Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
28class TProfile;
29
30class TH2 : public TH1 {
31
32protected:
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) override {return -2;} //may not use
57 Int_t Fill(Double_t) override; //MayNotUse
58 Int_t Fill(const char*, Double_t) override { return Fill(0);} //MayNotUse
59
60 Double_t Interpolate(Double_t x) const override; // may not use
61
62private:
63
64 TH2(const TH2&) = delete;
65 TH2& operator=(const TH2&) = delete;
66
67 // make private methods which have a TH1 signature and should not
68 using TH1::Integral;
70
71public:
72 virtual ~TH2();
73 Int_t BufferEmpty(Int_t action=0) override;
74 void Copy(TObject &hnew) const override;
75 Int_t Fill(Double_t x, Double_t y) override;
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 void FillN(Int_t, const Double_t *, const Double_t *, Int_t) override {} //MayNotUse
81 void FillN(Int_t ntimes, const Double_t *x, const Double_t *y, const Double_t *w, Int_t stride=1) override;
82 void FillRandom(const char *fname, Int_t ntimes=5000, TRandom *rng = nullptr) override;
83 void FillRandom(TH1 *h, Int_t ntimes=5000, TRandom *rng = nullptr) override;
84 virtual void FitSlicesX(TF1 *f1 = nullptr, Int_t firstybin=0, Int_t lastybin=-1, Int_t cut=0, Option_t *option="QNR", TObjArray* arr = nullptr);
85 virtual void FitSlicesY(TF1 *f1 = nullptr, Int_t firstxbin=0, Int_t lastxbin=-1, Int_t cut=0, Option_t *option="QNR", TObjArray* arr = nullptr);
86 Int_t GetBin(Int_t binx, Int_t biny, Int_t binz = 0) const override;
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;
89 Double_t GetBinContent(Int_t binx, Int_t biny) const override { return TH1::GetBinContent( GetBin(binx, biny) ); }
90 Double_t GetBinContent(Int_t binx, Int_t biny, Int_t) const override { return TH1::GetBinContent( GetBin(binx, biny) ); }
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, TRandom * rng = nullptr);
98 void GetStats(Double_t *stats) const override;
99 Double_t Integral(Option_t *option="") const override;
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 Double_t Interpolate(Double_t x, Double_t y) const override;
105 Double_t Interpolate(Double_t x, Double_t y, Double_t z) const override;
106 Double_t KolmogorovTest(const TH1 *h2, Option_t *option="") const override;
107 TH2 *RebinX(Int_t ngroup=2, const char *newname="") override; // *MENU*
108 virtual TH2 *RebinY(Int_t ngroup=2, const char *newname=""); // *MENU*
109 TH2 *Rebin(Int_t ngroup=2, const char*newname="", const Double_t *xbins = nullptr) override; // 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 void PutStats(Double_t *stats) override;
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 void Reset(Option_t *option="") override;
119 void SetBinContent(Int_t bin, Double_t content) override;
120 void SetBinContent(Int_t binx, Int_t biny, Double_t content) override { SetBinContent(GetBin(binx, biny), content); }
121 void SetBinContent(Int_t binx, Int_t biny, Int_t, Double_t content) override { SetBinContent(GetBin(binx, biny), content); }
122 virtual void SetShowProjectionX(Int_t nbins=1); // *MENU*
123 virtual void SetShowProjectionY(Int_t nbins=1); // *MENU*
124 TH1 *ShowBackground(Int_t niter=20, Option_t *option="same") override;
125 Int_t ShowPeaks(Double_t sigma=2, Option_t *option="", Double_t threshold=0.05) override; // *MENU*
126 void Smooth(Int_t ntimes=1, Option_t *option="") override; // *MENU*
127
128 ClassDefOverride(TH2,5) //2-Dim histogram base class
129};
130
131
132//______________________________________________________________________________
133
134class TH2C : public TH2, public TArrayC {
135
136public:
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
151 void AddBinContent(Int_t bin) override;
152 void AddBinContent(Int_t bin, Double_t w) override;
153 void Copy(TObject &hnew) const override;
154 void Reset(Option_t *option="") override;
155 void SetBinsLength(Int_t n=-1) override;
156
157 TH2C& operator=(const TH2C &h1);
158 friend TH2C operator*(Float_t c1, TH2C &h1);
159 friend TH2C operator*(TH2C &h1, Float_t c1) {return operator*(c1,h1);}
160 friend TH2C operator+(TH2C &h1, TH2C &h2);
161 friend TH2C operator-(TH2C &h1, TH2C &h2);
162 friend TH2C operator*(TH2C &h1, TH2C &h2);
163 friend TH2C operator/(TH2C &h1, TH2C &h2);
164
165protected:
166 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
167 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Char_t (content); }
168
169 ClassDefOverride(TH2C,4) //2-Dim histograms (one char per channel)
170};
171
172
173//______________________________________________________________________________
174
175class TH2S : public TH2, public TArrayS {
176
177public:
178 TH2S();
179 TH2S(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
180 ,Int_t nbinsy,Double_t ylow,Double_t yup);
181 TH2S(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
182 ,Int_t nbinsy,Double_t ylow,Double_t yup);
183 TH2S(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
184 ,Int_t nbinsy,const Double_t *ybins);
185 TH2S(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
186 ,Int_t nbinsy,const Double_t *ybins);
187 TH2S(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
188 ,Int_t nbinsy,const Float_t *ybins);
189 TH2S(const TH2S &h2s);
190 virtual ~TH2S();
191
192 void AddBinContent(Int_t bin) override;
193 void AddBinContent(Int_t bin, Double_t w) override;
194 void Copy(TObject &hnew) const override;
195 void Reset(Option_t *option="") override;
196 void SetBinsLength(Int_t n=-1) override;
197
198 TH2S& operator=(const TH2S &h1);
199 friend TH2S operator*(Float_t c1, TH2S &h1);
200 friend TH2S operator*(TH2S &h1, Float_t c1) {return operator*(c1,h1);}
201 friend TH2S operator+(TH2S &h1, TH2S &h2);
202 friend TH2S operator-(TH2S &h1, TH2S &h2);
203 friend TH2S operator*(TH2S &h1, TH2S &h2);
204 friend TH2S operator/(TH2S &h1, TH2S &h2);
205
206protected:
207 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
208 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Short_t (content); }
209
210 ClassDefOverride(TH2S,4) //2-Dim histograms (one short per channel)
211};
212
213
214//______________________________________________________________________________
215
216class TH2I : public TH2, public TArrayI {
217
218public:
219 TH2I();
220 TH2I(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
221 ,Int_t nbinsy,Double_t ylow,Double_t yup);
222 TH2I(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
223 ,Int_t nbinsy,Double_t ylow,Double_t yup);
224 TH2I(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
225 ,Int_t nbinsy,const Double_t *ybins);
226 TH2I(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
227 ,Int_t nbinsy,const Double_t *ybins);
228 TH2I(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
229 ,Int_t nbinsy,const Float_t *ybins);
230 TH2I(const TH2I &h2i);
231 virtual ~TH2I();
232
233 void AddBinContent(Int_t bin) override;
234 void AddBinContent(Int_t bin, Double_t w) override;
235 void Copy(TObject &hnew) const override;
236 void Reset(Option_t *option="") override;
237 void SetBinsLength(Int_t n=-1) override;
238
239 TH2I& operator=(const TH2I &h1);
240 friend TH2I operator*(Float_t c1, TH2I &h1);
241 friend TH2I operator*(TH2I &h1, Float_t c1) {return operator*(c1,h1);}
242 friend TH2I operator+(TH2I &h1, TH2I &h2);
243 friend TH2I operator-(TH2I &h1, TH2I &h2);
244 friend TH2I operator*(TH2I &h1, TH2I &h2);
245 friend TH2I operator/(TH2I &h1, TH2I &h2);
246
247protected:
248 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
249 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Int_t (content); }
250
251 ClassDefOverride(TH2I,4) //2-Dim histograms (one 32 bits integer per channel)
252};
253
254
255//______________________________________________________________________________
256
257class TH2F : public TH2, public TArrayF {
258
259public:
260 TH2F();
261 TH2F(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
262 ,Int_t nbinsy,Double_t ylow,Double_t yup);
263 TH2F(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
264 ,Int_t nbinsy,Double_t ylow,Double_t yup);
265 TH2F(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
266 ,Int_t nbinsy,const Double_t *ybins);
267 TH2F(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
268 ,Int_t nbinsy,const Double_t *ybins);
269 TH2F(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
270 ,Int_t nbinsy,const Float_t *ybins);
271 TH2F(const TMatrixFBase &m);
272 TH2F(const TH2F &h2f);
273 virtual ~TH2F();
274
275 void AddBinContent(Int_t bin) override {++fArray[bin];}
276 void AddBinContent(Int_t bin, Double_t w) override
277 {fArray[bin] += Float_t (w);}
278 void Copy(TObject &hnew) const override;
279 void Reset(Option_t *option="") override;
280 void SetBinsLength(Int_t n=-1) override;
281
282 TH2F& operator=(const TH2F &h1);
283 friend TH2F operator*(Float_t c1, TH2F &h1);
284 friend TH2F operator*(TH2F &h1, Float_t c1);
285 friend TH2F operator+(TH2F &h1, TH2F &h2);
286 friend TH2F operator-(TH2F &h1, TH2F &h2);
287 friend TH2F operator*(TH2F &h1, TH2F &h2);
288 friend TH2F operator/(TH2F &h1, TH2F &h2);
289
290protected:
291 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
292 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Float_t (content); }
293
294 ClassDefOverride(TH2F,4) //2-Dim histograms (one float per channel)
295};
296
297
298//______________________________________________________________________________
299
300class TH2D : public TH2, public TArrayD {
301
302public:
303 TH2D();
304 TH2D(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
305 ,Int_t nbinsy,Double_t ylow,Double_t yup);
306 TH2D(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
307 ,Int_t nbinsy,Double_t ylow,Double_t yup);
308 TH2D(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
309 ,Int_t nbinsy,const Double_t *ybins);
310 TH2D(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
311 ,Int_t nbinsy,const Double_t *ybins);
312 TH2D(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
313 ,Int_t nbinsy,const Float_t *ybins);
314 TH2D(const TMatrixDBase &m);
315 TH2D(const TH2D &h2d);
316 virtual ~TH2D();
317
318 void AddBinContent(Int_t bin) override {++fArray[bin];}
319 void AddBinContent(Int_t bin, Double_t w) override
320 {fArray[bin] += Double_t (w);}
321 void Copy(TObject &hnew) const override;
322 void Reset(Option_t *option="") override;
323 void SetBinsLength(Int_t n=-1) override;
324
325 TH2D& operator=(const TH2D &h1);
326 friend TH2D operator*(Float_t c1, TH2D &h1);
327 friend TH2D operator*(TH2D &h1, Float_t c1) {return operator*(c1,h1);}
328 friend TH2D operator+(TH2D &h1, TH2D &h2);
329 friend TH2D operator-(TH2D &h1, TH2D &h2);
330 friend TH2D operator*(TH2D &h1, TH2D &h2);
331 friend TH2D operator/(TH2D &h1, TH2D &h2);
332
333protected:
334 Double_t RetrieveBinContent(Int_t bin) const override { return fArray[bin]; }
335 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = content; }
336
337 ClassDefOverride(TH2D,4) //2-Dim histograms (one double per channel)
338};
339
340#endif
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
int Int_t
Definition RtypesCore.h:45
char Char_t
Definition RtypesCore.h:37
float Float_t
Definition RtypesCore.h:57
short Short_t
Definition RtypesCore.h:39
double Double_t
Definition RtypesCore.h:59
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t option
char name[80]
Definition TGX11.cxx:110
Array of chars or bytes (8 bits per element).
Definition TArrayC.h:27
Char_t * fArray
Definition TArrayC.h:30
Array of doubles (64 bits per element).
Definition TArrayD.h:27
Double_t * fArray
Definition TArrayD.h:30
void Reset()
Definition TArrayD.h:47
Array of floats (32 bits per element).
Definition TArrayF.h:27
Float_t * fArray
Definition TArrayF.h:30
void Reset()
Definition TArrayF.h:47
Array of integers (32 bits per element).
Definition TArrayI.h:27
Int_t * fArray
Definition TArrayI.h:30
void Reset()
Definition TArrayI.h:47
Array of shorts (16 bits per element).
Definition TArrayS.h:27
void Reset()
Definition TArrayS.h:47
Short_t * fArray
Definition TArrayS.h:30
1-Dim function class
Definition TF1.h:213
1-D histogram with a double per channel (see TH1 documentation)}
Definition TH1.h:620
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:58
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:7878
virtual Double_t GetBinErrorLow(Int_t bin) const
Return lower error associated to bin number bin.
Definition TH1.cxx:8945
virtual Double_t Integral(Option_t *option="") const
Return integral of bin contents.
Definition TH1.cxx:7851
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Definition TH1.cxx:5025
virtual Double_t GetBinErrorUp(Int_t bin) const
Return upper error associated to bin number bin.
Definition TH1.cxx:8976
2-D histogram with a byte per channel (see TH1 documentation)
Definition TH2.h:134
void Reset(Option_t *option="") override
Reset this histogram: contents, errors, etc.
Definition TH2.cxx:2909
friend TH2C operator-(TH2C &h1, TH2C &h2)
Operator -.
Definition TH2.cxx:3001
friend TH2C operator+(TH2C &h1, TH2C &h2)
Operator +.
Definition TH2.cxx:2989
Double_t RetrieveBinContent(Int_t bin) const override
Raw retrieval of bin content on internal data structure see convention for numbering bins in TH1::Get...
Definition TH2.h:166
friend TH2C operator/(TH2C &h1, TH2C &h2)
Operator /.
Definition TH2.cxx:3025
virtual ~TH2C()
Destructor.
Definition TH2.cxx:2794
void UpdateBinContent(Int_t bin, Double_t content) override
Raw update of bin content on internal data structure see convention for numbering bins in TH1::GetBin...
Definition TH2.h:167
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH2.cxx:2879
TH2C()
Constructor.
Definition TH2.cxx:2784
TH2C & operator=(const TH2C &h1)
Operator =.
Definition TH2.cxx:2966
void Copy(TObject &hnew) const override
Copy.
Definition TH2.cxx:2900
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH2.cxx:2920
friend TH2C operator*(Float_t c1, TH2C &h1)
Operator *.
Definition TH2.cxx:2977
friend TH2C operator*(TH2C &h1, Float_t c1)
Definition TH2.h:159
2-D histogram with a double per channel (see TH1 documentation)}
Definition TH2.h:300
void UpdateBinContent(Int_t bin, Double_t content) override
Raw update of bin content on internal data structure see convention for numbering bins in TH1::GetBin...
Definition TH2.h:335
friend TH2D operator-(TH2D &h1, TH2D &h2)
Operator -.
Definition TH2.cxx:4024
friend TH2D operator*(Float_t c1, TH2D &h1)
Operator *.
Definition TH2.cxx:4000
virtual ~TH2D()
Destructor.
Definition TH2.cxx:3814
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH2.cxx:3941
Double_t RetrieveBinContent(Int_t bin) const override
Raw retrieval of bin content on internal data structure see convention for numbering bins in TH1::Get...
Definition TH2.h:334
friend TH2D operator/(TH2D &h1, TH2D &h2)
Operator /.
Definition TH2.cxx:4048
void AddBinContent(Int_t bin, Double_t w) override
Increment bin content by a weight w.
Definition TH2.h:319
void Copy(TObject &hnew) const override
Copy.
Definition TH2.cxx:3921
friend TH2D operator+(TH2D &h1, TH2D &h2)
Operator +.
Definition TH2.cxx:4012
friend TH2D operator*(TH2D &h1, Float_t c1)
Definition TH2.h:327
TH2D()
Constructor.
Definition TH2.cxx:3804
TH2D & operator=(const TH2D &h1)
Operator =.
Definition TH2.cxx:3987
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH2.h:318
2-D histogram with a float per channel (see TH1 documentation)}
Definition TH2.h:257
TH2F()
Constructor.
Definition TH2.cxx:3532
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH2.h:275
void AddBinContent(Int_t bin, Double_t w) override
Increment bin content by a weight w.
Definition TH2.h:276
friend TH2F operator*(Float_t c1, TH2F &h1)
Operator *.
Definition TH2.cxx:3724
TH2F & operator=(const TH2F &h1)
Operator =.
Definition TH2.cxx:3713
virtual ~TH2F()
Destructor.
Definition TH2.cxx:3542
void Copy(TObject &hnew) const override
Copy.
Definition TH2.cxx:3647
void UpdateBinContent(Int_t bin, Double_t content) override
Raw update of bin content on internal data structure see convention for numbering bins in TH1::GetBin...
Definition TH2.h:292
Double_t RetrieveBinContent(Int_t bin) const override
Raw retrieval of bin content on internal data structure see convention for numbering bins in TH1::Get...
Definition TH2.h:291
friend TH2F operator-(TH2F &h1, TH2F &h2)
Operator -.
Definition TH2.cxx:3760
friend TH2F operator/(TH2F &h1, TH2F &h2)
Operator /.
Definition TH2.cxx:3784
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH2.cxx:3667
friend TH2F operator+(TH2F &h1, TH2F &h2)
Operator +.
Definition TH2.cxx:3748
2-D histogram with an int per channel (see TH1 documentation)}
Definition TH2.h:216
friend TH2I operator/(TH2I &h1, TH2I &h2)
Operator /.
Definition TH2.cxx:3512
friend TH2I operator-(TH2I &h1, TH2I &h2)
Operator -.
Definition TH2.cxx:3488
TH2I()
Constructor.
Definition TH2.cxx:3306
Double_t RetrieveBinContent(Int_t bin) const override
Raw retrieval of bin content on internal data structure see convention for numbering bins in TH1::Get...
Definition TH2.h:248
friend TH2I operator*(TH2I &h1, Float_t c1)
Definition TH2.h:241
friend TH2I operator*(Float_t c1, TH2I &h1)
Operator *.
Definition TH2.cxx:3464
virtual ~TH2I()
Destructor.
Definition TH2.cxx:3316
void Copy(TObject &hnew) const override
Copy.
Definition TH2.cxx:3422
void UpdateBinContent(Int_t bin, Double_t content) override
Raw update of bin content on internal data structure see convention for numbering bins in TH1::GetBin...
Definition TH2.h:249
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH2.cxx:3401
friend TH2I operator+(TH2I &h1, TH2I &h2)
Operator +.
Definition TH2.cxx:3476
TH2I & operator=(const TH2I &h1)
Operator =.
Definition TH2.cxx:3453
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH2.cxx:3442
2-D histogram with a short per channel (see TH1 documentation)
Definition TH2.h:175
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH2.cxx:3140
TH2S & operator=(const TH2S &h1)
Operator =.
Definition TH2.cxx:3227
friend TH2S operator+(TH2S &h1, TH2S &h2)
Operator +.
Definition TH2.cxx:3250
void Copy(TObject &hnew) const override
Copy.
Definition TH2.cxx:3161
TH2S()
Constructor.
Definition TH2.cxx:3045
friend TH2S operator-(TH2S &h1, TH2S &h2)
Operator -.
Definition TH2.cxx:3262
friend TH2S operator*(Float_t c1, TH2S &h1)
Operator *.
Definition TH2.cxx:3238
virtual ~TH2S()
Destructor.
Definition TH2.cxx:3055
friend TH2S operator/(TH2S &h1, TH2S &h2)
Operator /.
Definition TH2.cxx:3286
Double_t RetrieveBinContent(Int_t bin) const override
Raw retrieval of bin content on internal data structure see convention for numbering bins in TH1::Get...
Definition TH2.h:207
void UpdateBinContent(Int_t bin, Double_t content) override
Raw update of bin content on internal data structure see convention for numbering bins in TH1::GetBin...
Definition TH2.h:208
friend TH2S operator*(TH2S &h1, Float_t c1)
Definition TH2.h:200
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH2.cxx:3181
Service class for 2-D histogram classes.
Definition TH2.h:30
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:2414
void GetStats(Double_t *stats) const override
Fill the array stats from the contents of this histogram The array stats must be correctly dimensione...
Definition TH2.cxx:1207
Int_t ShowPeaks(Double_t sigma=2, Option_t *option="", Double_t threshold=0.05) override
Interface to TSpectrum2::Search the function finds peaks in this histogram where the width is > sigma...
Definition TH2.cxx:2615
virtual Double_t GetCorrelationFactor(Int_t axis1=1, Int_t axis2=2) const
Return correlation factor between axis1 and axis2.
Definition TH2.cxx:1099
virtual TProfile * DoProfile(bool onX, const char *name, Int_t firstbin, Int_t lastbin, Option_t *option) const
Definition TH2.cxx:1833
Double_t KolmogorovTest(const TH1 *h2, Option_t *option="") const override
Statistical test of compatibility in shape between THIS histogram and h2, using Kolmogorov test.
Definition TH2.cxx:1423
virtual void FitSlicesY(TF1 *f1=nullptr, Int_t firstxbin=0, Int_t lastxbin=-1, Int_t cut=0, Option_t *option="QNR", TObjArray *arr=nullptr)
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:1035
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:1071
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:2051
TH2(const TH2 &)=delete
TH2 * Rebin(Int_t ngroup=2, const char *newname="", const Double_t *xbins=nullptr) override
Override TH1::Rebin as TH2::RebinX Rebinning in variable binning as for TH1 is not allowed If a non-n...
Definition TH2.cxx:1616
void FillN(Int_t, const Double_t *, const Double_t *, Int_t) override
Fill this histogram with an array x and weights w.
Definition TH2.h:80
Int_t BufferFill(Double_t, Double_t) override
accumulate arguments in buffer.
Definition TH2.h:56
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:2456
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:2101
void Copy(TObject &hnew) const override
Copy.
Definition TH2.cxx:334
virtual TH1D * DoQuantiles(bool onX, const char *name, Double_t prob) const
Implementation of quantiles for x or y.
Definition TH2.cxx:2465
Double_t fTsumwxy
Total Sum of weight*X*Y.
Definition TH2.h:36
void SetBinContent(Int_t bin, Double_t content) override
Set bin content.
Definition TH2.cxx:2554
Int_t Fill(const char *, Double_t) override
Increment bin with namex with a weight w.
Definition TH2.h:58
Int_t BufferEmpty(Int_t action=0) override
Fill histogram with all entries in the buffer.
Definition TH2.cxx:232
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 DoFitSlices(bool onX, TF1 *f1, Int_t firstbin, Int_t lastbin, Int_t cut, Option_t *option, TObjArray *arr)
Definition TH2.cxx:768
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:2443
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:2586
void SetBinContent(Int_t binx, Int_t biny, Int_t, Double_t content) override
Definition TH2.h:121
void FillRandom(const char *fname, Int_t ntimes=5000, TRandom *rng=nullptr) override
Fill histogram following distribution in function fname.
Definition TH2.cxx:668
virtual Double_t GetBinErrorUp(Int_t binx, Int_t biny)
Definition TH2.h:94
void Reset(Option_t *option="") override
Reset this histogram: contents, errors, etc.
Definition TH2.cxx:2538
Double_t fScalefactor
Scale factor.
Definition TH2.h:33
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:2111
TH2 * RebinX(Int_t ngroup=2, const char *newname="") override
Rebin only the X axis see Rebin2D.
Definition TH2.cxx:1595
Double_t fTsumwy2
Total Sum of weight*Y*Y.
Definition TH2.h:35
virtual void GetRandom2(Double_t &x, Double_t &y, TRandom *rng=nullptr)
Return 2 random numbers along axis x and y distributed according to the cell-contents of this 2-D his...
Definition TH2.cxx:1153
void SetBinContent(Int_t binx, Int_t biny, Double_t content) override
Definition TH2.h:120
virtual Double_t GetCovariance(Int_t axis1=1, Int_t axis2=2) const
Return covariance between axis1 and axis2.
Definition TH2.cxx:1117
Int_t GetBin(Int_t binx, Int_t biny, Int_t binz=0) const override
Return Global bin number corresponding to binx,y,z.
Definition TH2.cxx:1040
Double_t GetBinContent(Int_t binx, Int_t biny, Int_t) const override
Definition TH2.h:90
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:2374
void Smooth(Int_t ntimes=1, Option_t *option="") override
Smooth bin contents of this 2-d histogram using kernel algorithms similar to the ones used in the ras...
Definition TH2.cxx:2647
Double_t GetBinContent(Int_t binx, Int_t biny) const override
Definition TH2.h:89
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:1298
Double_t fTsumwy
Total Sum of weight*Y.
Definition TH2.h:34
TH2()
2-D histogram default constructor.
Definition TH2.cxx:62
TH2 & operator=(const TH2 &)=delete
TH1 * ShowBackground(Int_t niter=20, Option_t *option="same") override
This function calculates the background spectrum in this histogram.
Definition TH2.cxx:2599
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:2571
Int_t Fill(Double_t) override
Invalid Fill method.
Definition TH2.cxx:347
virtual Double_t GetBinErrorLow(Int_t binx, Int_t biny)
Definition TH2.h:93
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:1651
virtual void FitSlicesX(TF1 *f1=nullptr, Int_t firstybin=0, Int_t lastybin=-1, Int_t cut=0, Option_t *option="QNR", TObjArray *arr=nullptr)
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:970
virtual Int_t BufferFill(Double_t x, Double_t y, Double_t w)
accumulate arguments in buffer.
Definition TH2.cxx:306
Double_t Integral(Option_t *option="") const override
Return integral of bin contents.
Definition TH2.cxx:1270
virtual ~TH2()
Destructor.
Definition TH2.cxx:219
void PutStats(Double_t *stats) override
Replace current statistics with the values in array stats.
Definition TH2.cxx:2423
virtual TH2 * RebinY(Int_t ngroup=2, const char *newname="")
Rebin only the Y axis see Rebin2D.
Definition TH2.cxx:1605
TMatrixTBase.
An array of TObjects.
Definition TObjArray.h:31
Mother of all ROOT objects.
Definition TObject.h:41
Profile Histogram.
Definition TProfile.h:32
This is the base class for the ROOT Random number generators.
Definition TRandom.h:27
#define Interpolate(a, x, b, y)
Definition geom.c:179
const Double_t sigma
Double_t y[n]
Definition legend1.C:17
return c1
Definition legend1.C:41
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
TH1F * h1
Definition legend1.C:5
TF1 * f1
Definition legend1.C:11
TMarker m
Definition textangle.C:8