16#ifndef ROOT7_RHistData
17#define ROOT7_RHistData
25namespace Experimental {
27template <
int DIMENSIONS,
class PRECISION,
template <
int D_,
class P_>
class...
STAT>
35template <
int DIMENSIONS,
class PRECISION>
155 &&
"this and other have incompatible bin configuration!");
157 &&
"this and other have incompatible bin configuration!");
170template <
int DIMENSIONS,
class PRECISION>
214template <
int DIMENSIONS,
class PRECISION>
258template <
int DIMENSIONS,
class PRECISION>
364 &&
"this and other have incompatible bin configuration!");
366 &&
"this and other have incompatible bin configuration!");
377template <
int DIMENSIONS,
class PRECISION>
411 for (
int idim = 0; idim < DIMENSIONS; ++idim) {
422 for (
size_t d = 0;
d < DIMENSIONS; ++
d) {
432template <
int DIMENSIONS,
class PRECISION>
467template <
class DATA,
class... BASES>
484 struct AllYourBaseAreBelongToUs:
public BASES... {
486 return sizeof(HaveUncertainty<AllYourBaseAreBelongToUs>(
nullptr)) ==
sizeof(
double);
490 template <
bool B = true,
class =
typename std::enable_if<B && HasBinUncerta
inty()>::type>
493 return this->GetUncertaintyImpl();
498 template <
bool B = true,
class =
typename std::enable_if<B && !HasBinUncerta
inty()>::type>
501 auto content = this->GetContent();
502 return std::sqrt(std::fabs(content));
509template <
int DIMENSIONS,
class PRECISION,
class STORAGE,
template <
int D_,
class P_>
class...
STAT>
514 static auto HaveUncertainty(
const T *This) ->
decltype(This->GetBinUncertaintyImpl(12));
537 static constexpr int GetNDim() noexcept {
return DIMENSIONS; }
562 using trigger_base_fill =
int[];
571 template <
typename OtherData>
572 void Add(
const OtherData &other)
575 using trigger_base_add =
int[];
583 struct AllYourBaseAreBelongToUs:
public STAT<DIMENSIONS, PRECISION>... {
585 return sizeof(HaveUncertainty<AllYourBaseAreBelongToUs>(
nullptr)) ==
sizeof(
double);
590 template <
bool B = true,
class =
typename std::enable_if<B && HasBinUncerta
inty()>::type>
593 return this->GetBinUncertaintyImpl(binidx);
598 template <
bool B = true,
class =
typename std::enable_if<B && !HasBinUncerta
inty()>::type>
601 auto content = this->GetBinContent(binidx);
602 return std::sqrt(std::fabs(content));
typedef void(GLAPIENTRYP _GLUfuncptr)(void)
Const view on a bin's statistical data.
static char HaveUncertainty(...)
Fall-back case for check whether double T::GetBinUncertaintyImpl(int) can be called.
RHistBinStat(DATA &data, int index)
static auto HaveUncertainty(const T *This) -> decltype(This->GetUncertaintyImpl())
Check whether double T::GetBinUncertaintyImpl(int) can be called.
static constexpr bool HasBinUncertainty()
Whether this provides storage for uncertainties, or whether uncertainties are determined as poisson u...
double GetUncertainty(...) const
Calculate the bin content's uncertainty for the given bin, using Poisson statistics on the absolute b...
double GetUncertainty() const
Calculate the bin content's uncertainty for the given bin, using base class information,...
A RHistImplBase's data, provides accessors to all its statistics.
static char HaveUncertainty(...)
Fall-back case for check whether double T::GetBinUncertaintyImpl(int) can be called.
RHistBinStat< const RHistData, typename STAT< DIMENSIONS, PRECISION >::ConstBinStat_t... > ConstHistBinStat_t
The type of a non-modifying view on a bin.
HistBinStat_t GetView(int idx)
Get a (non-const) view on the statistics values of a bin.
RHistData(size_t bin_size, size_t overflow_size)
Constructor providing the number of bins (incl under, overflow) to the base classes.
static constexpr bool HasBinUncertainty()
Whether this provides storage for uncertainties, or whether uncertainties are determined as poisson u...
void Add(const OtherData &other)
Integrate other statistical data into the current data.
ConstHistBinStat_t GetView(int idx) const
Get a view on the statistics values of a bin.
PRECISION Weight_t
The type of the weight and the bin content.
void Fill(const CoordArray_t &x, int binidx, Weight_t weight=1.)
Fill weight at x to the bin content at binidx.
double GetBinUncertainty(int binidx) const
Calculate the bin content's uncertainty for the given bin, using base class information,...
RHistBinStat< RHistData, typename STAT< DIMENSIONS, PRECISION >::BinStat_t... > HistBinStat_t
The type of a modifying view on a bin.
static constexpr int GetNDim() noexcept
Number of dimensions of the coordinates.
double GetBinUncertainty(int binidx,...) const
Calculate the bin content's uncertainty for the given bin, using Poisson statistics on the absolute b...
static auto HaveUncertainty(const T *This) -> decltype(This->GetBinUncertaintyImpl(12))
Check whether double T::GetBinUncertaintyImpl(int) can be called.
No-op; this class does not provide per-bin statistics.
RBinStat(const RHistDataMomentUncert &, int)
For now do as RH1: calculate first (xw) and second (x^2w) moment.
RHistDataMomentUncert()=default
PRECISION Weight_t
The type of the weight and the bin content.
RHistDataMomentUncert(size_t, size_t)
std::array< Weight_t, DIMENSIONS > fMomentX2W
void Add(const RHistDataMomentUncert &other)
Merge with other RHistDataMomentUncert data, assuming same bin configuration.
std::vector< PRECISION > Content_t
Type of the bin content array.
void Fill(const CoordArray_t &x, int, Weight_t weight=1.)
Add weight to the bin at binidx; the coordinate was x.
std::array< Weight_t, DIMENSIONS > fMomentXW
Modifying view on a RHistStatContent for a given bin.
PRECISION & GetContent() const
RBinStat(RHistStatContent &stat, int index)
PRECISION & fContent
The content of this bin.
Const view on a RHistStatContent for a given bin.
RConstBinStat(const RHistStatContent &stat, int index)
PRECISION fContent
The content of this bin.
PRECISION GetContent() const
Basic histogram statistics, keeping track of the bin content and the total number of calls to Fill().
Weight_t & GetBinContent(int binidx)
Get the bin content for the given bin (non-const).
Content_t & GetOverflowContentArray()
Retrieve the under-/overflow content array (non-const).
size_t sizeUnderOver() const noexcept
Get the number of bins including under- and overflow..
Content_t & GetContentArray()
Retrieve the content array (non-const).
Content_t fBinContent
Bin content.
Weight_t operator[](int binidx) const
Get the bin content for the given bin.
RHistStatContent()=default
Weight_t GetBinArray(int binidx) const
Get a reference to the bin corresponding to binidx of the correct bin content array i....
RHistStatContent(size_t bin_size, size_t overflow_size)
Weight_t & operator[](int binidx)
Get the bin content for the given bin (non-const).
std::vector< PRECISION > Content_t
Type of the bin content array.
const Content_t & GetContentArray() const
Retrieve the content array.
int64_t GetEntries() const
Get the number of entries filled into the histogram - i.e.
void Add(const RHistStatContent &other)
Merge with other RHistStatContent, assuming same bin configuration.
int64_t fEntries
Number of calls to Fill().
size_t size() const noexcept
Get the number of bins including under- and overflow..
const Content_t & GetOverflowContentArray() const
Retrieve the under-/overflow content array.
Weight_t & GetBinArray(int binidx)
Get a reference to the bin corresponding to binidx of the correct bin content array (non-const) i....
void Fill(const CoordArray_t &, int binidx, Weight_t weight=1.)
Add weight to the bin content at binidx.
Content_t fOverflowBinContent
Under- and overflow bin content.
Weight_t GetBinContent(int binidx) const
Get the bin content for the given bin.
PRECISION Weight_t
The type of the weight and the bin content.
size_t sizeNoOver() const noexcept
Get the number of bins exluding under- and overflow.
No-op; this class does not provide per-bin statistics.
RBinStat(const RHistStatRuntime &, int)
Interface implementing a pure virtual functions DoFill(), DoFillN().
virtual ~RHistStatRuntime()=default
PRECISION Weight_t
The type of the weight and the bin content.
RHistStatRuntime(size_t, size_t)
std::vector< PRECISION > Content_t
Type of the bin content array.
virtual void DoFill(const CoordArray_t &x, int binidx, Weight_t weightN)=0
void Fill(const CoordArray_t &x, int binidx, Weight_t weight=1.)
RHistStatRuntime()=default
No-op; this class does not provide per-bin statistics.
RBinStat(const RHistStatTotalSumOfSquaredWeights &, int)
Keeps track of the histogram's total sum of squared weights.
RHistStatTotalSumOfSquaredWeights()=default
RHistStatTotalSumOfSquaredWeights(size_t, size_t)
void Add(const RHistStatTotalSumOfSquaredWeights &other)
Merge with other RHistStatTotalSumOfSquaredWeights data, assuming same bin configuration.
void Fill(const CoordArray_t &, int, Weight_t weight=1.)
Add weight to the bin content at binidx.
PRECISION fSumWeights2
Sum of (weights^2).
PRECISION Weight_t
The type of the weight and the bin content.
Weight_t GetSumOfSquaredWeights() const
Get the sum of weights.
No-op; this class does not provide per-bin statistics.
RBinStat(const RHistStatTotalSumOfWeights &, int)
Keeps track of the histogram's total sum of weights.
Weight_t GetSumOfWeights() const
Get the sum of weights.
RHistStatTotalSumOfWeights()=default
PRECISION Weight_t
The type of the weight and the bin content.
PRECISION fSumWeights
Sum of weights.
void Fill(const CoordArray_t &, int, Weight_t weight=1.)
Add weight to the bin content at binidx.
void Add(const RHistStatTotalSumOfWeights &other)
Merge with other RHistStatTotalSumOfWeights data, assuming same bin configuration.
RHistStatTotalSumOfWeights(size_t, size_t)
Modifying view on a RHistStatUncertainty for a given bin.
double GetUncertaintyImpl() const
PRECISION & fSumW2
The bin's sum of square of weights.
RBinStat(RHistStatUncertainty &stat, int index)
PRECISION & GetSumW2() const
Const view on a RHistStatUncertainty for a given bin.
RConstBinStat(const RHistStatUncertainty &stat, int index)
PRECISION GetSumW2() const
PRECISION fSumW2
The bin's sum of square of weights.
double GetUncertaintyImpl() const
Histogram statistics to keep track of the Poisson uncertainty per bin.
Content_t fOverflowSumWeightsSquared
Uncertainty of the under-/overflow content.
double GetBinUncertaintyImpl(int binidx) const
Calculate a bin's (Poisson) uncertainty of the bin content as the square-root of the bin's sum of squ...
const std::vector< double > & GetSumOfSquaredWeights() const
Get the structure holding the sum of squares of weights.
void Add(const RHistStatUncertainty &other)
Merge with other RHistStatUncertainty data, assuming same bin configuration.
std::vector< double > & GetSumOfSquaredWeights()
Get the structure holding the sum of squares of weights (non-const).
Weight_t GetSumOfSquaredWeights(int binidx) const
Get a bin's sum of squared weights.
Content_t fSumWeightsSquared
Uncertainty of the content for each bin excluding under-/overflow.
std::vector< double > & GetOverflowSumOfSquaredWeights()
Get the structure holding the under-/overflow sum of squares of weights (non-const).
Weight_t & GetBinArray(int binidx)
Get a reference to the bin corresponding to binidx of the correct bin content array (non-const) i....
Weight_t GetBinArray(int binidx) const
Get a reference to the bin corresponding to binidx of the correct bin content array i....
RHistStatUncertainty(size_t bin_size, size_t overflow_size)
RHistStatUncertainty()=default
Weight_t & GetSumOfSquaredWeights(int binidx)
Get a bin's sum of squared weights.
std::vector< PRECISION > Content_t
Type of the bin content array.
const std::vector< double > & GetOverflowSumOfSquaredWeights() const
Get the structure holding the under-/overflow sum of squares of weights.
PRECISION Weight_t
The type of the weight and the bin content.
void Fill(const CoordArray_t &, int binidx, Weight_t weight=1.)
Add weight to the bin at binidx; the coordinate was x.
Histogram class for histograms with DIMENSIONS dimensions, where each bin count is stored by a value ...
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...