ROOT  6.06/09
Reference Guide
THistImpl.h
Go to the documentation of this file.
1 /// \file ROOT/THistImpl.h
2 /// \ingroup Hist ROOT7
3 /// \author Axel Naumann <axel@cern.ch>
4 /// \date 2015-03-23
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_THistImpl
16 #define ROOT7_THistImpl
17 
18 #include <cctype>
19 #include "ROOT/RArrayView.h"
20 #include "ROOT/RTupleApply.h"
21 
22 #include "ROOT/TAxis.h"
23 
24 namespace ROOT {
25 
26 namespace Hist {
27 /// Iterator over n dimensional axes - an array of n axis iterators.
28 template<int NDIM> using AxisIter_t = std::array<TAxisBase::const_iterator, NDIM>;
29 /// Range over n dimensional axes - a pair of arrays of n axis iterators.
30 template<int NDIM> using AxisIterRange_t = std::array<AxisIter_t<NDIM>, 2>;
31 
32 /// Kinds of under- and overflow handling.
33 enum class EOverflow {
34  kNoOverflow = 0x0, ///< Exclude under- and overflows
35  kUnderflow = 0x1, ///< Include underflows
36  kOverflow = 0x2, ///< Include overflows
37  kUnderOver = 0x3, ///< Include both under- and overflows
38 };
39 
40 inline bool operator&(EOverflow a, EOverflow b) {
41  return static_cast<int>(a) & static_cast<int>(b);
42 }
43 }
44 
45 namespace Detail {
46 
47 /**
48  \class THistImplPrecisionAgnosticBase
49  Base class for THistImplBase that abstracts out the histogram's PRECISION.
50 
51  For operations such as painting a histogram, the PRECISION (type of the bin
52  content) is not relevant; painting will cast the underlying bin type to double.
53  To facilitate this, THistImplBase itself inherits from the
54  THistImplPrecisionAgnosticBase interface.
55  */
56 template <int DIMENSIONS>
58 public:
59  /// Type of the coordinate: a DIMENSIONS-dimensional array of doubles.
60  using Coord_t = std::array<double, DIMENSIONS>;
61 
63 
64  /// Number of dimensions of this histogram.
65  constexpr int GetNDim() const { return DIMENSIONS; }
66  /// Number of bins of this histogram, including all overflow and underflow
67  /// bins. Simply the product of all axes' number of bins.
68  virtual int GetNBins() const = 0;
69 
70  /// Given the coordinate `x`, determine the index of the bin.
71  virtual int GetBinIndex(const Coord_t& x) const = 0;
72  /// Given the coordinate `x`, determine the index of the bin, possibly growing
73  /// axes for which `x` is out of range.
74  virtual int GetBinIndexAndGrow(const Coord_t& x) = 0;
75 
76  /// Get the center in all dimensions of the bin with index `binidx`.
77  virtual Coord_t GetBinCenter(int binidx) const = 0;
78  /// Get the lower edge in all dimensions of the bin with index `binidx`.
79  virtual Coord_t GetBinFrom(int binidx) const = 0;
80  /// Get the upper edge in all dimensions of the bin with index `binidx`.
81  virtual Coord_t GetBinTo(int binidx) const = 0;
82 
83  /// The bin's uncertainty. size() of the vector is a multiple of 2:
84  /// several kinds of uncertainty, same number of entries for lower and upper.
85  virtual std::vector<double> GetBinUncertainties(int binidx) const = 0;
86 
87  /// The bin content, cast to double.
88  virtual double GetBinContentAsDouble(int binidx) const = 0;
89 
90  /// Get a TAxisView on axis with index iAxis.
91  ///
92  /// \param iAxis - index of the axis, must be 0 <= iAxis < DIMENSION
93  virtual TAxisView GetAxis(int iAxis) const = 0;
94 
95  /// Get a Hist::AxisIterRange_t for the whole histogram, possibly
96  /// restricting the range to non-overflow bins.
97  ///
98  /// \param withOverUnder - specifies for each dimension whether under and
99  /// overflow should be included in the returned range.
101  GetRange(const std::array<Hist::EOverflow, DIMENSIONS>& withOverUnder) const = 0;
102 };
103 
104 
105 /**
106  \class THistImplBase
107  Interface class for THistImpl.
108 
109  THistImpl is templated for a specific configuration of axes. To enable access
110  through THist, THistImpl inherits from THistImplBase, exposing only dimension
111  (`DIMENSION`) and bin type (`PRECISION`).
112  */
113 template<int DIMENSIONS, class PRECISION>
115 public:
116  /// Type of a coordinate: an array of `DIMENSIONS` doubles.
118  /// Type of the bin content (and thus weights).
120  /// Type of the Fill(x, w) function
121  using FillFunc_t = void (THistImplBase::*)(const Coord_t& x, Weight_t w);
122 
123  /// Interface function to fill a vector or array of coordinates with
124  /// corresponding weights.
125  /// \note the size of `xN` and `weightN` must be the same!
126  virtual void FillN(const std::array_view<Coord_t> xN,
127  const std::array_view<Weight_t> weightN) = 0;
128 
129  /// Interface function to fill a vector or array of coordinates.
130  virtual void FillN(const std::array_view<Coord_t> xN) = 0;
131 
132  /// Retrieve the pointer to the overridden Fill(x, w) function.
133  virtual FillFunc_t GetFillFunc() const = 0;
134 
135 
136  /// Get the bin content (sum of weights) for bin index `binidx`.
137  virtual PRECISION GetBinContent(int binidx) const = 0;
138 
139  /// Get the bin content (sum of weights) for bin index `binidx`, cast to
140  /// double.
141  double GetBinContentAsDouble(int binidx) const final {
142  return (double) GetBinContent(binidx);
143  }
144 };
145 } // namespace Detail
146 
147 
148 namespace Internal {
149 /** \name Histogram traits
150  Helper traits for histogram operations.
151  */
152 ///\{
153 
154 /// \name AxisTupleOperations
155 /// Template operations on axis tuple.
156 ///@{
157 template <int IDX, class AXISTUPLE> struct TGetBinCount;
158 
159 template <class AXES> struct TGetBinCount<0, AXES> {
160  int operator()(const AXES& axes) const {
161  return std::get<0>(axes).GetNBins();
162  }
163 };
164 
165 
166 template <int I, class AXES>
167 struct TGetBinCount {
168  int operator()(const AXES& axes) const {
169  return std::get<I>(axes).GetNBins() * TGetBinCount<I - 1, AXES>()(axes);
170  }
171 };
172 
173 
174 template <int IDX, class HISTIMPL, class AXES, bool GROW>
176 
177 // Break recursion
178 template <class HISTIMPL, class AXES, bool GROW>
179 struct TGetBinIndex< -1, HISTIMPL, AXES, GROW> {
180  int operator()(HISTIMPL*, const AXES&, const typename HISTIMPL::Coord_t&,
183  return 0;
184  }
185 };
186 
187 template <int I, class HISTIMPL, class AXES, bool GROW>
188 struct TGetBinIndex {
189  int operator()(HISTIMPL* hist, const AXES& axes,
190  const typename HISTIMPL::Coord_t& x, TAxisBase::EFindStatus& status) const {
191  int bin = std::get<I>(axes).FindBin(x[I]);
192  if (GROW && std::get<I>(axes).CanGrow()
193  && (bin < 0 || bin > std::get<I>(axes).GetNBinsNoOver())) {
194  hist->GrowAxis(I, x[I]);
196 
197  // Abort bin calculation; we don't care. Let THist::GetBinIndex() retry!
198  return bin;
199  }
200  return bin + TGetBinIndex<I - 1, HISTIMPL, AXES, GROW>()(hist, axes, x, status)
201  * std::get<I>(axes).GetNBins();
202  }
203 };
204 
205 
206 template<int I, class AXES> struct FillIterRange_t;
207 
208 // Break recursion.
209 template<class AXES> struct FillIterRange_t<-1, AXES> {
211  const AXES& /*axes*/,
212  const std::array<Hist::EOverflow, std::tuple_size<AXES>::value>& /*over*/) const {}
213 };
214 
215 /** Fill `range` with begin() and end() of all axes, including under/overflow
216  as specified by `over`.
217 */
218 template<int I, class AXES>
219 struct FillIterRange_t {
221  const AXES &axes,
222  const std::array<Hist::EOverflow, std::tuple_size<AXES>::value> &over) const {
223  if (over[I] & Hist::EOverflow::kUnderflow)
224  range[0][I] = std::get<I>(axes).begin_with_underflow();
225  else
226  range[0][I] = std::get<I>(axes).begin();
227  if (over[I] & Hist::EOverflow::kOverflow)
228  range[1][I] = std::get<I>(axes).end_with_overflow();
229  else
230  range[1][I] = std::get<I>(axes).end();
231  FillIterRange_t<I - 1, AXES>()(range, axes, over);
232  }
233 };
234 
235 
236 
237 enum class EBinCoord {
238  kBinFrom, ///< Get the lower bin edge
239  kBinCenter, ///< Get the bin center
240  kBinTo ///< Get the bin high edge
241 };
242 
243 template<int I, class COORD, class AXES> struct FillBinCoord_t;
244 
245 // Break recursion.
246 template<class COORD, class AXES> struct FillBinCoord_t<-1, COORD, AXES> {
247  void operator()(COORD& /*coord*/, const AXES& /*axes*/, EBinCoord /*kind*/, int /*binidx*/) const {}
248 };
249 
250 /** Fill `coord` with low bin edge or center or high bin edge of all axes.
251 */
252 template<int I, class COORD, class AXES>
253 struct FillBinCoord_t {
254  void operator()(COORD& coord, const AXES& axes, EBinCoord kind, int binidx) const {
255  int axisbin = binidx % std::get<I>(axes).GetNBins();
256  size_t coordidx = std::tuple_size<AXES>::value - I;
257  switch (kind) {
258  case EBinCoord::kBinFrom:
259  coord[coordidx] = std::get<I>(axes).GetBinFrom(axisbin);
260  break;
262  coord[coordidx] = std::get<I>(axes).GetBinCenter(axisbin);
263  break;
264  case EBinCoord::kBinTo:
265  coord[coordidx] = std::get<I>(axes).GetBinTo(axisbin);
266  break;
267  }
268  FillBinCoord_t<I - 1, COORD, AXES>()(coord, axes, kind,
269  binidx / std::get<I>(axes).GetNBins());
270  }
271 };
272 
273 
274 
275 template <class... AXISCONFIG>
276 static std::array<TAxisView, sizeof...(AXISCONFIG)>
277 GetAxisView(const AXISCONFIG&...axes) noexcept {
278  std::array<TAxisView, sizeof...(AXISCONFIG)> axisViews = {
279  {TAxisView(axes)...}
280  };
281  return axisViews;
282 }
283 
284 ///\}
285 } // namespace Internal
286 
287 
288 template <int DIMENSIONS, class PRECISION> class THist;
289 
290 namespace Detail {
291 
292 template <int DIMENSIONS, class PRECISION, class STATISTICS, class... AXISCONFIG>
293 class THistImpl final: public THistImplBase<DIMENSIONS, PRECISION>,
294  STATISTICS {
295  static_assert(sizeof...(AXISCONFIG) == DIMENSIONS,
296  "Number of axes must equal histogram dimension");
297  friend class THist<DIMENSIONS, PRECISION>;
298 
299 public:
301  using Coord_t = typename ImplBase_t::Coord_t;
302  using Weight_t = typename ImplBase_t::Weight_t;
303  using typename ImplBase_t::FillFunc_t;
304  template <int NDIM = DIMENSIONS> using AxisIterRange_t
306 
307 private:
308  /// Get the number of bins in this histograms, including possible under- and
309  /// overflow bins.
310  int GetNBins() const final {
311  return Internal::TGetBinCount<sizeof...(AXISCONFIG) - 1,
312  decltype(fAxes)>()(fAxes);
313  }
314 
315  /// Add `w` to the bin at index `bin`.
316  void AddBinContent(int bin, Weight_t w) {
317  fContent[bin] += w;
318  }
319 
320  std::tuple<AXISCONFIG...> fAxes; ///< The histogram's axes
321  std::vector<PRECISION> fContent; ///< The histogram's bin content
322 
323 public:
324  THistImpl(STATISTICS statConfig, AXISCONFIG... axisArgs);
325 
326  /// Retrieve the fill function for this histogram implementation, to prevent
327  /// the virtual function call for high-frequency fills.
328  FillFunc_t GetFillFunc() const final { return (FillFunc_t)&THistImpl::Fill; }
329 
330  /// Get the axes of this histogram.
331  const std::tuple<AXISCONFIG...>& GetAxes() const { return fAxes; }
332 
333  /// Normalized axes access, converting the actual axis to TAxisConfig
334  TAxisView GetAxis(int iAxis) const final {
335  return std::apply(Internal::GetAxisView<AXISCONFIG...>, fAxes)[iAxis];
336  }
337 
338 
339  /// Gets the bin index for coordinate `x`; returns -1 if there is no such bin,
340  /// e.g. for axes without over / underflow but coordinate out of range.
341  int GetBinIndex(const Coord_t& x) const final {
343  int ret = Internal::TGetBinIndex<DIMENSIONS - 1, THistImpl,
344  decltype(fAxes), false>()(nullptr, fAxes, x, status);
345  if (status != TAxisBase::EFindStatus::kValid)
346  return -1;
347  return ret;
348  }
349 
350  /// Gets the bin index for coordinate `x`, growing the axes as needed and
351  /// possible. Returns -1 if there is no such bin,
352  /// e.g. for axes without over / underflow but coordinate out of range.
353  int GetBinIndexAndGrow(const Coord_t& x) final {
355  int ret = - 1;
356  while (status == TAxisBase::EFindStatus::kCanGrow) {
357  ret = Internal::TGetBinIndex<DIMENSIONS - 1, THistImpl, decltype(fAxes), true>()
358  (this, fAxes, x, status);
359  }
360  return ret;
361  }
362 
363  /// Get the center coordinate of the bin.
364  Coord_t GetBinCenter(int binidx) const final {
365  using FillBinCoord_t
366  = Internal::FillBinCoord_t<DIMENSIONS - 1, Coord_t, decltype(fAxes)>;
367  Coord_t coord;
369  return coord;
370  }
371 
372  /// Get the coordinate of the low limit of the bin.
373  Coord_t GetBinFrom(int binidx) const final {
374  using FillBinCoord_t = Internal::FillBinCoord_t<DIMENSIONS - 1, Coord_t, decltype(fAxes)>;
375  Coord_t coord;
377  return coord;
378  }
379 
380  /// Get the coordinate of the high limit of the bin.
381  Coord_t GetBinTo(int binidx) const final {
382  using FillBinCoord_t = Internal::FillBinCoord_t<DIMENSIONS - 1, Coord_t, decltype(fAxes)>;
383  Coord_t coord;
385  return coord;
386  }
387 
388  /// Fill an array of `weightN` to the bins specified by coordinates `xN`.
389  /// For each element `i`, the weight `weightN[i]` will be added to the bin
390  /// at the coordinate `xN[i]`
391  /// \note `xN` and `weightN` must have the same size!
393  const std::array_view<Weight_t> weightN) final {
394 #ifndef NDEBUG
395  if (xN.size() != weightN.size()) {
396  R__ERROR_HERE("HIST") << "Not the same number of points and weights!";
397  return;
398  }
399 #endif
400 
401  for (int i = 0; i < xN.size(); ++i) {
402  Fill(xN[i], weightN[i]);
403  STATISTICS::Fill(xN[i], weightN[i]);
404  }
405  }
406 
407  /// Fill an array of `weightN` to the bins specified by coordinates `xN`.
408  /// For each element `i`, the weight `weightN[i]` will be added to the bin
409  /// at the coordinate `xN[i]`
410  void FillN(const std::array_view<Coord_t> xN) final {
411  for (int i = 0; i < xN.size(); ++i) {
412  Fill(xN[i]);
413  STATISTICS::Fill(xN[i]);
414  }
415  }
416 
417  /// Return the uncertainties for the given bin.
418  std::vector<double> GetBinUncertainties(int binidx) const final {
419  return STATISTICS::GetBinUncertainties(binidx, *this);
420  }
421 
422  /// Add a single weight `w` to the bin at coordinate `x`.
423  void Fill(const Coord_t& x, Weight_t w = 1.) {
424  int bin = GetBinIndexAndGrow(x);
425  if (bin >= 0)
426  AddBinContent(bin, w);
427  STATISTICS::Fill(x, w);
428  }
429 
430  /// Get the content of the bin at position `x`.
431  PRECISION GetBinContent(const Coord_t& x) const {
432  int bin = GetBinIndex(x);
433  if (bin >= 0)
434  return GetBinContent(bin);
435  return 0.;
436  }
437 
438 
439  /// Get the content of the bin at bin index `binidx`.
440  PRECISION GetBinContent(int binidx) const final {
441  return fContent[binidx];
442  }
443 
444  /// Get the begin() and end() for each axis.
445  ///
446  ///\param[in] withOverUnder - Whether the begin and end should contain over-
447  /// or underflow. Ignored if the axis does not support over- / underflow.
448  AxisIterRange_t<DIMENSIONS>
449  GetRange(const std::array<Hist::EOverflow, DIMENSIONS>& withOverUnder) const final {
450  std::array<std::array<TAxisBase::const_iterator, DIMENSIONS>, 2> ret;
451  Internal::FillIterRange_t<DIMENSIONS - 1, decltype(fAxes)>()(ret, fAxes, withOverUnder);
452  return ret;
453  }
454 
455  /// Grow the axis number `iAxis` to fit the coordinate `x`.
456  ///
457  /// The histogram (conceptually) combines pairs of bins along this axis until
458  /// `x` is within the range of the axis.
459  /// The axis must support growing for this to work (e.g. a `TAxisGrow`).
460  void GrowAxis(int /*iAxis*/, double /*x*/) {
461  // TODO: Implement GrowAxis()
462  }
463 };
464 
465 
466 template <int DIMENSIONS, class PRECISION, class STATISTICS, class... AXISCONFIG>
467 THistImpl<DIMENSIONS, PRECISION, STATISTICS, AXISCONFIG...>::THistImpl(STATISTICS statConfig, AXISCONFIG... axisArgs):
468  STATISTICS(statConfig), fAxes{axisArgs...}, fContent(GetNBins())
469 {}
470 
471 #if 0
472 // In principle we can also have a runtime version of THistImpl, that does not
473 // contain a tuple of concrete axis types but a vector of `TAxisConfig`.
474 template <int DIMENSIONS, class PRECISION>
475 class THistImplRuntime: public THistImplBase<DIMENSIONS, PRECISION> {
476 public:
477  THistImplRuntime(std::array<TAxisConfig, DIMENSIONS>&& axisCfg);
478 };
479 #endif
480 
481 } // namespace Detail
482 } // namespace ROOT
483 
484 #endif
PRECISION Weight_t
Type of the bin content (and thus weights).
Definition: THistImpl.h:119
Fill coord with low bin edge or center or high bin edge of all axes.
Definition: THistImpl.h:243
int GetBinIndex(const Coord_t &x) const final
Gets the bin index for coordinate x; returns -1 if there is no such bin, e.g.
Definition: THistImpl.h:341
bool operator&(EOverflow a, EOverflow b)
Definition: THistImpl.h:40
std::array< TAxisBase::const_iterator, NDIM > AxisIter_t
Iterator over n dimensional axes - an array of n axis iterators.
Definition: THistImpl.h:28
Exclude under- and overflows.
int operator()(const AXES &axes) const
Definition: THistImpl.h:160
Coordinate could fit after growing the axis.
Namespace for new ROOT classes and functions.
Definition: ROOT.py:1
static std::array< TAxisView, sizeof...(AXISCONFIG)> GetAxisView(const AXISCONFIG &...axes) noexcept
Definition: THistImpl.h:277
virtual void FillN(const std::array_view< Coord_t > xN, const std::array_view< Weight_t > weightN)=0
Interface function to fill a vector or array of coordinates with corresponding weights.
Common view on a TAxis, no matter what its kind.
Definition: TAxis.h:699
Get the bin high edge.
void operator()(Hist::AxisIterRange_t< std::tuple_size< AXES >::value > &range, const AXES &axes, const std::array< Hist::EOverflow, std::tuple_size< AXES >::value > &over) const
Definition: THistImpl.h:220
std::vector< PRECISION > fContent
The histogram's bin content.
Definition: THistImpl.h:321
void operator()(Hist::AxisIterRange_t< std::tuple_size< AXES >::value > &, const AXES &, const std::array< Hist::EOverflow, std::tuple_size< AXES >::value > &) const
Definition: THistImpl.h:210
virtual int GetBinIndexAndGrow(const Coord_t &x)=0
Given the coordinate x, determine the index of the bin, possibly growing axes for which x is out of r...
TAlienJobStatus * status
Definition: TAlienJob.cxx:51
TArc * a
Definition: textangle.C:12
THistImpl(STATISTICS statConfig, AXISCONFIG...axisArgs)
Definition: THistImpl.h:467
int GetBinIndexAndGrow(const Coord_t &x) final
Gets the bin index for coordinate x, growing the axes as needed and possible.
Definition: THistImpl.h:353
virtual Coord_t GetBinCenter(int binidx) const =0
Get the center in all dimensions of the bin with index binidx.
typename THistImplPrecisionAgnosticBase< DIMENSIONS >::Coord_t Coord_t
Type of a coordinate: an array of DIMENSIONS doubles.
Definition: THistImpl.h:117
void AddBinContent(int bin, Weight_t w)
Add w to the bin at index bin.
Definition: THistImpl.h:316
virtual double GetBinContentAsDouble(int binidx) const =0
The bin content, cast to double.
int operator()(HISTIMPL *hist, const AXES &axes, const typename HISTIMPL::Coord_t &x, TAxisBase::EFindStatus &status) const
Definition: THistImpl.h:189
PRECISION GetBinContent(const Coord_t &x) const
Get the content of the bin at position x.
Definition: THistImpl.h:431
Double_t x[n]
Definition: legend1.C:17
#define PRECISION
Definition: MnPrint.cxx:26
Coord_t GetBinCenter(int binidx) const final
Get the center coordinate of the bin.
Definition: THistImpl.h:364
std::vector< double > GetBinUncertainties(int binidx) const final
Return the uncertainties for the given bin.
Definition: THistImpl.h:418
void operator()(COORD &coord, const AXES &axes, EBinCoord kind, int binidx) const
Definition: THistImpl.h:254
constexpr int GetNDim() const
Number of dimensions of this histogram.
Definition: THistImpl.h:65
virtual Coord_t GetBinFrom(int binidx) const =0
Get the lower edge in all dimensions of the bin with index binidx.
double GetBinContentAsDouble(int binidx) const final
Get the bin content (sum of weights) for bin index binidx, cast to double.
Definition: THistImpl.h:141
void(THistImplBase::*)(const Coord_t &x, Weight_t w) FillFunc_t
Type of the Fill(x, w) function.
Definition: THistImpl.h:121
void FillN(const std::array_view< Coord_t > xN, const std::array_view< Weight_t > weightN) final
Fill an array of weightN to the bins specified by coordinates xN.
Definition: THistImpl.h:392
virtual int GetBinIndex(const Coord_t &x) const =0
Given the coordinate x, determine the index of the bin.
typename ImplBase_t::Coord_t Coord_t
Definition: THistImpl.h:301
virtual int GetNBins() const =0
Number of bins of this histogram, including all overflow and underflow bins.
Coord_t GetBinTo(int binidx) const final
Get the coordinate of the high limit of the bin.
Definition: THistImpl.h:381
double Coord_t
Definition: RtypesCore.h:81
virtual Coord_t GetBinTo(int binidx) const =0
Get the upper edge in all dimensions of the bin with index binidx.
std::array< AxisIter_t< NDIM >, 2 > AxisIterRange_t
Range over n dimensional axes - a pair of arrays of n axis iterators.
Definition: THistImpl.h:30
typename Hist::AxisIterRange_t< NDIM > AxisIterRange_t
Definition: THistImpl.h:305
Get the lower bin edge.
int operator()(HISTIMPL *, const AXES &, const typename HISTIMPL::Coord_t &, TAxisBase::EFindStatus &status) const
Definition: THistImpl.h:180
void Fill(const Coord_t &x, Weight_t w=1.)
Add a single weight w to the bin at coordinate x.
Definition: THistImpl.h:423
PRECISION GetBinContent(int binidx) const final
Get the content of the bin at bin index binidx.
Definition: THistImpl.h:440
void FillN(const std::array_view< Coord_t > xN) final
Fill an array of weightN to the bins specified by coordinates xN.
Definition: THistImpl.h:410
virtual FillFunc_t GetFillFunc() const =0
Retrieve the pointer to the overridden Fill(x, w) function.
virtual std::vector< double > GetBinUncertainties(int binidx) const =0
The bin's uncertainty.
virtual TAxisView GetAxis(int iAxis) const =0
Get a TAxisView on axis with index iAxis.
Fill range with begin() and end() of all axes, including under/overflow as specified by over...
Definition: THistImpl.h:206
The returned bin index is valid.
AxisIterRange_t< DIMENSIONS > GetRange(const std::array< Hist::EOverflow, DIMENSIONS > &withOverUnder) const final
Get the begin() and end() for each axis.
Definition: THistImpl.h:449
int GetNBins() const final
Get the number of bins in this histograms, including possible under- and overflow bins...
Definition: THistImpl.h:310
std::array< double, DIMENSIONS > Coord_t
Type of the coordinate: a DIMENSIONS-dimensional array of doubles.
Definition: THistImpl.h:60
typedef void((*Func_t)())
Base class for THistImplBase that abstracts out the histogram's PRECISION.
Definition: THistImpl.h:57
virtual Hist::AxisIterRange_t< DIMENSIONS > GetRange(const std::array< Hist::EOverflow, DIMENSIONS > &withOverUnder) const =0
Get a Hist::AxisIterRange_t for the whole histogram, possibly restricting the range to non-overflow b...
int operator()(const AXES &axes) const
Definition: THistImpl.h:168
#define R__ERROR_HERE(GROUP)
Definition: TLogger.h:125
Coord_t GetBinFrom(int binidx) const final
Get the coordinate of the low limit of the bin.
Definition: THistImpl.h:373
void operator()(COORD &, const AXES &, EBinCoord, int) const
Definition: THistImpl.h:247
FillFunc_t GetFillFunc() const final
Retrieve the fill function for this histogram implementation, to prevent the virtual function call fo...
Definition: THistImpl.h:328
Include both under- and overflows.
EOverflow
Kinds of under- and overflow handling.
Definition: THistImpl.h:33
EFindStatus
Status of FindBin(x)
Definition: TAxis.h:40
Interface class for THistImpl.
Definition: THistImpl.h:114
#define I(x, y, z)
void GrowAxis(int, double)
Grow the axis number iAxis to fit the coordinate x.
Definition: THistImpl.h:460
float value
Definition: math.cpp:443
Histogram class for histograms with DIMENSIONS dimensions, where each bin count is stored by a value ...
Definition: THist.h:31
virtual PRECISION GetBinContent(int binidx) const =0
Get the bin content (sum of weights) for bin index binidx.
TAxisView GetAxis(int iAxis) const final
Normalized axes access, converting the actual axis to TAxisConfig.
Definition: THistImpl.h:334
std::tuple< AXISCONFIG...> fAxes
The histogram's axes.
Definition: THistImpl.h:320
const std::tuple< AXISCONFIG...> & GetAxes() const
Get the axes of this histogram.
Definition: THistImpl.h:331