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
148protected:
149
150 virtual TH1D *DoProject1D(const char* name, const char * title, int imin1, int imax1, int imin2, int imax2,
151 const TAxis* projAxis, const TAxis * axis1, const TAxis * axis2, Option_t * option) const;
152 virtual TH1D *DoProject1D(const char *name, const char *title, const TAxis *projAxis, const TAxis *axis1,
153 const TAxis *axis2, bool computeErrors, bool originalRange, bool useUF, bool useOF) const;
154 virtual TH2D *DoProject2D(const char* name, const char * title, const TAxis* projX, const TAxis* projY,
155 bool computeErrors, bool originalRange, bool useUF, bool useOF) const;
156 virtual TProfile2D *DoProjectProfile2D(const char* name, const char * title, const TAxis* projX, const TAxis* projY,
157 bool originalRange, bool useUF, bool useOF) const;
158
159 // these functions are need to be used inside TProfile3D::DoProjectProfile2D
160 static TH1D *DoProject1D(const TH3 & h, const char* name, const char * title, const TAxis* projX,
161 bool computeErrors, bool originalRange, bool useUF, bool useOF);
162 static TH2D *DoProject2D(const TH3 & h, const char* name, const char * title, const TAxis* projX, const TAxis* projY,
163 bool computeErrors, bool originalRange, bool useUF, bool useOF);
164
165 ClassDefOverride(TH3,6) //3-Dim histogram base class
166};
167
168//________________________________________________________________________
169
170class TH3C : public TH3, public TArrayC {
171public:
172 TH3C();
173 TH3C(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
174 ,Int_t nbinsy,Double_t ylow,Double_t yup
176 TH3C(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
177 ,Int_t nbinsy,const Float_t *ybins
178 ,Int_t nbinsz,const Float_t *zbins);
179 TH3C(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
180 ,Int_t nbinsy,const Double_t *ybins
181 ,Int_t nbinsz,const Double_t *zbins);
182 TH3C(const TH3C &h3c);
183 ~TH3C() override;
184
185 void AddBinContent(Int_t bin) override;
186 void AddBinContent(Int_t bin, Double_t w) override;
187 using TH3::AddBinContent;
188 void Copy(TObject &hnew) const override;
189 void Reset(Option_t *option="") override;
190 void SetBinsLength(Int_t n=-1) override;
191
192 TH3C& operator=(const TH3C &h1);
193 friend TH3C operator*(Float_t c1, TH3C const &h1);
194 friend TH3C operator*(TH3C const &h1, Float_t c1);
195 friend TH3C operator+(TH3C const &h1, TH3C const &h2);
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
200protected:
201 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
202 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Char_t (content); }
203
204 ClassDefOverride(TH3C,4) //3-Dim histograms (one char per channel)
205};
206
207TH3C operator*(Float_t c1, TH3C const &h1);
209{
210 return operator*(c1, h1);
211}
212TH3C operator+(TH3C const &h1, TH3C const &h2);
213TH3C operator-(TH3C const &h1, TH3C const &h2);
214TH3C operator*(TH3C const &h1, TH3C const &h2);
215TH3C operator/(TH3C const &h1, TH3C const &h2);
216//________________________________________________________________________
217
218class TH3S : public TH3, public TArrayS {
219public:
220 TH3S();
221 TH3S(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
222 ,Int_t nbinsy,Double_t ylow,Double_t yup
224 TH3S(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
225 ,Int_t nbinsy,const Float_t *ybins
226 ,Int_t nbinsz,const Float_t *zbins);
227 TH3S(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
228 ,Int_t nbinsy,const Double_t *ybins
229 ,Int_t nbinsz,const Double_t *zbins);
230 TH3S(const TH3S &h3s);
231 ~TH3S() override;
232
233 void AddBinContent(Int_t bin) override;
234 void AddBinContent(Int_t bin, Double_t w) override;
235 using TH3::AddBinContent;
236 void Copy(TObject &hnew) const override;
237 void Reset(Option_t *option="") override;
238 void SetBinsLength(Int_t n=-1) override;
239
240 TH3S& operator=(const TH3S &h1);
241 friend TH3S operator*(Float_t c1, TH3S const &h1);
242 friend TH3S operator*(TH3S const &h1, Float_t c1);
243 friend TH3S operator+(TH3S const &h1, TH3S const &h2);
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
248protected:
249 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
250 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Short_t (content); }
251
252 ClassDefOverride(TH3S,4) //3-Dim histograms (one short per channel)
253};
254
255TH3S operator*(Float_t c1, TH3S const &h1);
257{
258 return operator*(c1, h1);
259}
260TH3S operator+(TH3S const &h1, TH3S const &h2);
261TH3S operator-(TH3S const &h1, TH3S const &h2);
262TH3S operator*(TH3S const &h1, TH3S const &h2);
263TH3S operator/(TH3S const &h1, TH3S const &h2);
264
265//________________________________________________________________________
266
267class TH3I : public TH3, public TArrayI {
268public:
269 TH3I();
270 TH3I(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
271 ,Int_t nbinsy,Double_t ylow,Double_t yup
273 TH3I(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
274 ,Int_t nbinsy,const Float_t *ybins
275 ,Int_t nbinsz,const Float_t *zbins);
276 TH3I(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
277 ,Int_t nbinsy,const Double_t *ybins
278 ,Int_t nbinsz,const Double_t *zbins);
279 TH3I(const TH3I &h3i);
280 ~TH3I() override;
281
282 void AddBinContent(Int_t bin) override;
283 void AddBinContent(Int_t bin, Double_t w) override;
284 using TH3::AddBinContent;
285 void Copy(TObject &hnew) const override;
286 void Reset(Option_t *option="") override;
287 void SetBinsLength(Int_t n=-1) override;
288
289 TH3I& operator=(const TH3I &h1);
290 friend TH3I operator*(Float_t c1, TH3I const &h1);
291 friend TH3I operator*(TH3I const &h1, Float_t c1);
292 friend TH3I operator+(TH3I const &h1, TH3I const &h2);
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
297protected:
298 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
299 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Int_t (content); }
300
301 ClassDefOverride(TH3I,4) //3-Dim histograms (one 32 bit integer per channel)
302};
303
304TH3I operator*(Float_t c1, TH3I const &h1);
306{
307 return operator*(c1, h1);
308}
309TH3I operator+(TH3I const &h1, TH3I const &h2);
310TH3I operator-(TH3I const &h1, TH3I const &h2);
311TH3I operator*(TH3I const &h1, TH3I const &h2);
312TH3I operator/(TH3I const &h1, TH3I const &h2);
313
314//________________________________________________________________________
315
316class TH3L : public TH3, public TArrayL64 {
317public:
318 TH3L();
319 TH3L(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
320 ,Int_t nbinsy,Double_t ylow,Double_t yup
322 TH3L(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
323 ,Int_t nbinsy,const Float_t *ybins
324 ,Int_t nbinsz,const Float_t *zbins);
325 TH3L(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
326 ,Int_t nbinsy,const Double_t *ybins
327 ,Int_t nbinsz,const Double_t *zbins);
328 TH3L(const TH3L &h3l);
329 ~TH3L() override;
330 void AddBinContent(Int_t bin) override;
331 void AddBinContent(Int_t bin, Double_t w) override;
332 using TH3::AddBinContent;
333 void Copy(TObject &hnew) const override;
334 void Reset(Option_t *option="") override;
335 void SetBinsLength(Int_t n=-1) override;
336 TH3L& operator=(const TH3L &h1);
337 friend TH3L operator*(Float_t c1, TH3L const &h1);
338 friend TH3L operator*(TH3L const &h1, Float_t c1);
339 friend TH3L operator+(TH3L const &h1, TH3L const &h2);
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
344protected:
345 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
346 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Int_t (content); }
347
348 ClassDefOverride(TH3L,0) //3-Dim histograms (one 64 bit integer per channel)
349};
350
351TH3L operator*(Float_t c1, TH3L const &h1);
353{
354 return operator*(c1, h1);
355}
356TH3L operator+(TH3L const &h1, TH3L const &h2);
357TH3L operator-(TH3L const &h1, TH3L const &h2);
358TH3L operator*(TH3L const &h1, TH3L const &h2);
359TH3L operator/(TH3L const &h1, TH3L const &h2);
360
361//________________________________________________________________________
362
363class TH3F : public TH3, public TArrayF {
364public:
365 TH3F();
366 TH3F(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
367 ,Int_t nbinsy,Double_t ylow,Double_t yup
369 TH3F(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
370 ,Int_t nbinsy,const Float_t *ybins
371 ,Int_t nbinsz,const Float_t *zbins);
372 TH3F(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
373 ,Int_t nbinsy,const Double_t *ybins
374 ,Int_t nbinsz,const Double_t *zbins);
375 TH3F(const TH3F &h3f);
376 ~TH3F() override;
377
378 /// Increment bin content by 1.
379 /// Passing an out-of-range bin leads to undefined behavior
380 void AddBinContent(Int_t bin) override {++fArray[bin];}
381 /// Increment bin content by a weight w.
382 /// \warning The value of w is cast to `Float_t` before being added.
383 /// Passing an out-of-range bin leads to undefined behavior
384 void AddBinContent(Int_t bin, Double_t w) override
385 {fArray[bin] += Float_t (w);}
386 using TH3::AddBinContent;
387 void Copy(TObject &hnew) const override;
388 void Reset(Option_t *option="") override;
389 void SetBinsLength(Int_t n=-1) override;
390
391 TH3F& operator=(const TH3F &h1);
392 friend TH3F operator*(Float_t c1, TH3F const &h1);
393 friend TH3F operator*(TH3F const &h1, Float_t c1);
394 friend TH3F operator+(TH3F const &h1, TH3F const &h2);
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
399protected:
400 Double_t RetrieveBinContent(Int_t bin) const override { return Double_t (fArray[bin]); }
401 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = Float_t (content); }
402
403 ClassDefOverride(TH3F,4) //3-Dim histograms (one float per channel)
404};
405
406TH3F operator*(Float_t c1, TH3F const &h1);
408{
409 return operator*(c1, h1);
410}
411TH3F operator+(TH3F const &h1, TH3F const &h2);
412TH3F operator-(TH3F const &h1, TH3F const &h2);
413TH3F operator*(TH3F const &h1, TH3F const &h2);
414TH3F operator/(TH3F const &h1, TH3F const &h2);
415
416//________________________________________________________________________
417
418class TH3D : public TH3, public TArrayD {
419public:
420 TH3D();
421 TH3D(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup
422 ,Int_t nbinsy,Double_t ylow,Double_t yup
424 TH3D(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins
425 ,Int_t nbinsy,const Float_t *ybins
426 ,Int_t nbinsz,const Float_t *zbins);
427 TH3D(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins
428 ,Int_t nbinsy,const Double_t *ybins
429 ,Int_t nbinsz,const Double_t *zbins);
430 TH3D(const TH3D &h3d);
431 ~TH3D() override;
432
433 /// Increment bin content by 1.
434 /// Passing an out-of-range bin leads to undefined behavior
435 void AddBinContent(Int_t bin) override {++fArray[bin];}
436 /// Increment bin content by a weight w
437 /// Passing an out-of-range bin leads to undefined behavior
438 void AddBinContent(Int_t bin, Double_t w) override
439 {fArray[bin] += Double_t (w);}
440 using TH3::AddBinContent;
441 void Copy(TObject &hnew) const override;
442 void Reset(Option_t *option="") override;
443 void SetBinsLength(Int_t n=-1) override;
444
445 TH3D& operator=(const TH3D &h1);
446 friend TH3D operator*(Float_t c1, TH3D const &h1);
447 friend TH3D operator*(TH3D const &h1, Float_t c1);
448 friend TH3D operator+(TH3D const &h1, TH3D const &h2);
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
453protected:
454 Double_t RetrieveBinContent(Int_t bin) const override { return fArray[bin]; }
455 void UpdateBinContent(Int_t bin, Double_t content) override { fArray[bin] = content; }
456private:
457#ifdef __cpp_lib_atomic_ref
458 void FillThreadSafe(Double_t x, Double_t y, Double_t z, Double_t w = 1.);
459 template <typename T, typename... Args>
460 friend auto ROOT::Internal::FillThreadSafe(T &histo, Args... args)
461 -> decltype(histo.FillThreadSafe(args...), void());
462#endif
463
464 ClassDefOverride(TH3D,4) //3-Dim histograms (one double per channel)
465};
466
467TH3D operator*(Float_t c1, TH3D const &h1);
469{
470 return operator*(c1, h1);
471}
472TH3D operator+(TH3D const &h1, TH3D const &h2);
473TH3D operator-(TH3D const &h1, TH3D const &h2);
474TH3D operator*(TH3D const &h1, TH3D const &h2);
475TH3D operator/(TH3D const &h1, TH3D const &h2);
476
477#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
TH3C operator*(Float_t c1, TH3C const &h1)
Operator *.
Definition TH3.cxx:3748
TH3C operator-(TH3C const &h1, TH3C const &h2)
Operator -.
Definition TH3.cxx:3772
TH3C operator+(TH3C const &h1, TH3C const &h2)
Operator +.
Definition TH3.cxx:3760
TH3C operator/(TH3C const &h1, TH3C const &h2)
Operator /.
Definition TH3.cxx:3796
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: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 double per channel (see TH1 documentation)
Definition TH2.h:400
3-D histogram with a byte per channel (see TH1 documentation)
Definition TH3.h:170
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH3.cxx:3664
friend TH3C operator*(Float_t c1, TH3C const &h1)
Operator *.
Definition TH3.cxx:3748
~TH3C() override
Destructor.
Definition TH3.cxx:3557
friend TH3C operator-(TH3C const &h1, TH3C const &h2)
Operator -.
Definition TH3.cxx:3772
void Reset(Option_t *option="") override
Reset this histogram: contents, errors, etc.
Definition TH3.cxx:3652
friend TH3C operator+(TH3C const &h1, TH3C const &h2)
Operator +.
Definition TH3.cxx:3760
friend TH3C operator/(TH3C const &h1, TH3C const &h2)
Operator /.
Definition TH3.cxx:3796
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:201
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH3.cxx:3620
TH3C & operator=(const TH3C &h1)
Operator =.
Definition TH3.cxx:3737
TH3C()
Constructor.
Definition TH3.cxx:3547
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:202
void Copy(TObject &hnew) const override
Copy this 3-D histogram structure to newth3.
Definition TH3.cxx:3643
3-D histogram with a double per channel (see TH1 documentation)
Definition TH3.h:418
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:455
TH3D()
Constructor.
Definition TH3.cxx:4681
friend TH3D operator+(TH3D const &h1, TH3D const &h2)
Operator +.
Definition TH3.cxx:4843
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH3.cxx:4775
~TH3D() override
Destructor.
Definition TH3.cxx:4691
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:438
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:454
friend TH3D operator-(TH3D const &h1, TH3D const &h2)
Operator -.
Definition TH3.cxx:4855
friend TH3D operator/(TH3D const &h1, TH3D const &h2)
Operator /.
Definition TH3.cxx:4879
friend TH3D operator*(Float_t c1, TH3D const &h1)
Operator *.
Definition TH3.cxx:4831
void Copy(TObject &hnew) const override
Copy this 3-D histogram structure to newth3.
Definition TH3.cxx:4754
TH3D & operator=(const TH3D &h1)
Operator =.
Definition TH3.cxx:4819
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH3.h:435
3-D histogram with a float per channel (see TH1 documentation)
Definition TH3.h:363
friend TH3F operator/(TH3F const &h1, TH3F const &h2)
Operator /.
Definition TH3.cxx:4662
TH3F & operator=(const TH3F &h1)
Operator =.
Definition TH3.cxx:4603
friend TH3F operator+(TH3F const &h1, TH3F const &h2)
Operator +.
Definition TH3.cxx:4626
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH3.h:380
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:401
void AddBinContent(Int_t bin, Double_t w) override
Increment bin content by a weight w.
Definition TH3.h:384
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH3.cxx:4559
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:400
TH3F()
Constructor.
Definition TH3.cxx:4466
~TH3F() override
Destructor.
Definition TH3.cxx:4476
friend TH3F operator-(TH3F const &h1, TH3F const &h2)
Operator -.
Definition TH3.cxx:4638
void Copy(TObject &hnew) const override
Copy this 3-D histogram structure to newth3.
Definition TH3.cxx:4538
friend TH3F operator*(Float_t c1, TH3F const &h1)
Operator *.
Definition TH3.cxx:4614
3-D histogram with an int per channel (see TH1 documentation)
Definition TH3.h:267
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:298
TH3I & operator=(const TH3I &h1)
Operator =.
Definition TH3.cxx:4182
friend TH3I operator+(TH3I const &h1, TH3I const &h2)
Operator +.
Definition TH3.cxx:4205
friend TH3I operator-(TH3I const &h1, TH3I const &h2)
Operator _.
Definition TH3.cxx:4217
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH3.cxx:4127
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:299
TH3I()
Constructor.
Definition TH3.cxx:4054
void Copy(TObject &hnew) const override
Copy this 3-D histogram structure to newth3.
Definition TH3.cxx:4150
friend TH3I operator*(Float_t c1, TH3I const &h1)
Operator *.
Definition TH3.cxx:4193
friend TH3I operator/(TH3I const &h1, TH3I const &h2)
Operator /.
Definition TH3.cxx:4241
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH3.cxx:4171
~TH3I() override
Destructor.
Definition TH3.cxx:4064
3-D histogram with a long64 per channel (see TH1 documentation)
Definition TH3.h:316
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:346
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:345
void Copy(TObject &hnew) const override
Copy this 3-D histogram structure to newth3.
Definition TH3.cxx:4356
TH3L & operator=(const TH3L &h1)
Operator =.
Definition TH3.cxx:4388
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH3.cxx:4333
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH3.cxx:4377
friend TH3L operator+(TH3L const &h1, TH3L const &h2)
Operator +.
Definition TH3.cxx:4411
~TH3L() override
Destructor.
Definition TH3.cxx:4270
TH3L()
Constructor.
Definition TH3.cxx:4260
friend TH3L operator*(Float_t c1, TH3L const &h1)
Operator *.
Definition TH3.cxx:4399
friend TH3L operator-(TH3L const &h1, TH3L const &h2)
Operator _.
Definition TH3.cxx:4423
friend TH3L operator/(TH3L const &h1, TH3L const &h2)
Operator /.
Definition TH3.cxx:4447
3-D histogram with a short per channel (see TH1 documentation)
Definition TH3.h:218
void SetBinsLength(Int_t n=-1) override
Set total number of bins including under/overflow Reallocate bin contents array.
Definition TH3.cxx:3932
friend TH3S operator+(TH3S const &h1, TH3S const &h2)
Operator +.
Definition TH3.cxx:3999
friend TH3S operator/(TH3S const &h1, TH3S const &h2)
Operator /.
Definition TH3.cxx:4035
void AddBinContent(Int_t bin) override
Increment bin content by 1.
Definition TH3.cxx:3888
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:250
~TH3S() override
Destructor.
Definition TH3.cxx:3825
void Copy(TObject &hnew) const override
Copy this 3-D histogram structure to newth3.
Definition TH3.cxx:3911
friend TH3S operator*(Float_t c1, TH3S const &h1)
Operator *.
Definition TH3.cxx:3987
friend TH3S operator-(TH3S const &h1, TH3S const &h2)
Operator -.
Definition TH3.cxx:4011
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:249
TH3S & operator=(const TH3S &h1)
Operator =.
Definition TH3.cxx:3976
TH3S()
Constructor.
Definition TH3.cxx:3815
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:2975
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
virtual TH2D * DoProject2D(const char *name, const char *title, const TAxis *projX, const TAxis *projY, bool computeErrors, bool originalRange, bool useUF, bool useOF) const
internal method performing the projection to a 2D histogram called from TH3::Project3D
Definition TH3.cxx:2121
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.
Definition TH3.cxx:1798
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:3467
~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:2934
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.
Definition TH3.cxx:1830
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.
Definition TH3.cxx:1765
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:2824
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:2427
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
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:2568
virtual TH3 * RebinZ(Int_t ngroup=2, const char *newname="")
Rebin only the Z axis see Rebin3D.
Definition TH3.cxx:2944
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:3693
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:2924
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:1847
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:3486
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 TProfile2D * DoProjectProfile2D(const char *name, const char *title, const TAxis *projX, const TAxis *projY, bool originalRange, bool useUF, bool useOF) const
internal method to project to a 2D Profile called from TH3::Project3DProfile
Definition TH3.cxx:2594
void PutStats(Double_t *stats) override
Replace current statistics with the values in array stats.
Definition TH3.cxx:2907
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