Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TH3.h
Go to the documentation of this file.
1// @(#)root/hist:$Id$
2// Author: Rene Brun 27/10/95
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_TH3
13#define ROOT_TH3
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TH3 //
19// //
20// 3-Dim histogram base class. //
21// //
22//////////////////////////////////////////////////////////////////////////
23
24#include "TH1.h"
25
26#include "TAtt3D.h"
27
28class TH2D;
29class TProfile2D;
30
31namespace ROOT::Internal {
32/// Entrypoint for thread-safe filling from RDataFrame.
33template <typename T, typename... Args>
34auto FillThreadSafe(T &histo, Args... args) -> decltype(histo.FillThreadSafe(args...), void())
35{
36 histo.FillThreadSafe(args...);
37}
38} // namespace ROOT::Internal
39
40class TH3 : public TH1, public TAtt3D {
41
42protected:
43 Double_t fTsumwy; ///< Total Sum of weight*Y
44 Double_t fTsumwy2; ///< Total Sum of weight*Y*Y
45 Double_t fTsumwxy; ///< Total Sum of weight*X*Y
46 Double_t fTsumwz; ///< Total Sum of weight*Z
47 Double_t fTsumwz2; ///< Total Sum of weight*Z*Z
48 Double_t fTsumwxz; ///< Total Sum of weight*X*Z
49 Double_t fTsumwyz; ///< Total Sum of weight*Y*Z
50
51 TH3();
52 TH3(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
55 TH3(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
57 ,Int_t nbinsz,const Float_t *zbins);
58 TH3(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
60 ,Int_t nbinsz,const Double_t *zbins);
62
64
65 Int_t BufferFill(Double_t, Double_t) override {return -2;} //may not use
66 virtual Int_t BufferFill(Double_t, Double_t, Double_t) {return -2;} //may not use
67 Int_t Fill(Double_t) override; //MayNotUse
68 Int_t Fill(Double_t,Double_t) override {return Fill(0.);} //MayNotUse
69 Int_t Fill(const char*, Double_t) override {return Fill(0);} //MayNotUse
70 Int_t Fill(Double_t,const char*,Double_t) {return Fill(0);} //MayNotUse
71 Int_t Fill(const char*,Double_t,Double_t) {return Fill(0);} //MayNotUse
72 Int_t Fill(const char*,const char*,Double_t) {return Fill(0);} //MayNotUse
73
74 Double_t Interpolate(Double_t x, Double_t y) const override; // May not use
75 Double_t Interpolate(Double_t x) const override; // MayNotUse
76
77private:
78
79 TH3(const TH3&) = delete;
80 TH3& operator=(const TH3&) = delete;
81
82 using TH1::Integral;
84
85public:
86 ~TH3() override;
88 /// Increment 3D bin content by 1.
89 /// Passing an out-of-range bin leads to undefined behavior
91 /// Increment 3D bin content by a weight w.
92 /// Passing an out-of-range bin leads to undefined behavior
94 Int_t BufferEmpty(Int_t action = 0) override;
95 void Copy(TObject &hnew) const override;
96 virtual Int_t Fill(Double_t x, Double_t y, Double_t z);
98
99 virtual Int_t Fill(const char *namex, const char *namey, const char *namez, Double_t w);
100 virtual Int_t Fill(const char *namex, Double_t y, const char *namez, Double_t w);
101 virtual Int_t Fill(const char *namex, const char *namey, Double_t z, Double_t w);
102 virtual Int_t Fill(Double_t x, const char *namey, const char *namez, Double_t w);
103 virtual Int_t Fill(const char *namex, Double_t y, Double_t z, Double_t w);
104 virtual Int_t Fill(Double_t x, const char *namey, Double_t z, Double_t w);
105 virtual Int_t Fill(Double_t x, Double_t y, const char *namez, Double_t w);
106
107 using TH1::FillRandom;
108 void FillRandom(TF1 *f1, Int_t ntimes=5000, TRandom *rng = nullptr) override;
109 void FillRandom(TH1 *h, Int_t ntimes=5000, TRandom *rng = nullptr) override;
110 virtual void FitSlicesZ(TF1 *f1 = nullptr, Int_t binminx = 1, Int_t binmaxx = 0, Int_t binminy = 1, Int_t binmaxy = 0,
111 Int_t cut = 0, Option_t *option = "QNR"); // *MENU*
112 Int_t GetBin(Int_t binx, Int_t biny, Int_t binz) const override;
113 using TH1::GetBinContent;
116 using TH1::GetBinErrorUp;
121 virtual Double_t GetCovariance(Int_t axis1=1,Int_t axis2=2) const;
122 virtual void GetRandom3(Double_t &x, Double_t &y, Double_t &, TRandom * rng = nullptr, Option_t *option = "");
123 void GetStats(Double_t *stats) const override;
124 Double_t Integral(Option_t *option="") const override;
127 Double_t Interpolate(Double_t x, Double_t y, Double_t z) const override;
128 Double_t KolmogorovTest(const TH1 *h2, Option_t *option="") const override;
129 virtual TH1D *ProjectionX(const char *name="_px", Int_t iymin=0, Int_t iymax=-1, Int_t izmin=0,
130 Int_t izmax=-1, Option_t *option="") const; // *MENU*
131 virtual TH1D *ProjectionY(const char *name="_py", Int_t ixmin=0, Int_t ixmax=-1, Int_t izmin=0,
132 Int_t izmax=-1, Option_t *option="") const; // *MENU*
133 virtual TH1D *ProjectionZ(const char *name="_pz", Int_t ixmin=0, Int_t ixmax=-1, Int_t iymin=0,
134 Int_t iymax=-1, Option_t *option="") const; // *MENU*
135 virtual TH1 *Project3D(Option_t *option="x") const; // *MENU*
136 virtual TProfile2D *Project3DProfile(Option_t *option="xy") const; // *MENU*
137 void PutStats(Double_t *stats) override;
138 TH3 *RebinX(Int_t ngroup = 2, const char *newname = "") override;
139 virtual TH3 *RebinY(Int_t ngroup = 2, const char *newname = "");
140 virtual TH3 *RebinZ(Int_t ngroup = 2, const char *newname = "");
141 virtual TH3 *Rebin3D(Int_t nxgroup = 2, Int_t nygroup = 2, Int_t nzgroup = 2, const char *newname = "");
142 void Reset(Option_t *option="") override;
143 void SetBinContent(Int_t bin, Double_t content) override;
146 virtual void SetShowProjection(const char *option="xy",Int_t nbins=1); // *MENU*
147 virtual TH1 *ShowBackground3D(Int_t nIterX = 20, Int_t nIterY = 20, Int_t nIterZ = 20, Option_t *option = "same");
148
149protected:
150
151 virtual TH1D *DoProject1D(const char* name, const char * title, int imin1, int imax1, int imin2, int imax2,
152 const TAxis* projAxis, const TAxis * axis1, const TAxis * axis2, Option_t * option) const;
153 virtual TH1D *DoProject1D(const char *name, const char *title, const TAxis *projAxis, const TAxis *axis1,
154 const TAxis *axis2, bool computeErrors, bool originalRange, bool useUF, bool useOF, bool useWidth) const;
155 virtual TH2D *DoProject2D(const char* name, const char * title, const TAxis* projX, const TAxis* projY,
156 bool computeErrors, bool originalRange, bool useUF, bool useOF, bool useWidth) const;
157 virtual TProfile2D *DoProjectProfile2D(const char* name, const char * title, const TAxis* projX, const TAxis* projY,
158 bool originalRange, bool useUF, bool useOF, bool useWidth) const;
159
160 // these functions are need to be used inside TProfile3D::DoProjectProfile2D
161 static TH1D *DoProject1D(const TH3 & h, const char* name, const char * title, const TAxis* projX,
162 bool computeErrors, bool originalRange, bool useUF, bool useOF, bool useWidth);
163 static TH2D *DoProject2D(const TH3 & h, const char* name, const char * title, const TAxis* projX, const TAxis* projY,
164 bool computeErrors, bool originalRange, bool useUF, bool useOF, bool useWidth);
165
166 ClassDefOverride(TH3,6) //3-Dim histogram base class
167};
168
169//________________________________________________________________________
170
171class TH3C : public TH3, public TArrayC {
172public:
173 TH3C();
174 TH3C(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
175 ,Int_t nbinsy,Double_t ylow,Double_t yup
177 TH3C(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
178 ,Int_t nbinsy,const Float_t *ybins
179 ,Int_t nbinsz,const Float_t *zbins);
180 TH3C(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
181 ,Int_t nbinsy,const Double_t *ybins
182 ,Int_t nbinsz,const Double_t *zbins);
183 TH3C(const TH3C &h3c);
184 ~TH3C() override;
185
186 void AddBinContent(Int_t bin) override;
187 void AddBinContent(Int_t bin, Double_t w) override;
188 using TH3::AddBinContent;
189 void Copy(TObject &hnew) const override;
190 void Reset(Option_t *option="") override;
191 void SetBinsLength(Int_t n=-1) override;
192
193 TH3C& operator=(const TH3C &h1);
194 friend TH3C operator*(Float_t c1, TH3C const &h1);
195 friend TH3C operator*(TH3C const &h1, Float_t c1);
196 friend TH3C operator+(TH3C const &h1, TH3C const &h2);
197 friend TH3C operator-(TH3C const &h1, TH3C const &h2);
198 friend TH3C operator*(TH3C const &h1, TH3C const &h2);
199 friend TH3C operator/(TH3C const &h1, TH3C const &h2);
200
201protected:
202 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
203 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Char_t (content); }
204
205 ClassDefOverride(TH3C,4) //3-Dim histograms (one char per channel)
206};
207
208TH3C operator*(Float_t c1, TH3C const &h1);
210{
211 return operator*(c1, h1);
212}
213TH3C operator+(TH3C const &h1, TH3C const &h2);
214TH3C operator-(TH3C const &h1, TH3C const &h2);
215TH3C operator*(TH3C const &h1, TH3C const &h2);
216TH3C operator/(TH3C const &h1, TH3C const &h2);
217//________________________________________________________________________
218
219class TH3S : public TH3, public TArrayS {
220public:
221 TH3S();
222 TH3S(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
223 ,Int_t nbinsy,Double_t ylow,Double_t yup
225 TH3S(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
226 ,Int_t nbinsy,const Float_t *ybins
227 ,Int_t nbinsz,const Float_t *zbins);
228 TH3S(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
229 ,Int_t nbinsy,const Double_t *ybins
230 ,Int_t nbinsz,const Double_t *zbins);
231 TH3S(const TH3S &h3s);
232 ~TH3S() override;
233
234 void AddBinContent(Int_t bin) override;
235 void AddBinContent(Int_t bin, Double_t w) override;
236 using TH3::AddBinContent;
237 void Copy(TObject &hnew) const override;
238 void Reset(Option_t *option="") override;
239 void SetBinsLength(Int_t n=-1) override;
240
241 TH3S& operator=(const TH3S &h1);
242 friend TH3S operator*(Float_t c1, TH3S const &h1);
243 friend TH3S operator*(TH3S const &h1, Float_t c1);
244 friend TH3S operator+(TH3S const &h1, TH3S const &h2);
245 friend TH3S operator-(TH3S const &h1, TH3S const &h2);
246 friend TH3S operator*(TH3S const &h1, TH3S const &h2);
247 friend TH3S operator/(TH3S const &h1, TH3S const &h2);
248
249protected:
250 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
251 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Short_t (content); }
252
253 ClassDefOverride(TH3S,4) //3-Dim histograms (one short per channel)
254};
255
256TH3S operator*(Float_t c1, TH3S const &h1);
258{
259 return operator*(c1, h1);
260}
261TH3S operator+(TH3S const &h1, TH3S const &h2);
262TH3S operator-(TH3S const &h1, TH3S const &h2);
263TH3S operator*(TH3S const &h1, TH3S const &h2);
264TH3S operator/(TH3S const &h1, TH3S const &h2);
265
266//________________________________________________________________________
267
268class TH3I : public TH3, public TArrayI {
269public:
270 TH3I();
271 TH3I(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
274 TH3I(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
275 ,Int_t nbinsy,const Float_t *ybins
276 ,Int_t nbinsz,const Float_t *zbins);
277 TH3I(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
278 ,Int_t nbinsy,const Double_t *ybins
279 ,Int_t nbinsz,const Double_t *zbins);
280 TH3I(const TH3I &h3i);
281 ~TH3I() override;
282
283 void AddBinContent(Int_t bin) override;
284 void AddBinContent(Int_t bin, Double_t w) override;
285 using TH3::AddBinContent;
286 void Copy(TObject &hnew) const override;
287 void Reset(Option_t *option="") override;
288 void SetBinsLength(Int_t n=-1) override;
289
290 TH3I& operator=(const TH3I &h1);
291 friend TH3I operator*(Float_t c1, TH3I const &h1);
292 friend TH3I operator*(TH3I const &h1, Float_t c1);
293 friend TH3I operator+(TH3I const &h1, TH3I const &h2);
294 friend TH3I operator-(TH3I const &h1, TH3I const &h2);
295 friend TH3I operator*(TH3I const &h1, TH3I const &h2);
296 friend TH3I operator/(TH3I const &h1, TH3I const &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(TH3I,4) //3-Dim histograms (one 32 bit integer per channel)
303};
304
305TH3I operator*(Float_t c1, TH3I const &h1);
307{
308 return operator*(c1, h1);
309}
310TH3I operator+(TH3I const &h1, TH3I const &h2);
311TH3I operator-(TH3I const &h1, TH3I const &h2);
312TH3I operator*(TH3I const &h1, TH3I const &h2);
313TH3I operator/(TH3I const &h1, TH3I const &h2);
314
315//________________________________________________________________________
316
317class TH3L : public TH3, public TArrayL64 {
318public:
319 TH3L();
320 TH3L(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
321 ,Int_t nbinsy,Double_t ylow,Double_t yup
323 TH3L(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
324 ,Int_t nbinsy,const Float_t *ybins
325 ,Int_t nbinsz,const Float_t *zbins);
326 TH3L(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
327 ,Int_t nbinsy,const Double_t *ybins
328 ,Int_t nbinsz,const Double_t *zbins);
329 TH3L(const TH3L &h3l);
330 ~TH3L() override;
331 void AddBinContent(Int_t bin) override;
332 void AddBinContent(Int_t bin, Double_t w) override;
333 using TH3::AddBinContent;
334 void Copy(TObject &hnew) const override;
335 void Reset(Option_t *option="") override;
336 void SetBinsLength(Int_t n=-1) override;
337 TH3L& operator=(const TH3L &h1);
338 friend TH3L operator*(Float_t c1, TH3L const &h1);
339 friend TH3L operator*(TH3L const &h1, Float_t c1);
340 friend TH3L operator+(TH3L const &h1, TH3L const &h2);
341 friend TH3L operator-(TH3L const &h1, TH3L const &h2);
342 friend TH3L operator*(TH3L const &h1, TH3L const &h2);
343 friend TH3L operator/(TH3L const &h1, TH3L const &h2);
344
345protected:
346 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
347 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Long64_t (content); }
348
349 ClassDefOverride(TH3L,0) //3-Dim histograms (one 64 bit integer per channel)
350};
351
352TH3L operator*(Float_t c1, TH3L const &h1);
354{
355 return operator*(c1, h1);
356}
357TH3L operator+(TH3L const &h1, TH3L const &h2);
358TH3L operator-(TH3L const &h1, TH3L const &h2);
359TH3L operator*(TH3L const &h1, TH3L const &h2);
360TH3L operator/(TH3L const &h1, TH3L const &h2);
361
362//________________________________________________________________________
363
364class TH3F : public TH3, public TArrayF {
365public:
366 TH3F();
367 TH3F(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
368 ,Int_t nbinsy,Double_t ylow,Double_t yup
370 TH3F(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
371 ,Int_t nbinsy,const Float_t *ybins
372 ,Int_t nbinsz,const Float_t *zbins);
373 TH3F(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
374 ,Int_t nbinsy,const Double_t *ybins
375 ,Int_t nbinsz,const Double_t *zbins);
376 TH3F(const TH3F &h3f);
377 ~TH3F() override;
378
379 /// Increment bin content by 1.
380 /// Passing an out-of-range bin leads to undefined behavior
381 void AddBinContent(Int_t bin) override {++fArray[bin];}
382 /// Increment bin content by a weight w.
383 /// \warning The value of w is cast to `Float_t` before being added.
384 /// Passing an out-of-range bin leads to undefined behavior
385 void AddBinContent(Int_t bin, Double_t w) override
386 {fArray[bin] += Float_t (w);}
387 using TH3::AddBinContent;
388 void Copy(TObject &hnew) const override;
389 void Reset(Option_t *option="") override;
390 void SetBinsLength(Int_t n=-1) override;
391
392 TH3F& operator=(const TH3F &h1);
393 friend TH3F operator*(Float_t c1, TH3F const &h1);
394 friend TH3F operator*(TH3F const &h1, Float_t c1);
395 friend TH3F operator+(TH3F const &h1, TH3F const &h2);
396 friend TH3F operator-(TH3F const &h1, TH3F const &h2);
397 friend TH3F operator*(TH3F const &h1, TH3F const &h2);
398 friend TH3F operator/(TH3F const &h1, TH3F const &h2);
399
400protected:
401 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
402 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Float_t (content); }
403
404 ClassDefOverride(TH3F,4) //3-Dim histograms (one float per channel)
405};
406
407TH3F operator*(Float_t c1, TH3F const &h1);
409{
410 return operator*(c1, h1);
411}
412TH3F operator+(TH3F const &h1, TH3F const &h2);
413TH3F operator-(TH3F const &h1, TH3F const &h2);
414TH3F operator*(TH3F const &h1, TH3F const &h2);
415TH3F operator/(TH3F const &h1, TH3F const &h2);
416
417//________________________________________________________________________
418
419class TH3D : public TH3, public TArrayD {
420public:
421 TH3D();
422 TH3D(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
423 ,Int_t nbinsy,Double_t ylow,Double_t yup
425 TH3D(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
426 ,Int_t nbinsy,const Float_t *ybins
427 ,Int_t nbinsz,const Float_t *zbins);
428 TH3D(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
429 ,Int_t nbinsy,const Double_t *ybins
430 ,Int_t nbinsz,const Double_t *zbins);
431 TH3D(const TH3D &h3d);
432 ~TH3D() override;
433
434 /// Increment bin content by 1.
435 /// Passing an out-of-range bin leads to undefined behavior
436 void AddBinContent(Int_t bin) override {++fArray[bin];}
437 /// Increment bin content by a weight w
438 /// Passing an out-of-range bin leads to undefined behavior
439 void AddBinContent(Int_t bin, Double_t w) override
440 {fArray[bin] += Double_t (w);}
441 using TH3::AddBinContent;
442 void Copy(TObject &hnew) const override;
443 void Reset(Option_t *option="") override;
444 void SetBinsLength(Int_t n=-1) override;
445
446 TH3D& operator=(const TH3D &h1);
447 friend TH3D operator*(Float_t c1, TH3D const &h1);
448 friend TH3D operator*(TH3D const &h1, Float_t c1);
449 friend TH3D operator+(TH3D const &h1, TH3D const &h2);
450 friend TH3D operator-(TH3D const &h1, TH3D const &h2);
451 friend TH3D operator*(TH3D const &h1, TH3D const &h2);
452 friend TH3D operator/(TH3D const &h1, TH3D const &h2);
453
454protected:
455 Double_t RetrieveBinContent(Int_t bin) const override { return fArray[bin]; }
456 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = content; }
457private:
458#ifdef __cpp_lib_atomic_ref
459 void FillThreadSafe(Double_t x, Double_t y, Double_t z, Double_t w = 1.);
460 template <typename T, typename... Args>
461 friend auto ROOT::Internal::FillThreadSafe(T &histo, Args... args)
462 -> decltype(histo.FillThreadSafe(args...), void());
463#endif
464
465 ClassDefOverride(TH3D,4) //3-Dim histograms (one double per channel)
466};
467
468TH3D operator*(Float_t c1, TH3D const &h1);
470{
471 return operator*(c1, h1);
472}
473TH3D operator+(TH3D const &h1, TH3D const &h2);
474TH3D operator-(TH3D const &h1, TH3D const &h2);
475TH3D operator*(TH3D const &h1, TH3D const &h2);
476TH3D operator/(TH3D const &h1, TH3D const &h2);
477
478#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
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:83
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
TH3C operator*(Float_t c1, TH3C const &h1)
Operator *.
Definition TH3.cxx:3767
TH3C operator-(TH3C const &h1, TH3C const &h2)
Operator -.
Definition TH3.cxx:3791
TH3C operator+(TH3C const &h1, TH3C const &h2)
Operator +.
Definition TH3.cxx:3779
TH3C operator/(TH3C const &h1, TH3C const &h2)
Operator /.
Definition TH3.cxx:3815
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
Use this attribute class when an object should have 3D capabilities.
Definition TAtt3D.h:19
Class to manage histogram axis.
Definition TAxis.h:32
1-Dim function class
Definition TF1.h:182
1-D histogram with a double per channel (see TH1 documentation)
Definition TH1.h:926
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:8019
virtual Double_t GetBinErrorLow(Int_t bin) const
Return lower error associated to bin number bin.
Definition TH1.cxx:9127
virtual Double_t Integral(Option_t *option="") const
Return integral of bin contents.
Definition TH1.cxx:7992
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:9158
virtual void AddBinContent(Int_t bin)=0
Increment bin content by 1.
2-D histogram with a double per channel (see TH1 documentation)
Definition TH2.h:400
3-D histogram with a byte per channel (see TH1 documentation)
Definition TH3.h:171
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH3.cxx:3683
friend TH3C operator*(Float_t c1, TH3C const &h1)
Operator *.
Definition TH3.cxx:3767
~TH3C() override
Destructor.
Definition TH3.cxx:3576
friend TH3C operator-(TH3C const &h1, TH3C const &h2)
Operator -.
Definition TH3.cxx:3791
void Reset(Option_t *option="") override
Reset this histogram: contents, errors, etc.
Definition TH3.cxx:3671
friend TH3C operator+(TH3C const &h1, TH3C const &h2)
Operator +.
Definition TH3.cxx:3779
friend TH3C operator/(TH3C const &h1, TH3C const &h2)
Operator /.
Definition TH3.cxx:3815
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 TH3.h:202
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH3.cxx:3639
TH3C & operator=(const TH3C &h1)
Operator =.
Definition TH3.cxx:3756
TH3C()
Constructor.
Definition TH3.cxx:3566
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 TH3.h:203
void Copy(TObject &hnew) const override
Copy this 3-D histogram structure to newth3.
Definition TH3.cxx:3662
3-D histogram with a double per channel (see TH1 documentation)
Definition TH3.h:419
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 TH3.h:456
TH3D()
Constructor.
Definition TH3.cxx:4700
friend TH3D operator+(TH3D const &h1, TH3D const &h2)
Operator +.
Definition TH3.cxx:4862
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH3.cxx:4794
~TH3D() override
Destructor.
Definition TH3.cxx:4710
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 TH3.h:439
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 TH3.h:455
friend TH3D operator-(TH3D const &h1, TH3D const &h2)
Operator -.
Definition TH3.cxx:4874
friend TH3D operator/(TH3D const &h1, TH3D const &h2)
Operator /.
Definition TH3.cxx:4898
friend TH3D operator*(Float_t c1, TH3D const &h1)
Operator *.
Definition TH3.cxx:4850
void Copy(TObject &hnew) const override
Copy this 3-D histogram structure to newth3.
Definition TH3.cxx:4773
TH3D & operator=(const TH3D &h1)
Operator =.
Definition TH3.cxx:4838
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH3.h:436
3-D histogram with a float per channel (see TH1 documentation)
Definition TH3.h:364
friend TH3F operator/(TH3F const &h1, TH3F const &h2)
Operator /.
Definition TH3.cxx:4681
TH3F & operator=(const TH3F &h1)
Operator =.
Definition TH3.cxx:4622
friend TH3F operator+(TH3F const &h1, TH3F const &h2)
Operator +.
Definition TH3.cxx:4645
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH3.h:381
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 TH3.h:402
void AddBinContent(Int_t bin, Double_t w) override
Increment bin content by a weight w.
Definition TH3.h:385
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH3.cxx:4578
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 TH3.h:401
TH3F()
Constructor.
Definition TH3.cxx:4485
~TH3F() override
Destructor.
Definition TH3.cxx:4495
friend TH3F operator-(TH3F const &h1, TH3F const &h2)
Operator -.
Definition TH3.cxx:4657
void Copy(TObject &hnew) const override
Copy this 3-D histogram structure to newth3.
Definition TH3.cxx:4557
friend TH3F operator*(Float_t c1, TH3F const &h1)
Operator *.
Definition TH3.cxx:4633
3-D histogram with an int per channel (see TH1 documentation)
Definition TH3.h:268
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 TH3.h:299
TH3I & operator=(const TH3I &h1)
Operator =.
Definition TH3.cxx:4201
friend TH3I operator+(TH3I const &h1, TH3I const &h2)
Operator +.
Definition TH3.cxx:4224
friend TH3I operator-(TH3I const &h1, TH3I const &h2)
Operator _.
Definition TH3.cxx:4236
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH3.cxx:4146
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 TH3.h:300
TH3I()
Constructor.
Definition TH3.cxx:4073
void Copy(TObject &hnew) const override
Copy this 3-D histogram structure to newth3.
Definition TH3.cxx:4169
friend TH3I operator*(Float_t c1, TH3I const &h1)
Operator *.
Definition TH3.cxx:4212
friend TH3I operator/(TH3I const &h1, TH3I const &h2)
Operator /.
Definition TH3.cxx:4260
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH3.cxx:4190
~TH3I() override
Destructor.
Definition TH3.cxx:4083
3-D histogram with a long64 per channel (see TH1 documentation)
Definition TH3.h:317
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 TH3.h:347
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 TH3.h:346
void Copy(TObject &hnew) const override
Copy this 3-D histogram structure to newth3.
Definition TH3.cxx:4375
TH3L & operator=(const TH3L &h1)
Operator =.
Definition TH3.cxx:4407
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH3.cxx:4352
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH3.cxx:4396
friend TH3L operator+(TH3L const &h1, TH3L const &h2)
Operator +.
Definition TH3.cxx:4430
~TH3L() override
Destructor.
Definition TH3.cxx:4289
TH3L()
Constructor.
Definition TH3.cxx:4279
friend TH3L operator*(Float_t c1, TH3L const &h1)
Operator *.
Definition TH3.cxx:4418
friend TH3L operator-(TH3L const &h1, TH3L const &h2)
Operator _.
Definition TH3.cxx:4442
friend TH3L operator/(TH3L const &h1, TH3L const &h2)
Operator /.
Definition TH3.cxx:4466
3-D histogram with a short per channel (see TH1 documentation)
Definition TH3.h:219
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH3.cxx:3951
friend TH3S operator+(TH3S const &h1, TH3S const &h2)
Operator +.
Definition TH3.cxx:4018
friend TH3S operator/(TH3S const &h1, TH3S const &h2)
Operator /.
Definition TH3.cxx:4054
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH3.cxx:3907
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 TH3.h:251
~TH3S() override
Destructor.
Definition TH3.cxx:3844
void Copy(TObject &hnew) const override
Copy this 3-D histogram structure to newth3.
Definition TH3.cxx:3930
friend TH3S operator*(Float_t c1, TH3S const &h1)
Operator *.
Definition TH3.cxx:4006
friend TH3S operator-(TH3S const &h1, TH3S const &h2)
Operator -.
Definition TH3.cxx:4030
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 TH3.h:250
TH3S & operator=(const TH3S &h1)
Operator =.
Definition TH3.cxx:3995
TH3S()
Constructor.
Definition TH3.cxx:3834
The 3-D histogram classes derived from the 1-D histogram classes.
Definition TH3.h:40
virtual TH3 * Rebin3D(Int_t nxgroup=2, Int_t nygroup=2, Int_t nzgroup=2, const char *newname="")
Rebin this histogram grouping nxgroup/nygroup/nzgroup bins along the xaxis/yaxis/zaxis together.
Definition TH3.cxx:2994
Int_t BufferFill(Double_t, Double_t) override
accumulate arguments in buffer.
Definition TH3.h:65
Int_t BufferEmpty(Int_t action=0) override
Fill histogram with all entries in the buffer.
Definition TH3.cxx:230
Double_t fTsumwy
Total Sum of weight*Y.
Definition TH3.h:43
Int_t Fill(const char *, const char *, Double_t)
Definition TH3.h:72
virtual Int_t BufferFill(Double_t, Double_t, Double_t)
Definition TH3.h:66
Double_t fTsumwy2
Total Sum of weight*Y*Y.
Definition TH3.h:44
virtual Double_t GetCovariance(Int_t axis1=1, Int_t axis2=2) const
Return covariance between axis1 and axis2.
Definition TH3.cxx:1225
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 TH3.cxx:1325
void Copy(TObject &hnew) const override
Copy.
Definition TH3.cxx:210
Double_t fTsumwxz
Total Sum of weight*X*Z.
Definition TH3.h:48
virtual Double_t GetBinErrorUp(Int_t binx, Int_t biny, Int_t binz)
Definition TH3.h:118
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 TH3.cxx:1550
virtual TH1D * ProjectionY(const char *name="_py", Int_t ixmin=0, Int_t ixmax=-1, Int_t izmin=0, Int_t izmax=-1, Option_t *option="") const
Project a 3-D histogram into a 1-D histogram along Y (integration along X and Z).
Definition TH3.cxx:1804
Int_t Fill(const char *, Double_t) override
Increment bin with namex with a weight w.
Definition TH3.h:69
Double_t Interpolate(Double_t x, Double_t y) const override
Not yet implemented.
Definition TH3.cxx:1459
void AddBinContent(Int_t binx, Int_t biny, Int_t binz)
Increment 3D bin content by 1.
Definition TH3.h:90
void Reset(Option_t *option="") override
Reset this histogram: contents, errors, etc.
Definition TH3.cxx:3486
~TH3() override
Destructor.
Definition TH3.cxx:202
Int_t Fill(Double_t) override
Invalid Fill method.
Definition TH3.cxx:334
virtual TH3 * RebinY(Int_t ngroup=2, const char *newname="")
Rebin only the Y axis see Rebin3D.
Definition TH3.cxx:2953
TH3 & operator=(const TH3 &)=delete
virtual Double_t IntegralAndError(Int_t binx1, Int_t binx2, Int_t biny1, Int_t biny2, Int_t binz1, Int_t binz2, Double_t &err, Option_t *option="") const
Return integral of bin contents in range [binx1,binx2],[biny1,biny2],[binz1,binz2] for a 3-D histogra...
Definition TH3.cxx:1439
virtual TH1D * ProjectionZ(const char *name="_pz", Int_t ixmin=0, Int_t ixmax=-1, Int_t iymin=0, Int_t iymax=-1, Option_t *option="") const
Project a 3-D histogram into a 1-D histogram along Z (integration along X and Y).
Definition TH3.cxx:1839
void SetBinContent(Int_t binx, Int_t biny, Int_t binz, Double_t content) override
Definition TH3.h:145
virtual TH1D * ProjectionX(const char *name="_px", Int_t iymin=0, Int_t iymax=-1, Int_t izmin=0, Int_t izmax=-1, Option_t *option="") const
Project a 3-D histogram into a 1-D histogram along X (integration along Y and Z).
Definition TH3.cxx:1768
virtual TProfile2D * Project3DProfile(Option_t *option="xy") const
Project a 3-d histogram into a 2-d profile histograms depending on the option parameter option may co...
Definition TH3.cxx:2841
Double_t fTsumwz2
Total Sum of weight*Z*Z.
Definition TH3.h:47
Double_t fTsumwxy
Total Sum of weight*X*Y.
Definition TH3.h:45
Int_t Fill(Double_t, Double_t) override
Increment bin with abscissa X with a weight w.
Definition TH3.h:68
virtual TH1 * Project3D(Option_t *option="x") const
Project a 3-d histogram into 1 or 2-d histograms depending on the option parameter,...
Definition TH3.cxx:2441
virtual Double_t GetBinErrorLow(Int_t binx, Int_t biny, Int_t binz)
Definition TH3.h:117
Int_t Fill(Double_t, const char *, Double_t)
Definition TH3.h:70
void AddBinContent(Int_t binx, Int_t biny, Int_t binz, Double_t w)
Increment 3D bin content by a weight w.
Definition TH3.h:93
virtual Double_t GetBinWithContent3(Double_t c, Int_t &binx, Int_t &biny, Int_t &binz, Int_t firstx=0, Int_t lastx=0, Int_t firsty=0, Int_t lasty=0, Int_t firstz=0, Int_t lastz=0, Double_t maxdiff=0) const
Compute first cell (binx,biny,binz) in the range [firstx,lastx](firsty,lasty][firstz,...
Definition TH3.cxx:1167
virtual TH2D * DoProject2D(const char *name, const char *title, const TAxis *projX, const TAxis *projY, bool computeErrors, bool originalRange, bool useUF, bool useOF, bool useWidth) const
internal method performing the projection to a 2D histogram called from TH3::Project3D
Definition TH3.cxx:2131
void DoFillProfileProjection(TProfile2D *p2, const TAxis &a1, const TAxis &a2, const TAxis &a3, Int_t bin1, Int_t bin2, Int_t bin3, Int_t inBin, Bool_t useWeights) const
internal function to fill the bins of the projected profile 2D histogram called from DoProjectProfile...
Definition TH3.cxx:2582
virtual TH3 * RebinZ(Int_t ngroup=2, const char *newname="")
Rebin only the Z axis see Rebin3D.
Definition TH3.cxx:2963
Double_t Integral(Option_t *option="") const override
Return integral of bin contents.
Definition TH3.cxx:1408
virtual Int_t BufferFill(Double_t x, Double_t y, Double_t z, Double_t w)
Accumulate arguments in buffer.
Definition TH3.cxx:305
void FillRandom(TF1 *f1, Int_t ntimes=5000, TRandom *rng=nullptr) override
Fill histogram following distribution in function fname.
Definition TH3.cxx:852
virtual void GetRandom3(Double_t &x, Double_t &y, Double_t &, TRandom *rng=nullptr, Option_t *option="")
Return 3 random numbers along axis x, y and z distributed according to the cell-contents of this 3-di...
Definition TH3.cxx:1276
virtual void SetShowProjection(const char *option="xy", Int_t nbins=1)
When the mouse is moved in a pad containing a 3-d view of this histogram a second canvas shows a proj...
Definition TH3.cxx:3712
Int_t Fill(const char *, Double_t, Double_t)
Definition TH3.h:71
TH3 * RebinX(Int_t ngroup=2, const char *newname="") override
Rebin only the X axis see Rebin3D.
Definition TH3.cxx:2943
virtual Double_t GetCorrelationFactor(Int_t axis1=1, Int_t axis2=2) const
Return correlation factor between axis1 and axis2.
Definition TH3.cxx:1207
virtual TH1D * DoProject1D(const char *name, const char *title, int imin1, int imax1, int imin2, int imax2, const TAxis *projAxis, const TAxis *axis1, const TAxis *axis2, Option_t *option) const
internal method performing the projection to 1D histogram called from TH3::Project3D
Definition TH3.cxx:1856
TH3(const TH3 &)=delete
Double_t fTsumwz
Total Sum of weight*Z.
Definition TH3.h:46
Double_t GetBinContent(Int_t binx, Int_t biny, Int_t binz) const override
Definition TH3.h:114
void SetBinContent(Int_t bin, Double_t content) override
Set bin content.
Definition TH3.cxx:3505
void SetBinContent(Int_t bin, Int_t, Double_t content) override
Definition TH3.h:144
Double_t fTsumwyz
Total Sum of weight*Y*Z.
Definition TH3.h:49
TH3()
Default constructor.
Definition TH3.cxx:76
Int_t GetBin(Int_t binx, Int_t biny, Int_t binz) const override
See comments in TH1::GetBin.
Definition TH3.cxx:1133
virtual void FitSlicesZ(TF1 *f1=nullptr, Int_t binminx=1, Int_t binmaxx=0, Int_t binminy=1, Int_t binmaxy=0, Int_t cut=0, Option_t *option="QNR")
Project slices along Z in case of a 3-D histogram, then fit each slice with function f1 and make a 2-...
Definition TH3.cxx:994
virtual TH1 * ShowBackground3D(Int_t nIterX=20, Int_t nIterY=20, Int_t nIterZ=20, Option_t *option="same")
This function calculates the background spectrum in this histogram.
Definition TH3.cxx:4910
virtual TProfile2D * DoProjectProfile2D(const char *name, const char *title, const TAxis *projX, const TAxis *projY, bool originalRange, bool useUF, bool useOF, bool useWidth) const
internal method to project to a 2D Profile called from TH3::Project3DProfile
Definition TH3.cxx:2608
void PutStats(Double_t *stats) override
Replace current statistics with the values in array stats.
Definition TH3.cxx:2926
Mother of all ROOT objects.
Definition TObject.h:41
Profile2D histograms are used to display the mean value of Z and its error for each cell in X,...
Definition TProfile2D.h:27
This is the base class for the ROOT Random number generators.
Definition TRandom.h:27
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
auto FillThreadSafe(T &histo, Args... args) -> decltype(histo.FillThreadSafe(args...), void())
Entrypoint for thread-safe filling from RDataFrame.
Definition TH3.h:34