Logo ROOT   6.08/07
Reference Guide
THistData.hxx
Go to the documentation of this file.
1 /// \file ROOT/THistData.h
2 /// \ingroup Hist ROOT7
3 /// \author Axel Naumann <axel@cern.ch>
4 /// \date 2015-06-14
5 /// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
6 
7 /*************************************************************************
8  * Copyright (C) 1995-2015, Rene Brun and Fons Rademakers. *
9  * All rights reserved. *
10  * *
11  * For the licensing terms see $ROOTSYS/LICENSE. *
12  * For the list of contributors see $ROOTSYS/README/CREDITS. *
13  *************************************************************************/
14 
15 #ifndef ROOT7_THistData_h
16 #define ROOT7_THistData_h
17 
18 #include <cmath>
19 #include <vector>
20 #include "ROOT/RArrayView.hxx"
21 #include "ROOT/THistUtils.hxx"
22 
23 namespace ROOT {
24 namespace Experimental {
25 
26 template<int DIMENSIONS, class PRECISION,
27  template <int D_, class P_, template <class P__> class STORAGE> class... STAT>
28 class THist;
29 
30 /**
31  \class THistStatContent
32  Basic histogram statistics, keeping track of the bin content and the total
33  number of calls to Fill().
34  */
35 template<int DIMENSIONS, class PRECISION,
36  template <class PRECISION_> class STORAGE>
38 public:
39  /// The type of a (possibly multi-dimensional) coordinate.
41  /// The type of the weight and the bin content.
43  /// Type of the bin content array.
44  using Content_t = STORAGE<PRECISION>;
45 
46  /**
47  \class TConstBinStat
48  Const view on a THistStatContent for a given bin.
49  */
50  class TConstBinStat {
51  public:
52  TConstBinStat(const THistStatContent& stat, int index):
53  fContent(stat.GetBinContent(index)) {}
54  PRECISION GetContent() const { return fContent; }
55 
56  private:
57  PRECISION fContent; ///< The content of this bin.
58  };
59 
60  /**
61  \class TBinStat
62  Modifying view on a THistStatContent for a given bin.
63  */
64  class TBinStat {
65  public:
66  TBinStat(THistStatContent& stat, int index):
67  fContent(stat.GetBinContent(index)) {}
68  PRECISION& GetContent() const { return fContent; }
69 
70  private:
71  PRECISION& fContent; ///< The content of this bin.
72  };
73 
76 
77 private:
78  /// Number of calls to Fill().
79  int64_t fEntries = 0;
80 
81  /// Bin content.
83 
84 public:
85  THistStatContent() = default;
86  THistStatContent(size_t in_size): fBinContent(in_size) {}
87 
88  /// Add weight to the bin content at binidx.
89  void Fill(const CoordArray_t& /*x*/, int binidx, Weight_t weight = 1.) {
90  fBinContent[binidx] += weight;
91  ++fEntries;
92  }
93 
94  /// Get the number of entries filled into the histogram - i.e. the number of
95  /// calls to Fill().
96  int64_t GetEntries() const { return fEntries; }
97 
98  /// Get the number of bins.
99  size_t size() const noexcept { return fBinContent.size(); }
100 
101  /// Get the bin content for the given bin.
102  Weight_t operator[](int idx) const { return fBinContent[idx]; }
103  /// Get the bin content for the given bin (non-const).
104  Weight_t& operator[](int idx) { return fBinContent[idx]; }
105 
106  /// Get the bin content for the given bin.
107  Weight_t GetBinContent(int idx) const { return fBinContent[idx]; }
108  /// Get the bin content for the given bin (non-const).
109  Weight_t& GetBinContent(int idx) { return fBinContent[idx]; }
110 
111  /// Retrieve the content array.
112  const Content_t& GetContentArray() const { return fBinContent; }
113  /// Retrieve the content array (non-const).
115 };
116 
117 /**
118  \class THistStatTotalSumOfWeights
119  Keeps track of the histogram's total sum of weights.
120  */
121 template<int DIMENSIONS, class PRECISION, template <class P_> class STORAGE>
123 public:
124  /// The type of a (possibly multi-dimensional) coordinate.
126  /// The type of the weight and the bin content.
128 
129  /**
130  \class TBinStat
131  No-op; this class does not provide per-bin statistics.
132  */
133  class TBinStat {
134  public:
136  };
137 
140 
141 private:
142  /// Sum of weights.
143  PRECISION fSumWeights = 0;
144 
145 public:
146  THistStatTotalSumOfWeights() = default;
148 
149  /// Add weight to the bin content at binidx.
150  void Fill(const CoordArray_t& /*x*/, int, Weight_t weight = 1.) {
151  fSumWeights += weight;
152  }
153 
154  /// Get the sum of weights.
155  Weight_t GetSumOfWeights() const { return fSumWeights; }
156 
157 };
158 
159 
160 /**
161  \class THistStatTotalSumOfSquaredWeights
162  Keeps track of the histogram's total sum of squared weights.
163  */
164 template<int DIMENSIONS, class PRECISION, template <class P_> class STORAGE>
166 public:
167  /// The type of a (possibly multi-dimensional) coordinate.
169  /// The type of the weight and the bin content.
171 
172  /**
173  \class TBinStat
174  No-op; this class does not provide per-bin statistics.
175  */
176  class TBinStat {
177  public:
179  };
180 
183 
184 private:
185  /// Sum of (weights^2).
186  PRECISION fSumWeights2 = 0;
187 
188 public:
191 
192  /// Add weight to the bin content at binidx.
193  void Fill(const CoordArray_t& /*x*/, int /*binidx*/, Weight_t weight = 1.) {
194  fSumWeights2 += weight * weight;
195  }
196 
197  /// Get the sum of weights.
198  Weight_t GetSumOfSquaredWeights() const { return fSumWeights2; }
199 
200 };
201 
202 
203 /**
204  \class THistStatUncertainty
205  Histogram statistics to keep track of the Poisson uncertainty per bin.
206  */
207 template<int DIMENSIONS, class PRECISION, template <class P_> class STORAGE>
209 
210 public:
211  /// The type of a (possibly multi-dimensional) coordinate.
213  /// The type of the weight and the bin content.
215  /// Type of the bin content array.
216  using Content_t = STORAGE<PRECISION>;
217 
218  /**
219  \class TConstBinStat
220  Const view on a THistStatUncertainty for a given bin.
221  */
223  public:
224  TConstBinStat(const THistStatUncertainty& stat, int index):
225  fSumW2(stat.GetSumOfSquaredWeights(index)) {}
226  PRECISION GetSumW2() const { return fSumW2; }
227 
228  double GetUncertaintyImpl() const { return std::sqrt(std::abs(fSumW2)); }
229 
230  private:
231  PRECISION fSumW2; ///< The bin's sum of square of weights.
232  };
233 
234  /**
235  \class TBinStat
236  Modifying view on a THistStatUncertainty for a given bin.
237  */
238  class TBinStat {
239  public:
240  TBinStat(THistStatUncertainty& stat, int index):
241  fSumW2(stat.GetSumOfSquaredWeights(index)) {}
242  PRECISION& GetSumW2() const { return fSumW2; }
243  // Can never modify this. Set GetSumW2() instead.
244  double GetUncertaintyImpl() const { return std::sqrt(std::abs(fSumW2)); }
245 
246  private:
247  PRECISION& fSumW2; ///< The bin's sum of square of weights.
248  };
249 
252 
253 private:
254  /// Uncertainty of the content for each bin.
255  Content_t fSumWeightsSquared; ///< Sum of squared weights
256 
257 public:
258  THistStatUncertainty() = default;
259  THistStatUncertainty(size_t size): fSumWeightsSquared(size) {}
260 
261  /// Add weight to the bin at binidx; the coordinate was x.
262  void Fill(const CoordArray_t& /*x*/, int binidx, Weight_t weight = 1.) {
263  fSumWeightsSquared[binidx] += weight * weight;
264  }
265 
266  /// Calculate a bin's (Poisson) uncertainty of the bin content as the
267  /// square-root of the bin's sum of squared weights.
268  double GetBinUncertaintyImpl(int binidx) const {
269  return std::sqrt(fSumWeightsSquared[binidx]);
270  }
271 
272  /// Get a bin's sum of squared weights.
273  Weight_t GetSumOfSquaredWeights(int binidx) const {
274  return fSumWeightsSquared[binidx];
275  }
276 
277  /// Get a bin's sum of squared weights.
279  return fSumWeightsSquared[binidx];
280  }
281 
282  /// Get the structure holding the sum of squares of weights.
283  const std::vector<double>& GetSumOfSquaredWeights() const { return fSumWeightsSquared; }
284  /// Get the structure holding the sum of squares of weights (non-const).
285  std::vector<double>& GetSumOfSquaredWeights() { return fSumWeightsSquared; }
286 };
287 
288 /** \class THistDataMomentUncert
289  For now do as TH1: calculate first (xw) and second (x^2w) moment.
290 */
291 template<int DIMENSIONS, class PRECISION, template <class P_> class STORAGE>
293 public:
294  /// The type of a (possibly multi-dimensional) coordinate.
296  /// The type of the weight and the bin content.
298  /// Type of the bin content array.
299  using Content_t = STORAGE<PRECISION>;
300 
301  /**
302  \class TBinStat
303  No-op; this class does not provide per-bin statistics.
304  */
305  class TBinStat {
306  public:
308  };
309 
312 
313 private:
314  std::array<Weight_t, DIMENSIONS> fMomentXW;
315  std::array<Weight_t, DIMENSIONS> fMomentX2W;
316 
317 public:
318  THistDataMomentUncert() = default;
320 
321  /// Add weight to the bin at binidx; the coordinate was x.
322  void Fill(const CoordArray_t &x, int /*binidx*/, Weight_t weight = 1.) {
323  for (int idim = 0; idim < DIMENSIONS; ++idim) {
324  const PRECISION xw = x[idim] * weight;
325  fMomentXW[idim] += xw ;
326  fMomentX2W[idim] += x[idim] * xw;
327  }
328  }
329 };
330 
331 
332 /** \class THistStatRuntime
333  Interface implementing a pure virtual functions DoFill(), DoFillN().
334  */
335 template<int DIMENSIONS, class PRECISION, template <class P_> class STORAGE>
337 public:
338  /// The type of a (possibly multi-dimensional) coordinate.
340  /// The type of the weight and the bin content.
342  /// Type of the bin content array.
343  using Content_t = STORAGE<PRECISION>;
344 
345  /**
346  \class TBinStat
347  No-op; this class does not provide per-bin statistics.
348  */
349  class TBinStat {
350  public:
351  TBinStat(const THistStatRuntime&, int) {}
352  };
353 
356 
357  THistStatRuntime() = default;
358  THistStatRuntime(size_t) {}
359  virtual ~THistStatRuntime() = default;
360 
361 
362  virtual void DoFill(const CoordArray_t &x, int binidx, Weight_t weightN) = 0;
363  void Fill(const CoordArray_t &x, int binidx, Weight_t weight = 1.) {
364  DoFill(x, binidx, weight);
365  }
366 };
367 
368 
369 namespace Detail {
370 
371 /// std::vector has more template arguments; for the default storage we don't
372 /// care about them, so use-decl them away:
373 template<class PRECISION>
374 using THistDataDefaultStorage = std::vector<PRECISION>;
375 
376 
377 /** \class THistBinStat
378  Const view on a bin's statistical data. Combines all STATs' BinStat_t views.
379  */
380 template <class DATA, class...BASES>
381 class THistBinStat: public BASES... {
382 private:
383  /// Check whether `double T::GetBinUncertaintyImpl(int)` can be called.
384  template <class T>
385  static auto HaveUncertainty(const T* This) -> decltype(This->GetUncertaintyImpl());
386  /// Fall-back case for check whether `double T::GetBinUncertaintyImpl(int)` can be called.
387  template <class T>
388  static char HaveUncertainty(...);
389 
390 public:
391  THistBinStat(DATA& data, int index):
392  BASES(data, index)... {}
393 
394  /// Whether this provides storage for uncertainties, or whether uncertainties
395  /// are determined as poisson uncertainty of the content.
396  static constexpr bool HasBinUncertainty() {
397  struct AllYourBaseAreBelongToUs: public BASES... {};
398  return sizeof(HaveUncertainty<AllYourBaseAreBelongToUs>(nullptr)) == sizeof(double);
399  }
400  /// Calculate the bin content's uncertainty for the given bin, using base class information,
401  /// i.e. forwarding to a base's `GetUncertaintyImpl()`.
402  template <bool B = true,
404  double GetUncertainty() const {
405  return this->GetUncertaintyImpl();
406  }
407  /// Calculate the bin content's uncertainty for the given bin, using Poisson
408  /// statistics on the absolute bin content. Only available if no base provides
409  /// this functionality. Requires GetContent().
410  template <bool B = true,
412  double GetUncertainty(...) const {
413  auto content = this->GetContent();
414  return std::sqrt(std::fabs(content));
415  }
416 };
417 
418 
419 /** \class THistData
420  A THistImplBase's data, provides accessors to all its statistics.
421  */
422 template<int DIMENSIONS, class PRECISION,
423  template <class P_> class STORAGE,
424  template <int D_, class P_, template <class P__> class S_> class... STAT>
425 class THistData: public STAT<DIMENSIONS, PRECISION, STORAGE>... {
426 private:
427  /// Check whether `double T::GetBinUncertaintyImpl(int)` can be called.
428  template <class T>
429  static auto HaveUncertainty(const T* This) -> decltype(This->GetBinUncertaintyImpl(12));
430  /// Fall-back case for check whether `double T::GetBinUncertaintyImpl(int)` can be called.
431  template <class T>
432  static char HaveUncertainty(...);
433 
434 public:
435  /// Matching THist
436  using Hist_t = THist<DIMENSIONS, PRECISION, STAT...>;
437 
438  /// The type of the weight and the bin content.
440 
441  /// The type of a (possibly multi-dimensional) coordinate.
443 
444  /// The type of a non-modifying view on a bin.
445  using ConstHistBinStat_t
447 
448  /// The type of a modifying view on a bin.
449  using HistBinStat_t
451 
452  /// Number of dimensions of the coordinates
453  static constexpr int GetNDim() noexcept { return DIMENSIONS; }
454 
455  THistData() = default;
456 
457 
458  /// Constructor providing the number of bins (incl under, overflow) to the
459  /// base classes.
460  THistData(size_t size): STAT<DIMENSIONS, PRECISION, STORAGE>(size)... {}
461 
462  /// Fill weight at x to the bin content at binidx.
463  void Fill(const CoordArray_t& x, int binidx, Weight_t weight = 1.) {
464  // Call Fill() on all base classes.
465  // This combines a couple of C++ spells:
466  // - "STAT": is a template parameter pack of template template arguments. It
467  // has multiple (or one or no) elements; each is a template name
468  // that needs to be instantiated before it can be used.
469  // - "...": template parameter pack expansion; the expression is evaluated
470  // for each STAT. The expression is
471  // (STAT<DIMENSIONS, PRECISION, STORAGE>::Fill(x, binidx, weight), 0)
472  // - "trigger_base_fill{}":
473  // initialization, provides a context in which template parameter
474  // pack expansion happens.
475  // - ", 0": because Fill() returns void it cannot be used as initializer
476  // expression. The trailing ", 0" gives it the type of the trailing
477  // comma-separated expression - int.
478  using trigger_base_fill = int[];
479  (void)trigger_base_fill{ (STAT<DIMENSIONS, PRECISION, STORAGE>::Fill(x, binidx, weight), 0)... };
480  }
481 
482  /// Whether this provides storage for uncertainties, or whether uncertainties
483  /// are determined as poisson uncertainty of the content.
484  static constexpr bool HasBinUncertainty() {
485  struct AllYourBaseAreBelongToUs: public STAT<DIMENSIONS, PRECISION, STORAGE>... {};
486  return sizeof(HaveUncertainty<AllYourBaseAreBelongToUs>(nullptr)) == sizeof(double);
487  }
488 
489  /// Calculate the bin content's uncertainty for the given bin, using base class information,
490  /// i.e. forwarding to a base's `GetBinUncertaintyImpl(binidx)`.
492  double GetBinUncertainty(int binidx) const {
493  return this->GetBinUncertaintyImpl(binidx);
494  }
495  /// Calculate the bin content's uncertainty for the given bin, using Poisson
496  /// statistics on the absolute bin content. Only available if no base provides
497  /// this functionality. Requires GetContent().
499  double GetBinUncertainty(int binidx, ...) const {
500  auto content = this->GetBinContent(binidx);
501  return std::sqrt(std::fabs(content));
502  }
503 
504  /// Get a view on the statistics values of a bin.
505  ConstHistBinStat_t GetView(int idx) const {
506  return ConstHistBinStat_t(*this, idx);
507  }
508  /// Get a (non-const) view on the statistics values of a bin.
510  return HistBinStat_t(*this, idx);
511  }
512 };
513 } // namespace Detail
514 
515 } // namespace Experimental
516 } // namespace ROOT
517 #endif
No-op; this class does not provide per-bin statistics.
Definition: THistData.hxx:349
std::vector< PRECISION > THistDataDefaultStorage
std::vector has more template arguments; for the default storage we don&#39;t care about them...
Definition: THistData.hxx:374
static double B[]
Hist::CoordArray_t< DIMENSIONS > CoordArray_t
The type of a (possibly multi-dimensional) coordinate.
Definition: THistData.hxx:40
std::array< double, DIMENSIONS > CoordArray_t
Definition: THistUtils.hxx:22
No-op; this class does not provide per-bin statistics.
Definition: THistData.hxx:305
void Fill(const CoordArray_t &x, int, Weight_t weight=1.)
Add weight to the bin at binidx; the coordinate was x.
Definition: THistData.hxx:322
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
Definition: StringConv.hxx:21
void Fill(const CoordArray_t &, int binidx, Weight_t weight=1.)
Add weight to the bin at binidx; the coordinate was x.
Definition: THistData.hxx:262
static constexpr bool HasBinUncertainty()
Whether this provides storage for uncertainties, or whether uncertainties are determined as poisson u...
Definition: THistData.hxx:484
double GetBinUncertainty(int binidx) const
Calculate the bin content&#39;s uncertainty for the given bin, using base class information, i.e.
Definition: THistData.hxx:492
std::array< Weight_t, DIMENSIONS > fMomentX2W
Definition: THistData.hxx:315
PRECISION Weight_t
The type of the weight and the bin content.
Definition: THistData.hxx:214
double T(double x)
Definition: ChebyshevPol.h:34
TBinStat(const THistDataMomentUncert &, int)
Definition: THistData.hxx:307
PRECISION fSumW2
The bin&#39;s sum of square of weights.
Definition: THistData.hxx:231
static constexpr bool HasBinUncertainty()
Whether this provides storage for uncertainties, or whether uncertainties are determined as poisson u...
Definition: THistData.hxx:396
TBinStat(THistStatContent &stat, int index)
Definition: THistData.hxx:66
Keeps track of the histogram&#39;s total sum of weights.
Definition: THistData.hxx:122
int64_t fEntries
Number of calls to Fill().
Definition: THistData.hxx:79
void Fill(const CoordArray_t &x, int binidx, Weight_t weight=1.)
Definition: THistData.hxx:363
STORAGE< PRECISION > Content_t
Type of the bin content array.
Definition: THistData.hxx:299
Hist::CoordArray_t< DIMENSIONS > CoordArray_t
The type of a (possibly multi-dimensional) coordinate.
Definition: THistData.hxx:442
PRECISION Weight_t
The type of the weight and the bin content.
Definition: THistData.hxx:42
Weight_t & GetSumOfSquaredWeights(int binidx)
Get a bin&#39;s sum of squared weights.
Definition: THistData.hxx:278
TBinStat(THistStatUncertainty &stat, int index)
Definition: THistData.hxx:240
Modifying view on a THistStatUncertainty for a given bin.
Definition: THistData.hxx:238
static constexpr int GetNDim() noexcept
Number of dimensions of the coordinates.
Definition: THistData.hxx:453
const Content_t & GetContentArray() const
Retrieve the content array.
Definition: THistData.hxx:112
std::array< Weight_t, DIMENSIONS > fMomentXW
Definition: THistData.hxx:314
double sqrt(double)
PRECISION Weight_t
The type of the weight and the bin content.
Definition: THistData.hxx:439
STORAGE< PRECISION > Content_t
Type of the bin content array.
Definition: THistData.hxx:216
Double_t x[n]
Definition: legend1.C:17
#define PRECISION
Definition: MnPrint.cxx:26
PRECISION fContent
The content of this bin.
Definition: THistData.hxx:57
Interface implementing a pure virtual functions DoFill(), DoFillN().
Definition: THistData.hxx:336
HistBinStat_t GetView(int idx)
Get a (non-const) view on the statistics values of a bin.
Definition: THistData.hxx:509
Hist::CoordArray_t< DIMENSIONS > CoordArray_t
The type of a (possibly multi-dimensional) coordinate.
Definition: THistData.hxx:339
Weight_t GetSumOfSquaredWeights() const
Get the sum of weights.
Definition: THistData.hxx:198
STORAGE< PRECISION > Content_t
Type of the bin content array.
Definition: THistData.hxx:343
size_t size() const noexcept
Get the number of bins.
Definition: THistData.hxx:99
Weight_t GetBinContent(int idx) const
Get the bin content for the given bin.
Definition: THistData.hxx:107
PRECISION Weight_t
The type of the weight and the bin content.
Definition: THistData.hxx:127
Weight_t operator[](int idx) const
Get the bin content for the given bin.
Definition: THistData.hxx:102
double GetUncertainty() const
Calculate the bin content&#39;s uncertainty for the given bin, using base class information, i.e.
Definition: THistData.hxx:404
double GetBinUncertainty(int binidx,...) const
Calculate the bin content&#39;s uncertainty for the given bin, using Poisson statistics on the absolute b...
Definition: THistData.hxx:499
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
void Fill(const CoordArray_t &, int, Weight_t weight=1.)
Add weight to the bin content at binidx.
Definition: THistData.hxx:150
TBinStat(const THistStatTotalSumOfWeights &, int)
Definition: THistData.hxx:135
PRECISION Weight_t
The type of the weight and the bin content.
Definition: THistData.hxx:341
Weight_t GetSumOfSquaredWeights(int binidx) const
Get a bin&#39;s sum of squared weights.
Definition: THistData.hxx:273
A THistImplBase&#39;s data, provides accessors to all its statistics.
Definition: THistData.hxx:425
Weight_t & GetBinContent(int idx)
Get the bin content for the given bin (non-const).
Definition: THistData.hxx:109
PRECISION & fContent
The content of this bin.
Definition: THistData.hxx:71
Hist::CoordArray_t< DIMENSIONS > CoordArray_t
The type of a (possibly multi-dimensional) coordinate.
Definition: THistData.hxx:125
double GetBinUncertaintyImpl(int binidx) const
Calculate a bin&#39;s (Poisson) uncertainty of the bin content as the square-root of the bin&#39;s sum of squ...
Definition: THistData.hxx:268
TConstBinStat(const THistStatUncertainty &stat, int index)
Definition: THistData.hxx:224
void Fill(const CoordArray_t &, int binidx, Weight_t weight=1.)
Add weight to the bin content at binidx.
Definition: THistData.hxx:89
const std::vector< double > & GetSumOfSquaredWeights() const
Get the structure holding the sum of squares of weights.
Definition: THistData.hxx:283
int64_t GetEntries() const
Get the number of entries filled into the histogram - i.e.
Definition: THistData.hxx:96
Histogram class for histograms with DIMENSIONS dimensions, where each bin count is stored by a value ...
Definition: THist.hxx:33
PRECISION & fSumW2
The bin&#39;s sum of square of weights.
Definition: THistData.hxx:247
TBinStat(const THistStatTotalSumOfSquaredWeights &, int)
Definition: THistData.hxx:178
No-op; this class does not provide per-bin statistics.
Definition: THistData.hxx:176
Hist::CoordArray_t< DIMENSIONS > CoordArray_t
The type of a (possibly multi-dimensional) coordinate.
Definition: THistData.hxx:295
Const view on a bin&#39;s statistical data.
Definition: THistData.hxx:381
Const view on a THistStatContent for a given bin.
Definition: THistData.hxx:50
TConstBinStat(const THistStatContent &stat, int index)
Definition: THistData.hxx:52
Weight_t & operator[](int idx)
Get the bin content for the given bin (non-const).
Definition: THistData.hxx:104
void Fill(const CoordArray_t &, int, Weight_t weight=1.)
Add weight to the bin content at binidx.
Definition: THistData.hxx:193
int type
Definition: TGX11.cxx:120
void Fill(const CoordArray_t &x, int binidx, Weight_t weight=1.)
Fill weight at x to the bin content at binidx.
Definition: THistData.hxx:463
std::vector< double > & GetSumOfSquaredWeights()
Get the structure holding the sum of squares of weights (non-const).
Definition: THistData.hxx:285
No-op; this class does not provide per-bin statistics.
Definition: THistData.hxx:133
typedef void((*Func_t)())
Hist::CoordArray_t< DIMENSIONS > CoordArray_t
The type of a (possibly multi-dimensional) coordinate.
Definition: THistData.hxx:212
Histogram statistics to keep track of the Poisson uncertainty per bin.
Definition: THistData.hxx:208
Content_t fSumWeightsSquared
Uncertainty of the content for each bin.
Definition: THistData.hxx:255
Basic histogram statistics, keeping track of the bin content and the total number of calls to Fill()...
Definition: THistData.hxx:37
TBinStat(const THistStatRuntime &, int)
Definition: THistData.hxx:351
STORAGE< PRECISION > Content_t
Type of the bin content array.
Definition: THistData.hxx:44
Hist::CoordArray_t< DIMENSIONS > CoordArray_t
The type of a (possibly multi-dimensional) coordinate.
Definition: THistData.hxx:168
Modifying view on a THistStatContent for a given bin.
Definition: THistData.hxx:64
PRECISION Weight_t
The type of the weight and the bin content.
Definition: THistData.hxx:170
Content_t fBinContent
Bin content.
Definition: THistData.hxx:82
For now do as TH1: calculate first (xw) and second (x^2w) moment.
Definition: THistData.hxx:292
double GetUncertainty(...) const
Calculate the bin content&#39;s uncertainty for the given bin, using Poisson statistics on the absolute b...
Definition: THistData.hxx:412
Content_t & GetContentArray()
Retrieve the content array (non-const).
Definition: THistData.hxx:114
PRECISION Weight_t
The type of the weight and the bin content.
Definition: THistData.hxx:297
Weight_t GetSumOfWeights() const
Get the sum of weights.
Definition: THistData.hxx:155
Const view on a THistStatUncertainty for a given bin.
Definition: THistData.hxx:222
THistData(size_t size)
Constructor providing the number of bins (incl under, overflow) to the base classes.
Definition: THistData.hxx:460
Keeps track of the histogram&#39;s total sum of squared weights.
Definition: THistData.hxx:165
ConstHistBinStat_t GetView(int idx) const
Get a view on the statistics values of a bin.
Definition: THistData.hxx:505