Logo ROOT   6.10/09
Reference Guide
TProfile2Poly.h
Go to the documentation of this file.
1 // @(#)root/hist:$Id$
2 // Author: Filip Ilic
3 
4 #ifndef ROOT_TProfile2Poly
5 #define ROOT_TProfile2Poly
6 
7 #include "TH2Poly.h"
8 #include "TProfile.h"
9 
10 class TProfile2PolyBin : public TH2PolyBin {
11 public:
12  friend class TProfile2Poly;
13 
15  TProfile2PolyBin(TObject *poly, Int_t bin_number);
16  virtual ~TProfile2PolyBin() {}
17 
18  void Merge(const TProfile2PolyBin *toMerge);
19 
20  void Update();
21  void ClearStats();
22 
23  Double_t GetEffectiveEntries() const { return (fSumw * fSumw) / fSumw2; }
24  Double_t GetEntries() const { return fSumw; }
25  Double_t GetEntriesW2() const { return fSumw2; }
26  Double_t GetEntriesVW() const { return fSumvw; }
27  Double_t GetEntriesWV2() const { return fSumwv2; }
28  Double_t GetError() const { return fError; }
29 
30 
31 private:
39 
40 protected:
41  void Fill(Double_t value, Double_t weight);
42  void UpdateAverage();
43  void UpdateError();
44  void SetErrorOption(EErrorType type) { fErrorMode = type; }
45 
47 };
48 
49 class TProfile2Poly : public TH2Poly {
50  friend class TProfile2PolyBin;
51 
52 public:
53  friend class TProfileHelper;
54 
56  TProfile2Poly(const char *name, const char *title, Double_t xlow, Double_t xup, Double_t ylow, Double_t yup);
57  TProfile2Poly(const char *name, const char *title, Int_t nX, Double_t xlow, Double_t xup, Int_t nY, Double_t ylow,
58  Double_t yup);
59  virtual ~TProfile2Poly() {}
60 
61  using TH2Poly::Fill;
62  virtual Int_t Fill(Double_t xcoord, Double_t ycoord, Double_t value) override;
63  virtual Int_t Fill(Double_t xcoord, Double_t ycoord, Double_t value, Double_t weight);
64 
65  Long64_t Merge(const std::vector<TProfile2Poly *> &list);
66  Long64_t Merge(TCollection *in) override;
67  virtual void Reset(Option_t *option = "") override;
68 
69  // option to dispay different measures on bins
70  void SetContentToAverage(); // this one is used by default
71  void SetContentToError();
72 
74 
76  Double_t GetBinEntries(Int_t bin) const;
77  Double_t GetBinEntriesW2(Int_t bin) const;
78  Double_t GetBinEntriesVW(Int_t bin) const;
79  Double_t GetBinEntriesWV2(Int_t bin) const;
80 
82  virtual Double_t GetBinContent(Int_t bin) const override;
83 
85  virtual Double_t GetBinError(Int_t bin) const override;
86 
87  virtual void GetStats(Double_t *stats) const override;
88 
89 
90  Double_t GetOverflowContent(Int_t idx) { return fOverflowBins[idx].fSumw; }
91  void printOverflowRegions();
92 
93 private:
94  TProfile2PolyBin fOverflowBins[kNOverflow];
98 
99 protected:
100  virtual TProfile2PolyBin *CreateBin(TObject *poly) override;
101 
102  Int_t GetOverflowRegionFromCoordinates(Double_t x, Double_t y);
103  Int_t OverflowIdxToArrayIdx(Int_t val) { return -val - 1; }
104 
105 
107 };
108 #endif
void Fill(Double_t value, Double_t weight)
long long Long64_t
Definition: RtypesCore.h:69
Double_t GetEntriesWV2() const
Definition: TProfile2Poly.h:27
EErrorType fErrorMode
Definition: TProfile2Poly.h:38
virtual Double_t GetBinError(Int_t bin) const
Returns the value of error associated to bin number bin.
Definition: TH2Poly.cxx:774
static Double_t GetBinError(T *p, Int_t bin)
Double_t fTsumwz2
Definition: TProfile2Poly.h:97
const char Option_t
Definition: RtypesCore.h:62
void Merge(const TProfile2PolyBin *toMerge)
int Int_t
Definition: RtypesCore.h:41
Double_t GetEffectiveEntries() const
Definition: TProfile2Poly.h:23
Double_t GetError() const
Definition: TProfile2Poly.h:28
Helper class to represent a bin in the TH2Poly histogram.
Definition: TH2Poly.h:25
EErrorType
Definition: TProfile.h:28
Double_t x[n]
Definition: legend1.C:17
virtual ~TProfile2Poly()
Definition: TProfile2Poly.h:59
#define ClassDef(name, id)
Definition: Rtypes.h:297
Double_t GetOverflowContent(Int_t idx)
Definition: TProfile2Poly.h:90
Double_t GetEntries() const
Definition: TProfile2Poly.h:24
virtual Double_t GetBinContent(Int_t bin) const
Returns the content of the input bin For the overflow/underflow/sea bins: -1 | -2 | -3 ---+----+---- ...
Definition: TH2Poly.cxx:761
Double_t GetEntriesW2() const
Definition: TProfile2Poly.h:25
Collection abstract base class.
Definition: TCollection.h:42
Double_t GetEntriesVW() const
Definition: TProfile2Poly.h:26
void Reset(Detail::TBranchProxy *x)
Int_t OverflowIdxToArrayIdx(Int_t val)
double Double_t
Definition: RtypesCore.h:55
virtual ~TProfile2PolyBin()
Definition: TProfile2Poly.h:16
static Double_t GetBinEffectiveEntries(T *p, Int_t bin)
int type
Definition: TGX11.cxx:120
Double_t y[n]
Definition: legend1.C:17
Mother of all ROOT objects.
Definition: TObject.h:37
void SetErrorOption(EErrorType type)
Definition: TProfile2Poly.h:44
Double_t fTsumwz
Definition: TProfile2Poly.h:96
#define ClassDefOverride(name, id)
Definition: Rtypes.h:301
friend class TProfile2Poly
Definition: TProfile2Poly.h:12
virtual Int_t Fill(Double_t x, Double_t y)
Increment the bin containing (x,y) by 1.
Definition: TH2Poly.cxx:604
2D Histogram with Polygonal Bins
Definition: TH2Poly.h:66