5#ifndef ROOT_RHistAutoAxisFiller
6#define ROOT_RHistAutoAxisFiller
23namespace Experimental {
47template <
typename BinContentType>
54 std::optional<RHist<BinContentType>>
fHist;
63 using BufferElement = std::conditional_t<SupportsWeightedFilling, std::pair<double, RWeight>,
double>;
68 double fMinimum = std::numeric_limits<double>::infinity();
70 double fMaximum = -std::numeric_limits<double>::infinity();
83 throw std::invalid_argument(
"nNormalBins must be > 0");
86 throw std::invalid_argument(
"maxBufferSize must be > 0");
89 throw std::invalid_argument(
"marginFraction must be > 0");
158 assert(
fBuffer.empty() &&
"buffer should have been emptied");
163 throw std::runtime_error(
"buffer is empty, cannot create histogram");
166 throw std::runtime_error(
"could not determine axis interval");
169 throw std::runtime_error(
"axis interval is empty");
175 const auto high =
fMaximum + margin;
182 fHist->Fill(
x.first,
x.second);
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
A histogram filler that automatically determines the axis interval.
double GetMarginFraction() const
std::size_t GetMaxBufferSize() const
std::vector< BufferElement > fBuffer
The buffer of filled entries.
static constexpr bool SupportsWeightedFilling
void Fill(double x)
Fill an entry into the histogram.
std::uint64_t fNNormalBins
The number of normal bins.
double fMaximum
The maximum of the filled entries.
double fMarginFraction
The fraction of the axis interval to use as margin.
std::size_t fMaxBufferSize
The maximum buffer size until Flush() is automatically called.
std::conditional_t< SupportsWeightedFilling, std::pair< double, RWeight >, double > BufferElement
double fMinimum
The minimum of the filled entries.
std::uint64_t GetNNormalBins() const
RHistAutoAxisFiller(std::uint64_t nNormalBins, std::size_t maxBufferSize=1024, double marginFraction=0.05)
Create a filler object.
RHist< BinContentType > & GetHist()
Return the constructed histogram.
void Fill(double x, RWeight weight)
Fill an entry into the histogram with a weight.
void BufferImpl(double x, RWeight weight)
std::optional< RHist< BinContentType > > fHist
The filled histogram, after it has been constructed.
void Flush()
Flush the buffer of entries and construct the histogram.
A histogram data structure to bin data along multiple dimensions.
A weight for filling histograms.