16#ifndef ROOT7_RHistImpl
17#define ROOT7_RHistImpl
33namespace Experimental {
35template <
int DIMENSIONS,
class PRECISION,
template <
int D_,
class P_>
class...
STAT>
41using AxisIter_t = std::array<RAxisBase::const_iterator, NDIMS>;
56 return static_cast<int>(
a) &
static_cast<int>(
b);
71template <
int DIMENSIONS>
88 static constexpr int GetNDim() {
return DIMENSIONS; }
173 RHistImplBase(std::string_view title,
size_t numBins,
size_t numOverflowBins)
179 virtual std::unique_ptr<RHistImplBase>
Clone()
const = 0;
184 virtual void FillN(
const std::span<const CoordArray_t> xN,
const std::span<const Weight_t> weightN) = 0;
187 virtual void FillN(
const std::span<const CoordArray_t> xN) = 0;
271template <
int IDX,
class AXISTUPLE>
272struct RGetNBinsNoOverCount;
276 int operator()(
const AXES &axes)
const {
return std::get<0>(axes).GetNBinsNoOver(); }
279template <
int I,
class AXES>
285template <
class... AXISCONFIG>
288 using axesTuple = std::tuple<AXISCONFIG...>;
295template <
int IDX,
class AXISTUPLE>
296struct RGetNBinsCount;
300 int operator()(
const AXES &axes)
const {
return std::get<0>(axes).GetNBins(); }
303template <
int I,
class AXES>
309template <
class... AXISCONFIG>
312 using axesTuple = std::tuple<AXISCONFIG...>;
313 return RGetNBinsCount<
sizeof...(AXISCONFIG) - 1, axesTuple>()(axesTuple{axisArgs...});
317template <
class... AXISCONFIG>
320 using axesTuple = std::tuple<AXISCONFIG...>;
321 return RGetNBinsCount<
sizeof...(AXISCONFIG) - 1, axesTuple>()(axesTuple{axisArgs...}) -
RGetNBinsNoOverCount<
sizeof...(AXISCONFIG) - 1, axesTuple>()(axesTuple{axisArgs...});
327template <
int I,
class AXES>
328struct RFillIterRange;
336template <
int I,
class AXES>
340 range[0][
I] = std::get<I>(axes).begin();
341 range[1][
I] = std::get<I>(axes).end();
349template <
int I,
int NDIMS,
typename BINS,
class AXES>
350struct RGetNRegularBinsBefore;
352template <
int NDIMS,
typename BINS,
class AXES>
358template <
int I,
int NDIMS,
typename BINS,
class AXES>
362 constexpr const int thisAxis = NDIMS -
I - 1;
363 binSizes[thisAxis] = binSizes[thisAxis-1] * std::get<thisAxis-1>(axes).GetNBinsNoOver();
384template <
int I,
int NDIMS,
typename BINS,
class AXES>
385struct RComputeGlobalBin;
387template <
int NDIMS,
typename BINS,
class AXES>
389 int operator()(
int total_regular_bins_before,
const AXES &,
const BINS &,
const BINS &,
const BINS &)
const
391 return total_regular_bins_before;
395template <
int I,
int NDIMS,
typename BINS,
class AXES>
397 int operator()(
int total_regular_bins_before,
const AXES &axes,
const BINS &virtualBins,
const BINS &binSizes,
const BINS &localBins)
const
401 const int num_underflow_bins =
static_cast<int>(!std::get<I>(axes).CanGrow());
402 const int num_regular_bins_before =
403 std::max(virtualBins[
I] - num_underflow_bins, 0);
404 total_regular_bins_before += num_regular_bins_before * binSizes[
I];
411 if (localBins[
I] < 1)
412 return total_regular_bins_before;
414 return RComputeGlobalBin<
I - 1, NDIMS, BINS, AXES>()(total_regular_bins_before, axes, virtualBins, binSizes, localBins);
421template <
int I,
int NDIMS,
class AXES>
422struct RComputeLocalBinsInitialisation;
424template <
int NDIMS,
class AXES>
426 void operator()(std::array<int, NDIMS-1> , std::array<int, NDIMS-1> ,
const AXES & )
const
430template <
int I,
int NDIMS,
class AXES>
432 void operator()(std::array<int, NDIMS-1>& bins_per_hyperplane, std::array<int, NDIMS-1>& regular_bins_per_hyperplane,
const AXES &axes)
const
434 constexpr const int thisAxis = NDIMS -
I - 1;
450template <
int I,
int NDIMS,
class AXES>
451struct RComputeLocalBins;
453template <
int NDIMS,
class AXES>
456 int &, std::array<int, NDIMS-1> ,
457 std::array<int, NDIMS-1> ,
int ,
462template <
int I,
int NDIMS,
class AXES>
464 void operator()(
const AXES &axes,
int &unprocessed_previous_overflow_bin,
465 int &num_regular_bins_before, std::array<int, NDIMS-1> bins_per_hyperplane,
466 std::array<int, NDIMS-1> regular_bins_per_hyperplane,
int curr_bins_per_hyperplane,
467 int curr_regular_bins_per_hyperplane)
const
471 const int num_underflow_hyperplanes =
472 static_cast<int>(!std::get<I>(axes).CanGrow());
473 const int bins_in_underflow_hyperplane =
474 num_underflow_hyperplanes * bins_per_hyperplane[
I-1];
479 const int overflow_bins_per_regular_hyperplane =
480 bins_per_hyperplane[
I-1] - regular_bins_per_hyperplane[
I-1];
485 if (overflow_bins_per_regular_hyperplane != 0) {
488 const int overflow_bins_in_regular_hyperplanes =
491 unprocessed_previous_overflow_bin
492 - bins_in_underflow_hyperplane,
495 overflow_bins_per_regular_hyperplane
496 * std::get<I>(axes).GetNBinsNoOver()
501 const int num_regular_hyperplanes_before =
502 overflow_bins_in_regular_hyperplanes
503 / overflow_bins_per_regular_hyperplane;
504 num_regular_bins_before +=
505 num_regular_hyperplanes_before
506 * regular_bins_per_hyperplane[
I-1];
511 unprocessed_previous_overflow_bin =
512 overflow_bins_in_regular_hyperplanes
513 % overflow_bins_per_regular_hyperplane;
519 if (unprocessed_previous_overflow_bin >= bins_in_underflow_hyperplane) {
520 num_regular_bins_before +=
521 std::get<I>(axes).GetNBinsNoOver()
522 * regular_bins_per_hyperplane[
I-1];
529 unprocessed_previous_overflow_bin = 0;
534 if (unprocessed_previous_overflow_bin == 0)
538 (axes, unprocessed_previous_overflow_bin, num_regular_bins_before, bins_per_hyperplane,
539 regular_bins_per_hyperplane, curr_bins_per_hyperplane, curr_regular_bins_per_hyperplane);
549template <
int I,
int NDIMS,
typename BINS,
class AXES,
class BINTYPE>
550struct RComputeLocalBinsRaw;
552template <
int NDIMS,
typename BINS,
class AXES,
class BINTYPE>
554 void operator()(BINS & ,
const AXES & ,
int , BINTYPE )
const
558template <
int I,
int NDIMS,
typename BINS,
class AXES,
class BINTYPE>
560 void operator()(BINS &virtualBins,
const AXES &axes,
int zeroBasedGlobalBin, BINTYPE GetNBinType)
const
562 constexpr const int thisAxis = NDIMS -
I - 1;
563 virtualBins[thisAxis] = zeroBasedGlobalBin % (std::get<thisAxis>(axes).*GetNBinType)();
564 RComputeLocalBinsRaw<
I - 1, NDIMS, BINS, AXES, BINTYPE>()(virtualBins, axes, zeroBasedGlobalBin / (std::get<thisAxis>(axes).*GetNBinType)(), GetNBinType);
574template <
int I,
int NDIMS,
typename BINS,
class AXES,
class BINTYPE>
575struct RComputeGlobalBinRaw;
577template <
int NDIMS,
typename BINS,
class AXES,
class BINTYPE>
579 int operator()(
int globalVirtualBin,
const AXES & ,
const BINS & ,
int , BINTYPE )
const
581 return globalVirtualBin;
585template <
int I,
int NDIMS,
typename BINS,
class AXES,
class BINTYPE>
587 int operator()(
int globalVirtualBin,
const AXES &axes,
const BINS &zeroBasedLocalBins,
int binSize, BINTYPE GetNBinType)
const
589 constexpr const int thisAxis = NDIMS -
I - 1;
590 globalVirtualBin += zeroBasedLocalBins[thisAxis] * binSize;
591 binSize *= (std::get<thisAxis>(axes).*GetNBinType)();
603template <
int I,
int NDIMS,
typename BINS,
class AXES>
604struct RVirtualBinsToLocalBins;
606template <
int NDIMS,
typename BINS,
class AXES>
612template <
int I,
int NDIMS,
typename BINS,
class AXES>
614 void operator()(BINS &localBins,
const AXES &axes,
const BINS &virtualBins)
const
616 constexpr const int thisAxis = NDIMS -
I - 1;
617 if ((!std::get<thisAxis>(axes).CanGrow()) && (virtualBins[thisAxis] == 0)) {
619 }
else if ((!std::get<thisAxis>(axes).CanGrow()) && (virtualBins[thisAxis] == (std::get<thisAxis>(axes).GetNBins() - 1))) {
622 const int regular_bin_offset = -
static_cast<int>(std::get<thisAxis>(axes).CanGrow());
623 localBins[thisAxis] = virtualBins[thisAxis] - regular_bin_offset;
637template <
int I,
int NDIMS,
typename BINS,
class AXES>
638struct RLocalBinsToVirtualBins;
640template <
int NDIMS,
typename BINS,
class AXES>
646template <
int I,
int NDIMS,
typename BINS,
class AXES>
648 void operator()(BINS &virtualBins,
const AXES &axes,
const BINS &localBins)
const
650 constexpr const int thisAxis = NDIMS -
I - 1;
651 switch (localBins[thisAxis]) {
653 virtualBins[thisAxis] = 0;
break;
655 virtualBins[thisAxis] = std::get<thisAxis>(axes).GetNBins() - 1;
break;
657 virtualBins[thisAxis] = localBins[thisAxis] -
static_cast<int>(std::get<thisAxis>(axes).CanGrow());
664template <
int I,
int NDIMS,
typename BINS,
typename COORD,
class AXES>
665struct RFindLocalBins;
667template <
int NDIMS,
typename BINS,
typename COORD,
class AXES>
669 void operator()(BINS & ,
const AXES & ,
const COORD & )
const
673template <
int I,
int NDIMS,
typename BINS,
typename COORD,
class AXES>
675 void operator()(BINS &localBins,
const AXES &axes,
const COORD &coords)
const
677 constexpr const int thisAxis = NDIMS -
I - 1;
678 localBins[thisAxis] = std::get<thisAxis>(axes).FindBin(coords[thisAxis]);
679 RFindLocalBins<
I - 1, NDIMS, BINS, COORD, AXES>()(localBins, axes, coords);
685template <
int I,
int NDIMS,
typename BINS,
typename COORD,
class AXES>
686struct RLocalBinsToCoords;
688template <
int NDIMS,
typename BINS,
typename COORD,
class AXES>
694template <
int I,
int NDIMS,
typename BINS,
typename COORD,
class AXES>
698 constexpr const int thisAxis = NDIMS -
I - 1;
699 int axisbin = localBins[thisAxis];
701 case EBinCoord::kBinFrom: coords[thisAxis] = std::get<thisAxis>(axes).GetBinFrom(axisbin);
break;
702 case EBinCoord::kBinCenter: coords[thisAxis] = std::get<thisAxis>(axes).GetBinCenter(axisbin);
break;
703 case EBinCoord::kBinTo: coords[thisAxis] = std::get<thisAxis>(axes).GetBinTo(axisbin);
break;
709template <
class... AXISCONFIG>
712 std::array<
const RAxisBase *,
sizeof...(AXISCONFIG)> axisViews{{&axes...}};
721template <
class DATA,
class... AXISCONFIG>
723 static_assert(
sizeof...(AXISCONFIG) == DATA::GetNDim(),
"Number of axes must equal histogram dimension");
725 friend typename DATA::Hist_t;
733 template <
int NDIMS = DATA::GetNDim()>
742 RHistImpl(std::string_view title, AXISCONFIG... axisArgs);
744 std::unique_ptr<ImplBase_t>
Clone()
const override {
745 return std::unique_ptr<ImplBase_t>(
new RHistImpl(*
this));
758 const RAxisBase &
GetAxis(
int iAxis)
const final {
return *std::apply(Internal::GetAxisView<AXISCONFIG...>,
fAxes)[iAxis]; }
766 template <
int NDIMS,
typename BINTYPE>
779 template <
int NDIMS,
typename BINTYPE>
813 if (std::all_of(local_bins.cbegin(), local_bins.cend(),
814 [](
int bin) { return bin >= 1; })) {
815 for (
int bin = 0; bin < NDIMS; bin++)
816 local_bins[bin] -= 1;
823 BinArray_t virtual_bins = LocalBinsToVirtualBins<NDIMS>(local_bins);
830 const int neg_1based_virtual_bin = -global_virtual_bin - 1;
841 int total_regular_bins_before = 0;
856 (total_regular_bins_before,
fAxes, virtual_bins, bin_sizes, local_bins);
861 return neg_1based_virtual_bin + total_regular_bins_before;
869 if (global_bin >= 1) {
871 for (
int bin = 0; bin < NDIMS; ++bin)
872 computed_bins[bin] += 1;
873 return computed_bins;
880 const int corrected_virtual_overflow_bin = -global_bin - 1;
934 std::array<
int, NDIMS - 1> bins_per_hyperplane;
935 std::array<
int, NDIMS - 1> regular_bins_per_hyperplane;
942 int unprocessed_previous_overflow_bin = corrected_virtual_overflow_bin;
943 int num_regular_bins_before = 0;
945 (
fAxes, unprocessed_previous_overflow_bin, num_regular_bins_before, bins_per_hyperplane,
946 regular_bins_per_hyperplane, curr_bins_per_hyperplane, curr_regular_bins_per_hyperplane);
958 num_regular_bins_before +=
959 unprocessed_previous_overflow_bin * std::get<0>(
fAxes).GetNBinsNoOver();
965 const int global_virtual_bin =
966 corrected_virtual_overflow_bin + num_regular_bins_before;
972 return VirtualBinsToLocalBins<NDIMS>(virtual_bins);
982 int result = ComputeGlobalBin<DATA::GetNDim()>(localBins);
998 ret = ComputeGlobalBin<DATA::GetNDim()>(localBins);
1009 int result = ComputeGlobalBin<DATA::GetNDim()>(localBins);
1017 BinArray_t localBins = ComputeLocalBins<DATA::GetNDim()>(binidx);
1024 BinArray_t localBins = ComputeLocalBins<DATA::GetNDim()>(binidx);
1033 BinArray_t localBins = ComputeLocalBins<DATA::GetNDim()>(binidx);
1042 BinArray_t localBins = ComputeLocalBins<DATA::GetNDim()>(binidx);
1052 void FillN(
const std::span<const CoordArray_t> xN,
const std::span<const Weight_t> weightN)
final
1055 if (xN.size() != weightN.size()) {
1061 for (
size_t i = 0; i < xN.size(); ++i) {
1062 Fill(xN[i], weightN[i]);
1069 void FillN(
const std::span<const CoordArray_t> xN)
final
1071 for (
auto &&
x: xN) {
1134template <
class DATA,
class... AXISCONFIG>
1138template <
class DATA,
class... AXISCONFIG>
1140 :
ImplBase_t(Internal::GetNBinsNoOverFromAxes(axisArgs...), Internal::GetNOverflowBinsFromAxes(axisArgs...)), fAxes{axisArgs...}
1143template <
class DATA,
class... AXISCONFIG>
1145 :
ImplBase_t(title, Internal::GetNBinsNoOverFromAxes(axisArgs...), Internal::GetNOverflowBinsFromAxes(axisArgs...)), fAxes{axisArgs...}
1151template <
class DATA>
1154 RHistImplRuntime(std::array<
RAxisConfig, DATA::GetNDim()>&& axisCfg);
#define R__LOG_ERROR(...)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Iterates over the bins of a RHist or RHistImpl.
Interface class for RHistImpl.
Weight_t & GetBinContent(int binidx)
Get the bin content (sum of weights) for bin index binidx (non-const).
int GetNOverflowBins() const noexcept final
Get the number of under- and overflow bins of this histogram, excluding all regular bins.
RHistImplBase(const RHistImplBase &)=default
void(RHistImplBase::*)(const CoordArray_t &x, Weight_t w) FillFunc_t
Type of the Fill(x, w) function.
virtual double GetBinUncertainty(const CoordArray_t &x) const =0
Get the bin uncertainty for the bin at coordinate x.
void AddBinContent(int binidx, Weight_t w)
Add w to the bin at index bin.
int GetNBinsNoOver() const noexcept final
Get the number of bins in this histogram, excluding possible under- and overflow bins.
RHistImplBase(RHistImplBase &&)=default
Hist::CoordArray_t< DATA::GetNDim()> CoordArray_t
Type of the coordinates.
virtual std::unique_ptr< RHistImplBase > Clone() const =0
DATA Stat_t
Type of the statistics (bin content, uncertainties etc).
Stat_t & GetStat() noexcept
Non-const access to statistics.
virtual void FillN(const std::span< const CoordArray_t > xN)=0
Interface function to fill a vector or array of coordinates.
Weight_t GetBinContent(int binidx) const
Get the bin content (sum of weights) for bin index binidx.
const Stat_t & GetStat() const noexcept
Const access to statistics.
Stat_t fStatistics
The histogram's bin content, uncertainties etc.
virtual void FillN(const std::span< const CoordArray_t > xN, const std::span< const Weight_t > weightN)=0
Interface function to fill a vector or array of coordinates with corresponding weights.
virtual Weight_t GetBinContent(const CoordArray_t &x) const =0
Get the bin content (sum of weights) for the bin at coordinate x.
std::array< int, DATA::GetNDim()> BinArray_t
Type of the local per-axis bin indices.
RHistImplBase(std::string_view title, size_t numBins, size_t numOverflowBins)
double GetBinContentAsDouble(int binidx) const final
Get the bin content (sum of weights) for bin index binidx, cast to double.
int GetNBins() const noexcept final
Get the number of bins in this histogram, including possible under- and overflow bins.
typename DATA::Weight_t Weight_t
Type of the bin content (and thus weights).
RHistImplBase(size_t numBins, size_t numOverflowBins)
virtual FillFunc_t GetFillFunc() const =0
Retrieve the pointer to the overridden Fill(x, w) function.
Base class for RHistImplBase that abstracts out the histogram's PRECISION.
virtual int GetNOverflowBins() const noexcept=0
Number of under- and overflow bins of this histogram, excluding all regular bins.
virtual ~RHistImplPrecisionAgnosticBase()
virtual int GetBinIndex(const CoordArray_t &x) const =0
Given the coordinate x, determine the index of the bin.
RHistImplPrecisionAgnosticBase(std::string_view title)
std::array< int, DIMENSIONS > BinArray_t
Type of the local per-axis bin indices.
RHistImplPrecisionAgnosticBase(RHistImplPrecisionAgnosticBase &&)=default
virtual int GetNBins() const noexcept=0
Number of bins of this histogram, including all overflow and underflow bins.
virtual bool HasBinUncertainty() const =0
Whether this histogram's statistics provide storage for uncertainties, or whether uncertainties are d...
virtual int GetNBinsNoOver() const noexcept=0
Number of bins of this histogram, excluding all overflow and underflow bins.
virtual CoordArray_t GetBinTo(int binidx) const =0
Get the upper edge in all dimensions of the bin with index binidx.
virtual BinArray_t GetLocalBins(int binidx) const =0
Given the index of the bin, determine the local per-axis bins x.
std::string fTitle
The histogram's title.
RHistImplPrecisionAgnosticBase()=default
RHistImplPrecisionAgnosticBase(const RHistImplPrecisionAgnosticBase &)=default
const std::string & GetTitle() const
Get the histogram title.
Hist::AxisIterRange_t< DIMENSIONS > AxisIterRange_t
Range type.
static constexpr int GetNDim()
Number of dimensions of the coordinates.
virtual int GetBinIndexAndGrow(const CoordArray_t &x) const =0
Given the coordinate x, determine the index of the bin, possibly growing axes for which x is out of r...
virtual int GetBinIndexFromLocalBins(const BinArray_t &x) const =0
Given the local per-axis bins x, determine the index of the bin.
virtual double GetBinUncertainty(int binidx) const =0
Get the uncertainty of the bin with index binidx.
virtual double GetBinContentAsDouble(int binidx) const =0
The bin content, cast to double.
virtual const RAxisBase & GetAxis(int iAxis) const =0
Get a base-class view on axis with index iAxis.
virtual CoordArray_t GetBinCenter(int binidx) const =0
Get the center in all dimensions of the bin with index binidx.
virtual AxisIterRange_t GetRange() const =0
Get an AxisIterRange_t for the whole histogram, excluding under- and overflow.
virtual CoordArray_t GetBinFrom(int binidx) const =0
Get the lower edge in all dimensions of the bin with index binidx.
void Fill(const CoordArray_t &x, Weight_t w=1.)
Add a single weight w to the bin at coordinate x.
BinArray_t GetLocalBins(int binidx) const final
Get the local per-axis bin indices x for the given bin index, using ComputeLocalBins().
int GetBinIndexAndGrow(const CoordArray_t &x) const final
Get the bin index for the given coordinates x, growing the axes as needed.
int ComputeGlobalBinRaw(const BinArray_t &zeroBasedLocalBins, BINTYPE GetNBinType) const
Computes a zero-based global bin index, given...
const_iterator end() const noexcept
void(RHistImplBase::*)(const CoordArray_t &x, Weight_t w) FillFunc_t
Type of the Fill(x, w) function.
AxisIterRange_t< DATA::GetNDim()> GetRange() const final
Get the begin() and end() for each axis.
BinArray_t ComputeLocalBins(int global_bin) const
Computes the local per-axis bin indices of a certain bin on an NDIMS-dimensional histogram,...
double GetBinUncertainty(const CoordArray_t &x) const final
Get the bin uncertainty for the bin at coordinate x.
const_iterator begin() const noexcept
CoordArray_t GetBinCenter(int binidx) const final
Get the center coordinates of the bin with index binidx.
int GetBinIndexFromLocalBins(const BinArray_t &x) const final
Get the bin index for the given local per-axis bin indices x, using ComputeGlobalBin().
FillFunc_t GetFillFunc() const final
Retrieve the fill function for this histogram implementation, to prevent the virtual function call fo...
std::tuple< AXISCONFIG... > fAxes
The histogram's axes.
void GrowAxis(int, double)
Grow the axis number iAxis to fit the coordinate x.
Weight_t GetBinContent(const CoordArray_t &x) const final
Get the content of the bin at position x.
int GetBinIndex(const CoordArray_t &x) const final
Get the bin index for the given coordinates x.
BinArray_t VirtualBinsToLocalBins(const BinArray_t &virtualBins) const
Converts zero-based virtual bins where the underflow bin has index 0 and the overflow bin has index N...
const RAxisBase & GetAxis(int iAxis) const final
Normalized axes access, converting from actual axis type to base class.
typename Hist::AxisIterRange_t< NDIMS > AxisIterRange_t
int ComputeGlobalBin(BinArray_t &local_bins) const
Computes the global index of a certain bin on an NDIMS-dimensional histogram, knowing the local per-a...
typename ImplBase_t::BinArray_t BinArray_t
double GetBinUncertainty(int binidx) const final
Return the uncertainties for the given bin index.
bool HasBinUncertainty() const final
Whether this histogram's statistics provide storage for uncertainties, or whether uncertainties are d...
typename ImplBase_t::Weight_t Weight_t
std::unique_ptr< ImplBase_t > Clone() const override
RHistBinIter< ImplBase_t > iterator
void FillN(const std::span< const CoordArray_t > xN, const std::span< const Weight_t > weightN) final
Fill an array of weightN to the bins specified by coordinates xN.
BinArray_t ComputeLocalBinsRaw(int zeroBasedGlobalBin, BINTYPE GetNBinType) const
Computes zero-based local bin indices, given...
const std::tuple< AXISCONFIG... > & GetAxes() const
Get the axes of this histogram.
CoordArray_t GetBinTo(int binidx) const final
Get the coordinates of the high limit of the bin with index binidx.
void FillN(const std::span< const CoordArray_t > xN) final
Fill an array of weightN to the bins specified by coordinates xN.
CoordArray_t GetBinFrom(int binidx) const final
Get the coordinates of the low limit of the bin with index binidx.
BinArray_t LocalBinsToVirtualBins(const BinArray_t &localBins) const
Converts local axis bins from the standard kUnderflowBin/kOverflowBin for under/overflow bin indexing...
iterator begin() noexcept
RHistBinIter< const ImplBase_t > const_iterator
typename ImplBase_t::CoordArray_t CoordArray_t
Random const_iterator through bins.
Histogram axis base class.
virtual int GetNBinsNoOver() const noexcept=0
Get the number of bins, excluding under- and overflow.
static constexpr const int kUnderflowBin
Index of the underflow bin, if any.
static constexpr const int kOverflowBin
Index of the overflow bin, if any.
int GetNBins() const noexcept
Get the number of bins, including under- and overflow.
Objects used to configure the different axis types.
EOverflow
Kinds of under- and overflow handling.
@ kUnderflow
Include underflows.
@ kNoOverflow
Exclude under- and overflows.
@ kOverflow
Include overflows.
@ kUnderOver
Include both under- and overflows.
std::array< AxisIter_t< NDIMS >, 2 > AxisIterRange_t
Range over n dimensional axes - a pair of arrays of n axis iterators.
bool operator&(EOverflow a, EOverflow b)
std::array< RAxisBase::const_iterator, NDIMS > AxisIter_t
Iterator over n dimensional axes - an array of n axis iterators.
EFindStatus
Status of FindBin(x) and FindAdjustedBin(x)
@ kValid
The returned bin index is valid.
@ kCanGrow
The coordinate could fit after growing the axis.
int GetNBinsFromAxes(AXISCONFIG... axisArgs)
Get the number of bins in whole hist, including under- and overflow.
EBinCoord
Specifies if the wanted result is the bin's lower edge, center or higher edge.
@ kBinTo
Get the bin high edge.
@ kBinFrom
Get the lower bin edge.
@ kBinCenter
Get the bin center.
int GetNOverflowBinsFromAxes(AXISCONFIG... axisArgs)
Get the number of under- and overflow bins in whole hist, excluding regular bins.
int GetNBinsNoOverFromAxes(AXISCONFIG... axisArgs)
Get the number of bins in whole hist, excluding under- and overflow.
static std::array< const RAxisBase *, sizeof...(AXISCONFIG)> GetAxisView(const AXISCONFIG &... axes) noexcept
RLogChannel & HistLog()
Log channel for Hist diagnostics.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
int operator()(int globalVirtualBin, const AXES &, const BINS &, int, BINTYPE) const
Recursively computes a zero-based global bin index, given...
int operator()(int globalVirtualBin, const AXES &axes, const BINS &zeroBasedLocalBins, int binSize, BINTYPE GetNBinType) const
int operator()(int total_regular_bins_before, const AXES &, const BINS &, const BINS &, const BINS &) const
Recursively gets the total number of regular bins before the current dimension, when computing a glob...
int operator()(int total_regular_bins_before, const AXES &axes, const BINS &virtualBins, const BINS &binSizes, const BINS &localBins) const
void operator()(std::array< int, NDIMS-1 >, std::array< int, NDIMS-1 >, const AXES &) const
Recursively compute some quantities needed for ComputeLocalBins, namely the total number of bins per ...
void operator()(std::array< int, NDIMS-1 > &bins_per_hyperplane, std::array< int, NDIMS-1 > ®ular_bins_per_hyperplane, const AXES &axes) const
void operator()(BINS &, const AXES &, int, BINTYPE) const
Recursively computes zero-based local bin indices, given...
void operator()(BINS &virtualBins, const AXES &axes, int zeroBasedGlobalBin, BINTYPE GetNBinType) const
void operator()(const AXES &, int &, int &, std::array< int, NDIMS-1 >, std::array< int, NDIMS-1 >, int, int) const
Recursively computes the number of regular bins before the current dimension, as well as the number o...
void operator()(const AXES &axes, int &unprocessed_previous_overflow_bin, int &num_regular_bins_before, std::array< int, NDIMS-1 > bins_per_hyperplane, std::array< int, NDIMS-1 > regular_bins_per_hyperplane, int curr_bins_per_hyperplane, int curr_regular_bins_per_hyperplane) const
void operator()(Hist::AxisIterRange_t< std::tuple_size< AXES >::value > &, const AXES &) const
Recursively fills the ranges of all axes, excluding under- and overflow.
void operator()(Hist::AxisIterRange_t< std::tuple_size< AXES >::value > &range, const AXES &axes) const
void operator()(BINS &, const AXES &, const COORD &) const
Find the per-axis local bin indices associated with a certain set of coordinates.
void operator()(BINS &localBins, const AXES &axes, const COORD &coords) const
int operator()(const AXES &axes) const
Recursively gets the total number of bins in whole hist, including under- and overflow.
int operator()(const AXES &axes) const
int operator()(const AXES &axes) const
Recursively gets the total number of bins in whole hist, excluding under- and overflow.
int operator()(const AXES &axes) const
void operator()(BINS &, const AXES &) const
Recursively gets the number of regular bins just before the current dimension.
void operator()(BINS &binSizes, const AXES &axes) const
void operator()(COORD &, const AXES &, const BINS &, EBinCoord) const
Recursively converts local axis bins from the standard kUnderflowBin/kOverflowBin for under/overflow ...
void operator()(COORD &coords, const AXES &axes, const BINS &localBins, EBinCoord kind) const
void operator()(BINS &, const AXES &, const BINS &) const
Recursively converts local axis bins from the standard kUnderflowBin/kOverflowBin for under/overflow ...
void operator()(BINS &virtualBins, const AXES &axes, const BINS &localBins) const
void operator()(BINS &, const AXES &, const BINS &) const
Recursively converts zero-based virtual bins where the underflow bin has index 0 and the overflow bin...
void operator()(BINS &localBins, const AXES &axes, const BINS &virtualBins) const