File indexing completed on 2025-01-18 10:12:21
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TProfile2Poly
0013 #define ROOT_TProfile2Poly
0014
0015 #include "TH2Poly.h"
0016 #include "TProfile.h"
0017 #include <vector>
0018
0019 class TProfile2PolyBin : public TH2PolyBin {
0020 public:
0021 friend class TProfile2Poly;
0022
0023 TProfile2PolyBin();
0024 TProfile2PolyBin(TObject *poly, Int_t bin_number);
0025 ~TProfile2PolyBin() override {}
0026
0027 void Merge(const TProfile2PolyBin *toMerge);
0028
0029 void Update();
0030 void ClearStats();
0031
0032 Double_t GetEffectiveEntries() const { return (fSumw * fSumw) / fSumw2; }
0033 Double_t GetEntries() const { return fSumw; }
0034 Double_t GetEntriesW2() const { return fSumw2; }
0035 Double_t GetEntriesVW() const { return fSumvw; }
0036 Double_t GetEntriesWV2() const { return fSumwv2; }
0037 Double_t GetError() const { return fError; }
0038
0039
0040 private:
0041 Double_t fSumw;
0042 Double_t fSumvw;
0043 Double_t fSumw2;
0044 Double_t fSumwv2;
0045 Double_t fAverage;
0046 Double_t fError;
0047 EErrorType fErrorMode = kERRORMEAN;
0048
0049 protected:
0050 void Fill(Double_t value, Double_t weight);
0051 void UpdateAverage();
0052 void UpdateError();
0053 void SetErrorOption(EErrorType type) { fErrorMode = type; }
0054
0055 ClassDefOverride(TProfile2PolyBin, 1)
0056 };
0057
0058 class TProfile2Poly : public TH2Poly {
0059 friend class TProfile2PolyBin;
0060
0061 public:
0062 friend class TProfileHelper;
0063
0064 TProfile2Poly() {}
0065 TProfile2Poly(const char *name, const char *title, Double_t xlow, Double_t xup, Double_t ylow, Double_t yup);
0066 TProfile2Poly(const char *name, const char *title, Int_t nX, Double_t xlow, Double_t xup, Int_t nY, Double_t ylow,
0067 Double_t yup);
0068 ~TProfile2Poly() override {}
0069
0070 using TH2Poly::Fill;
0071 Int_t Fill(Double_t xcoord, Double_t ycoord, Double_t value) override;
0072 virtual Int_t Fill(Double_t xcoord, Double_t ycoord, Double_t value, Double_t weight);
0073
0074 Long64_t Merge(const std::vector<TProfile2Poly *> &list);
0075 Long64_t Merge(TCollection *in) override;
0076 void Reset(Option_t *option = "") override;
0077
0078
0079 void SetContentToAverage();
0080 void SetContentToError();
0081
0082 void SetErrorOption(EErrorType type);
0083
0084 Double_t GetBinEffectiveEntries(Int_t bin) const;
0085 Double_t GetBinEntries(Int_t bin) const;
0086 Double_t GetBinEntriesW2(Int_t bin) const;
0087 Double_t GetBinEntriesVW(Int_t bin) const;
0088 Double_t GetBinEntriesWV2(Int_t bin) const;
0089
0090 using TH2Poly::GetBinContent;
0091 Double_t GetBinContent(Int_t bin) const override;
0092
0093 using TH2Poly::GetBinError;
0094 Double_t GetBinError(Int_t bin) const override;
0095
0096 void GetStats(Double_t *stats) const override;
0097
0098
0099 Double_t GetOverflowContent(Int_t idx) { return fOverflowBins[idx].fSumw; }
0100 void PrintOverflowRegions();
0101
0102 private:
0103 TProfile2PolyBin fOverflowBins[kNOverflow];
0104 EErrorType fErrorMode = kERRORMEAN;
0105 Double_t fTsumwz;
0106 Double_t fTsumwz2;
0107
0108 protected:
0109 TProfile2PolyBin *CreateBin(TObject *poly) override;
0110
0111 Int_t GetOverflowRegionFromCoordinates(Double_t x, Double_t y);
0112 Int_t OverflowIdxToArrayIdx(Int_t val) { return -val - 1; }
0113
0114
0115 ClassDefOverride(TProfile2Poly, 2)
0116 };
0117 #endif