Logo ROOT   master
Reference Guide
TH2.h
Go to the documentation of this file.
1 // @(#)root/hist:$Id$
2 // Author: Rene Brun 26/12/94
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TH2
13 #define ROOT_TH2
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TH2 //
19 // //
20 // 2-Dim histogram base class. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #include "TH1.h"
25 #include "TMatrixFBasefwd.h"
26 #include "TMatrixDBasefwd.h"
27 
28 class TProfile;
29 
30 class TH2 : public TH1 {
31 
32 protected:
33  Double_t fScalefactor; //Scale factor
34  Double_t fTsumwy; //Total Sum of weight*Y
35  Double_t fTsumwy2; //Total Sum of weight*Y*Y
36  Double_t fTsumwxy; //Total Sum of weight*X*Y
37 
38  TH2();
39  TH2(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
40  ,Int_t nbinsy,Double_t ylow,Double_t yup);
41  TH2(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
42  ,Int_t nbinsy,Double_t ylow,Double_t yup);
43  TH2(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
44  ,Int_t nbinsy,const Double_t *ybins);
45  TH2(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
46  ,Int_t nbinsy,const Double_t *ybins);
47  TH2(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
48  ,Int_t nbinsy,const Float_t *ybins);
49 
51  virtual TH1D *DoProjection(bool onX, const char *name, Int_t firstbin, Int_t lastbin, Option_t *option) const;
52  virtual TProfile *DoProfile(bool onX, const char *name, Int_t firstbin, Int_t lastbin, Option_t *option) const;
53  virtual TH1D *DoQuantiles(bool onX, const char *name, Double_t prob) const;
54  virtual void DoFitSlices(bool onX, TF1 *f1, Int_t firstbin, Int_t lastbin, Int_t cut, Option_t *option, TObjArray* arr);
55 
56  Int_t BufferFill(Double_t, Double_t) {return -2;} //may not use
57  Int_t Fill(Double_t); //MayNotUse
58  Int_t Fill(const char*, Double_t) { return Fill(0);} //MayNotUse
59 
60  virtual Double_t Interpolate(Double_t x) const; // may not use
61 
62 private:
63 
64  TH2(const TH2&);
65  TH2& operator=(const TH2&); // Not implemented
66 
67  // make private methods which have a TH1 signature and should not
68  using TH1::Integral;
70 
71 public:
72  virtual ~TH2();
73  virtual Int_t BufferEmpty(Int_t action=0);
74  virtual void Copy(TObject &hnew) const;
75  virtual Int_t Fill(Double_t x, Double_t y);
76  virtual Int_t Fill(Double_t x, Double_t y, Double_t w);
77  virtual Int_t Fill(Double_t x, const char *namey, Double_t w);
78  virtual Int_t Fill(const char *namex, Double_t y, Double_t w);
79  virtual Int_t Fill(const char *namex, const char *namey, Double_t w);
80  virtual void FillN(Int_t, const Double_t *, const Double_t *, Int_t) {;} //MayNotUse
81  virtual void FillN(Int_t ntimes, const Double_t *x, const Double_t *y, const Double_t *w, Int_t stride=1);
82  virtual void FillRandom(const char *fname, Int_t ntimes=5000);
83  virtual void FillRandom(TH1 *h, Int_t ntimes=5000);
84  virtual void FitSlicesX(TF1 *f1=0,Int_t firstybin=0, Int_t lastybin=-1, Int_t cut=0, Option_t *option="QNR", TObjArray* arr = 0);
85  virtual void FitSlicesY(TF1 *f1=0,Int_t firstxbin=0, Int_t lastxbin=-1, Int_t cut=0, Option_t *option="QNR", TObjArray* arr = 0);
86  virtual Int_t GetBin(Int_t binx, Int_t biny, Int_t binz = 0) const;
87  virtual Double_t GetBinWithContent2(Double_t c, Int_t &binx, Int_t &biny, Int_t firstxbin=1, Int_t lastxbin=-1,Int_t firstybin=1, Int_t lastybin=-1, Double_t maxdiff=0) const;
88  virtual Double_t GetBinContent(Int_t bin) const { return TH1::GetBinContent(bin); }
89  virtual Double_t GetBinContent(Int_t binx, Int_t biny) const { return TH1::GetBinContent( GetBin(binx, biny) ); }
90  virtual Double_t GetBinContent(Int_t binx, Int_t biny, Int_t) const { return TH1::GetBinContent( GetBin(binx, biny) ); }
91  using TH1::GetBinErrorLow;
92  using TH1::GetBinErrorUp;
93  virtual Double_t GetBinErrorLow(Int_t binx, Int_t biny) { return TH1::GetBinErrorLow( GetBin(binx, biny) ); }
94  virtual Double_t GetBinErrorUp(Int_t binx, Int_t biny) { return TH1::GetBinErrorUp( GetBin(binx, biny) ); }
95  virtual Double_t GetCorrelationFactor(Int_t axis1=1,Int_t axis2=2) const;
96  virtual Double_t GetCovariance(Int_t axis1=1,Int_t axis2=2) const;
97  virtual void GetRandom2(Double_t &x, Double_t &y);
98  virtual void GetStats(Double_t *stats) const;
99  virtual Double_t Integral(Option_t *option="") const;
100  //virtual Double_t Integral(Int_t, Int_t, Option_t * ="") const {return 0;}
101  virtual Double_t Integral(Int_t binx1, Int_t binx2, Int_t biny1, Int_t biny2, Option_t *option="") const;
102  virtual Double_t Integral(Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, Option_t * ="") const {return 0;}
103  virtual Double_t IntegralAndError(Int_t binx1, Int_t binx2, Int_t biny1, Int_t biny2, Double_t & err, Option_t *option="") const;
104  virtual Double_t Interpolate(Double_t x, Double_t y) const;
105  virtual Double_t Interpolate(Double_t x, Double_t y, Double_t z) const;
106  virtual Double_t KolmogorovTest(const TH1 *h2, Option_t *option="") const;
107  virtual TH2 *RebinX(Int_t ngroup=2, const char *newname=""); // *MENU*
108  virtual TH2 *RebinY(Int_t ngroup=2, const char *newname=""); // *MENU*
109  virtual TH2 *Rebin(Int_t ngroup=2, const char*newname="", const Double_t *xbins=0); // re-implementation of the TH1 function using RebinX
110  virtual TH2 *Rebin2D(Int_t nxgroup=2, Int_t nygroup=2, const char *newname=""); // *MENU*
111  TProfile *ProfileX(const char *name="_pfx", Int_t firstybin=1, Int_t lastybin=-1, Option_t *option="") const; // *MENU*
112  TProfile *ProfileY(const char *name="_pfy", Int_t firstxbin=1, Int_t lastxbin=-1, Option_t *option="") const; // *MENU*
113  TH1D *ProjectionX(const char *name="_px", Int_t firstybin=0, Int_t lastybin=-1, Option_t *option="") const; // *MENU*
114  TH1D *ProjectionY(const char *name="_py", Int_t firstxbin=0, Int_t lastxbin=-1, Option_t *option="") const; // *MENU*
115  virtual void PutStats(Double_t *stats);
116  TH1D *QuantilesX(Double_t prob = 0.5, const char * name = "_qx" ) const;
117  TH1D *QuantilesY(Double_t prob = 0.5, const char * name = "_qy" ) const;
118  virtual void Reset(Option_t *option="");
119  virtual void SetBinContent(Int_t bin, Double_t content);
120  virtual void SetBinContent(Int_t binx, Int_t biny, Double_t content) { SetBinContent(GetBin(binx, biny), content); }
121  virtual void SetBinContent(Int_t binx, Int_t biny, Int_t, Double_t content) { SetBinContent(GetBin(binx, biny), content); }
122  virtual void SetShowProjectionX(Int_t nbins=1); // *MENU*
123  virtual void SetShowProjectionY(Int_t nbins=1); // *MENU*
124  virtual TH1 *ShowBackground(Int_t niter=20, Option_t *option="same");
125  virtual Int_t ShowPeaks(Double_t sigma=2, Option_t *option="", Double_t threshold=0.05); // *MENU*
126  virtual void Smooth(Int_t ntimes=1, Option_t *option=""); // *MENU*
127 
128  ClassDef(TH2,5) //2-Dim histogram base class
129 };
130 
131 
132 //______________________________________________________________________________
133 
134 class TH2C : public TH2, public TArrayC {
135 
136 public:
137  TH2C();
138  TH2C(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
139  ,Int_t nbinsy,Double_t ylow,Double_t yup);
140  TH2C(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
141  ,Int_t nbinsy,Double_t ylow,Double_t yup);
142  TH2C(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
143  ,Int_t nbinsy,const Double_t *ybins);
144  TH2C(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
145  ,Int_t nbinsy,const Double_t *ybins);
146  TH2C(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
147  ,Int_t nbinsy,const Float_t *ybins);
148  TH2C(const TH2C &h2c);
149  virtual ~TH2C();
150  virtual void AddBinContent(Int_t bin);
151  virtual void AddBinContent(Int_t bin, Double_t w);
152  virtual void Copy(TObject &hnew) const;
153  virtual void Reset(Option_t *option="");
154  virtual void SetBinsLength(Int_t n=-1);
155  TH2C& operator=(const TH2C &h1);
156  friend TH2C operator*(Float_t c1, TH2C &h1);
157  friend TH2C operator*(TH2C &h1, Float_t c1) {return operator*(c1,h1);}
158  friend TH2C operator+(TH2C &h1, TH2C &h2);
159  friend TH2C operator-(TH2C &h1, TH2C &h2);
160  friend TH2C operator*(TH2C &h1, TH2C &h2);
161  friend TH2C operator/(TH2C &h1, TH2C &h2);
162 
163 protected:
164  virtual Double_t RetrieveBinContent(Int_t bin) const { return Double_t (fArray[bin]); }
165  virtual void UpdateBinContent(Int_t bin, Double_t content) { fArray[bin] = Char_t (content); }
166 
167  ClassDef(TH2C,4) //2-Dim histograms (one char per channel)
168 };
169 
170 
171 //______________________________________________________________________________
172 
173 class TH2S : public TH2, public TArrayS {
174 
175 public:
176  TH2S();
177  TH2S(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
178  ,Int_t nbinsy,Double_t ylow,Double_t yup);
179  TH2S(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
180  ,Int_t nbinsy,Double_t ylow,Double_t yup);
181  TH2S(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
182  ,Int_t nbinsy,const Double_t *ybins);
183  TH2S(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
184  ,Int_t nbinsy,const Double_t *ybins);
185  TH2S(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
186  ,Int_t nbinsy,const Float_t *ybins);
187  TH2S(const TH2S &h2s);
188  virtual ~TH2S();
189  virtual void AddBinContent(Int_t bin);
190  virtual void AddBinContent(Int_t bin, Double_t w);
191  virtual void Copy(TObject &hnew) const;
192  virtual void Reset(Option_t *option="");
193  virtual void SetBinsLength(Int_t n=-1);
194  TH2S& operator=(const TH2S &h1);
195  friend TH2S operator*(Float_t c1, TH2S &h1);
196  friend TH2S operator*(TH2S &h1, Float_t c1) {return operator*(c1,h1);}
197  friend TH2S operator+(TH2S &h1, TH2S &h2);
198  friend TH2S operator-(TH2S &h1, TH2S &h2);
199  friend TH2S operator*(TH2S &h1, TH2S &h2);
200  friend TH2S operator/(TH2S &h1, TH2S &h2);
201 
202 protected:
203  virtual Double_t RetrieveBinContent(Int_t bin) const { return Double_t (fArray[bin]); }
204  virtual void UpdateBinContent(Int_t bin, Double_t content) { fArray[bin] = Short_t (content); }
205 
206  ClassDef(TH2S,4) //2-Dim histograms (one short per channel)
207 };
208 
209 
210 //______________________________________________________________________________
211 
212 class TH2I : public TH2, public TArrayI {
213 
214 public:
215  TH2I();
216  TH2I(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
217  ,Int_t nbinsy,Double_t ylow,Double_t yup);
218  TH2I(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
219  ,Int_t nbinsy,Double_t ylow,Double_t yup);
220  TH2I(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
221  ,Int_t nbinsy,const Double_t *ybins);
222  TH2I(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
223  ,Int_t nbinsy,const Double_t *ybins);
224  TH2I(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
225  ,Int_t nbinsy,const Float_t *ybins);
226  TH2I(const TH2I &h2i);
227  virtual ~TH2I();
228  virtual void AddBinContent(Int_t bin);
229  virtual void AddBinContent(Int_t bin, Double_t w);
230  virtual void Copy(TObject &hnew) const;
231  virtual void Reset(Option_t *option="");
232  virtual void SetBinsLength(Int_t n=-1);
233  TH2I& operator=(const TH2I &h1);
234  friend TH2I operator*(Float_t c1, TH2I &h1);
235  friend TH2I operator*(TH2I &h1, Float_t c1) {return operator*(c1,h1);}
236  friend TH2I operator+(TH2I &h1, TH2I &h2);
237  friend TH2I operator-(TH2I &h1, TH2I &h2);
238  friend TH2I operator*(TH2I &h1, TH2I &h2);
239  friend TH2I operator/(TH2I &h1, TH2I &h2);
240 
241 protected:
242  virtual Double_t RetrieveBinContent(Int_t bin) const { return Double_t (fArray[bin]); }
243  virtual void UpdateBinContent(Int_t bin, Double_t content) { fArray[bin] = Int_t (content); }
244 
245  ClassDef(TH2I,4) //2-Dim histograms (one 32 bits integer per channel)
246 };
247 
248 
249 //______________________________________________________________________________
250 
251 class TH2F : public TH2, public TArrayF {
252 
253 public:
254  TH2F();
255  TH2F(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
256  ,Int_t nbinsy,Double_t ylow,Double_t yup);
257  TH2F(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
258  ,Int_t nbinsy,Double_t ylow,Double_t yup);
259  TH2F(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
260  ,Int_t nbinsy,const Double_t *ybins);
261  TH2F(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
262  ,Int_t nbinsy,const Double_t *ybins);
263  TH2F(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
264  ,Int_t nbinsy,const Float_t *ybins);
265  TH2F(const TMatrixFBase &m);
266  TH2F(const TH2F &h2f);
267  virtual ~TH2F();
268  virtual void AddBinContent(Int_t bin) {++fArray[bin];}
269  virtual void AddBinContent(Int_t bin, Double_t w)
270  {fArray[bin] += Float_t (w);}
271  virtual void Copy(TObject &hnew) const;
272  virtual void Reset(Option_t *option="");
273  virtual void SetBinsLength(Int_t n=-1);
274  TH2F& operator=(const TH2F &h1);
275  friend TH2F operator*(Float_t c1, TH2F &h1);
276  friend TH2F operator*(TH2F &h1, Float_t c1);
277  friend TH2F operator+(TH2F &h1, TH2F &h2);
278  friend TH2F operator-(TH2F &h1, TH2F &h2);
279  friend TH2F operator*(TH2F &h1, TH2F &h2);
280  friend TH2F operator/(TH2F &h1, TH2F &h2);
281 
282 protected:
283  virtual Double_t RetrieveBinContent(Int_t bin) const { return Double_t (fArray[bin]); }
284  virtual void UpdateBinContent(Int_t bin, Double_t content) { fArray[bin] = Float_t (content); }
285 
286  ClassDef(TH2F,4) //2-Dim histograms (one float per channel)
287 };
288 
289 
290 //______________________________________________________________________________
291 
292 class TH2D : public TH2, public TArrayD {
293 
294 public:
295  TH2D();
296  TH2D(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
297  ,Int_t nbinsy,Double_t ylow,Double_t yup);
298  TH2D(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
299  ,Int_t nbinsy,Double_t ylow,Double_t yup);
300  TH2D(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
301  ,Int_t nbinsy,const Double_t *ybins);
302  TH2D(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
303  ,Int_t nbinsy,const Double_t *ybins);
304  TH2D(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
305  ,Int_t nbinsy,const Float_t *ybins);
306  TH2D(const TMatrixDBase &m);
307  TH2D(const TH2D &h2d);
308  virtual ~TH2D();
309  virtual void AddBinContent(Int_t bin) {++fArray[bin];}
310  virtual void AddBinContent(Int_t bin, Double_t w)
311  {fArray[bin] += Double_t (w);}
312  virtual void Copy(TObject &hnew) const;
313  virtual void Reset(Option_t *option="");
314  virtual void SetBinsLength(Int_t n=-1);
315  TH2D& operator=(const TH2D &h1);
316  friend TH2D operator*(Float_t c1, TH2D &h1);
317  friend TH2D operator*(TH2D &h1, Float_t c1) {return operator*(c1,h1);}
318  friend TH2D operator+(TH2D &h1, TH2D &h2);
319  friend TH2D operator-(TH2D &h1, TH2D &h2);
320  friend TH2D operator*(TH2D &h1, TH2D &h2);
321  friend TH2D operator/(TH2D &h1, TH2D &h2);
322 
323 protected:
324  virtual Double_t RetrieveBinContent(Int_t bin) const { return fArray[bin]; }
325  virtual void UpdateBinContent(Int_t bin, Double_t content) { fArray[bin] = content; }
326 
327  ClassDef(TH2D,4) //2-Dim histograms (one double per channel)
328 };
329 
330 #endif
virtual void SetBinsLength(Int_t n=-1)
Set total number of bins including under/overflow Reallocate bin contents array.
Definition: TH2.cxx:3827
virtual void SetBinContent(Int_t binx, Int_t biny, Double_t content)
Definition: TH2.h:120
TH1D * QuantilesX(Double_t prob=0.5, const char *name="_qx") const
Compute the X distribution of quantiles in the other variable Y name is the name of the returned hist...
Definition: TH2.cxx:2369
Float_t * fArray
Definition: TArrayF.h:30
virtual void AddBinContent(Int_t bin)
Increment bin content by 1.
Definition: TH2.cxx:3050
virtual Double_t IntegralAndError(Int_t binx1, Int_t binx2, Double_t &err, Option_t *option="") const
Return integral of bin contents in range [binx1,binx2] and its error.
Definition: TH1.cxx:7476
An array of TObjects.
Definition: TObjArray.h:37
virtual void FillRandom(const char *fname, Int_t ntimes=5000)
Fill histogram following distribution in function fname.
Definition: TH2.cxx:599
friend TH2D operator+(TH2D &h1, TH2D &h2)
Operator +.
Definition: TH2.cxx:3896
virtual Double_t RetrieveBinContent(Int_t bin) const
Raw retrieval of bin content on internal data structure see convention for numbering bins in TH1::Get...
Definition: TH2.h:324
virtual void GetRandom2(Double_t &x, Double_t &y)
Return 2 random numbers along axis x and y distributed according the cell-contents of a 2-dim histogr...
Definition: TH2.cxx:1076
virtual Int_t BufferEmpty(Int_t action=0)
Fill histogram with all entries in the buffer.
Definition: TH2.cxx:179
auto * m
Definition: textangle.C:8
friend TH2F operator/(TH2F &h1, TH2F &h2)
Operator /.
Definition: TH2.cxx:3678
virtual void PutStats(Double_t *stats)
Replace current statistics with the values in array stats.
Definition: TH2.cxx:2349
virtual void UpdateBinContent(Int_t bin, Double_t content)
Raw update of bin content on internal data structure see convention for numbering bins in TH1::GetBin...
Definition: TH2.h:284
friend TH2I operator*(TH2I &h1, Float_t c1)
Definition: TH2.h:235
float Float_t
Definition: RtypesCore.h:55
friend TH2C operator/(TH2C &h1, TH2C &h2)
Operator /.
Definition: TH2.cxx:2941
Short_t * fArray
Definition: TArrayS.h:30
const char Option_t
Definition: RtypesCore.h:64
return c1
Definition: legend1.C:41
void Reset()
Definition: TArrayD.h:47
friend TH2C operator+(TH2C &h1, TH2C &h2)
Operator +.
Definition: TH2.cxx:2905
friend TH2D operator-(TH2D &h1, TH2D &h2)
Operator -.
Definition: TH2.cxx:3908
TH1D * ProjectionY(const char *name="_py", Int_t firstxbin=0, Int_t lastxbin=-1, Option_t *option="") const
Project a 2-D histogram into a 1-D histogram along Y.
Definition: TH2.cxx:2340
virtual TH2 * RebinY(Int_t ngroup=2, const char *newname="")
Rebin only the Y axis see Rebin2D.
Definition: TH2.cxx:1523
Double_t fScalefactor
Definition: TH2.h:33
friend TH2C operator*(TH2C &h1, Float_t c1)
Definition: TH2.h:157
friend TH2I operator-(TH2I &h1, TH2I &h2)
Operator -.
Definition: TH2.cxx:3390
TH2C()
Constructor.
Definition: TH2.cxx:2707
int Int_t
Definition: CPyCppyy.h:43
virtual Int_t BufferFill(Double_t x, Double_t y, Double_t w)
accumulate arguments in buffer.
Definition: TH2.cxx:253
virtual void SetBinsLength(Int_t n=-1)
Set total number of bins including under/overflow Reallocate bin contents array.
Definition: TH2.cxx:3091
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Definition: TH1.cxx:4906
virtual Double_t Integral(Option_t *option="") const
Return integral of bin contents.
Definition: TH1.cxx:7449
TH1D * ProjectionX(const char *name="_px", Int_t firstybin=0, Int_t lastybin=-1, Option_t *option="") const
Project a 2-D histogram into a 1-D histogram along X.
Definition: TH2.cxx:2300
TH2I()
Constructor.
Definition: TH2.cxx:3215
virtual ~TH2D()
Destructor.
Definition: TH2.cxx:3708
virtual TH1D * DoQuantiles(bool onX, const char *name, Double_t prob) const
Implementation of quantiles for x or y.
Definition: TH2.cxx:2391
virtual Double_t GetCorrelationFactor(Int_t axis1=1, Int_t axis2=2) const
Return correlation factor between axis1 and axis2.
Definition: TH2.cxx:1026
2-D histogram with a byte per channel (see TH1 documentation)
Definition: TH2.h:134
Array of floats (32 bits per element).
Definition: TArrayF.h:27
virtual Double_t Integral(Option_t *option="") const
Return integral of bin contents.
Definition: TH2.cxx:1188
virtual ~TH2()
Destructor.
Definition: TH2.cxx:166
friend TH2C operator*(Float_t c1, TH2C &h1)
Operator *.
Definition: TH2.cxx:2893
virtual void UpdateBinContent(Int_t bin, Double_t content)
Raw update of bin content on internal data structure see convention for numbering bins in TH1::GetBin...
Definition: TH2.h:325
friend TH2I operator/(TH2I &h1, TH2I &h2)
Operator /.
Definition: TH2.cxx:3414
void Reset()
Definition: TArrayF.h:47
Profile Histogram.
Definition: TProfile.h:32
virtual void Copy(TObject &hnew) const
Copy.
Definition: TH2.cxx:2817
virtual void SetShowProjectionY(Int_t nbins=1)
When the mouse is moved in a pad containing a 2-d view of this histogram a second canvas shows the pr...
Definition: TH2.cxx:2512
TH2F()
Constructor.
Definition: TH2.cxx:3434
friend TH2I operator*(Float_t c1, TH2I &h1)
Operator *.
Definition: TH2.cxx:3366
virtual Double_t RetrieveBinContent(Int_t bin) const
Raw retrieval of bin content on internal data structure see convention for numbering bins in TH1::Get...
Definition: TH2.h:164
virtual void SetBinsLength(Int_t n=-1)
Set total number of bins including under/overflow Reallocate bin contents array.
Definition: TH2.cxx:2837
friend TH2D operator/(TH2D &h1, TH2D &h2)
Operator /.
Definition: TH2.cxx:3932
friend TH2I operator+(TH2I &h1, TH2I &h2)
Operator +.
Definition: TH2.cxx:3378
Array of integers (32 bits per element).
Definition: TArrayI.h:27
virtual Double_t RetrieveBinContent(Int_t bin) const
Raw retrieval of bin content on internal data structure see convention for numbering bins in TH1::Get...
Definition: TH2.h:283
friend TH2S operator/(TH2S &h1, TH2S &h2)
Operator /.
Definition: TH2.cxx:3195
TH2 & operator=(const TH2 &)
friend TH2C operator-(TH2C &h1, TH2C &h2)
Operator -.
Definition: TH2.cxx:2917
TH2S()
Constructor.
Definition: TH2.cxx:2961
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:322
TH2F & operator=(const TH2F &h1)
Operator =.
Definition: TH2.cxx:3608
virtual Int_t ShowPeaks(Double_t sigma=2, Option_t *option="", Double_t threshold=0.05)
Interface to TSpectrum2::Search the function finds peaks in this histogram where the width is > sigma...
Definition: TH2.cxx:2541
virtual void Copy(TObject &hnew) const
Copy.
Definition: TH2.cxx:3071
virtual void SetShowProjectionX(Int_t nbins=1)
When the mouse is moved in a pad containing a 2-d view of this histogram a second canvas shows the pr...
Definition: TH2.cxx:2497
virtual Double_t GetBinErrorUp(Int_t binx, Int_t biny)
Definition: TH2.h:94
friend TH2S operator*(TH2S &h1, Float_t c1)
Definition: TH2.h:196
Double_t * fArray
Definition: TArrayD.h:30
TH2S & operator=(const TH2S &h1)
Operator =.
Definition: TH2.cxx:3137
Double_t fTsumwy2
Definition: TH2.h:35
friend TH2F operator-(TH2F &h1, TH2F &h2)
Operator -.
Definition: TH2.cxx:3654
const Double_t sigma
TH1F * h1
Definition: legend1.C:5
virtual void AddBinContent(Int_t bin)
Increment bin content by 1.
Definition: TH2.cxx:2796
virtual Double_t GetBinErrorLow(Int_t binx, Int_t biny)
Definition: TH2.h:93
virtual void Copy(TObject &hnew) const
Copy.
Definition: TH2.cxx:3325
virtual void AddBinContent(Int_t bin)
Increment bin content by 1.
Definition: TH2.h:309
virtual Double_t GetBinContent(Int_t binx, Int_t biny, Int_t) const
Definition: TH2.h:90
virtual void Smooth(Int_t ntimes=1, Option_t *option="")
Smooth bin contents of this 2-d histogram using kernel algorithms similar to the ones used in the ras...
Definition: TH2.cxx:2570
virtual Double_t GetBinWithContent2(Double_t c, Int_t &binx, Int_t &biny, Int_t firstxbin=1, Int_t lastxbin=-1, Int_t firstybin=1, Int_t lastybin=-1, Double_t maxdiff=0) const
compute first cell (binx,biny) in the range [firstxbin,lastxbin][firstybin,lastybin] for which diff =...
Definition: TH2.cxx:998
void Reset()
Definition: TArrayS.h:47
virtual void Reset(Option_t *option="")
Reset this histogram: contents, errors, etc.
Definition: TH2.cxx:2826
virtual Double_t GetBinContent(Int_t binx, Int_t biny) const
Definition: TH2.h:89
Int_t Fill(const char *, Double_t)
Increment bin with namex with a weight w.
Definition: TH2.h:58
virtual void Copy(TObject &hnew) const
Copy.
Definition: TH2.cxx:281
virtual ~TH2C()
Destructor.
Definition: TH2.cxx:2717
virtual void AddBinContent(Int_t bin)
Increment bin content by 1.
Definition: TH2.cxx:3304
Service class for 2-Dim histogram classes.
Definition: TH2.h:30
virtual void GetStats(Double_t *stats) const
Fill the array stats from the contents of this histogram The array stats must be correctly dimensione...
Definition: TH2.cxx:1129
Array of shorts (16 bits per element).
Definition: TArrayS.h:27
TH2C & operator=(const TH2C &h1)
Operator =.
Definition: TH2.cxx:2883
virtual void FitSlicesX(TF1 *f1=0, Int_t firstybin=0, Int_t lastybin=-1, Int_t cut=0, Option_t *option="QNR", TObjArray *arr=0)
Project slices along X in case of a 2-D histogram, then fit each slice with function f1 and make a hi...
Definition: TH2.cxx:897
friend TH2D operator*(TH2D &h1, Float_t c1)
Definition: TH2.h:317
2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:251
Double_t fTsumwxy
Definition: TH2.h:36
Double_t fTsumwy
Definition: TH2.h:34
virtual void Copy(TObject &hnew) const
Copy.
Definition: TH2.cxx:3807
virtual void SetBinContent(Int_t binx, Int_t biny, Int_t, Double_t content)
Definition: TH2.h:121
short Short_t
Definition: RtypesCore.h:37
virtual Double_t Interpolate(Double_t x) const
illegal for a TH2
Definition: TH2.cxx:1224
virtual void UpdateBinContent(Int_t bin, Double_t content)
Raw update of bin content on internal data structure see convention for numbering bins in TH1::GetBin...
Definition: TH2.h:165
virtual Double_t RetrieveBinContent(Int_t bin) const
Raw retrieval of bin content on internal data structure see convention for numbering bins in TH1::Get...
Definition: TH2.h:242
virtual Double_t IntegralAndError(Int_t binx1, Int_t binx2, Int_t biny1, Int_t biny2, Double_t &err, Option_t *option="") const
Return integral of bin contents in range [firstxbin,lastxbin],[firstybin,lastybin] for a 2-D histogra...
Definition: TH2.cxx:1216
1-D histogram with a double per channel (see TH1 documentation)}
Definition: TH1.h:614
TMatrixTBase.
#define h(i)
Definition: RSha256.hxx:106
virtual Double_t Integral(Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, Option_t *="") const
Definition: TH2.h:102
virtual void UpdateBinContent(Int_t bin, Double_t content)
Raw update of bin content on internal data structure see convention for numbering bins in TH1::GetBin...
Definition: TH2.h:243
TH1D * QuantilesY(Double_t prob=0.5, const char *name="_qy") const
Compute the Y distribution of quantiles in the other variable X name is the name of the returned hist...
Definition: TH2.cxx:2382
friend TH2D operator*(Float_t c1, TH2D &h1)
Operator *.
Definition: TH2.cxx:3884
friend TH2F operator+(TH2F &h1, TH2F &h2)
Operator +.
Definition: TH2.cxx:3642
friend TH2S operator*(Float_t c1, TH2S &h1)
Operator *.
Definition: TH2.cxx:3147
TH2D()
Constructor.
Definition: TH2.cxx:3698
virtual TH2 * RebinX(Int_t ngroup=2, const char *newname="")
Rebin only the X axis see Rebin2D.
Definition: TH2.cxx:1513
TProfile * ProfileY(const char *name="_pfy", Int_t firstxbin=1, Int_t lastxbin=-1, Option_t *option="") const
Project a 2-D histogram into a profile histogram along Y.
Definition: TH2.cxx:2024
TProfile * ProfileX(const char *name="_pfx", Int_t firstybin=1, Int_t lastybin=-1, Option_t *option="") const
Project a 2-D histogram into a profile histogram along X.
Definition: TH2.cxx:1974
virtual Double_t GetBinErrorLow(Int_t bin) const
Return lower error associated to bin number bin.
Definition: TH1.cxx:8534
TH2I & operator=(const TH2I &h1)
Operator =.
Definition: TH2.cxx:3356
double Double_t
Definition: RtypesCore.h:57
virtual void AddBinContent(Int_t bin)
Increment bin content by 1.
Definition: TH2.h:268
virtual void DoFitSlices(bool onX, TF1 *f1, Int_t firstbin, Int_t lastbin, Int_t cut, Option_t *option, TObjArray *arr)
Definition: TH2.cxx:695
Int_t * fArray
Definition: TArrayI.h:30
virtual void FitSlicesY(TF1 *f1=0, Int_t firstxbin=0, Int_t lastxbin=-1, Int_t cut=0, Option_t *option="QNR", TObjArray *arr=0)
Project slices along Y in case of a 2-D histogram, then fit each slice with function f1 and make a hi...
Definition: TH2.cxx:962
Double_t y[n]
Definition: legend1.C:17
The TH1 histogram class.
Definition: TH1.h:56
2-D histogram with a short per channel (see TH1 documentation)
Definition: TH2.h:173
Array of doubles (64 bits per element).
Definition: TArrayD.h:27
friend TH2F operator*(Float_t c1, TH2F &h1)
Operator *.
Definition: TH2.cxx:3618
virtual void AddBinContent(Int_t bin, Double_t w)
Increment bin content by a weight w.
Definition: TH2.h:269
virtual Double_t RetrieveBinContent(Int_t bin) const
Raw retrieval of bin content on internal data structure see convention for numbering bins in TH1::Get...
Definition: TH2.h:203
Mother of all ROOT objects.
Definition: TObject.h:37
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
char Char_t
Definition: RtypesCore.h:31
virtual void AddBinContent(Int_t bin, Double_t w)
Increment bin content by a weight w.
Definition: TH2.h:310
virtual TH1 * ShowBackground(Int_t niter=20, Option_t *option="same")
This function calculates the background spectrum in this histogram.
Definition: TH2.cxx:2525
virtual ~TH2F()
Destructor.
Definition: TH2.cxx:3444
virtual void SetBinsLength(Int_t n=-1)
Set total number of bins including under/overflow Reallocate bin contents array.
Definition: TH2.cxx:3562
virtual ~TH2I()
Destructor.
Definition: TH2.cxx:3225
virtual void Copy(TObject &hnew) const
Copy.
Definition: TH2.cxx:3542
1-Dim function class
Definition: TF1.h:210
Char_t * fArray
Definition: TArrayC.h:30
TF1 * f1
Definition: legend1.C:11
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Definition: TH2.h:88
void Reset()
Definition: TArrayI.h:47
#define c(i)
Definition: RSha256.hxx:101
virtual Double_t GetBinErrorUp(Int_t bin) const
Return upper error associated to bin number bin.
Definition: TH1.cxx:8565
virtual void SetBinsLength(Int_t n=-1)
Set total number of bins including under/overflow Reallocate bin contents array.
Definition: TH2.cxx:3345
virtual void UpdateBinContent(Int_t bin, Double_t content)
Raw update of bin content on internal data structure see convention for numbering bins in TH1::GetBin...
Definition: TH2.h:204
friend TH2S operator+(TH2S &h1, TH2S &h2)
Operator +.
Definition: TH2.cxx:3159
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content.
Definition: TH2.cxx:2480
virtual void Reset(Option_t *option="")
Reset this histogram: contents, errors, etc.
Definition: TH2.cxx:2464
2-D histogram with an int per channel (see TH1 documentation)}
Definition: TH2.h:212
virtual Int_t GetBin(Int_t binx, Int_t biny, Int_t binz=0) const
Return Global bin number corresponding to binx,y,z.
Definition: TH2.cxx:967
Int_t Fill(Double_t)
Invalid Fill method.
Definition: TH2.cxx:294
TH2()
Constructor.
Definition: TH2.cxx:62
virtual ~TH2S()
Destructor.
Definition: TH2.cxx:2971
friend TH2S operator-(TH2S &h1, TH2S &h2)
Operator -.
Definition: TH2.cxx:3171
Int_t BufferFill(Double_t, Double_t)
accumulate arguments in buffer.
Definition: TH2.h:56
const Int_t n
Definition: legend1.C:16
virtual TProfile * DoProfile(bool onX, const char *name, Int_t firstbin, Int_t lastbin, Option_t *option) const
Definition: TH2.cxx:1751
char name[80]
Definition: TGX11.cxx:109
virtual void FillN(Int_t, const Double_t *, const Double_t *, Int_t)
Fill this histogram with an array x and weights w.
Definition: TH2.h:80
virtual TH2 * Rebin(Int_t ngroup=2, const char *newname="", const Double_t *xbins=0)
Override TH1::Rebin as TH2::RebinX Rebinning in variable binning as for TH1 is not allowed If a non-n...
Definition: TH2.cxx:1534
virtual TH2 * Rebin2D(Int_t nxgroup=2, Int_t nygroup=2, const char *newname="")
Rebin this histogram grouping nxgroup/nygroup bins along the xaxis/yaxis together.
Definition: TH2.cxx:1569
virtual Double_t KolmogorovTest(const TH1 *h2, Option_t *option="") const
Statistical test of compatibility in shape between THIS histogram and h2, using Kolmogorov test...
Definition: TH2.cxx:1341
virtual TH1D * DoProjection(bool onX, const char *name, Int_t firstbin, Int_t lastbin, Option_t *option) const
Internal (protected) method for performing projection on the X or Y axis called by ProjectionX or Pro...
Definition: TH2.cxx:2034
TH2D & operator=(const TH2D &h1)
Operator =.
Definition: TH2.cxx:3873
virtual Double_t GetCovariance(Int_t axis1=1, Int_t axis2=2) const
Return covariance between axis1 and axis2.
Definition: TH2.cxx:1044
2-D histogram with a double per channel (see TH1 documentation)}
Definition: TH2.h:292
Array of chars or bytes (8 bits per element).
Definition: TArrayC.h:27