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
31#if defined R__B64 && defined __cpp_lib_atomic_ref
32// ROOT-20834 Atomic_ref on 32 bit can fail because of alignment problems
33#define TH3D_FILL_THREADSAFE
34#endif
35
36namespace ROOT::Internal {
37/// Entrypoint for thread-safe filling from RDataFrame.
38template <typename T, typename... Args>
39auto FillThreadSafe(T &histo, Args... args) -> decltype(histo.FillThreadSafe(args...), void())
40{
41 histo.FillThreadSafe(args...);
42}
43} // namespace ROOT::Internal
44
45class TH3 : public TH1, public TAtt3D {
46
47protected:
48 Double_t fTsumwy; ///< Total Sum of weight*Y
49 Double_t fTsumwy2; ///< Total Sum of weight*Y*Y
50 Double_t fTsumwxy; ///< Total Sum of weight*X*Y
51 Double_t fTsumwz; ///< Total Sum of weight*Z
52 Double_t fTsumwz2; ///< Total Sum of weight*Z*Z
53 Double_t fTsumwxz; ///< Total Sum of weight*X*Z
54 Double_t fTsumwyz; ///< Total Sum of weight*Y*Z
55
56 TH3();
57 TH3(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
60 TH3(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
62 ,Int_t nbinsz,const Float_t *zbins);
63 TH3(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
65 ,Int_t nbinsz,const Double_t *zbins);
67
69
70 Int_t BufferFill(Double_t, Double_t) override {return -2;} //may not use
71 virtual Int_t BufferFill(Double_t, Double_t, Double_t) {return -2;} //may not use
72 Int_t Fill(Double_t) override; //MayNotUse
73 Int_t Fill(Double_t,Double_t) override {return Fill(0.);} //MayNotUse
74 Int_t Fill(const char*, Double_t) override {return Fill(0);} //MayNotUse
75 Int_t Fill(Double_t,const char*,Double_t) {return Fill(0);} //MayNotUse
76 Int_t Fill(const char*,Double_t,Double_t) {return Fill(0);} //MayNotUse
77 Int_t Fill(const char*,const char*,Double_t) {return Fill(0);} //MayNotUse
78
79 Double_t Interpolate(Double_t x, Double_t y) const override; // May not use
80 Double_t Interpolate(Double_t x) const override; // MayNotUse
81
82private:
83
84 TH3(const TH3&) = delete;
85 TH3& operator=(const TH3&) = delete;
86
87 using TH1::Integral;
89
90public:
91 ~TH3() override;
93 /// Increment 3D bin content by 1.
94 /// Passing an out-of-range bin leads to undefined behavior
96 /// Increment 3D bin content by a weight w.
97 /// Passing an out-of-range bin leads to undefined behavior
99 Int_t BufferEmpty(Int_t action = 0) override;
100 void Copy(TObject &hnew) const override;
101 virtual Int_t Fill(Double_t x, Double_t y, Double_t z);
103
104 virtual Int_t Fill(const char *namex, const char *namey, const char *namez, Double_t w);
105 virtual Int_t Fill(const char *namex, Double_t y, const char *namez, Double_t w);
106 virtual Int_t Fill(const char *namex, const char *namey, Double_t z, Double_t w);
107 virtual Int_t Fill(Double_t x, const char *namey, const char *namez, Double_t w);
108 virtual Int_t Fill(const char *namex, Double_t y, Double_t z, Double_t w);
109 virtual Int_t Fill(Double_t x, const char *namey, Double_t z, Double_t w);
110 virtual Int_t Fill(Double_t x, Double_t y, const char *namez, Double_t w);
111
112 using TH1::FillRandom;
113 void FillRandom(TF1 *f1, Int_t ntimes=5000, TRandom *rng = nullptr) override;
114 void FillRandom(TH1 *h, Int_t ntimes=5000, TRandom *rng = nullptr) override;
115 virtual void FitSlicesZ(TF1 *f1 = nullptr, Int_t binminx = 1, Int_t binmaxx = 0, Int_t binminy = 1, Int_t binmaxy = 0,
116 Int_t cut = 0, Option_t *option = "QNR"); // *MENU*
117 Int_t GetBin(Int_t binx, Int_t biny, Int_t binz) const override;
118 using TH1::GetBinContent;
121 using TH1::GetBinErrorUp;
126 virtual Double_t GetCovariance(Int_t axis1=1,Int_t axis2=2) const;
127 virtual void GetRandom3(Double_t &x, Double_t &y, Double_t &, TRandom * rng = nullptr, Option_t *option = "");
128 void GetStats(Double_t *stats) const override;
129 Double_t Integral(Option_t *option="") const override;
132 Double_t Interpolate(Double_t x, Double_t y, Double_t z) const override;
133 Double_t KolmogorovTest(const TH1 *h2, Option_t *option="") const override;
134 virtual TH1D *ProjectionX(const char *name="_px", Int_t iymin=0, Int_t iymax=-1, Int_t izmin=0,
135 Int_t izmax=-1, Option_t *option="") const; // *MENU*
136 virtual TH1D *ProjectionY(const char *name="_py", Int_t ixmin=0, Int_t ixmax=-1, Int_t izmin=0,
137 Int_t izmax=-1, Option_t *option="") const; // *MENU*
138 virtual TH1D *ProjectionZ(const char *name="_pz", Int_t ixmin=0, Int_t ixmax=-1, Int_t iymin=0,
139 Int_t iymax=-1, Option_t *option="") const; // *MENU*
140 virtual TH1 *Project3D(Option_t *option="x") const; // *MENU*
141 virtual TProfile2D *Project3DProfile(Option_t *option="xy") const; // *MENU*
142 void PutStats(Double_t *stats) override;
143 TH3 *RebinX(Int_t ngroup = 2, const char *newname = "") override;
144 virtual TH3 *RebinY(Int_t ngroup = 2, const char *newname = "");
145 virtual TH3 *RebinZ(Int_t ngroup = 2, const char *newname = "");
146 virtual TH3 *Rebin3D(Int_t nxgroup = 2, Int_t nygroup = 2, Int_t nzgroup = 2, const char *newname = "");
147 void Reset(Option_t *option="") override;
148 void SetBinContent(Int_t bin, Double_t content) override;
151 virtual void SetShowProjection(const char *option="xy",Int_t nbins=1); // *MENU*
152 virtual TH1 *ShowBackground3D(Int_t nIterX = 20, Int_t nIterY = 20, Int_t nIterZ = 20, Option_t *option = "same");
153
154protected:
155
156 virtual TH1D *DoProject1D(const char* name, const char * title, int imin1, int imax1, int imin2, int imax2,
157 const TAxis* projAxis, const TAxis * axis1, const TAxis * axis2, Option_t * option) const;
158 virtual TH1D *DoProject1D(const char *name, const char *title, const TAxis *projAxis, const TAxis *axis1,
159 const TAxis *axis2, bool computeErrors, bool originalRange, bool useUF, bool useOF, bool useWidth) const;
160 virtual TH2D *DoProject2D(const char* name, const char * title, const TAxis* projX, const TAxis* projY,
161 bool computeErrors, bool originalRange, bool useUF, bool useOF, bool useWidth) const;
162 virtual TProfile2D *DoProjectProfile2D(const char* name, const char * title, const TAxis* projX, const TAxis* projY,
163 bool originalRange, bool useUF, bool useOF, bool useWidth) const;
164
165 // these functions are need to be used inside TProfile3D::DoProjectProfile2D
166 static TH1D *DoProject1D(const TH3 & h, const char* name, const char * title, const TAxis* projX,
167 bool computeErrors, bool originalRange, bool useUF, bool useOF, bool useWidth);
168 static TH2D *DoProject2D(const TH3 & h, const char* name, const char * title, const TAxis* projX, const TAxis* projY,
169 bool computeErrors, bool originalRange, bool useUF, bool useOF, bool useWidth);
170
171 ClassDefOverride(TH3,6) //3-Dim histogram base class
172};
173
174//________________________________________________________________________
175
176class TH3C : public TH3, public TArrayC {
177public:
178 TH3C();
179 TH3C(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
180 ,Int_t nbinsy,Double_t ylow,Double_t yup
182 TH3C(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
183 ,Int_t nbinsy,const Float_t *ybins
184 ,Int_t nbinsz,const Float_t *zbins);
185 TH3C(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
186 ,Int_t nbinsy,const Double_t *ybins
187 ,Int_t nbinsz,const Double_t *zbins);
188 TH3C(const TH3C &h3c);
189 ~TH3C() override;
190
191 void AddBinContent(Int_t bin) override;
192 void AddBinContent(Int_t bin, Double_t w) override;
193 using TH3::AddBinContent;
194 void Copy(TObject &hnew) const override;
195 void Reset(Option_t *option="") override;
196 void SetBinsLength(Int_t n=-1) override;
197
198 TH3C& operator=(const TH3C &h1);
199 friend TH3C operator*(Float_t c1, TH3C const &h1);
200 friend TH3C operator*(TH3C const &h1, Float_t c1);
201 friend TH3C operator+(TH3C const &h1, TH3C const &h2);
202 friend TH3C operator-(TH3C const &h1, TH3C const &h2);
203 friend TH3C operator*(TH3C const &h1, TH3C const &h2);
204 friend TH3C operator/(TH3C const &h1, TH3C const &h2);
205
206protected:
207 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
208 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Char_t (content); }
209
210 ClassDefOverride(TH3C,4) //3-Dim histograms (one char per channel)
211};
212
213TH3C operator*(Float_t c1, TH3C const &h1);
215{
216 return operator*(c1, h1);
217}
218TH3C operator+(TH3C const &h1, TH3C const &h2);
219TH3C operator-(TH3C const &h1, TH3C const &h2);
220TH3C operator*(TH3C const &h1, TH3C const &h2);
221TH3C operator/(TH3C const &h1, TH3C const &h2);
222//________________________________________________________________________
223
224class TH3S : public TH3, public TArrayS {
225public:
226 TH3S();
227 TH3S(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
228 ,Int_t nbinsy,Double_t ylow,Double_t yup
230 TH3S(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
231 ,Int_t nbinsy,const Float_t *ybins
232 ,Int_t nbinsz,const Float_t *zbins);
233 TH3S(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
234 ,Int_t nbinsy,const Double_t *ybins
235 ,Int_t nbinsz,const Double_t *zbins);
236 TH3S(const TH3S &h3s);
237 ~TH3S() override;
238
239 void AddBinContent(Int_t bin) override;
240 void AddBinContent(Int_t bin, Double_t w) override;
241 using TH3::AddBinContent;
242 void Copy(TObject &hnew) const override;
243 void Reset(Option_t *option="") override;
244 void SetBinsLength(Int_t n=-1) override;
245
246 TH3S& operator=(const TH3S &h1);
247 friend TH3S operator*(Float_t c1, TH3S const &h1);
248 friend TH3S operator*(TH3S const &h1, Float_t c1);
249 friend TH3S operator+(TH3S const &h1, TH3S const &h2);
250 friend TH3S operator-(TH3S const &h1, TH3S const &h2);
251 friend TH3S operator*(TH3S const &h1, TH3S const &h2);
252 friend TH3S operator/(TH3S const &h1, TH3S const &h2);
253
254protected:
255 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
256 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Short_t (content); }
257
258 ClassDefOverride(TH3S,4) //3-Dim histograms (one short per channel)
259};
260
261TH3S operator*(Float_t c1, TH3S const &h1);
263{
264 return operator*(c1, h1);
265}
266TH3S operator+(TH3S const &h1, TH3S const &h2);
267TH3S operator-(TH3S const &h1, TH3S const &h2);
268TH3S operator*(TH3S const &h1, TH3S const &h2);
269TH3S operator/(TH3S const &h1, TH3S const &h2);
270
271//________________________________________________________________________
272
273class TH3I : public TH3, public TArrayI {
274public:
275 TH3I();
276 TH3I(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
277 ,Int_t nbinsy,Double_t ylow,Double_t yup
279 TH3I(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
280 ,Int_t nbinsy,const Float_t *ybins
281 ,Int_t nbinsz,const Float_t *zbins);
282 TH3I(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
283 ,Int_t nbinsy,const Double_t *ybins
284 ,Int_t nbinsz,const Double_t *zbins);
285 TH3I(const TH3I &h3i);
286 ~TH3I() override;
287
288 void AddBinContent(Int_t bin) override;
289 void AddBinContent(Int_t bin, Double_t w) override;
290 using TH3::AddBinContent;
291 void Copy(TObject &hnew) const override;
292 void Reset(Option_t *option="") override;
293 void SetBinsLength(Int_t n=-1) override;
294
295 TH3I& operator=(const TH3I &h1);
296 friend TH3I operator*(Float_t c1, TH3I const &h1);
297 friend TH3I operator*(TH3I const &h1, Float_t c1);
298 friend TH3I operator+(TH3I const &h1, TH3I const &h2);
299 friend TH3I operator-(TH3I const &h1, TH3I const &h2);
300 friend TH3I operator*(TH3I const &h1, TH3I const &h2);
301 friend TH3I operator/(TH3I const &h1, TH3I const &h2);
302
303protected:
304 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
305 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Int_t (content); }
306
307 ClassDefOverride(TH3I,4) //3-Dim histograms (one 32 bit integer per channel)
308};
309
310TH3I operator*(Float_t c1, TH3I const &h1);
312{
313 return operator*(c1, h1);
314}
315TH3I operator+(TH3I const &h1, TH3I const &h2);
316TH3I operator-(TH3I const &h1, TH3I const &h2);
317TH3I operator*(TH3I const &h1, TH3I const &h2);
318TH3I operator/(TH3I const &h1, TH3I const &h2);
319
320//________________________________________________________________________
321
322class TH3L : public TH3, public TArrayL64 {
323public:
324 TH3L();
325 TH3L(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
326 ,Int_t nbinsy,Double_t ylow,Double_t yup
328 TH3L(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
329 ,Int_t nbinsy,const Float_t *ybins
330 ,Int_t nbinsz,const Float_t *zbins);
331 TH3L(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
332 ,Int_t nbinsy,const Double_t *ybins
333 ,Int_t nbinsz,const Double_t *zbins);
334 TH3L(const TH3L &h3l);
335 ~TH3L() override;
336 void AddBinContent(Int_t bin) override;
337 void AddBinContent(Int_t bin, Double_t w) override;
338 using TH3::AddBinContent;
339 void Copy(TObject &hnew) const override;
340 void Reset(Option_t *option="") override;
341 void SetBinsLength(Int_t n=-1) override;
342 TH3L& operator=(const TH3L &h1);
343 friend TH3L operator*(Float_t c1, TH3L const &h1);
344 friend TH3L operator*(TH3L const &h1, Float_t c1);
345 friend TH3L operator+(TH3L const &h1, TH3L const &h2);
346 friend TH3L operator-(TH3L const &h1, TH3L const &h2);
347 friend TH3L operator*(TH3L const &h1, TH3L const &h2);
348 friend TH3L operator/(TH3L const &h1, TH3L const &h2);
349
350protected:
351 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
352 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Long64_t (content); }
353
354 ClassDefOverride(TH3L,0) //3-Dim histograms (one 64 bit integer per channel)
355};
356
357TH3L operator*(Float_t c1, TH3L const &h1);
359{
360 return operator*(c1, h1);
361}
362TH3L operator+(TH3L const &h1, TH3L const &h2);
363TH3L operator-(TH3L const &h1, TH3L const &h2);
364TH3L operator*(TH3L const &h1, TH3L const &h2);
365TH3L operator/(TH3L const &h1, TH3L const &h2);
366
367//________________________________________________________________________
368
369class TH3F : public TH3, public TArrayF {
370public:
371 TH3F();
372 TH3F(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
373 ,Int_t nbinsy,Double_t ylow,Double_t yup
375 TH3F(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
376 ,Int_t nbinsy,const Float_t *ybins
377 ,Int_t nbinsz,const Float_t *zbins);
378 TH3F(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
379 ,Int_t nbinsy,const Double_t *ybins
380 ,Int_t nbinsz,const Double_t *zbins);
381 TH3F(const TH3F &h3f);
382 ~TH3F() override;
383
384 /// Increment bin content by 1.
385 /// Passing an out-of-range bin leads to undefined behavior
386 void AddBinContent(Int_t bin) override {++fArray[bin];}
387 /// Increment bin content by a weight w.
388 /// \warning The value of w is cast to `Float_t` before being added.
389 /// Passing an out-of-range bin leads to undefined behavior
390 void AddBinContent(Int_t bin, Double_t w) override
391 {fArray[bin] += Float_t (w);}
392 using TH3::AddBinContent;
393 void Copy(TObject &hnew) const override;
394 void Reset(Option_t *option="") override;
395 void SetBinsLength(Int_t n=-1) override;
396
397 TH3F& operator=(const TH3F &h1);
398 friend TH3F operator*(Float_t c1, TH3F const &h1);
399 friend TH3F operator*(TH3F const &h1, Float_t c1);
400 friend TH3F operator+(TH3F const &h1, TH3F const &h2);
401 friend TH3F operator-(TH3F const &h1, TH3F const &h2);
402 friend TH3F operator*(TH3F const &h1, TH3F const &h2);
403 friend TH3F operator/(TH3F const &h1, TH3F const &h2);
404
405protected:
406 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
407 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Float_t (content); }
408
409 ClassDefOverride(TH3F,4) //3-Dim histograms (one float per channel)
410};
411
412TH3F operator*(Float_t c1, TH3F const &h1);
414{
415 return operator*(c1, h1);
416}
417TH3F operator+(TH3F const &h1, TH3F const &h2);
418TH3F operator-(TH3F const &h1, TH3F const &h2);
419TH3F operator*(TH3F const &h1, TH3F const &h2);
420TH3F operator/(TH3F const &h1, TH3F const &h2);
421
422//________________________________________________________________________
423
424class TH3D : public TH3, public TArrayD {
425public:
426 TH3D();
427 TH3D(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
428 ,Int_t nbinsy,Double_t ylow,Double_t yup
430 TH3D(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
431 ,Int_t nbinsy,const Float_t *ybins
432 ,Int_t nbinsz,const Float_t *zbins);
433 TH3D(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
434 ,Int_t nbinsy,const Double_t *ybins
435 ,Int_t nbinsz,const Double_t *zbins);
436 TH3D(const TH3D &h3d);
437 ~TH3D() override;
438
439 /// Increment bin content by 1.
440 /// Passing an out-of-range bin leads to undefined behavior
441 void AddBinContent(Int_t bin) override {++fArray[bin];}
442 /// Increment bin content by a weight w
443 /// Passing an out-of-range bin leads to undefined behavior
444 void AddBinContent(Int_t bin, Double_t w) override
445 {fArray[bin] += Double_t (w);}
446 using TH3::AddBinContent;
447 void Copy(TObject &hnew) const override;
448 void Reset(Option_t *option="") override;
449 void SetBinsLength(Int_t n=-1) override;
450
451 TH3D& operator=(const TH3D &h1);
452 friend TH3D operator*(Float_t c1, TH3D const &h1);
453 friend TH3D operator*(TH3D const &h1, Float_t c1);
454 friend TH3D operator+(TH3D const &h1, TH3D const &h2);
455 friend TH3D operator-(TH3D const &h1, TH3D const &h2);
456 friend TH3D operator*(TH3D const &h1, TH3D const &h2);
457 friend TH3D operator/(TH3D const &h1, TH3D const &h2);
458
459protected:
460 Double_t RetrieveBinContent(Int_t bin) const override { return fArray[bin]; }
461 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = content; }
462private:
463#ifdef TH3D_FILL_THREADSAFE
464 void FillThreadSafe(Double_t x, Double_t y, Double_t z, Double_t w = 1.);
465 template <typename T, typename... Args>
466 friend auto ROOT::Internal::FillThreadSafe(T &histo, Args... args)
467 -> decltype(histo.FillThreadSafe(args...), void());
468#endif
469
470 ClassDefOverride(TH3D,4) //3-Dim histograms (one double per channel)
471};
472
473TH3D operator*(Float_t c1, TH3D const &h1);
475{
476 return operator*(c1, h1);
477}
478TH3D operator+(TH3D const &h1, TH3D const &h2);
479TH3D operator-(TH3D const &h1, TH3D const &h2);
480TH3D operator*(TH3D const &h1, TH3D const &h2);
481TH3D operator/(TH3D const &h1, TH3D const &h2);
482
483#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:3776
TH3C operator-(TH3C const &h1, TH3C const &h2)
Operator -.
Definition TH3.cxx:3800
TH3C operator+(TH3C const &h1, TH3C const &h2)
Operator +.
Definition TH3.cxx:3788
TH3C operator/(TH3C const &h1, TH3C const &h2)
Operator /.
Definition TH3.cxx:3824
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:3514
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:8024
virtual Double_t GetBinErrorLow(Int_t bin) const
Return lower error associated to bin number bin.
Definition TH1.cxx:9136
virtual Double_t Integral(Option_t *option="") const
Return integral of bin contents.
Definition TH1.cxx:7997
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Definition TH1.cxx:5081
virtual Double_t GetBinErrorUp(Int_t bin) const
Return upper error associated to bin number bin.
Definition TH1.cxx:9167
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:176
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH3.cxx:3692
friend TH3C operator*(Float_t c1, TH3C const &h1)
Operator *.
Definition TH3.cxx:3776
~TH3C() override
Destructor.
Definition TH3.cxx:3585
friend TH3C operator-(TH3C const &h1, TH3C const &h2)
Operator -.
Definition TH3.cxx:3800
void Reset(Option_t *option="") override
Reset this histogram: contents, errors, etc.
Definition TH3.cxx:3680
friend TH3C operator+(TH3C const &h1, TH3C const &h2)
Operator +.
Definition TH3.cxx:3788
friend TH3C operator/(TH3C const &h1, TH3C const &h2)
Operator /.
Definition TH3.cxx:3824
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:207
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH3.cxx:3648
TH3C & operator=(const TH3C &h1)
Operator =.
Definition TH3.cxx:3765
TH3C()
Constructor.
Definition TH3.cxx:3575
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:208
void Copy(TObject &hnew) const override
Copy this 3-D histogram structure to newth3.
Definition TH3.cxx:3671
3-D histogram with a double per channel (see TH1 documentation)
Definition TH3.h:424
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:461
TH3D()
Constructor.
Definition TH3.cxx:4709
friend TH3D operator+(TH3D const &h1, TH3D const &h2)
Operator +.
Definition TH3.cxx:4871
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH3.cxx:4803
~TH3D() override
Destructor.
Definition TH3.cxx:4719
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:444
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:460
friend TH3D operator-(TH3D const &h1, TH3D const &h2)
Operator -.
Definition TH3.cxx:4883
friend TH3D operator/(TH3D const &h1, TH3D const &h2)
Operator /.
Definition TH3.cxx:4907
friend TH3D operator*(Float_t c1, TH3D const &h1)
Operator *.
Definition TH3.cxx:4859
void Copy(TObject &hnew) const override
Copy this 3-D histogram structure to newth3.
Definition TH3.cxx:4782
TH3D & operator=(const TH3D &h1)
Operator =.
Definition TH3.cxx:4847
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH3.h:441
3-D histogram with a float per channel (see TH1 documentation)
Definition TH3.h:369
friend TH3F operator/(TH3F const &h1, TH3F const &h2)
Operator /.
Definition TH3.cxx:4690
TH3F & operator=(const TH3F &h1)
Operator =.
Definition TH3.cxx:4631
friend TH3F operator+(TH3F const &h1, TH3F const &h2)
Operator +.
Definition TH3.cxx:4654
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH3.h:386
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:407
void AddBinContent(Int_t bin, Double_t w) override
Increment bin content by a weight w.
Definition TH3.h:390
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH3.cxx:4587
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:406
TH3F()
Constructor.
Definition TH3.cxx:4494
~TH3F() override
Destructor.
Definition TH3.cxx:4504
friend TH3F operator-(TH3F const &h1, TH3F const &h2)
Operator -.
Definition TH3.cxx:4666
void Copy(TObject &hnew) const override
Copy this 3-D histogram structure to newth3.
Definition TH3.cxx:4566
friend TH3F operator*(Float_t c1, TH3F const &h1)
Operator *.
Definition TH3.cxx:4642
3-D histogram with an int per channel (see TH1 documentation)
Definition TH3.h:273
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:304
TH3I & operator=(const TH3I &h1)
Operator =.
Definition TH3.cxx:4210
friend TH3I operator+(TH3I const &h1, TH3I const &h2)
Operator +.
Definition TH3.cxx:4233
friend TH3I operator-(TH3I const &h1, TH3I const &h2)
Operator _.
Definition TH3.cxx:4245
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH3.cxx:4155
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:305
TH3I()
Constructor.
Definition TH3.cxx:4082
void Copy(TObject &hnew) const override
Copy this 3-D histogram structure to newth3.
Definition TH3.cxx:4178
friend TH3I operator*(Float_t c1, TH3I const &h1)
Operator *.
Definition TH3.cxx:4221
friend TH3I operator/(TH3I const &h1, TH3I const &h2)
Operator /.
Definition TH3.cxx:4269
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH3.cxx:4199
~TH3I() override
Destructor.
Definition TH3.cxx:4092
3-D histogram with a long64 per channel (see TH1 documentation)
Definition TH3.h:322
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:352
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:351
void Copy(TObject &hnew) const override
Copy this 3-D histogram structure to newth3.
Definition TH3.cxx:4384
TH3L & operator=(const TH3L &h1)
Operator =.
Definition TH3.cxx:4416
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH3.cxx:4361
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH3.cxx:4405
friend TH3L operator+(TH3L const &h1, TH3L const &h2)
Operator +.
Definition TH3.cxx:4439
~TH3L() override
Destructor.
Definition TH3.cxx:4298
TH3L()
Constructor.
Definition TH3.cxx:4288
friend TH3L operator*(Float_t c1, TH3L const &h1)
Operator *.
Definition TH3.cxx:4427
friend TH3L operator-(TH3L const &h1, TH3L const &h2)
Operator _.
Definition TH3.cxx:4451
friend TH3L operator/(TH3L const &h1, TH3L const &h2)
Operator /.
Definition TH3.cxx:4475
3-D histogram with a short per channel (see TH1 documentation)
Definition TH3.h:224
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH3.cxx:3960
friend TH3S operator+(TH3S const &h1, TH3S const &h2)
Operator +.
Definition TH3.cxx:4027
friend TH3S operator/(TH3S const &h1, TH3S const &h2)
Operator /.
Definition TH3.cxx:4063
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH3.cxx:3916
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:256
~TH3S() override
Destructor.
Definition TH3.cxx:3853
void Copy(TObject &hnew) const override
Copy this 3-D histogram structure to newth3.
Definition TH3.cxx:3939
friend TH3S operator*(Float_t c1, TH3S const &h1)
Operator *.
Definition TH3.cxx:4015
friend TH3S operator-(TH3S const &h1, TH3S const &h2)
Operator -.
Definition TH3.cxx:4039
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:255
TH3S & operator=(const TH3S &h1)
Operator =.
Definition TH3.cxx:4004
TH3S()
Constructor.
Definition TH3.cxx:3843
The 3-D histogram classes derived from the 1-D histogram classes.
Definition TH3.h:45
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:3003
Int_t BufferFill(Double_t, Double_t) override
accumulate arguments in buffer.
Definition TH3.h:70
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:48
Int_t Fill(const char *, const char *, Double_t)
Definition TH3.h:77
virtual Int_t BufferFill(Double_t, Double_t, Double_t)
Definition TH3.h:71
Double_t fTsumwy2
Total Sum of weight*Y*Y.
Definition TH3.h:49
virtual Double_t GetCovariance(Int_t axis1=1, Int_t axis2=2) const
Return covariance between axis1 and axis2.
Definition TH3.cxx:1234
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:1334
void Copy(TObject &hnew) const override
Copy.
Definition TH3.cxx:210
Double_t fTsumwxz
Total Sum of weight*X*Z.
Definition TH3.h:53
virtual Double_t GetBinErrorUp(Int_t binx, Int_t biny, Int_t binz)
Definition TH3.h:123
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:1559
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:1813
Int_t Fill(const char *, Double_t) override
Increment bin with namex with a weight w.
Definition TH3.h:74
Double_t Interpolate(Double_t x, Double_t y) const override
Not yet implemented.
Definition TH3.cxx:1468
void AddBinContent(Int_t binx, Int_t biny, Int_t binz)
Increment 3D bin content by 1.
Definition TH3.h:95
void Reset(Option_t *option="") override
Reset this histogram: contents, errors, etc.
Definition TH3.cxx:3495
~TH3() override
Destructor.
Definition TH3.cxx:202
Int_t Fill(Double_t) override
Invalid Fill method.
Definition TH3.cxx:343
virtual TH3 * RebinY(Int_t ngroup=2, const char *newname="")
Rebin only the Y axis see Rebin3D.
Definition TH3.cxx:2962
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:1448
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:1848
void SetBinContent(Int_t binx, Int_t biny, Int_t binz, Double_t content) override
Definition TH3.h:150
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:1777
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:2850
Double_t fTsumwz2
Total Sum of weight*Z*Z.
Definition TH3.h:52
Double_t fTsumwxy
Total Sum of weight*X*Y.
Definition TH3.h:50
Int_t Fill(Double_t, Double_t) override
Increment bin with abscissa X with a weight w.
Definition TH3.h:73
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:2450
virtual Double_t GetBinErrorLow(Int_t binx, Int_t biny, Int_t binz)
Definition TH3.h:122
Int_t Fill(Double_t, const char *, Double_t)
Definition TH3.h:75
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:98
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:1176
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:2140
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:2591
virtual TH3 * RebinZ(Int_t ngroup=2, const char *newname="")
Rebin only the Z axis see Rebin3D.
Definition TH3.cxx:2972
Double_t Integral(Option_t *option="") const override
Return integral of bin contents.
Definition TH3.cxx:1417
virtual Int_t BufferFill(Double_t x, Double_t y, Double_t z, Double_t w)
Accumulate arguments in buffer.
Definition TH3.cxx:314
void FillRandom(TF1 *f1, Int_t ntimes=5000, TRandom *rng=nullptr) override
Fill histogram following distribution in function fname.
Definition TH3.cxx:861
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:1285
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:3721
Int_t Fill(const char *, Double_t, Double_t)
Definition TH3.h:76
TH3 * RebinX(Int_t ngroup=2, const char *newname="") override
Rebin only the X axis see Rebin3D.
Definition TH3.cxx:2952
virtual Double_t GetCorrelationFactor(Int_t axis1=1, Int_t axis2=2) const
Return correlation factor between axis1 and axis2.
Definition TH3.cxx:1216
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:1865
TH3(const TH3 &)=delete
Double_t fTsumwz
Total Sum of weight*Z.
Definition TH3.h:51
Double_t GetBinContent(Int_t binx, Int_t biny, Int_t binz) const override
Definition TH3.h:119
void SetBinContent(Int_t bin, Double_t content) override
Set bin content.
Definition TH3.cxx:3514
void SetBinContent(Int_t bin, Int_t, Double_t content) override
Definition TH3.h:149
Double_t fTsumwyz
Total Sum of weight*Y*Z.
Definition TH3.h:54
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:1142
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:1003
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:4919
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:2617
void PutStats(Double_t *stats) override
Replace current statistics with the values in array stats.
Definition TH3.cxx:2935
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:39