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;
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;
74 /// Increment 2D bin content by 1.
75 /// Passing an out-of-range bin leads to undefined behavior
77 /// Increment 2D bin content by a weight w.
78 /// Passing an out-of-range bin leads to undefined behavior
80 Int_t BufferEmpty(Int_t action=0) override;
81 void Copy(TObject &hnew) const override;
82 Int_t Fill(Double_t x, Double_t y) override;
84 virtual Int_t Fill(Double_t x, const char *namey, Double_t w);
85 virtual Int_t Fill(const char *namex, Double_t y, Double_t w);
86 virtual Int_t Fill(const char *namex, const char *namey, Double_t w);
87 void FillN(Int_t, const Double_t *, const Double_t *, Int_t) override {} //MayNotUse
88 void FillN(Int_t ntimes, const Double_t *x, const Double_t *y, const Double_t *w, Int_t stride=1) override;
89 using TH1::FillRandom;
90 void FillRandom(TF1 *f1, Int_t ntimes=5000, TRandom *rng = nullptr) override;
91 void FillRandom(TH1 *h, Int_t ntimes=5000, TRandom *rng = nullptr) override;
92 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);
93 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);
94 Int_t GetBin(Int_t binx, Int_t biny, Int_t binz = 0) const override;
100 using TH1::GetBinErrorUp;
104 virtual Double_t GetCovariance(Int_t axis1=1,Int_t axis2=2) const;
105 virtual void GetRandom2(Double_t &x, Double_t &y, TRandom * rng = nullptr, Option_t *option = "");
106 void GetStats(Double_t *stats) const override;
107 Double_t Integral(Option_t *option="") const override;
108 //virtual Double_t Integral(Int_t, Int_t, Option_t * ="") const {return 0;}
110 virtual Double_t Integral(Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, Option_t * ="") const {return 0;}
112 Double_t Interpolate(Double_t x, Double_t y) const override;
113 Double_t Interpolate(Double_t x, Double_t y, Double_t z) const override;
114 Double_t KolmogorovTest(const TH1 *h2, Option_t *option="") const override;
115 TH2 *RebinX(Int_t ngroup=2, const char *newname="") override; // *MENU*
116 virtual TH2 *RebinY(Int_t ngroup=2, const char *newname=""); // *MENU*
117 TH2 *Rebin(Int_t ngroup=2, const char*newname="", const Double_t *xbins = nullptr) override; // re-implementation of the TH1 function using RebinX
118 virtual TH2 *Rebin2D(Int_t nxgroup=2, Int_t nygroup=2, const char *newname=""); // *MENU*
119 TProfile *ProfileX(const char *name="_pfx", Int_t firstybin=1, Int_t lastybin=-1, Option_t *option="") const; // *MENU*
120 TProfile *ProfileY(const char *name="_pfy", Int_t firstxbin=1, Int_t lastxbin=-1, Option_t *option="") const; // *MENU*
121 TH1D *ProjectionX(const char *name="_px", Int_t firstybin=0, Int_t lastybin=-1, Option_t *option="") const; // *MENU*
122 TH1D *ProjectionY(const char *name="_py", Int_t firstxbin=0, Int_t lastxbin=-1, Option_t *option="") const; // *MENU*
123 void PutStats(Double_t *stats) override;
124 TH1D *QuantilesX(Double_t prob = 0.5, const char * name = "_qx" ) const;
125 TH1D *QuantilesY(Double_t prob = 0.5, const char * name = "_qy" ) const;
126 void Reset(Option_t *option="") override;
127 void SetBinContent(Int_t bin, Double_t content) override;
130 virtual void SetShowProjectionX(Int_t nbins=1); // *MENU*
131 virtual void SetShowProjectionY(Int_t nbins=1); // *MENU*
132 virtual void SetShowProjectionXY(Int_t nbinsY=1, Int_t nbinsX=1); // *MENU*
133 TH1 *ShowBackground(Int_t niter=20, Option_t *option="same") override;
134 Int_t ShowPeaks(Double_t sigma=2, Option_t *option="", Double_t threshold=0.05) override; // *MENU*
135 void Smooth(Int_t ntimes=1, Option_t *option="") override; // *MENU*
136
137 ClassDefOverride(TH2,5) //2-Dim histogram base class
138};
139
140
141//______________________________________________________________________________
142
143class TH2C : public TH2, public TArrayC {
144
145public:
146 TH2C();
147 TH2C(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
148 ,Int_t nbinsy,Double_t ylow,Double_t yup);
149 TH2C(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
150 ,Int_t nbinsy,Double_t ylow,Double_t yup);
151 TH2C(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
152 ,Int_t nbinsy,const Double_t *ybins);
153 TH2C(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
154 ,Int_t nbinsy,const Double_t *ybins);
155 TH2C(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
156 ,Int_t nbinsy,const Float_t *ybins);
157 TH2C(const TH2C &h2c);
158 ~TH2C() override;
159
160 void AddBinContent(Int_t bin) override;
161 void AddBinContent(Int_t bin, Double_t w) override;
162 using TH2::AddBinContent;
163 void Copy(TObject &hnew) const override;
164 void Reset(Option_t *option="") override;
165 void SetBinsLength(Int_t n=-1) override;
166
167 TH2C& operator=(const TH2C &h1);
168 friend TH2C operator*(Float_t c1, TH2C const &h1);
169 friend TH2C operator*(TH2C const &h1, Float_t c1);
170 friend TH2C operator+(TH2C const &h1, TH2C const &h2);
171 friend TH2C operator-(TH2C const &h1, TH2C const &h2);
172 friend TH2C operator*(TH2C const &h1, TH2C const &h2);
173 friend TH2C operator/(TH2C const &h1, TH2C const &h2);
174
175protected:
176 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
177 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Char_t (content); }
178
179 ClassDefOverride(TH2C,4) //2-Dim histograms (one char per channel)
180};
181
182TH2C operator*(Float_t c1, TH2C const &h1);
184{
185 return operator*(c1, h1);
186}
187TH2C operator+(TH2C const &h1, TH2C const &h2);
188TH2C operator-(TH2C const &h1, TH2C const &h2);
189TH2C operator*(TH2C const &h1, TH2C const &h2);
190TH2C operator/(TH2C const &h1, TH2C const &h2);
191
192//______________________________________________________________________________
193
194class TH2S : public TH2, public TArrayS {
195
196public:
197 TH2S();
198 TH2S(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
199 ,Int_t nbinsy,Double_t ylow,Double_t yup);
200 TH2S(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
201 ,Int_t nbinsy,Double_t ylow,Double_t yup);
202 TH2S(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
203 ,Int_t nbinsy,const Double_t *ybins);
204 TH2S(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
205 ,Int_t nbinsy,const Double_t *ybins);
206 TH2S(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
207 ,Int_t nbinsy,const Float_t *ybins);
208 TH2S(const TH2S &h2s);
209 ~TH2S() override;
210
211 void AddBinContent(Int_t bin) override;
212 void AddBinContent(Int_t bin, Double_t w) override;
213 using TH2::AddBinContent;
214 void Copy(TObject &hnew) const override;
215 void Reset(Option_t *option="") override;
216 void SetBinsLength(Int_t n=-1) override;
217
218 TH2S& operator=(const TH2S &h1);
219 friend TH2S operator*(Float_t c1, TH2S const &h1);
220 friend TH2S operator*(TH2S const &h1, Float_t c1);
221 friend TH2S operator+(TH2S const &h1, TH2S const &h2);
222 friend TH2S operator-(TH2S const &h1, TH2S const &h2);
223 friend TH2S operator*(TH2S const &h1, TH2S const &h2);
224 friend TH2S operator/(TH2S const &h1, TH2S const &h2);
225
226protected:
227 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
228 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Short_t (content); }
229
230 ClassDefOverride(TH2S,4) //2-Dim histograms (one short per channel)
231};
232
233TH2S operator*(Float_t c1, TH2S const &h1);
235{
236 return operator*(c1, h1);
237}
238TH2S operator+(TH2S const &h1, TH2S const &h2);
239TH2S operator-(TH2S const &h1, TH2S const &h2);
240TH2S operator*(TH2S const &h1, TH2S const &h2);
241TH2S operator/(TH2S const &h1, TH2S const &h2);
242
243//______________________________________________________________________________
244
245class TH2I : public TH2, public TArrayI {
246
247public:
248 TH2I();
249 TH2I(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
250 ,Int_t nbinsy,Double_t ylow,Double_t yup);
251 TH2I(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
252 ,Int_t nbinsy,Double_t ylow,Double_t yup);
253 TH2I(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
254 ,Int_t nbinsy,const Double_t *ybins);
255 TH2I(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
256 ,Int_t nbinsy,const Double_t *ybins);
257 TH2I(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
258 ,Int_t nbinsy,const Float_t *ybins);
259 TH2I(const TH2I &h2i);
260 ~TH2I() override;
261
262 void AddBinContent(Int_t bin) override;
263 void AddBinContent(Int_t bin, Double_t w) override;
264 using TH2::AddBinContent;
265 void Copy(TObject &hnew) const override;
266 void Reset(Option_t *option="") override;
267 void SetBinsLength(Int_t n=-1) override;
268
269 TH2I& operator=(const TH2I &h1);
270 friend TH2I operator*(Float_t c1, TH2I const &h1);
271 friend TH2I operator*(TH2I const &h1, Float_t c1);
272 friend TH2I operator+(TH2I const &h1, TH2I const &h2);
273 friend TH2I operator-(TH2I const &h1, TH2I const &h2);
274 friend TH2I operator*(TH2I const &h1, TH2I const &h2);
275 friend TH2I operator/(TH2I const &h1, TH2I const &h2);
276
277protected:
278 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
279 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Int_t (content); }
280
281 ClassDefOverride(TH2I,4) //2-Dim histograms (one 32 bit integer per channel)
282};
283
284TH2I operator*(Float_t c1, TH2I const &h1);
286{
287 return operator*(c1, h1);
288}
289TH2I operator+(TH2I const &h1, TH2I const &h2);
290TH2I operator-(TH2I const &h1, TH2I const &h2);
291TH2I operator*(TH2I const &h1, TH2I const &h2);
292TH2I operator/(TH2I const &h1, TH2I const &h2);
293
294//______________________________________________________________________________
295
296class TH2L : public TH2, public TArrayL64 {
297
298public:
299 TH2L();
300 TH2L(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
301 ,Int_t nbinsy,Double_t ylow,Double_t yup);
302 TH2L(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
303 ,Int_t nbinsy,Double_t ylow,Double_t yup);
304 TH2L(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
305 ,Int_t nbinsy,const Double_t *ybins);
306 TH2L(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
307 ,Int_t nbinsy,const Double_t *ybins);
308 TH2L(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
309 ,Int_t nbinsy,const Float_t *ybins);
310 TH2L(const TH2L &h2l);
311 ~TH2L() override;
312 void AddBinContent(Int_t bin) override;
313 void AddBinContent(Int_t bin, Double_t w) override;
314 using TH2::AddBinContent;
315 void Copy(TObject &hnew) const override;
316 void Reset(Option_t *option="") override;
317 void SetBinsLength(Int_t n=-1) override;
318 TH2L& operator=(const TH2L &h1);
319 friend TH2L operator*(Float_t c1, TH2L const &h1);
320 friend TH2L operator*(TH2L const &h1, Float_t c1);
321 friend TH2L operator+(TH2L const &h1, TH2L const &h2);
322 friend TH2L operator-(TH2L const &h1, TH2L const &h2);
323 friend TH2L operator*(TH2L const &h1, TH2L const &h2);
324 friend TH2L operator/(TH2L const &h1, TH2L const &h2);
325
326protected:
327 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
328 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Int_t (content); }
329
330 ClassDefOverride(TH2L,0) //2-Dim histograms (one 64 bit integer per channel)
331};
332
333TH2L operator*(Float_t c1, TH2L const &h1);
335{
336 return operator*(c1, h1);
337}
338TH2L operator+(TH2L const &h1, TH2L const &h2);
339TH2L operator-(TH2L const &h1, TH2L const &h2);
340TH2L operator*(TH2L const &h1, TH2L const &h2);
341TH2L operator/(TH2L const &h1, TH2L const &h2);
342
343//______________________________________________________________________________
344
345class TH2F : public TH2, public TArrayF {
346
347public:
348 TH2F();
349 TH2F(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
350 ,Int_t nbinsy,Double_t ylow,Double_t yup);
351 TH2F(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
352 ,Int_t nbinsy,Double_t ylow,Double_t yup);
353 TH2F(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
354 ,Int_t nbinsy,const Double_t *ybins);
355 TH2F(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
356 ,Int_t nbinsy,const Double_t *ybins);
357 TH2F(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
358 ,Int_t nbinsy,const Float_t *ybins);
359 TH2F(const TMatrixFBase &m);
360 TH2F(const TH2F &h2f);
361 ~TH2F() override;
362
363 /// Increment bin content by 1.
364 /// Passing an out-of-range bin leads to undefined behavior
365 void AddBinContent(Int_t bin) override {++fArray[bin];}
366 /// Increment bin content by a weight w.
367 /// \warning The value of w is cast to `Float_t` before being added.
368 /// Passing an out-of-range bin leads to undefined behavior
369 void AddBinContent(Int_t bin, Double_t w) override
370 {fArray[bin] += Float_t (w);}
371 using TH2::AddBinContent;
372 void Copy(TObject &hnew) const override;
373 void Reset(Option_t *option="") override;
374 void SetBinsLength(Int_t n=-1) override;
375
376 TH2F& operator=(const TH2F &h1);
377 friend TH2F operator*(Float_t c1, TH2F const &h1);
378 friend TH2F operator*(TH2F const &h1, Float_t c1);
379 friend TH2F operator+(TH2F const &h1, TH2F const &h2);
380 friend TH2F operator-(TH2F const &h1, TH2F const &h2);
381 friend TH2F operator*(TH2F const &h1, TH2F const &h2);
382 friend TH2F operator/(TH2F const &h1, TH2F const &h2);
383
384protected:
385 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
386 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Float_t (content); }
387
388 ClassDefOverride(TH2F,4) //2-Dim histograms (one float per channel)
389};
390
391TH2F operator*(Float_t c1, TH2F const &h1);
392TH2F operator*(TH2F const &h1, Float_t c1);
393TH2F operator+(TH2F const &h1, TH2F const &h2);
394TH2F operator-(TH2F const &h1, TH2F const &h2);
395TH2F operator*(TH2F const &h1, TH2F const &h2);
396TH2F operator/(TH2F const &h1, TH2F const &h2);
397
398//______________________________________________________________________________
399
400class TH2D : public TH2, public TArrayD {
401
402public:
403 TH2D();
404 TH2D(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
405 ,Int_t nbinsy,Double_t ylow,Double_t yup);
406 TH2D(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
407 ,Int_t nbinsy,Double_t ylow,Double_t yup);
408 TH2D(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
409 ,Int_t nbinsy,const Double_t *ybins);
410 TH2D(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
411 ,Int_t nbinsy,const Double_t *ybins);
412 TH2D(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
413 ,Int_t nbinsy,const Float_t *ybins);
414 TH2D(const TMatrixDBase &m);
415 TH2D(const TH2D &h2d);
416 ~TH2D() override;
417
418 /// Increment bin content by 1.
419 /// Passing an out-of-range bin leads to undefined behavior
420 void AddBinContent(Int_t bin) override {++fArray[bin];}
421 /// Increment bin content by a weight w
422 /// Passing an out-of-range bin leads to undefined behavior
423 void AddBinContent(Int_t bin, Double_t w) override
424 {fArray[bin] += Double_t (w);}
425 using TH2::AddBinContent;
426 void Copy(TObject &hnew) const override;
427 void Reset(Option_t *option="") override;
428 void SetBinsLength(Int_t n=-1) override;
429
430 TH2D& operator=(const TH2D &h1);
431 friend TH2D operator*(Float_t c1, TH2D const &h1);
432 friend TH2D operator*(TH2D const &h1, Float_t c1);
433 friend TH2D operator+(TH2D const &h1, TH2D const &h2);
434 friend TH2D operator-(TH2D const &h1, TH2D const &h2);
435 friend TH2D operator*(TH2D const &h1, TH2D const &h2);
436 friend TH2D operator/(TH2D const &h1, TH2D const &h2);
437
438protected:
439 Double_t RetrieveBinContent(Int_t bin) const override { return fArray[bin]; }
440 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = content; }
441
442 ClassDefOverride(TH2D,4) //2-Dim histograms (one double per channel)
443};
444
445TH2D operator*(Float_t c1, TH2D const &h1);
447{
448 return operator*(c1, h1);
449}
450TH2D operator+(TH2D const &h1, TH2D const &h2);
451TH2D operator-(TH2D const &h1, TH2D const &h2);
452TH2D operator*(TH2D const &h1, TH2D const &h2);
453TH2D operator/(TH2D const &h1, TH2D const &h2);
454
455#endif
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
char Char_t
Character 1 byte (char)
Definition RtypesCore.h:51
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
short Short_t
Signed Short integer 2 bytes (short)
Definition RtypesCore.h:53
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t option
char name[80]
Definition TGX11.cxx:110
TH2C operator+(TH2C const &h1, TH2C const &h2)
Operator +.
Definition TH2.cxx:3031
TH2C operator*(Float_t c1, TH2C const &h1)
Operator *.
Definition TH2.cxx:3019
TH2C operator/(TH2C const &h1, TH2C const &h2)
Operator /.
Definition TH2.cxx:3067
TH2C operator-(TH2C const &h1, TH2C const &h2)
Operator -.
Definition TH2.cxx:3043
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:182
1-D histogram with a double per channel (see TH1 documentation)
Definition TH1.h:927
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:109
virtual void FillRandom(TF1 *f1, Int_t ntimes=5000, TRandom *rng=nullptr)
Definition TH1.cxx:3510
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:8009
virtual Double_t GetBinErrorLow(Int_t bin) const
Return lower error associated to bin number bin.
Definition TH1.cxx:9117
virtual Double_t Integral(Option_t *option="") const
Return integral of bin contents.
Definition TH1.cxx:7982
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Definition TH1.cxx:5076
virtual Double_t GetBinErrorUp(Int_t bin) const
Return upper error associated to bin number bin.
Definition TH1.cxx:9148
virtual void AddBinContent(Int_t bin)=0
Increment bin content by 1.
2-D histogram with a byte per channel (see TH1 documentation)
Definition TH2.h:143
void Reset(Option_t *option="") override
Reset this histogram: contents, errors, etc.
Definition TH2.cxx:2951
friend TH2C operator+(TH2C const &h1, TH2C const &h2)
Operator +.
Definition TH2.cxx:3031
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:176
friend TH2C operator*(Float_t c1, TH2C const &h1)
Operator *.
Definition TH2.cxx:3019
friend TH2C operator/(TH2C const &h1, TH2C const &h2)
Operator /.
Definition TH2.cxx:3067
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:177
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH2.cxx:2919
TH2C()
Constructor.
Definition TH2.cxx:2825
TH2C & operator=(const TH2C &h1)
Operator =.
Definition TH2.cxx:3008
~TH2C() override
Destructor.
Definition TH2.cxx:2835
void Copy(TObject &hnew) const override
Copy.
Definition TH2.cxx:2942
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH2.cxx:2962
friend TH2C operator-(TH2C const &h1, TH2C const &h2)
Operator -.
Definition TH2.cxx:3043
2-D histogram with a double per channel (see TH1 documentation)
Definition TH2.h:400
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:440
friend TH2D operator-(TH2D const &h1, TH2D const &h2)
Operator -.
Definition TH2.cxx:4296
friend TH2D operator+(TH2D const &h1, TH2D const &h2)
Operator +.
Definition TH2.cxx:4284
friend TH2D operator*(Float_t c1, TH2D const &h1)
Operator *.
Definition TH2.cxx:4272
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH2.cxx:4213
friend TH2D operator/(TH2D const &h1, TH2D const &h2)
Operator /.
Definition TH2.cxx:4320
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:439
~TH2D() override
Destructor.
Definition TH2.cxx:4086
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:423
void Copy(TObject &hnew) const override
Copy.
Definition TH2.cxx:4193
TH2D()
Constructor.
Definition TH2.cxx:4076
TH2D & operator=(const TH2D &h1)
Operator =.
Definition TH2.cxx:4259
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH2.h:420
2-D histogram with a float per channel (see TH1 documentation)
Definition TH2.h:345
TH2F()
Constructor.
Definition TH2.cxx:3805
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH2.h:365
void AddBinContent(Int_t bin, Double_t w) override
Increment bin content by a weight w.
Definition TH2.h:369
TH2F & operator=(const TH2F &h1)
Operator =.
Definition TH2.cxx:3986
~TH2F() override
Destructor.
Definition TH2.cxx:3815
friend TH2F operator+(TH2F const &h1, TH2F const &h2)
Operator +.
Definition TH2.cxx:4021
void Copy(TObject &hnew) const override
Copy.
Definition TH2.cxx:3920
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:386
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:385
friend TH2F operator-(TH2F const &h1, TH2F const &h2)
Operator -.
Definition TH2.cxx:4033
friend TH2F operator*(Float_t c1, TH2F const &h1)
Operator *.
Definition TH2.cxx:3997
friend TH2F operator/(TH2F const &h1, TH2F const &h2)
Operator /.
Definition TH2.cxx:4057
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH2.cxx:3940
2-D histogram with an int per channel (see TH1 documentation)
Definition TH2.h:245
TH2I()
Constructor.
Definition TH2.cxx:3349
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:278
friend TH2I operator*(Float_t c1, TH2I const &h1)
Operator *.
Definition TH2.cxx:3510
friend TH2I operator-(TH2I const &h1, TH2I const &h2)
Operator -.
Definition TH2.cxx:3534
void Copy(TObject &hnew) const override
Copy.
Definition TH2.cxx:3468
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:279
friend TH2I operator+(TH2I const &h1, TH2I const &h2)
Operator +.
Definition TH2.cxx:3522
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH2.cxx:3445
~TH2I() override
Destructor.
Definition TH2.cxx:3359
TH2I & operator=(const TH2I &h1)
Operator =.
Definition TH2.cxx:3499
friend TH2I operator/(TH2I const &h1, TH2I const &h2)
Operator /.
Definition TH2.cxx:3558
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH2.cxx:3488
2-D histogram with a long64 per channel (see TH1 documentation)
Definition TH2.h:296
TH2L & operator=(const TH2L &h1)
Operator =.
Definition TH2.cxx:3727
friend TH2L operator-(TH2L const &h1, TH2L const &h2)
Operator -.
Definition TH2.cxx:3762
friend TH2L operator+(TH2L const &h1, TH2L const &h2)
Operator +.
Definition TH2.cxx:3750
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH2.cxx:3716
~TH2L() override
Destructor.
Definition TH2.cxx:3587
void Copy(TObject &hnew) const override
Copy.
Definition TH2.cxx:3696
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:327
friend TH2L operator/(TH2L const &h1, TH2L const &h2)
Operator /.
Definition TH2.cxx:3786
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:328
TH2L()
Constructor.
Definition TH2.cxx:3577
friend TH2L operator*(Float_t c1, TH2L const &h1)
Operator *.
Definition TH2.cxx:3738
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH2.cxx:3673
2-D histogram with a short per channel (see TH1 documentation)
Definition TH2.h:194
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH2.cxx:3182
~TH2S() override
Destructor.
Definition TH2.cxx:3096
friend TH2S operator-(TH2S const &h1, TH2S const &h2)
Operator -.
Definition TH2.cxx:3306
TH2S & operator=(const TH2S &h1)
Operator =.
Definition TH2.cxx:3271
void Copy(TObject &hnew) const override
Copy.
Definition TH2.cxx:3205
TH2S()
Constructor.
Definition TH2.cxx:3086
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:227
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:228
friend TH2S operator*(Float_t c1, TH2S const &h1)
Operator *.
Definition TH2.cxx:3282
friend TH2S operator+(TH2S const &h1, TH2S const &h2)
Operator +.
Definition TH2.cxx:3294
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH2.cxx:3225
friend TH2S operator/(TH2S const &h1, TH2S const &h2)
Operator /.
Definition TH2.cxx:3330
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:2438
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:1216
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:2657
virtual Double_t GetCorrelationFactor(Int_t axis1=1, Int_t axis2=2) const
Return correlation factor between axis1 and axis2.
Definition TH2.cxx:1105
void FillRandom(TF1 *f1, Int_t ntimes=5000, TRandom *rng=nullptr) override
Fill histogram following distribution in function fname.
Definition TH2.cxx:677
virtual TProfile * DoProfile(bool onX, const char *name, Int_t firstbin, Int_t lastbin, Option_t *option) const
Definition TH2.cxx:1842
virtual void GetRandom2(Double_t &x, Double_t &y, TRandom *rng=nullptr, Option_t *option="")
Return 2 random numbers along axis x and y distributed according to the cell-contents of this 2-D his...
Definition TH2.cxx:1161
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:1432
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:1041
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:1077
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:2071
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:1625
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:87
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:2480
void AddBinContent(Int_t binx, Int_t biny)
Increment 2D bin content by 1.
Definition TH2.h:76
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:2121
void Copy(TObject &hnew) const override
Copy.
Definition TH2.cxx:343
virtual TH1D * DoQuantiles(bool onX, const char *name, Double_t prob) const
Implementation of quantiles for x or y.
Definition TH2.cxx:2489
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:2578
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:241
virtual Double_t Integral(Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, Option_t *="") const
Definition TH2.h:110
virtual void DoFitSlices(bool onX, TF1 *f1, Int_t firstbin, Int_t lastbin, Int_t cut, Option_t *option, TObjArray *arr)
Definition TH2.cxx:774
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:2467
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:2612
void SetBinContent(Int_t binx, Int_t biny, Int_t, Double_t content) override
Definition TH2.h:129
virtual Double_t GetBinErrorUp(Int_t binx, Int_t biny)
Definition TH2.h:102
void Reset(Option_t *option="") override
Reset this histogram: contents, errors, etc.
Definition TH2.cxx:2562
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:2131
TH2 * RebinX(Int_t ngroup=2, const char *newname="") override
Rebin only the X axis see Rebin2D.
Definition TH2.cxx:1604
Double_t fTsumwy2
Total Sum of weight*Y*Y.
Definition TH2.h:35
void SetBinContent(Int_t binx, Int_t biny, Double_t content) override
Definition TH2.h:128
virtual Double_t GetCovariance(Int_t axis1=1, Int_t axis2=2) const
Return covariance between axis1 and axis2.
Definition TH2.cxx:1123
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:1046
Double_t GetBinContent(Int_t binx, Int_t biny, Int_t) const override
Definition TH2.h:98
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:2398
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:2689
void AddBinContent(Int_t binx, Int_t biny, Double_t w)
Increment 2D bin content by a weight w.
Definition TH2.h:79
~TH2() override
Destructor.
Definition TH2.cxx:229
Double_t GetBinContent(Int_t binx, Int_t biny) const override
Definition TH2.h:97
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:1307
Double_t fTsumwy
Total Sum of weight*Y.
Definition TH2.h:34
TH2()
2-D histogram default constructor.
Definition TH2.cxx:72
Double_t Interpolate(Double_t x) const override
illegal for a TH2
Definition TH2.cxx:1315
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:2641
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:2596
Int_t Fill(Double_t) override
Invalid Fill method.
Definition TH2.cxx:356
virtual Double_t GetBinErrorLow(Int_t binx, Int_t biny)
Definition TH2.h:101
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:1660
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:976
virtual Int_t BufferFill(Double_t x, Double_t y, Double_t w)
accumulate arguments in buffer.
Definition TH2.cxx:315
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:2629
Double_t Integral(Option_t *option="") const override
Return integral of bin contents.
Definition TH2.cxx:1279
void PutStats(Double_t *stats) override
Replace current statistics with the values in array stats.
Definition TH2.cxx:2447
virtual TH2 * RebinY(Int_t ngroup=2, const char *newname="")
Rebin only the Y axis see Rebin2D.
Definition TH2.cxx:1614
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
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