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 ~TH2() override;
73 void AddBinContent(Int_t bin) override;
74 void AddBinContent(Int_t bin, Double_t w) override;
75 virtual void AddBinContent(Int_t binx, Int_t biny);
76 virtual void AddBinContent(Int_t binx, Int_t biny, Double_t w);
77 Int_t BufferEmpty(Int_t action=0) override;
78 void Copy(TObject &hnew) const override;
79 Int_t Fill(Double_t x, Double_t y) override;
81 virtual Int_t Fill(Double_t x, const char *namey, Double_t w);
82 virtual Int_t Fill(const char *namex, Double_t y, Double_t w);
83 virtual Int_t Fill(const char *namex, const char *namey, Double_t w);
84 void FillN(Int_t, const Double_t *, const Double_t *, Int_t) override {} //MayNotUse
85 void FillN(Int_t ntimes, const Double_t *x, const Double_t *y, const Double_t *w, Int_t stride=1) override;
86 void FillRandom(const char *fname, Int_t ntimes=5000, TRandom *rng = nullptr) override;
87 void FillRandom(TH1 *h, Int_t ntimes=5000, TRandom *rng = nullptr) override;
88 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);
89 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);
90 Int_t GetBin(Int_t binx, Int_t biny, Int_t binz = 0) const override;
91 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;
93 Double_t GetBinContent(Int_t binx, Int_t biny) const override { return TH1::GetBinContent( GetBin(binx, biny) ); }
94 Double_t GetBinContent(Int_t binx, Int_t biny, Int_t) const override { return TH1::GetBinContent( GetBin(binx, biny) ); }
97 virtual Double_t GetBinErrorLow(Int_t binx, Int_t biny) { return TH1::GetBinErrorLow( GetBin(binx, biny) ); }
98 virtual Double_t GetBinErrorUp(Int_t binx, Int_t biny) { return TH1::GetBinErrorUp( GetBin(binx, biny) ); }
99 virtual Double_t GetCorrelationFactor(Int_t axis1=1,Int_t axis2=2) const;
100 virtual Double_t GetCovariance(Int_t axis1=1,Int_t axis2=2) const;
101 virtual void GetRandom2(Double_t &x, Double_t &y, TRandom * rng = nullptr);
102 void GetStats(Double_t *stats) const override;
103 Double_t Integral(Option_t *option="") const override;
104 //virtual Double_t Integral(Int_t, Int_t, Option_t * ="") const {return 0;}
105 virtual Double_t Integral(Int_t binx1, Int_t binx2, Int_t biny1, Int_t biny2, Option_t *option="") const;
106 virtual Double_t Integral(Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, Option_t * ="") const {return 0;}
107 virtual Double_t IntegralAndError(Int_t binx1, Int_t binx2, Int_t biny1, Int_t biny2, Double_t & err, Option_t *option="") const;
108 Double_t Interpolate(Double_t x, Double_t y) const override;
109 Double_t Interpolate(Double_t x, Double_t y, Double_t z) const override;
110 Double_t KolmogorovTest(const TH1 *h2, Option_t *option="") const override;
111 TH2 *RebinX(Int_t ngroup=2, const char *newname="") override; // *MENU*
112 virtual TH2 *RebinY(Int_t ngroup=2, const char *newname=""); // *MENU*
113 TH2 *Rebin(Int_t ngroup=2, const char*newname="", const Double_t *xbins = nullptr) override; // re-implementation of the TH1 function using RebinX
114 virtual TH2 *Rebin2D(Int_t nxgroup=2, Int_t nygroup=2, const char *newname=""); // *MENU*
115 TProfile *ProfileX(const char *name="_pfx", Int_t firstybin=1, Int_t lastybin=-1, Option_t *option="") const; // *MENU*
116 TProfile *ProfileY(const char *name="_pfy", Int_t firstxbin=1, Int_t lastxbin=-1, Option_t *option="") const; // *MENU*
117 TH1D *ProjectionX(const char *name="_px", Int_t firstybin=0, Int_t lastybin=-1, Option_t *option="") const; // *MENU*
118 TH1D *ProjectionY(const char *name="_py", Int_t firstxbin=0, Int_t lastxbin=-1, Option_t *option="") const; // *MENU*
119 void PutStats(Double_t *stats) override;
120 TH1D *QuantilesX(Double_t prob = 0.5, const char * name = "_qx" ) const;
121 TH1D *QuantilesY(Double_t prob = 0.5, const char * name = "_qy" ) const;
122 void Reset(Option_t *option="") override;
123 void SetBinContent(Int_t bin, Double_t content) override;
124 void SetBinContent(Int_t binx, Int_t biny, Double_t content) override { SetBinContent(GetBin(binx, biny), content); }
125 void SetBinContent(Int_t binx, Int_t biny, Int_t, Double_t content) override { SetBinContent(GetBin(binx, biny), content); }
126 virtual void SetShowProjectionX(Int_t nbins=1); // *MENU*
127 virtual void SetShowProjectionY(Int_t nbins=1); // *MENU*
128 virtual void SetShowProjectionXY(Int_t nbinsY=1, Int_t nbinsX=1); // *MENU*
129 TH1 *ShowBackground(Int_t niter=20, Option_t *option="same") override;
130 Int_t ShowPeaks(Double_t sigma=2, Option_t *option="", Double_t threshold=0.05) override; // *MENU*
131 void Smooth(Int_t ntimes=1, Option_t *option="") override; // *MENU*
132
133 ClassDefOverride(TH2,5) //2-Dim histogram base class
134};
135
136
137//______________________________________________________________________________
138
139class TH2C : public TH2, public TArrayC {
140
141public:
142 TH2C();
143 TH2C(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
144 ,Int_t nbinsy,Double_t ylow,Double_t yup);
145 TH2C(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
146 ,Int_t nbinsy,Double_t ylow,Double_t yup);
147 TH2C(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
148 ,Int_t nbinsy,const Double_t *ybins);
149 TH2C(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
150 ,Int_t nbinsy,const Double_t *ybins);
151 TH2C(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
152 ,Int_t nbinsy,const Float_t *ybins);
153 TH2C(const TH2C &h2c);
154 ~TH2C() override;
155
156 void AddBinContent(Int_t bin) override;
157 void AddBinContent(Int_t bin, Double_t w) override;
158 void AddBinContent(Int_t binx, Int_t biny) override { AddBinContent(GetBin(binx, biny)); }
159 void AddBinContent(Int_t binx, Int_t biny, Double_t w) override { AddBinContent(GetBin(binx, biny), w); }
160 void Copy(TObject &hnew) const override;
161 void Reset(Option_t *option="") override;
162 void SetBinsLength(Int_t n=-1) override;
163
164 TH2C& operator=(const TH2C &h1);
165 friend TH2C operator*(Float_t c1, TH2C &h1);
166 friend TH2C operator*(TH2C &h1, Float_t c1) {return operator*(c1,h1);}
167 friend TH2C operator+(TH2C &h1, TH2C &h2);
168 friend TH2C operator-(TH2C &h1, TH2C &h2);
169 friend TH2C operator*(TH2C &h1, TH2C &h2);
170 friend TH2C operator/(TH2C &h1, TH2C &h2);
171
172protected:
173 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
174 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Char_t (content); }
175
176 ClassDefOverride(TH2C,4) //2-Dim histograms (one char per channel)
177};
178
179
180//______________________________________________________________________________
181
182class TH2S : public TH2, public TArrayS {
183
184public:
185 TH2S();
186 TH2S(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
187 ,Int_t nbinsy,Double_t ylow,Double_t yup);
188 TH2S(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
189 ,Int_t nbinsy,Double_t ylow,Double_t yup);
190 TH2S(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
191 ,Int_t nbinsy,const Double_t *ybins);
192 TH2S(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
193 ,Int_t nbinsy,const Double_t *ybins);
194 TH2S(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
195 ,Int_t nbinsy,const Float_t *ybins);
196 TH2S(const TH2S &h2s);
197 ~TH2S() override;
198
199 void AddBinContent(Int_t bin) override;
200 void AddBinContent(Int_t bin, Double_t w) override;
201 void AddBinContent(Int_t binx, Int_t biny) override { AddBinContent(GetBin(binx, biny)); }
202 void AddBinContent(Int_t binx, Int_t biny, Double_t w) override { AddBinContent(GetBin(binx, biny), w); }
203 void Copy(TObject &hnew) const override;
204 void Reset(Option_t *option="") override;
205 void SetBinsLength(Int_t n=-1) override;
206
207 TH2S& operator=(const TH2S &h1);
208 friend TH2S operator*(Float_t c1, TH2S &h1);
209 friend TH2S operator*(TH2S &h1, Float_t c1) {return operator*(c1,h1);}
210 friend TH2S operator+(TH2S &h1, TH2S &h2);
211 friend TH2S operator-(TH2S &h1, TH2S &h2);
212 friend TH2S operator*(TH2S &h1, TH2S &h2);
213 friend TH2S operator/(TH2S &h1, TH2S &h2);
214
215protected:
216 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
217 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Short_t (content); }
218
219 ClassDefOverride(TH2S,4) //2-Dim histograms (one short per channel)
220};
221
222
223//______________________________________________________________________________
224
225class TH2I : public TH2, public TArrayI {
226
227public:
228 TH2I();
229 TH2I(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
230 ,Int_t nbinsy,Double_t ylow,Double_t yup);
231 TH2I(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
232 ,Int_t nbinsy,Double_t ylow,Double_t yup);
233 TH2I(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
234 ,Int_t nbinsy,const Double_t *ybins);
235 TH2I(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
236 ,Int_t nbinsy,const Double_t *ybins);
237 TH2I(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
238 ,Int_t nbinsy,const Float_t *ybins);
239 TH2I(const TH2I &h2i);
240 ~TH2I() override;
241
242 void AddBinContent(Int_t bin) override;
243 void AddBinContent(Int_t bin, Double_t w) override;
244 void AddBinContent(Int_t binx, Int_t biny) override { AddBinContent(GetBin(binx, biny)); }
245 void AddBinContent(Int_t binx, Int_t biny, Double_t w) override { AddBinContent(GetBin(binx, biny), w); }
246 void Copy(TObject &hnew) const override;
247 void Reset(Option_t *option="") override;
248 void SetBinsLength(Int_t n=-1) override;
249
250 TH2I& operator=(const TH2I &h1);
251 friend TH2I operator*(Float_t c1, TH2I &h1);
252 friend TH2I operator*(TH2I &h1, Float_t c1) {return operator*(c1,h1);}
253 friend TH2I operator+(TH2I &h1, TH2I &h2);
254 friend TH2I operator-(TH2I &h1, TH2I &h2);
255 friend TH2I operator*(TH2I &h1, TH2I &h2);
256 friend TH2I operator/(TH2I &h1, TH2I &h2);
257
258protected:
259 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
260 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Int_t (content); }
261
262 ClassDefOverride(TH2I,4) //2-Dim histograms (one 32 bit integer per channel)
263};
264
265//______________________________________________________________________________
266
267class TH2L : public TH2, public TArrayL64 {
268
269public:
270 TH2L();
271 TH2L(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
272 ,Int_t nbinsy,Double_t ylow,Double_t yup);
273 TH2L(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
274 ,Int_t nbinsy,Double_t ylow,Double_t yup);
275 TH2L(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
276 ,Int_t nbinsy,const Double_t *ybins);
277 TH2L(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
278 ,Int_t nbinsy,const Double_t *ybins);
279 TH2L(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
280 ,Int_t nbinsy,const Float_t *ybins);
281 TH2L(const TH2L &h2l);
282 ~TH2L() override;
283 void AddBinContent(Int_t bin) override;
284 void AddBinContent(Int_t bin, Double_t w) override;
285 void AddBinContent(Int_t binx, Int_t biny) override { AddBinContent(GetBin(binx, biny)); }
286 void AddBinContent(Int_t binx, Int_t biny, Double_t w) override { AddBinContent(GetBin(binx, biny), w); }
287 void Copy(TObject &hnew) const override;
288 void Reset(Option_t *option="") override;
289 void SetBinsLength(Int_t n=-1) override;
290 TH2L& operator=(const TH2L &h1);
291 friend TH2L operator*(Float_t c1, TH2L &h1);
292 friend TH2L operator*(TH2L &h1, Float_t c1) {return operator*(c1,h1);}
293 friend TH2L operator+(TH2L &h1, TH2L &h2);
294 friend TH2L operator-(TH2L &h1, TH2L &h2);
295 friend TH2L operator*(TH2L &h1, TH2L &h2);
296 friend TH2L operator/(TH2L &h1, TH2L &h2);
297
298protected:
299 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
300 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Int_t (content); }
301
302 ClassDefOverride(TH2L,0) //2-Dim histograms (one 64 bit integer per channel)
303};
304
305//______________________________________________________________________________
306
307class TH2F : public TH2, public TArrayF {
308
309public:
310 TH2F();
311 TH2F(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
312 ,Int_t nbinsy,Double_t ylow,Double_t yup);
313 TH2F(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
314 ,Int_t nbinsy,Double_t ylow,Double_t yup);
315 TH2F(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
316 ,Int_t nbinsy,const Double_t *ybins);
317 TH2F(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
318 ,Int_t nbinsy,const Double_t *ybins);
319 TH2F(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
320 ,Int_t nbinsy,const Float_t *ybins);
321 TH2F(const TMatrixFBase &m);
322 TH2F(const TH2F &h2f);
323 ~TH2F() override;
324
325 /// Increment bin content by 1.
326 /// Passing an out-of-range bin leads to undefined behavior
327 void AddBinContent(Int_t bin) override {++fArray[bin];}
328 /// Increment bin content by a weight w.
329 /// \warning The value of w is cast to `Float_t` before being added.
330 /// Passing an out-of-range bin leads to undefined behavior
331 void AddBinContent(Int_t bin, Double_t w) override
332 {fArray[bin] += Float_t (w);}
333 void AddBinContent(Int_t binx, Int_t biny) override { AddBinContent(GetBin(binx, biny)); }
334 void AddBinContent(Int_t binx, Int_t biny, Double_t w) override { AddBinContent(GetBin(binx, biny), w); }
335 void Copy(TObject &hnew) const override;
336 void Reset(Option_t *option="") override;
337 void SetBinsLength(Int_t n=-1) override;
338
339 TH2F& operator=(const TH2F &h1);
340 friend TH2F operator*(Float_t c1, TH2F &h1);
341 friend TH2F operator*(TH2F &h1, Float_t c1);
342 friend TH2F operator+(TH2F &h1, TH2F &h2);
343 friend TH2F operator-(TH2F &h1, TH2F &h2);
344 friend TH2F operator*(TH2F &h1, TH2F &h2);
345 friend TH2F operator/(TH2F &h1, TH2F &h2);
346
347protected:
348 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
349 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Float_t (content); }
350
351 ClassDefOverride(TH2F,4) //2-Dim histograms (one float per channel)
352};
353
354
355//______________________________________________________________________________
356
357class TH2D : public TH2, public TArrayD {
358
359public:
360 TH2D();
361 TH2D(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
362 ,Int_t nbinsy,Double_t ylow,Double_t yup);
363 TH2D(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
364 ,Int_t nbinsy,Double_t ylow,Double_t yup);
365 TH2D(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
366 ,Int_t nbinsy,const Double_t *ybins);
367 TH2D(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
368 ,Int_t nbinsy,const Double_t *ybins);
369 TH2D(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
370 ,Int_t nbinsy,const Float_t *ybins);
371 TH2D(const TMatrixDBase &m);
372 TH2D(const TH2D &h2d);
373 ~TH2D() override;
374
375 /// Increment bin content by 1.
376 /// Passing an out-of-range bin leads to undefined behavior
377 void AddBinContent(Int_t bin) override {++fArray[bin];}
378 /// Increment bin content by a weight w
379 /// Passing an out-of-range bin leads to undefined behavior
380 void AddBinContent(Int_t bin, Double_t w) override
381 {fArray[bin] += Double_t (w);}
382 void AddBinContent(Int_t binx, Int_t biny) override { AddBinContent(GetBin(binx, biny)); }
383 void AddBinContent(Int_t binx, Int_t biny, Double_t w) override { AddBinContent(GetBin(binx, biny), w); }
384 void Copy(TObject &hnew) const override;
385 void Reset(Option_t *option="") override;
386 void SetBinsLength(Int_t n=-1) override;
387
388 TH2D& operator=(const TH2D &h1);
389 friend TH2D operator*(Float_t c1, TH2D &h1);
390 friend TH2D operator*(TH2D &h1, Float_t c1) {return operator*(c1,h1);}
391 friend TH2D operator+(TH2D &h1, TH2D &h2);
392 friend TH2D operator-(TH2D &h1, TH2D &h2);
393 friend TH2D operator*(TH2D &h1, TH2D &h2);
394 friend TH2D operator/(TH2D &h1, TH2D &h2);
395
396protected:
397 Double_t RetrieveBinContent(Int_t bin) const override { return fArray[bin]; }
398 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = content; }
399
400 ClassDefOverride(TH2D,4) //2-Dim histograms (one double per channel)
401};
402
403#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 long64s (64 bits per element).
Definition TArrayL64.h:27
Long64_t * fArray
Definition TArrayL64.h:30
void Reset()
Definition TArrayL64.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:233
1-D histogram with a double per channel (see TH1 documentation)
Definition TH1.h:669
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:59
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:7936
virtual Double_t GetBinErrorLow(Int_t bin) const
Return lower error associated to bin number bin.
Definition TH1.cxx:9047
virtual Double_t Integral(Option_t *option="") const
Return integral of bin contents.
Definition TH1.cxx:7909
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Definition TH1.cxx:5029
virtual Double_t GetBinErrorUp(Int_t bin) const
Return upper error associated to bin number bin.
Definition TH1.cxx:9078
2-D histogram with a byte per channel (see TH1 documentation)
Definition TH2.h:139
void Reset(Option_t *option="") override
Reset this histogram: contents, errors, etc.
Definition TH2.cxx:2992
friend TH2C operator-(TH2C &h1, TH2C &h2)
Operator -.
Definition TH2.cxx:3084
friend TH2C operator+(TH2C &h1, TH2C &h2)
Operator +.
Definition TH2.cxx:3072
void AddBinContent(Int_t binx, Int_t biny, Double_t w) override
Increment 2D bin content by a weight w.
Definition TH2.h:159
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:173
friend TH2C operator/(TH2C &h1, TH2C &h2)
Operator /.
Definition TH2.cxx:3108
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:174
void AddBinContent(Int_t binx, Int_t biny) override
Increment 2D bin content by 1.
Definition TH2.h:158
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH2.cxx:2960
TH2C()
Constructor.
Definition TH2.cxx:2864
TH2C & operator=(const TH2C &h1)
Operator =.
Definition TH2.cxx:3049
~TH2C() override
Destructor.
Definition TH2.cxx:2874
void Copy(TObject &hnew) const override
Copy.
Definition TH2.cxx:2983
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH2.cxx:3003
friend TH2C operator*(Float_t c1, TH2C &h1)
Operator *.
Definition TH2.cxx:3060
friend TH2C operator*(TH2C &h1, Float_t c1)
Definition TH2.h:166
2-D histogram with a double per channel (see TH1 documentation)
Definition TH2.h:357
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:398
friend TH2D operator-(TH2D &h1, TH2D &h2)
Operator -.
Definition TH2.cxx:4342
friend TH2D operator*(Float_t c1, TH2D &h1)
Operator *.
Definition TH2.cxx:4318
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH2.cxx:4259
void AddBinContent(Int_t binx, Int_t biny, Double_t w) override
Increment 2D bin content by a weight w.
Definition TH2.h:383
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:397
~TH2D() override
Destructor.
Definition TH2.cxx:4132
friend TH2D operator/(TH2D &h1, TH2D &h2)
Operator /.
Definition TH2.cxx:4366
void AddBinContent(Int_t bin, Double_t w) override
Increment bin content by a weight w Passing an out-of-range bin leads to undefined behavior.
Definition TH2.h:380
void Copy(TObject &hnew) const override
Copy.
Definition TH2.cxx:4239
friend TH2D operator+(TH2D &h1, TH2D &h2)
Operator +.
Definition TH2.cxx:4330
void AddBinContent(Int_t binx, Int_t biny) override
Increment 2D bin content by 1.
Definition TH2.h:382
friend TH2D operator*(TH2D &h1, Float_t c1)
Definition TH2.h:390
TH2D()
Constructor.
Definition TH2.cxx:4122
TH2D & operator=(const TH2D &h1)
Operator =.
Definition TH2.cxx:4305
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH2.h:377
2-D histogram with a float per channel (see TH1 documentation)
Definition TH2.h:307
TH2F()
Constructor.
Definition TH2.cxx:3850
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH2.h:327
void AddBinContent(Int_t bin, Double_t w) override
Increment bin content by a weight w.
Definition TH2.h:331
friend TH2F operator*(Float_t c1, TH2F &h1)
Operator *.
Definition TH2.cxx:4042
TH2F & operator=(const TH2F &h1)
Operator =.
Definition TH2.cxx:4031
~TH2F() override
Destructor.
Definition TH2.cxx:3860
void AddBinContent(Int_t binx, Int_t biny) override
Increment 2D bin content by 1.
Definition TH2.h:333
void Copy(TObject &hnew) const override
Copy.
Definition TH2.cxx:3965
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:349
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:348
void AddBinContent(Int_t binx, Int_t biny, Double_t w) override
Increment 2D bin content by a weight w.
Definition TH2.h:334
friend TH2F operator-(TH2F &h1, TH2F &h2)
Operator -.
Definition TH2.cxx:4078
friend TH2F operator/(TH2F &h1, TH2F &h2)
Operator /.
Definition TH2.cxx:4102
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH2.cxx:3985
friend TH2F operator+(TH2F &h1, TH2F &h2)
Operator +.
Definition TH2.cxx:4066
2-D histogram with an int per channel (see TH1 documentation)
Definition TH2.h:225
friend TH2I operator/(TH2I &h1, TH2I &h2)
Operator /.
Definition TH2.cxx:3601
friend TH2I operator-(TH2I &h1, TH2I &h2)
Operator -.
Definition TH2.cxx:3577
TH2I()
Constructor.
Definition TH2.cxx:3392
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:259
friend TH2I operator*(TH2I &h1, Float_t c1)
Definition TH2.h:252
friend TH2I operator*(Float_t c1, TH2I &h1)
Operator *.
Definition TH2.cxx:3553
void Copy(TObject &hnew) const override
Copy.
Definition TH2.cxx:3511
void AddBinContent(Int_t binx, Int_t biny) override
Increment 2D bin content by 1.
Definition TH2.h:244
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:260
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH2.cxx:3488
friend TH2I operator+(TH2I &h1, TH2I &h2)
Operator +.
Definition TH2.cxx:3565
void AddBinContent(Int_t binx, Int_t biny, Double_t w) override
Increment 2D bin content by a weight w.
Definition TH2.h:245
~TH2I() override
Destructor.
Definition TH2.cxx:3402
TH2I & operator=(const TH2I &h1)
Operator =.
Definition TH2.cxx:3542
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH2.cxx:3531
2-D histogram with a long64 per channel (see TH1 documentation)
Definition TH2.h:267
friend TH2L operator/(TH2L &h1, TH2L &h2)
Operator /.
Definition TH2.cxx:3830
void AddBinContent(Int_t binx, Int_t biny) override
Increment 2D bin content by 1.
Definition TH2.h:285
TH2L & operator=(const TH2L &h1)
Operator =.
Definition TH2.cxx:3771
friend TH2L operator*(TH2L &h1, Float_t c1)
Definition TH2.h:292
void AddBinContent(Int_t binx, Int_t biny, Double_t w) override
Increment 2D bin content by a weight w.
Definition TH2.h:286
friend TH2L operator*(Float_t c1, TH2L &h1)
Operator *.
Definition TH2.cxx:3782
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH2.cxx:3760
friend TH2L operator+(TH2L &h1, TH2L &h2)
Operator +.
Definition TH2.cxx:3794
~TH2L() override
Destructor.
Definition TH2.cxx:3631
void Copy(TObject &hnew) const override
Copy.
Definition TH2.cxx:3740
friend TH2L operator-(TH2L &h1, TH2L &h2)
Operator -.
Definition TH2.cxx:3806
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:299
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:300
TH2L()
Constructor.
Definition TH2.cxx:3621
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH2.cxx:3717
2-D histogram with a short per channel (see TH1 documentation)
Definition TH2.h:182
void AddBinContent(Int_t binx, Int_t biny, Double_t w) override
Increment 2D bin content by a weight w.
Definition TH2.h:202
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH2.cxx:3224
~TH2S() override
Destructor.
Definition TH2.cxx:3138
TH2S & operator=(const TH2S &h1)
Operator =.
Definition TH2.cxx:3313
friend TH2S operator+(TH2S &h1, TH2S &h2)
Operator +.
Definition TH2.cxx:3336
void Copy(TObject &hnew) const override
Copy.
Definition TH2.cxx:3247
TH2S()
Constructor.
Definition TH2.cxx:3128
friend TH2S operator-(TH2S &h1, TH2S &h2)
Operator -.
Definition TH2.cxx:3348
friend TH2S operator*(Float_t c1, TH2S &h1)
Operator *.
Definition TH2.cxx:3324
friend TH2S operator/(TH2S &h1, TH2S &h2)
Operator /.
Definition TH2.cxx:3372
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:216
void AddBinContent(Int_t binx, Int_t biny) override
Increment 2D bin content by 1.
Definition TH2.h:201
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:217
friend TH2S operator*(TH2S &h1, Float_t c1)
Definition TH2.h:209
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH2.cxx:3267
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:2476
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:1254
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:2695
virtual Double_t GetCorrelationFactor(Int_t axis1=1, Int_t axis2=2) const
Return correlation factor between axis1 and axis2.
Definition TH2.cxx:1145
virtual TProfile * DoProfile(bool onX, const char *name, Int_t firstbin, Int_t lastbin, Option_t *option) const
Definition TH2.cxx:1880
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:1470
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:1081
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:1117
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:2109
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH2.cxx:238
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:1663
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:84
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:2518
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:2159
void Copy(TObject &hnew) const override
Copy.
Definition TH2.cxx:380
virtual TH1D * DoQuantiles(bool onX, const char *name, Double_t prob) const
Implementation of quantiles for x or y.
Definition TH2.cxx:2527
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:2616
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:278
virtual Double_t Integral(Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, Option_t *="") const
Definition TH2.h:106
virtual void DoFitSlices(bool onX, TF1 *f1, Int_t firstbin, Int_t lastbin, Int_t cut, Option_t *option, TObjArray *arr)
Definition TH2.cxx:814
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:2505
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:2650
void SetBinContent(Int_t binx, Int_t biny, Int_t, Double_t content) override
Definition TH2.h:125
void FillRandom(const char *fname, Int_t ntimes=5000, TRandom *rng=nullptr) override
Fill histogram following distribution in function fname.
Definition TH2.cxx:714
virtual Double_t GetBinErrorUp(Int_t binx, Int_t biny)
Definition TH2.h:98
void Reset(Option_t *option="") override
Reset this histogram: contents, errors, etc.
Definition TH2.cxx:2600
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:2169
TH2 * RebinX(Int_t ngroup=2, const char *newname="") override
Rebin only the X axis see Rebin2D.
Definition TH2.cxx:1642
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:1200
void SetBinContent(Int_t binx, Int_t biny, Double_t content) override
Definition TH2.h:124
virtual Double_t GetCovariance(Int_t axis1=1, Int_t axis2=2) const
Return covariance between axis1 and axis2.
Definition TH2.cxx:1163
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:1086
Double_t GetBinContent(Int_t binx, Int_t biny, Int_t) const override
Definition TH2.h:94
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:2436
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:2727
~TH2() override
Destructor.
Definition TH2.cxx:230
Double_t GetBinContent(Int_t binx, Int_t biny) const override
Definition TH2.h:93
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:1345
Double_t fTsumwy
Total Sum of weight*Y.
Definition TH2.h:34
TH2()
2-D histogram default constructor.
Definition TH2.cxx:73
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:2679
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:2634
Int_t Fill(Double_t) override
Invalid Fill method.
Definition TH2.cxx:393
virtual Double_t GetBinErrorLow(Int_t binx, Int_t biny)
Definition TH2.h:97
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:1698
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:1016
virtual Int_t BufferFill(Double_t x, Double_t y, Double_t w)
accumulate arguments in buffer.
Definition TH2.cxx:352
virtual void SetShowProjectionXY(Int_t nbinsY=1, Int_t nbinsX=1)
When the mouse is moved in a pad containing a 2-d view of this histogram two canvases show the projec...
Definition TH2.cxx:2667
Double_t Integral(Option_t *option="") const override
Return integral of bin contents.
Definition TH2.cxx:1317
void PutStats(Double_t *stats) override
Replace current statistics with the values in array stats.
Definition TH2.cxx:2485
virtual TH2 * RebinY(Int_t ngroup=2, const char *newname="")
Rebin only the Y axis see Rebin2D.
Definition TH2.cxx:1652
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