CbmRoot
Loading...
Searching...
No Matches
Histogram.h
Go to the documentation of this file.
1/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergei Zharko [committer] */
4
9
10#pragma once
11
12#include "Accumulators.h"
13
14#include <boost/histogram.hpp>
15//#include <boost/histogram/algorithm/sum.hpp>
16#include <boost/histogram/serialization.hpp>
17#include <boost/serialization/access.hpp>
18#include <boost/serialization/base_object.hpp>
19#include <boost/serialization/string.hpp>
20#include <boost/serialization/vector.hpp>
21
22#include <algorithm>
23#include <cstdint>
24#include <memory>
25#include <numeric>
26#include <string>
27#include <tuple>
28#include <type_traits>
29
30#include <fmt/format.h>
31
32namespace cbm::algo::qa
33{
34 namespace bh = boost::histogram;
35
36 using RegularAxis_t = bh::axis::regular<>;
37
38 using Axes1D_t = std::tuple<RegularAxis_t>;
39 using Axes2D_t = std::tuple<RegularAxis_t, RegularAxis_t>;
40
41 using HistStorage_t = bh::weight_storage;
43
46 enum class EAxis : unsigned
47 {
48 X = 0,
49 Y,
50 Z
51 };
52
55 enum class EHistFlag : uint8_t
56 {
57 StoreVsTsId = 0b00000001,
58 OmitIntegrated = 0b00000010,
59 SetMinimum = 0b00000100
60 };
61
66 public:
67 using Flags_t = std::underlying_type_t<EHistFlag>;
68
69 static constexpr std::string_view ksTsIdSuffix = "_ts_id";
70
72 HistogramMetadata() = default;
73
76 explicit HistogramMetadata(const std::string& msg)
77 {
78 if (!msg.empty()) {
79 fFlags = std::stoi(msg, nullptr, 16);
80 }
81 }
82
84 ~HistogramMetadata() = default;
85
88 bool CheckFlags() const
89 {
90 // The histogram must be plotted either vs TS, or over all TS
92 }
93
96 bool GetFlag(EHistFlag key) const { return static_cast<bool>(fFlags & static_cast<Flags_t>(key)); }
97
101 void SetFlag(EHistFlag key, bool flag = true)
102 {
103 flag ? (fFlags |= static_cast<Flags_t>(key)) : (fFlags &= ~static_cast<Flags_t>(key));
104 }
105
110 std::string ToString() const { return fmt::format("{0:02x}", fFlags); }
111
114 static std::pair<std::string, std::string> SeparateNameAndMetadata(const std::string& msg)
115 {
116 size_t pos = msg.find_last_of('!');
117 if (pos != msg.npos) {
118 return std::make_pair(msg.substr(0, pos), msg.substr(pos + 1));
119 }
120 else {
121 return std::make_pair(msg, "");
122 }
123 }
124
125 private:
127 template<class Archive>
129 void serialize(Archive& ar, const unsigned int /*version*/)
130 {
131 ar& fFlags;
132 }
133
135 };
136
140 public:
142 double GetTotSumW() const { return fTotSumW; }
143
145 double GetTotSumW2() const { return fTotSumW2; }
146
148 double GetTotSumWX() const { return fTotSumWX; }
149
151 double GetTotSumWX2() const { return fTotSumWX2; }
152
153 protected:
157 void UpdateTotalSums(double x, double w)
158 {
159 fTotSumW += w;
160 fTotSumW2 += w * w;
161 fTotSumWX += w * x;
162 fTotSumWX2 += w * x * x;
163 }
164
166 void Reset()
167 {
168 fTotSumW = 0;
169 fTotSumW2 = 0;
170 fTotSumWX = 0;
171 fTotSumWX2 = 0;
172 }
173
174 double fTotSumW = 0.;
175 double fTotSumW2 = 0.;
176 double fTotSumWX = 0.;
177 double fTotSumWX2 = 0.;
178
179 private:
182 template<class Archive>
183 void serialize(Archive& ar, const unsigned int /*version*/)
184 {
185 ar& fTotSumW;
186 ar& fTotSumW2;
187 ar& fTotSumWX;
188 ar& fTotSumWX2;
189 }
190 };
191
194 class TotalSums2D : public TotalSums1D {
195 public:
197 double GetTotSumWXY() const { return fTotSumWXY; }
198
200 double GetTotSumWY() const { return fTotSumWY; }
201
203 double GetTotSumWY2() const { return fTotSumWY2; }
204
205 protected:
207 void Reset()
208 {
210 fTotSumWXY = 0;
211 fTotSumWY = 0;
212 fTotSumWY2 = 0;
213 }
214
219 void UpdateTotalSums(double x, double y, double w)
220 {
222 fTotSumWXY += w * x * y;
223 fTotSumWY += w * y;
224 fTotSumWY2 += w * y * y;
225 }
226
227 double fTotSumWY = 0.;
228 double fTotSumWXY = 0.;
229 double fTotSumWY2 = 0.;
230
231 private:
234 template<class Archive>
235 void serialize(Archive& ar, const unsigned int /*version*/)
236 {
237 ar& boost::serialization::base_object<TotalSums1D>(*this);
238 ar& fTotSumWXY;
239 ar& fTotSumWY;
240 ar& fTotSumWY2;
241 }
242 };
243
244
250 template<class Axes, class Storage, class TotalSums>
251 class Histogram : public TotalSums {
252 protected:
253 using Hist_t = bh::histogram<Axes, Storage>; // TODO: Test in future
254 static constexpr unsigned Rank = std::tuple_size_v<Axes>;
255
256 public:
258 ~Histogram() = default;
259
262 template<EAxis A, unsigned IA = static_cast<unsigned>(A), std::enable_if_t<(IA < Rank), bool> = true>
263 double GetAxisMin() const
264 {
265 return fHistogram.template axis<IA>().value(0.);
266 }
267
270 template<EAxis A, unsigned IA = static_cast<unsigned>(A), std::enable_if_t<(IA < Rank), bool> = true>
271 double GetAxisMax() const
272 {
273 return fHistogram.template axis<IA>().value(static_cast<double>(GetAxisNbins<A>()));
274 }
275
279 template<EAxis A, unsigned IA = static_cast<unsigned>(A), std::enable_if_t<(IA < Rank), bool> = true>
280 uint32_t GetAxisNbins() const
281 {
282 return fHistogram.template axis<IA>().size();
283 }
284
286 // TODO: Gives different results, if weights are not 1 (investigate!)
287 double GetEntries() const
288 {
289 // return bh::algorithm::sum(fHistogram); // -> effective entries (but different to the ROOT ones: if w != 1)
290 return fEntries;
291 }
292
295 bool GetFlag(EHistFlag key) const { return fMetadata.GetFlag(key); }
296
298 const std::string& GetName() const { return fName; }
299
301 const HistogramMetadata& GetMetadata() const { return fMetadata; }
302
304 std::string GetMetadataString() const { return fMetadata.ToString(); }
305
307 uint32_t GetNbinsX() const { return GetAxisNbins<EAxis::X>(); }
308
310 double GetMinX() const { return GetAxisMin<EAxis::X>(); }
311
313 double GetMaxX() const { return GetAxisMax<EAxis::X>(); }
314
316 template<unsigned RankCheck = Rank, std::enable_if_t<(RankCheck > 1), bool> = true>
317 uint32_t GetNbinsY() const
318 {
319 return GetAxisNbins<EAxis::Y>();
320 }
321
323 template<unsigned RankCheck = Rank, std::enable_if_t<(RankCheck > 1), bool> = true>
324 double GetMinY() const
325 {
326 return GetAxisMin<EAxis::Y>();
327 }
328
330 template<unsigned RankCheck = Rank, std::enable_if_t<(RankCheck > 1), bool> = true>
331 double GetMaxY() const
332 {
333 return GetAxisMax<EAxis::Y>();
334 }
335
337 double GetMaximum() const
338 {
339 return *std::max_element(bh::indexed(fHistogram).begin(), bh::indexed(fHistogram).end());
340 }
341
343 double GetMinimum() const
344 {
345 return *std::min_element(bh::indexed(fHistogram).begin(), bh::indexed(fHistogram).end());
346 }
347
349 const std::string& GetTitle() const { return fTitle; }
350
352 void Reset()
353 {
354 TotalSums::Reset();
355 fHistogram.reset();
356 fEntries = 0;
357 }
358
362 void SetFlag(EHistFlag key, bool flag = true) { fMetadata.SetFlag(key, flag); }
363
366 void SetName(const std::string& name) { fName = name; }
367
371 void SetTitle(const std::string& title) { fTitle = title; }
372
374 //std::string ToString() const
375 //{
376 // std::stringstream msg;
377 // msg <<
378 //}
379
380 protected:
382 Histogram() = default;
383
386
387 //explicit Histogram(const Histogram<Axes, Storage>& h)
388 // : fHistogram(h.fHistogram)
389 // , fName(h.fName)
390 // , fTitle(h.fTitle)
391 // , fEntries(h.fEntries)
392 //{
393 //}
394
399 Histogram(const Hist_t& bhist, const std::string& name, const std::string title)
400 : fHistogram(bhist)
401 , fName(name)
402 , fTitle(title)
403 , fEntries(0)
405 {
406 }
407
411 inline static int GetBinBH(uint32_t iBin) { return (iBin > 0) ? iBin - 1 : -1; }
412
414 std::string fName = "";
415 std::string fTitle = "";
416 int fEntries = 0;
418
419
420 private:
422 template<class Archive>
424 void serialize(Archive& ar, const unsigned int /*version*/)
425 {
426 ar& boost::serialization::base_object<TotalSums>(*this);
427 ar& fHistogram;
428 ar& fName;
429 ar& fTitle;
430 ar& fEntries;
431 ar& fMetadata;
432 }
433 };
434
439
442 class H1D : public BaseH1D {
443 public:
450 H1D(const std::string& name, const std::string& title, uint32_t nBins, double xMin, double xMax)
451 : BaseH1D(bh::make_weighted_histogram(RegularAxis_t(nBins, xMin, xMax)), name, title)
452 {
453 }
454
456 H1D() = default;
457
459 H1D(const H1D&) = default;
460
462 H1D(H1D&&) = default;
463
465 H1D& operator=(const H1D&) = default;
466
468 H1D& operator=(H1D&&) = default;
469
474 int Fill(double x, double w = 1.)
475 {
476 auto cellIt = fHistogram(bh::weight(w), x);
477 ++fEntries;
478 int iBin = cellIt - fHistogram.begin();
479 if (iBin == 0 || iBin > static_cast<int>(GetNbinsX())) {
480 return -1; // ROOT TH1::Fill behaviour
481 }
482 // NOTE: In ROOT TH1 the total sums are updated only for non-overflow bins
483 BaseH1D::UpdateTotalSums(x, w);
484 return iBin;
485 }
486
489 auto GetBinAccumulator(uint32_t iBin) const { return fHistogram.at(Histogram::GetBinBH(iBin)); }
490
493 double GetBinContent(uint32_t iBin) const { return fHistogram.at(Histogram::GetBinBH(iBin)).value(); }
494
497 double GetBinError(uint32_t iBin) const { return std::sqrt(fHistogram.at(Histogram::GetBinBH(iBin)).variance()); }
498
499 private:
502 template<class Archive>
503 void serialize(Archive& ar, const unsigned int /*version*/)
504 {
505 ar& boost::serialization::base_object<BaseH1D>(*this);
506 }
507 };
508
511 class H2D : public BaseH2D {
512 public:
522 H2D(const std::string& name, const std::string& title, uint32_t nBinsX, double xMin, double xMax, uint32_t nBinsY,
523 double yMin, double yMax)
524 : BaseH2D(bh::make_weighted_histogram(RegularAxis_t(nBinsX, xMin, xMax), RegularAxis_t(nBinsY, yMin, yMax)), name,
525 title)
526 {
527 }
528
530 H2D() = default;
531
533 H2D(const H2D&) = default;
534
536 H2D(H2D&&) = default;
537
539 H2D& operator=(const H2D&) = default;
540
542 H2D& operator=(H2D&&) = default;
543
549 int Fill(double x, double y, double w = 1.)
550 {
551 auto cellIt = fHistogram(x, y, bh::weight(w));
552 ++fEntries;
553
554 int iBin = cellIt - fHistogram.begin();
555 uint32_t iBinX = iBin % (GetNbinsX() + 2);
556 if (iBinX == 0 || iBinX > GetNbinsX()) {
557 return -1;
558 }
559 uint32_t iBinY = iBin / (GetNbinsX() + 2);
560 if (iBinY == 0 || iBinY > GetNbinsY()) {
561 return -1;
562 }
563 // NOTE: In ROOT TH2 the total sums are updated only for non-overflow bins
564 BaseH2D::UpdateTotalSums(x, y, w);
565 return iBin;
566 }
567
571 auto GetBinAccumulator(uint32_t iBinX, uint32_t iBinY) const
572 {
573 return fHistogram.at(Histogram::GetBinBH(iBinX), Histogram::GetBinBH(iBinY));
574 }
575
579 double GetBinContent(uint32_t iBinX, uint32_t iBinY) const
580 {
581 return fHistogram.at(Histogram::GetBinBH(iBinX), Histogram::GetBinBH(iBinY)).value();
582 }
583
587 double GetBinError(uint32_t iBinX, uint32_t iBinY) const
588 {
589 return std::sqrt(fHistogram.at(Histogram::GetBinBH(iBinX), Histogram::GetBinBH(iBinY)).variance());
590 }
591
592 private:
595 template<class Archive>
596 void serialize(Archive& ar, const unsigned int /*version*/)
597 {
598 ar& boost::serialization::base_object<BaseH2D>(*this);
599 }
600 };
601
602 // TODO: Boost::histogram by default uses a different error calculation approach as ROOT TProfile. TODO: investigate
603
604 class Prof1D : public BaseProf1D {
605 public:
617 Prof1D(const std::string& name, const std::string& title, uint32_t nBinsX, double xMin, double xMax,
618 double yMin = 0., double yMax = 0.)
619 : BaseProf1D(bh::MakeRootStyleProfile(RegularAxis_t(nBinsX, xMin, xMax)), name, title)
620 , fYmin(yMin)
621 , fYmax(yMax)
622 {
623 }
624
626 Prof1D() = default;
627
629 Prof1D(const Prof1D&) = default;
630
632 Prof1D(Prof1D&&) = default;
633
635 Prof1D& operator=(const Prof1D&) = default;
636
638 Prof1D& operator=(Prof1D&&) = default;
639
645 int Fill(double x, double y, double w = 1.)
646 {
648 if ((fYmin != fYmax) && (y < fYmin || y > fYmax || std::isnan(y))) {
649 return -1;
650 }
651
652 auto cellIt = fHistogram(x, bh::sample(y), bh::weight(w));
653 ++fEntries;
654 int iBin = cellIt - fHistogram.begin();
655 if (iBin == 0 || iBin > static_cast<int>(GetNbinsX())) {
656 return -1; // ROOT TH1::Fill behaviour
657 }
658 // NOTE: In ROOT TProfile the total sums are updated only for non-overflow bins
659 BaseProf1D::UpdateTotalSums(x, w);
660 return iBin;
661 }
662
665 auto GetBinAccumulator(uint32_t iBin) const { return fHistogram.at(Histogram::GetBinBH(iBin)); }
666
669 double GetBinContent(uint32_t iBin) const { return fHistogram.at(Histogram::GetBinBH(iBin)).GetMean(); }
670
673 double GetBinCount(uint32_t iBin) const { return fHistogram.at(Histogram::GetBinBH(iBin)).GetEffCount(); }
674
677 double GetBinError(uint32_t iBin) const { return fHistogram.at(Histogram::GetBinBH(iBin)).GetSEM(); }
678
680 double GetMinY() const { return fYmin; }
681
683 double GetMaxY() const { return fYmax; }
684
685 private:
688 template<class Archive>
689 void serialize(Archive& ar, const unsigned int /*version*/)
690 {
691 ar& boost::serialization::base_object<BaseProf1D>(*this);
692 ar& fYmin;
693 ar& fYmax;
694 }
695
696 double fYmin = 0.;
697 double fYmax = 0.;
698 };
699
700 class Prof2D : public BaseProf2D {
701 public:
716 Prof2D(const std::string& name, const std::string& title, uint32_t nBinsX, double xMin, double xMax,
717 uint32_t nBinsY, double yMin, double yMax, double zMin = 0., double zMax = 0.)
718 : BaseProf2D(bh::MakeRootStyleProfile(RegularAxis_t(nBinsX, xMin, xMax), RegularAxis_t(nBinsY, yMin, yMax)), name,
719 title)
720 , fZmin(zMin)
721 , fZmax(zMax)
722 {
723 }
724
726 Prof2D() = default;
727
729 Prof2D(const Prof2D&) = default;
730
732 Prof2D(Prof2D&&) = default;
733
735 Prof2D& operator=(const Prof2D&) = default;
736
738 Prof2D& operator=(Prof2D&&) = default;
739
746 int Fill(double x, double y, double z, double w = 1.)
747 {
749 if ((fZmin != fZmax) && (z < fZmin || z > fZmax || std::isnan(z))) {
750 return -1;
751 }
752
753 auto cellIt = fHistogram(x, y, bh::sample(z), bh::weight(w));
754 ++fEntries;
755
756 int iBin = cellIt - fHistogram.begin();
757 uint32_t iBinX = iBin % (GetNbinsX() + 2);
758 if (iBinX == 0 || iBinX > GetNbinsX()) {
759 return -1;
760 }
761 uint32_t iBinY = iBin / (GetNbinsX() + 2);
762 if (iBinY == 0 || iBinY > GetNbinsY()) {
763 return -1;
764 }
765 // NOTE: In ROOT TProfile2D the total sums are updated only for non-overflow bins
766 BaseProf2D::UpdateTotalSums(x, y, w);
767 return iBin;
768 }
769
773 auto GetBinAccumulator(uint32_t iBinX, uint32_t iBinY) const
774 {
775 return fHistogram.at(Histogram::GetBinBH(iBinX), Histogram::GetBinBH(iBinY));
776 }
777
781 double GetBinContent(uint32_t iBinX, uint32_t iBinY) const
782 {
783 return fHistogram.at(Histogram::GetBinBH(iBinX), Histogram::GetBinBH(iBinY)).GetMean();
784 }
785
789 double GetBinCount(uint32_t iBinX, uint32_t iBinY) const
790 {
791 return fHistogram.at(Histogram::GetBinBH(iBinX), Histogram::GetBinBH(iBinY)).GetEffCount();
792 }
793
797 double GetBinError(uint32_t iBinX, uint32_t iBinY) const
798 {
799 return fHistogram.at(Histogram::GetBinBH(iBinX), Histogram::GetBinBH(iBinY)).GetSEM();
800 }
801
803 double GetMinZ() const { return fZmin; }
804
806 double GetMaxZ() const { return fZmax; }
807
808 private:
811 template<class Archive>
812 void serialize(Archive& ar, const unsigned int /*version*/)
813 {
814 ar& boost::serialization::base_object<BaseProf2D>(*this);
815 ar& fZmin;
816 ar& fZmax;
817 }
818
819 double fZmin = 0.;
820 double fZmax = 0.;
821 };
822
823} // namespace cbm::algo::qa
Custom accumulators for boost::histogram (header)
Data class with information on a STS local track.
1D-histogram
H1D & operator=(H1D &&)=default
Move assignment operator.
H1D(const H1D &)=default
Copy constructor.
double GetBinError(uint32_t iBin) const
Gets bin error.
Definition Histogram.h:497
H1D()=default
Default constructor.
auto GetBinAccumulator(uint32_t iBin) const
Gets underlying bin accumulator.
Definition Histogram.h:489
void serialize(Archive &ar, const unsigned int)
Definition Histogram.h:503
int Fill(double x, double w=1.)
Fills histogram.
Definition Histogram.h:474
H1D & operator=(const H1D &)=default
Copy assignment operator.
H1D(const std::string &name, const std::string &title, uint32_t nBins, double xMin, double xMax)
Constructor for 1D-histogram.
Definition Histogram.h:450
friend class boost::serialization::access
Serialization function.
Definition Histogram.h:501
double GetBinContent(uint32_t iBin) const
Gets bin content.
Definition Histogram.h:493
H1D(H1D &&)=default
Move constructor.
2D-histogram
H2D(const std::string &name, const std::string &title, uint32_t nBinsX, double xMin, double xMax, uint32_t nBinsY, double yMin, double yMax)
Constructor for 2D-histogram.
Definition Histogram.h:522
double GetBinError(uint32_t iBinX, uint32_t iBinY) const
Gets bin error.
Definition Histogram.h:587
H2D & operator=(H2D &&)=default
Move assignment operator.
H2D()=default
Default constructor.
auto GetBinAccumulator(uint32_t iBinX, uint32_t iBinY) const
Gets underlying bin accumulator.
Definition Histogram.h:571
H2D(const H2D &)=default
Copy constructor.
void serialize(Archive &ar, const unsigned int)
Definition Histogram.h:596
double GetBinContent(uint32_t iBinX, uint32_t iBinY) const
Gets bin content.
Definition Histogram.h:579
friend class boost::serialization::access
Serialization rule.
Definition Histogram.h:594
H2D(H2D &&)=default
Move constructor.
int Fill(double x, double y, double w=1.)
Fills histogram.
Definition Histogram.h:549
H2D & operator=(const H2D &)=default
Copy assignment operator.
Metadata of the histogram.
Definition Histogram.h:65
Flags_t fFlags
Flags collection for the histogram.
Definition Histogram.h:134
void serialize(Archive &ar, const unsigned int)
Serialization rule.
Definition Histogram.h:129
HistogramMetadata()=default
Default constructor.
static std::pair< std::string, std::string > SeparateNameAndMetadata(const std::string &msg)
Separates a name and metadata of histogram.
Definition Histogram.h:114
static constexpr std::string_view ksTsIdSuffix
Suffix of additional histograms vs. TS index.
Definition Histogram.h:69
std::string ToString() const
Converts the metadata to a string.
Definition Histogram.h:110
bool CheckFlags() const
Checks if the histogram flags configuration is valid.
Definition Histogram.h:88
~HistogramMetadata()=default
Destructor.
friend class boost::serialization::access
Definition Histogram.h:126
bool GetFlag(EHistFlag key) const
Get flag.
Definition Histogram.h:96
void SetFlag(EHistFlag key, bool flag=true)
Get flag.
Definition Histogram.h:101
std::underlying_type_t< EHistFlag > Flags_t
Definition Histogram.h:67
HistogramMetadata(const std::string &msg)
Constructor from the metadata string representation.
Definition Histogram.h:76
Interface to a histogram/profile.
Definition Histogram.h:251
const std::string & GetTitle() const
Gets title.
Definition Histogram.h:349
static int GetBinBH(uint32_t iBin)
Gets bin index in underlying boost histogram.
Definition Histogram.h:411
static constexpr unsigned Rank
Definition Histogram.h:254
std::string fTitle
Title of the histogram.
Definition Histogram.h:415
uint32_t GetAxisNbins() const
Gets number of bins in axis.
Definition Histogram.h:280
std::string fName
Name of the histogram.
Definition Histogram.h:414
void SetName(const std::string &name)
Sets name.
Definition Histogram.h:366
void serialize(Archive &ar, const unsigned int)
Serialization rule.
Definition Histogram.h:424
uint32_t GetNbinsY() const
Gets number of bins for y axis.
Definition Histogram.h:317
double GetMaximum() const
Gets maximum value.
Definition Histogram.h:337
double GetMaxY() const
Gets y-axis lower bound.
Definition Histogram.h:331
double GetAxisMin() const
Gets range lower bound of the selected axis.
Definition Histogram.h:263
void SetFlag(EHistFlag key, bool flag=true)
Get flag.
Definition Histogram.h:362
Histogram(const Hist_t &bhist, const std::string &name, const std::string title)
Constructor.
Definition Histogram.h:399
void Reset()
Resets the histogram.
Definition Histogram.h:352
bh::histogram< Axes, Storage > Hist_t
Definition Histogram.h:253
bool GetFlag(EHistFlag key) const
Get flag.
Definition Histogram.h:295
HistogramMetadata fMetadata
Meta-data for histogram.
Definition Histogram.h:417
double GetAxisMax() const
Gets range upper bound of the selected axis.
Definition Histogram.h:271
Histogram()=default
String representation of the histogram/profile.
Hist_t fHistogram
Underlying boost histogram.
Definition Histogram.h:413
void SetTitle(const std::string &title)
Sets title.
Definition Histogram.h:371
~Histogram()=default
Destructor.
Histogram(const Histogram< Axes, Storage, TotalSums > &h)=default
Copy constructor.
const std::string & GetName() const
Gets name.
Definition Histogram.h:298
double GetMinY() const
Gets y-axis lower bound.
Definition Histogram.h:324
double GetMaxX() const
Gets x-axis lower bound.
Definition Histogram.h:313
double GetEntries() const
Gets number of entries.
Definition Histogram.h:287
friend class boost::serialization::access
Definition Histogram.h:421
double GetMinimum() const
Gets minimum value.
Definition Histogram.h:343
double GetMinX() const
Gets x-axis lower bound.
Definition Histogram.h:310
std::string GetMetadataString() const
Gets metadata string.
Definition Histogram.h:304
int fEntries
Number of histogram entries.
Definition Histogram.h:416
uint32_t GetNbinsX() const
Gets number of bins for x axis.
Definition Histogram.h:307
const HistogramMetadata & GetMetadata() const
Gets metadata instance.
Definition Histogram.h:301
double fYmin
Lower bound of the profile y-axis.
Definition Histogram.h:696
double GetMaxY() const
Gets y-axis lower bound.
Definition Histogram.h:683
Prof1D(const Prof1D &)=default
Copy constructor.
Prof1D & operator=(const Prof1D &)=default
Copy assignment operator.
auto GetBinAccumulator(uint32_t iBin) const
Gets underlying bin accumulator.
Definition Histogram.h:665
double fYmax
Upper bound of the profile y-axis.
Definition Histogram.h:697
double GetMinY() const
Gets y-axis lower bound.
Definition Histogram.h:680
Prof1D(Prof1D &&)=default
Move constructor.
Prof1D(const std::string &name, const std::string &title, uint32_t nBinsX, double xMin, double xMax, double yMin=0., double yMax=0.)
Constructor for 2D-histogram.
Definition Histogram.h:617
void serialize(Archive &ar, const unsigned int)
Definition Histogram.h:689
Prof1D & operator=(Prof1D &&)=default
Move assignment operator.
int Fill(double x, double y, double w=1.)
Fills histogram.
Definition Histogram.h:645
double GetBinError(uint32_t iBin) const
Gets bin error.
Definition Histogram.h:677
Prof1D()=default
Default constructor.
friend class boost::serialization::access
Serialization rule.
Definition Histogram.h:687
double GetBinContent(uint32_t iBin) const
Gets bin content.
Definition Histogram.h:669
double GetBinCount(uint32_t iBin) const
Gets bin entries.
Definition Histogram.h:673
Prof2D(const Prof2D &)=default
Copy constructor.
int Fill(double x, double y, double z, double w=1.)
Fills histogram.
Definition Histogram.h:746
double GetBinCount(uint32_t iBinX, uint32_t iBinY) const
Gets bin entries.
Definition Histogram.h:789
Prof2D & operator=(const Prof2D &)=default
Copy assignment operator.
double GetBinError(uint32_t iBinX, uint32_t iBinY) const
Gets bin error.
Definition Histogram.h:797
Prof2D(Prof2D &&)=default
Move constructor.
auto GetBinAccumulator(uint32_t iBinX, uint32_t iBinY) const
Gets underlying bin accumulator.
Definition Histogram.h:773
Prof2D(const std::string &name, const std::string &title, uint32_t nBinsX, double xMin, double xMax, uint32_t nBinsY, double yMin, double yMax, double zMin=0., double zMax=0.)
Constructor for 2D-histogram.
Definition Histogram.h:716
Prof2D()=default
Default constructor.
double GetMaxZ() const
Gets z-axis lower bound.
Definition Histogram.h:806
double GetMinZ() const
Gets z-axis lower bound.
Definition Histogram.h:803
void serialize(Archive &ar, const unsigned int)
Definition Histogram.h:812
double fZmin
Lower bound of the profile z-axis.
Definition Histogram.h:819
double fZmax
Upper bound of the profile z-axis.
Definition Histogram.h:820
double GetBinContent(uint32_t iBinX, uint32_t iBinY) const
Gets bin content.
Definition Histogram.h:781
friend class boost::serialization::access
Serialization rule.
Definition Histogram.h:810
Prof2D & operator=(Prof2D &&)=default
Move assignment operator.
Storage for total sums of weights, squared weights, weights over x, weights over squared x.
Definition Histogram.h:139
void Reset()
Resets the sums.
Definition Histogram.h:166
double GetTotSumW() const
Gets total sum of weights.
Definition Histogram.h:142
double fTotSumWX
Total sum (over all bins) of weight over x products.
Definition Histogram.h:176
void UpdateTotalSums(double x, double w)
Updates the sums.
Definition Histogram.h:157
double GetTotSumW2() const
Gets total sum of squared weights.
Definition Histogram.h:145
double GetTotSumWX2() const
Gets total sum of weight over squared x products.
Definition Histogram.h:151
double fTotSumW
Total sum (over all bins) of weights.
Definition Histogram.h:174
double GetTotSumWX() const
Gets total sum of weight over x products.
Definition Histogram.h:148
double fTotSumW2
Total sum (over all bins) of squared weights.
Definition Histogram.h:175
friend class boost::serialization::access
Serialization rule.
Definition Histogram.h:181
double fTotSumWX2
Total sum (over all bins) of weight over square x products.
Definition Histogram.h:177
void serialize(Archive &ar, const unsigned int)
Definition Histogram.h:183
TotalSums1D including storage for total sums of w*x*y, w*y, w*y*y products.
Definition Histogram.h:194
double fTotSumWXY
Total sum (over all bins) of weight over square x products.
Definition Histogram.h:228
double GetTotSumWY() const
Gets total sum of weight over y products.
Definition Histogram.h:200
void serialize(Archive &ar, const unsigned int)
Definition Histogram.h:235
double GetTotSumWY2() const
Gets total sum of weight over squared y products.
Definition Histogram.h:203
double GetTotSumWXY() const
Gets total sum of weight over squared y products.
Definition Histogram.h:197
double fTotSumWY2
Total sum (over all bins) of weight over x over y products.
Definition Histogram.h:229
double fTotSumWY
Total sum (over all bins) of weight over y products.
Definition Histogram.h:227
friend class boost::serialization::access
Serialization rule.
Definition Histogram.h:233
void Reset()
Resets the sums.
Definition Histogram.h:207
void UpdateTotalSums(double x, double y, double w)
Updates the sums.
Definition Histogram.h:219
dense_storage< RootStyleProfileAccumulator< T > > RootStyleProfileStorage
Histogram< Axes2D_t, HistStorage_t, TotalSums2D > BaseH2D
Definition Histogram.h:436
std::tuple< RegularAxis_t > Axes1D_t
Definition Histogram.h:38
EHistFlag
Histogram control flags (bit masks)
Definition Histogram.h:56
@ SetMinimum
Sets minimum to the histogram.
@ StoreVsTsId
Store the histogram vs timeslice index.
@ OmitIntegrated
Omits storing integrated histogram.
bh::axis::regular<> RegularAxis_t
Definition Histogram.h:36
bh::RootStyleProfileStorage< double > ProfStorage_t
Definition Histogram.h:42
std::tuple< RegularAxis_t, RegularAxis_t > Axes2D_t
Definition Histogram.h:39
bh::weight_storage HistStorage_t
Definition Histogram.h:41