Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
THnBase.h
Go to the documentation of this file.
1// @(#)root/hist:$Id$
2// Author: Axel Naumann (2011-12-20)
3
4/*************************************************************************
5 * Copyright (C) 1995-2012, 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_THnBase
13#define ROOT_THnBase
14
15/*************************************************************************
16
17 THnBase: Common base class for n-dimensional histogramming.
18 Defines interfaces and algorithms.
19
20*************************************************************************/
21
22
23#include "TNamed.h"
24#include "TMath.h"
25#include "TFitResultPtr.h"
26#include "TObjArray.h"
27#include "TArrayD.h"
28#include <vector>
29
30
31class TAxis;
32class TH1;
33class TH1D;
34class TH2D;
35class TH3D;
36class TF1;
37class THnIter;
38
39namespace ROOT {
40namespace Internal {
41 class THnBaseBinIter;
42}
43}
44
45class THnBase: public TNamed {
46protected:
47 Int_t fNdimensions; ///< Number of dimensions
48 TObjArray fAxes; ///< Axes of the histogram
49 TObjArray fBrowsables; ///<! Browser-helpers for each axis
50 Double_t fEntries; ///< Number of entries, spread over chunks
51 Double_t fTsumw; ///< Total sum of weights
52 Double_t fTsumw2; ///< Total sum of weights squared; -1 if no errors are calculated
53 TArrayD fTsumwx; ///< Total sum of weight*X for each dimension
54 TArrayD fTsumwx2; ///< Total sum of weight*X*X for each dimension
55 std::vector<Double_t> fIntegral; ///<! vector with bin weight sums
56 enum {
60 } fIntegralStatus; ///<! status of integral
61
62 protected:
64
65 THnBase(const char *name, const char *title, Int_t dim, const Int_t *nbins, const Double_t *xmin,
66 const Double_t *xmax);
67
68 THnBase(const char* name, const char* title, const std::vector<TAxis>& axes);
69
70 THnBase(const char *name, const char *title, Int_t dim, const Int_t *nbins,
71 const std::vector<std::vector<double>> &xbins);
72
73 THnBase(const THnBase &other);
74
76
78
80
81 void UpdateXStat(const Double_t *x, Double_t w = 1.)
82 {
83 if (GetCalculateErrors()) {
84 for (Int_t d = 0; d < fNdimensions; ++d) {
85 const Double_t xd = x[d];
86 fTsumwx[d] += w * xd;
87 fTsumwx2[d] += w * xd * xd;
88 }
89 }
90 }
91
92 /// Increment the statistics due to filled weight "w",
94 fEntries += 1;
95 if (GetCalculateErrors()) {
96 fTsumw += w;
97 fTsumw2 += w*w;
98 }
100 }
101
102 virtual void InitStorage(Int_t* nbins, Int_t chunkSize) = 0;
103 void Init(const char* name, const char* title,
104 const TObjArray* axes, Bool_t keepTargetAxis,
105 Int_t chunkSize = 1024 * 16);
106 THnBase* CloneEmpty(const char* name, const char* title,
107 const TObjArray* axes, Bool_t keepTargetAxis) const;
108 virtual void Reserve(Long64_t /*nbins*/) {}
109 virtual void SetFilledBins(Long64_t /*nbins*/) {};
110
111 Bool_t CheckConsistency(const THnBase *h, const char *tag) const;
112 TH1* CreateHist(const char* name, const char* title,
113 const TObjArray* axes, Bool_t keepTargetAxis) const;
114 TObject* ProjectionAny(Int_t ndim, const Int_t* dim,
115 Bool_t wantNDim, Option_t* option = "") const;
116 Bool_t PrintBin(Long64_t idx, Int_t* coord, Option_t* options) const;
119 THnBase* RebinBase(const Int_t* group) const;
120 void ResetBase(Option_t *option= "");
121
122 static THnBase* CreateHnAny(const char* name, const char* title,
123 const TH1* h1, Bool_t sparse,
124 Int_t chunkSize = 1024 * 16);
125 static THnBase* CreateHnAny(const char* name, const char* title,
126 const THnBase* hn, Bool_t sparse,
127 Int_t chunkSize = 1024 * 16);
128
129 public:
130 ~THnBase() override;
131
133 const TObjArray* GetListOfAxes() const { return &fAxes; }
134 TAxis* GetAxis(Int_t dim) const { return (TAxis*)fAxes[dim]; }
135
137 TList* GetListOfFunctions() { return nullptr; }
138
140
141 virtual Long64_t GetNbins() const = 0;
142 Double_t GetEntries() const { return fEntries; }
143 Double_t GetWeightSum() const { return fTsumw; }
145 Bool_t GetCalculateErrors() const { return fTsumw2 >= 0.; }
146
147 /// Calculate errors (or not if "calc" == kFALSE)
149 if (calc) Sumw2();
150 else fTsumw2 = -1.;
151 }
152
154 UpdateXStat(x, w);
155 Long64_t bin = GetBin(x, kTRUE /*alloc*/);
156 FillBin(bin, w);
157 return bin;
158 }
159 Long64_t Fill(const char* name[], Double_t w = 1.) {
160 Long64_t bin = GetBin(name, kTRUE /*alloc*/);
161 FillBin(bin, w);
162 return bin;
163 }
164
165 /// Fill with the provided variadic arguments.
166 /// The number of arguments must be equal to the number of histogram dimensions or, for weighted fills, to the
167 /// number of dimensions + 1; in the latter case, the last function argument is used as weight.
168 /// A separate `firstval` argument is needed so the compiler does not pick this overload instead of the non-templated
169 /// Fill overloads
170 template <typename... MoreTypes>
172 {
173 const std::array<double, 1 + sizeof...(morevals)> x{firstval, static_cast<double>(morevals)...};
174 if (Int_t(x.size()) == GetNdimensions()) {
175 // without weight
176 return Fill(x.data());
177 } else if (Int_t(x.size()) == (GetNdimensions() + 1)) {
178 // with weight
179 return Fill(x.data(), x.back());
180 } else {
181 Error("Fill", "Wrong number of arguments for number of histogram axes.");
182 }
183
184 return -1;
185 }
186
187 virtual void FillBin(Long64_t bin, Double_t w) = 0;
188
189 void SetBinEdges(Int_t idim, const Double_t* bins);
190 Bool_t IsInRange(Int_t *coord) const;
191 Double_t GetBinError(const Int_t *idx) const { return GetBinError(GetBin(idx)); }
193 void SetBinError(const Int_t* idx, Double_t e) { SetBinError(GetBin(idx), e); }
195 void AddBinContent(const Int_t* x, Double_t v = 1.) { AddBinContent(GetBin(x), v); }
196 void SetEntries(Double_t entries) { fEntries = entries; }
197 void SetTitle(const char *title) override;
198
199 std::vector<Double_t> GetBinCenter(const std::vector<Int_t> &idx) const;
200
201 Double_t GetBinContent(const Int_t *idx) const { return GetBinContent(GetBin(idx)); } // intentionally non-virtual
202 virtual Double_t GetBinContent(Long64_t bin, Int_t* idx = nullptr) const = 0;
204 virtual Long64_t GetBin(const Int_t* idx) const = 0;
205 virtual Long64_t GetBin(const Double_t* x) const = 0;
206 virtual Long64_t GetBin(const char* name[]) const = 0;
207 virtual Long64_t GetBin(const Int_t* idx, Bool_t /*allocate*/ = kTRUE) = 0;
208 virtual Long64_t GetBin(const Double_t* x, Bool_t /*allocate*/ = kTRUE) = 0;
209 virtual Long64_t GetBin(const char* name[], Bool_t /*allocate*/ = kTRUE) = 0;
210
211 void SetBinContent(const Int_t* idx, Double_t v) { SetBinContent(GetBin(idx), v); } // intentionally non-virtual
212 virtual void SetBinContent(Long64_t bin, Double_t v) = 0;
213 virtual void SetBinError2(Long64_t bin, Double_t e2) = 0;
214 virtual void AddBinError2(Long64_t bin, Double_t e2) = 0;
215 virtual void AddBinContent(Long64_t bin, Double_t v = 1.) = 0;
216
217 Double_t GetSumw() const { return fTsumw; }
218 Double_t GetSumw2() const { return fTsumw2; }
219 Double_t GetSumwx(Int_t dim) const { return fTsumwx[dim]; }
220 Double_t GetSumwx2(Int_t dim) const { return fTsumwx2[dim]; }
221
222 /// Project all bins into a 1-dimensional histogram,
223 /// keeping only axis "xDim".
224 /// If "option" contains:
225 /// - "E" errors will be calculated.
226 /// - "A" ranges of the taget axes will be ignored.
227 /// - "O" original axis range of the taget axes will be
228 /// kept, but only bins inside the selected range
229 /// will be filled.
231 return (TH1D*) ProjectionAny(1, &xDim, false, option);
232 }
233
234 /// Project all bins into a 2-dimensional histogram,
235 /// keeping only axes "xDim" and "yDim".
236 ///
237 /// WARNING: just like TH3::Project3D("yx") and TTree::Draw("y:x"),
238 /// Projection(y,x) uses the first argument to define the y-axis and the
239 /// second for the x-axis!
240 ///
241 /// If "option" contains "E" errors will be calculated.
242 /// "A" ranges of the taget axes will be ignored.
244 const Int_t dim[2] = {xDim, yDim};
245 return (TH2D*) ProjectionAny(2, dim, false, option);
246 }
247
248 /// Project all bins into a 3-dimensional histogram,
249 /// keeping only axes "xDim", "yDim", and "zDim".
250 /// If "option" contains:
251 /// - "E" errors will be calculated.
252 /// - "A" ranges of the taget axes will be ignored.
253 /// - "O" original axis range of the taget axes will be
254 /// kept, but only bins inside the selected range
255 /// will be filled.
257 const Int_t dim[3] = {xDim, yDim, zDim};
258 return (TH3D*) ProjectionAny(3, dim, false, option);
259 }
260
261 THnBase* ProjectionND(Int_t ndim, const Int_t* dim,
262 Option_t* option = "") const {
263 return (THnBase*)ProjectionAny(ndim, dim, kTRUE /*wantNDim*/, option);
264 }
265
267
268 void Scale(Double_t c);
269 void Add(const THnBase* h, Double_t c=1.);
270 void Add(const TH1* hist, Double_t c=1.);
271 void Multiply(const THnBase* h);
272 void Multiply(TF1* f, Double_t c = 1.);
273 void Divide(const THnBase* h);
274 void Divide(const THnBase* h1, const THnBase* h2, Double_t c1 = 1., Double_t c2 = 1., Option_t* option="");
275 void RebinnedAdd(const THnBase* h, Double_t c=1.);
276
277 virtual void Reset(Option_t* option = "") = 0;
278 virtual void Sumw2() = 0;
279
283
284 void Print(Option_t* option = "") const override;
285 void PrintEntries(Long64_t from = 0, Long64_t howmany = -1, Option_t* options = nullptr) const;
286 void PrintBin(Int_t* coord, Option_t* options) const {
287 PrintBin(-1, coord, options);
288 }
289 void PrintBin(Long64_t idx, Option_t* options) const;
290
291 void Browse(TBrowser *b) override;
292 Bool_t IsFolder() const override { return kTRUE; }
293
294 //void Draw(Option_t* option = "");
295
296 ClassDefOverride(THnBase, 1); // Common base for n-dimensional histogram
297
298 friend class THnIter;
299};
300
301namespace ROOT {
302namespace Internal {
303 // Helper class for browsing THnBase objects
304 class THnBaseBrowsable: public TNamed {
305 public:
306 THnBaseBrowsable(THnBase* hist, Int_t axis);
307 ~THnBaseBrowsable() override;
308 void Browse(TBrowser *b) override;
309 Bool_t IsFolder() const override { return kFALSE; }
310
311 private:
312 THnBase* fHist; // Original histogram
313 Int_t fAxis; // Axis to visualize
314 TH1* fProj; // Projection result
315 ClassDefOverride(THnBaseBrowsable, 0); // Browser-helper for THnBase
316 };
317
318 // Base class for iterating over THnBase bins
334}
335}
336
337class THnIter: public TObject {
338public:
340 fIter(hist->CreateIter(respectAxisRange)) {}
341 ~THnIter() override;
342
343 /// Return the next bin's index.
344 /// If provided, set coord to that bin's coordinates (bin indexes).
345 /// I.e. coord must point to Int_t[hist->GetNdimensions()]
346 /// Returns -1 when all bins have been visited.
347 Long64_t Next(Int_t* coord = nullptr) {
348 return fIter->Next(coord);
349 }
350
351 Int_t GetCoord(Int_t dim) const { return fIter->GetCoord(dim); }
354
355private:
357 ClassDefOverride(THnIter, 0); //Iterator over bins of a THnBase.
358};
359
360#endif // ROOT_THnBase
#define d(i)
Definition RSha256.hxx:102
#define b(i)
Definition RSha256.hxx:100
#define f(i)
Definition RSha256.hxx:104
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
#define e(i)
Definition RSha256.hxx:103
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
double Double_t
Definition RtypesCore.h:59
long long Long64_t
Definition RtypesCore.h:69
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
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
float xmin
float xmax
Iterator over THnBase bins (internal implementation).
Definition THnBase.h:319
Bool_t RespectsAxisRange() const
Definition THnBase.h:325
Bool_t HaveSkippedBin() const
Definition THnBase.h:324
virtual Int_t GetCoord(Int_t dim) const =0
THnBaseBinIter(Bool_t respectAxisRange)
Definition THnBase.h:321
virtual ~THnBaseBinIter()
Destruct a bin iterator.
Definition THnBase.cxx:1618
virtual Long64_t Next(Int_t *coord=nullptr)=0
TBrowser helper for THnBase.
Definition THnBase.h:304
~THnBaseBrowsable() override
Destruct a THnBaseBrowsable.
Definition THnBase.cxx:1662
THnBaseBrowsable(THnBase *hist, Int_t axis)
Construct a THnBaseBrowsable.
Definition THnBase.cxx:1646
Bool_t IsFolder() const override
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
Definition THnBase.h:309
void Browse(TBrowser *b) override
Browse an axis of a THnBase, i.e. draw its projection.
Definition THnBase.cxx:1670
Array of doubles (64 bits per element).
Definition TArrayD.h:27
Class to manage histogram axis.
Definition TAxis.h:32
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
Collection abstract base class.
Definition TCollection.h:65
1-Dim function class
Definition TF1.h:233
Provides an indirection to the TFitResult class and with a semantics identical to a TFitResult pointe...
1-D histogram with a double per channel (see TH1 documentation)
Definition TH1.h:693
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:59
2-D histogram with a double per channel (see TH1 documentation)
Definition TH2.h:351
3-D histogram with a double per channel (see TH1 documentation)
Definition TH3.h:357
Multidimensional histogram base.
Definition THnBase.h:45
virtual void Sumw2()=0
virtual ROOT::Internal::THnBaseBinIter * CreateIter(Bool_t respectAxisRange) const =0
void SetEntries(Double_t entries)
Definition THnBase.h:196
virtual void SetFilledBins(Long64_t)
Definition THnBase.h:109
void Browse(TBrowser *b) override
Browse a THnSparse: create an entry (ROOT::THnSparseBrowsable) for each dimension.
Definition THnBase.cxx:1595
const TObjArray * GetListOfAxes() const
Definition THnBase.h:133
Long64_t Fill(const Double_t *x, Double_t w=1.)
Definition THnBase.h:153
virtual void InitStorage(Int_t *nbins, Int_t chunkSize)=0
Double_t GetBinError(const Int_t *idx) const
Definition THnBase.h:191
void SetBinError(const Int_t *idx, Double_t e)
Definition THnBase.h:193
Double_t fEntries
Number of entries, spread over chunks.
Definition THnBase.h:50
virtual void AddBinContent(Long64_t bin, Double_t v=1.)=0
Double_t GetSumw2() const
Definition THnBase.h:218
Bool_t IsInRange(Int_t *coord) const
Check whether bin coord is in range, as defined by TAxis::SetRange().
Definition THnBase.cxx:605
TList * GetListOfFunctions()
Definition THnBase.h:137
virtual Long64_t GetBin(const Int_t *idx, Bool_t=kTRUE)=0
TFitResultPtr Fit(TF1 *f1, Option_t *option="", Option_t *goption="")
Fit a THnSparse with function f.
Definition THnBase.cxx:518
void AddBinContent(const Int_t *x, Double_t v=1.)
Definition THnBase.h:195
void Scale(Double_t c)
Scale contents and errors of this histogram by c: this = this * c It does not modify the histogram's ...
Definition THnBase.cxx:787
virtual void SetBinError2(Long64_t bin, Double_t e2)=0
TObjArray * GetListOfAxes()
Definition THnBase.h:132
TH1 * CreateHist(const char *name, const char *title, const TObjArray *axes, Bool_t keepTargetAxis) const
Create an empty histogram with name and title with a given set of axes.
Definition THnBase.cxx:265
Bool_t PrintBin(Long64_t idx, Int_t *coord, Option_t *options) const
Print one bin.
Definition THnBase.cxx:1453
TH1D * Projection(Int_t xDim, Option_t *option="") const
Project all bins into a 1-dimensional histogram, keeping only axis "xDim".
Definition THnBase.h:230
Double_t GetSumwx(Int_t dim) const
Definition THnBase.h:219
@ kInvalidInt
Definition THnBase.h:59
@ kNoInt
Definition THnBase.h:57
@ kValidInt
Definition THnBase.h:58
Bool_t CheckConsistency(const THnBase *h, const char *tag) const
Consistency check on (some of) the parameters of two histograms (for operations).
Definition THnBase.cxx:1175
Int_t GetNdimensions() const
Definition THnBase.h:144
TH3D * Projection(Int_t xDim, Int_t yDim, Int_t zDim, Option_t *option="") const
Project all bins into a 3-dimensional histogram, keeping only axes "xDim", "yDim",...
Definition THnBase.h:256
~THnBase() override
Destruct a THnBase.
Definition THnBase.cxx:180
void PrintBin(Int_t *coord, Option_t *options) const
Definition THnBase.h:286
static THnBase * CreateHnAny(const char *name, const char *title, const TH1 *h1, Bool_t sparse, Int_t chunkSize=1024 *16)
Create a THn / THnSparse object from a histogram deriving from TH1.
Definition THnBase.cxx:336
virtual Long64_t GetBin(const char *name[], Bool_t=kTRUE)=0
TArrayD fTsumwx2
Total sum of weight*X*X for each dimension.
Definition THnBase.h:54
void ResetBase(Option_t *option="")
Clear the histogram.
Definition THnBase.cxx:1340
virtual Long64_t GetNbins() const =0
Bool_t IsFolder() const override
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
Definition THnBase.h:292
THnBase * RebinBase(Int_t group) const
Combine the content of "group" neighboring bins into a new bin and return the resulting THnBase.
Definition THnBase.cxx:1245
THnBase * ProjectionND(Int_t ndim, const Int_t *dim, Option_t *option="") const
Definition THnBase.h:261
TObjArray fAxes
Axes of the histogram.
Definition THnBase.h:48
void SetBinEdges(Int_t idim, const Double_t *bins)
Set the axis # of bins and bin limits on dimension idim.
Definition THnBase.cxx:1193
Bool_t GetCalculateErrors() const
Definition THnBase.h:145
void AddInternal(const THnBase *h, Double_t c, Bool_t rebinned)
Add() implementation for both rebinned histograms and those with identical binning.
Definition THnBase.cxx:811
void SetTitle(const char *title) override
Change (i.e.
Definition THnBase.cxx:1209
void PrintEntries(Long64_t from=0, Long64_t howmany=-1, Option_t *options=nullptr) const
Print "howmany" entries starting at "from".
Definition THnBase.cxx:1497
virtual void SetBinContent(Long64_t bin, Double_t v)=0
enum THnBase::@83 fIntegralStatus
! status of integral
Double_t GetBinError(Long64_t linidx) const
Definition THnBase.h:192
Double_t GetBinContent(const Int_t *idx) const
Definition THnBase.h:201
virtual Long64_t GetBin(const Double_t *x, Bool_t=kTRUE)=0
void Add(const THnBase *h, Double_t c=1.)
Add contents of h scaled by c to this histogram: this = this + c * h Note that if h has Sumw2 set,...
Definition THnBase.cxx:884
Double_t fTsumw2
Total sum of weights squared; -1 if no errors are calculated.
Definition THnBase.h:52
virtual void Reserve(Long64_t)
Definition THnBase.h:108
THnBase()
Definition THnBase.h:63
Double_t GetEntries() const
Definition THnBase.h:142
Long64_t Fill(Double_t firstval, MoreTypes... morevals)
Fill with the provided variadic arguments.
Definition THnBase.h:171
std::vector< Double_t > GetBinCenter(const std::vector< Int_t > &idx) const
THnBase::GetBinCenter.
Definition THnBase.cxx:547
virtual Long64_t GetBin(const char *name[]) const =0
virtual Double_t GetBinError2(Long64_t linidx) const =0
virtual void Reset(Option_t *option="")=0
void SetBinContent(const Int_t *idx, Double_t v)
Definition THnBase.h:211
virtual void FillBin(Long64_t bin, Double_t w)=0
virtual Long64_t GetBin(const Double_t *x) const =0
void UpdateXStat(const Double_t *x, Double_t w=1.)
Definition THnBase.h:81
virtual Double_t GetBinContent(Long64_t bin, Int_t *idx=nullptr) const =0
void Multiply(const THnBase *h)
Multiply this histogram by histogram h this = this * h Note that if h has Sumw2 set,...
Definition THnBase.cxx:945
Double_t Integral(Bool_t respectAxisRange) const
Compute integral (sum of counts) of histogram in all dimensions.
Definition THnBase.cxx:1358
void Divide(const THnBase *h)
Divide this histogram by h this = this/(h) Note that if h has Sumw2 set, Sumw2 is automatically calle...
Definition THnBase.cxx:1036
void Print(Option_t *option="") const override
Print a THnBase.
Definition THnBase.cxx:1548
Long64_t Fill(const char *name[], Double_t w=1.)
Definition THnBase.h:159
Double_t GetSumwx2(Int_t dim) const
Definition THnBase.h:220
Double_t GetWeightSum() const
Definition THnBase.h:143
TObjArray fBrowsables
! Browser-helpers for each axis
Definition THnBase.h:49
Double_t GetSumw() const
Definition THnBase.h:217
TObject * ProjectionAny(Int_t ndim, const Int_t *dim, Bool_t wantNDim, Option_t *option="") const
Project all bins into a ndim-dimensional THn / THnSparse (whatever *this is) or if (ndim < 4 and !...
Definition THnBase.cxx:631
void GetRandom(Double_t *rand, Bool_t subBinRandom=kTRUE)
Generate an n-dimensional random tuple based on the histogrammed distribution.
Definition THnBase.cxx:570
TAxis * GetAxis(Int_t dim) const
Definition THnBase.h:134
THnBase * CloneEmpty(const char *name, const char *title, const TObjArray *axes, Bool_t keepTargetAxis) const
Create a new THnBase object that is of the same type as *this, but with dimensions and bins given by ...
Definition THnBase.cxx:192
Long64_t Merge(TCollection *list)
Merge this with a list of THnBase's.
Definition THnBase.cxx:910
Double_t fTsumw
Total sum of weights.
Definition THnBase.h:51
virtual Long64_t GetBin(const Int_t *idx) const =0
Double_t ComputeIntegral()
Compute integral (normalized cumulative sum of bins) w/o under/overflows The result is stored in fInt...
Definition THnBase.cxx:1378
virtual void AddBinError2(Long64_t bin, Double_t e2)=0
void RebinnedAdd(const THnBase *h, Double_t c=1.)
Add contents of h scaled by c to this histogram: this = this + c * h Note that if h has Sumw2 set,...
Definition THnBase.cxx:900
void SetBinError(Long64_t bin, Double_t e)
Definition THnBase.h:194
void CalculateErrors(Bool_t calc=kTRUE)
Calculate errors (or not if "calc" == kFALSE)
Definition THnBase.h:148
Int_t fNdimensions
Number of dimensions.
Definition THnBase.h:47
TH2D * Projection(Int_t yDim, Int_t xDim, Option_t *option="") const
Project all bins into a 2-dimensional histogram, keeping only axes "xDim" and "yDim".
Definition THnBase.h:243
void Init(const char *name, const char *title, const TObjArray *axes, Bool_t keepTargetAxis, Int_t chunkSize=1024 *16)
Initialize axes and name.
Definition THnBase.cxx:208
void FillBinBase(Double_t w)
Increment the statistics due to filled weight "w",.
Definition THnBase.h:93
THnBase & operator=(const THnBase &other)
Definition THnBase.cxx:114
std::vector< Double_t > fIntegral
! vector with bin weight sums
Definition THnBase.h:55
TArrayD fTsumwx
Total sum of weight*X for each dimension.
Definition THnBase.h:53
Iterator over THnBase bins.
Definition THnBase.h:337
Bool_t HaveSkippedBin() const
Definition THnBase.h:352
THnIter(const THnBase *hist, Bool_t respectAxisRange=kFALSE)
Definition THnBase.h:339
Int_t GetCoord(Int_t dim) const
Definition THnBase.h:351
ROOT::Internal::THnBaseBinIter * fIter
Definition THnBase.h:356
~THnIter() override
Definition THnBase.cxx:1630
Bool_t RespectsAxisRange() const
Definition THnBase.h:353
Long64_t Next(Int_t *coord=nullptr)
Return the next bin's index.
Definition THnBase.h:347
A doubly linked list.
Definition TList.h:38
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
An array of TObjects.
Definition TObjArray.h:31
Mother of all ROOT objects.
Definition TObject.h:41
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1005
return c1
Definition legend1.C:41
Double_t x[n]
Definition legend1.C:17
TH1F * h1
Definition legend1.C:5
TF1 * f1
Definition legend1.C:11
return c2
Definition legend2.C:14
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:666