From ea780ee2697935ad1aaa437e69535e39a9758150 Mon Sep 17 00:00:00 2001 From: Alberto Mecca Date: Mon, 20 Nov 2023 11:41:52 +0100 Subject: [PATCH 1/2] Made TH1::CheckConsistency public --- hist/hist/inc/TH1.h | 2 +- hist/hist/src/TH1.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hist/hist/inc/TH1.h b/hist/hist/inc/TH1.h index 78291eb9183f8..1d0f2edfce1a6 100644 --- a/hist/hist/inc/TH1.h +++ b/hist/hist/inc/TH1.h @@ -156,7 +156,6 @@ class TH1 : public TNamed, public TAttLine, public TAttFill, public TAttMarker { static bool CheckBinLabels(const TAxis* a1, const TAxis* a2); static bool CheckEqualAxes(const TAxis* a1, const TAxis* a2); static bool CheckConsistentSubAxes(const TAxis *a1, Int_t firstBin1, Int_t lastBin1, const TAxis *a2, Int_t firstBin2=0, Int_t lastBin2=0); - static int CheckConsistency(const TH1* h1, const TH1* h2); int LoggedInconsistency(const char* name, const TH1* h1, const TH1* h2, bool useMerge=false) const; public: @@ -199,6 +198,7 @@ class TH1 : public TNamed, public TAttLine, public TAttFill, public TAttMarker { virtual Double_t Chi2Test(const TH1* h2, Option_t *option = "UU", Double_t *res = nullptr) const; virtual Double_t Chi2TestX(const TH1* h2, Double_t &chi2, Int_t &ndf, Int_t &igood,Option_t *option = "UU", Double_t *res = nullptr) const; virtual Double_t Chisquare(TF1 * f1, Option_t *option = "") const; + static Int_t CheckConsistency(const TH1* h1, const TH1* h2); virtual void ClearUnderflowAndOverflow(); virtual Double_t ComputeIntegral(Bool_t onlyPositive = false); TObject* Clone(const char *newname = "") const override; diff --git a/hist/hist/src/TH1.cxx b/hist/hist/src/TH1.cxx index e9b2e79c44349..a18b3406839a0 100644 --- a/hist/hist/src/TH1.cxx +++ b/hist/hist/src/TH1.cxx @@ -1676,7 +1676,7 @@ bool TH1::CheckConsistentSubAxes(const TAxis *a1, Int_t firstBin1, Int_t lastBin //////////////////////////////////////////////////////////////////////////////// /// Check histogram compatibility. -int TH1::CheckConsistency(const TH1* h1, const TH1* h2) +Int_t TH1::CheckConsistency(const TH1* h1, const TH1* h2) { if (h1 == h2) return kFullyConsistent; From 840f3d894f77218ea50f48bb715ce9b770101804 Mon Sep 17 00:00:00 2001 From: Alberto Mecca Date: Mon, 20 Nov 2023 12:13:44 +0100 Subject: [PATCH 2/2] Made TH1::EInconsistencyBits public --- hist/hist/inc/TH1.h | 11 +++++++++++ hist/hist/src/TH1.cxx | 17 ++--------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/hist/hist/inc/TH1.h b/hist/hist/inc/TH1.h index 1d0f2edfce1a6..c74a497ab318f 100644 --- a/hist/hist/inc/TH1.h +++ b/hist/hist/inc/TH1.h @@ -83,6 +83,17 @@ class TH1 : public TNamed, public TAttLine, public TAttFill, public TAttMarker { kNeutral = 2, ///< Adapt to the global flag }; + /// Enumeration specifying inconsistencies between two histograms, + /// in increasing severity. + enum EInconsistencyBits { + kFullyConsistent = 0, + kDifferentLabels = BIT(0), + kDifferentBinLimits = BIT(1), + kDifferentAxisLimits = BIT(2), + kDifferentNumberOfBins = BIT(3), + kDifferentDimensions = BIT(4) + }; + friend class TH1Merger; protected: diff --git a/hist/hist/src/TH1.cxx b/hist/hist/src/TH1.cxx index a18b3406839a0..9ee730d01a5fb 100644 --- a/hist/hist/src/TH1.cxx +++ b/hist/hist/src/TH1.cxx @@ -594,21 +594,6 @@ extern void H1LeastSquareFit(Int_t n, Int_t m, Double_t *a); extern void H1LeastSquareLinearFit(Int_t ndata, Double_t &a0, Double_t &a1, Int_t &ifail); extern void H1LeastSquareSeqnd(Int_t n, Double_t *a, Int_t idim, Int_t &ifail, Int_t k, Double_t *b); -namespace { - -/// Enumeration specifying inconsistencies between two histograms, -/// in increasing severity. -enum EInconsistencyBits { - kFullyConsistent = 0, - kDifferentLabels = BIT(0), - kDifferentBinLimits = BIT(1), - kDifferentAxisLimits = BIT(2), - kDifferentNumberOfBins = BIT(3), - kDifferentDimensions = BIT(4) -}; - -} // namespace - ClassImp(TH1); //////////////////////////////////////////////////////////////////////////////// @@ -1675,6 +1660,8 @@ bool TH1::CheckConsistentSubAxes(const TAxis *a1, Int_t firstBin1, Int_t lastBin //////////////////////////////////////////////////////////////////////////////// /// Check histogram compatibility. +/// The returned integer is part of EInconsistencyBits +/// The value 0 means that the histograms are compatible Int_t TH1::CheckConsistency(const TH1* h1, const TH1* h2) {