Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Experimental::RHistAutoAxisFiller< BinContentType > Class Template Referencefinal

template<typename BinContentType>
class ROOT::Experimental::RHistAutoAxisFiller< BinContentType >

A histogram filler that automatically determines the axis interval.

This class allows filling a regular one-dimensional histogram without specifying an axis interval during construction. After a configurable number of buffered entries, or upon request, a RRegularAxis is constructed using the minimum and maximum values until that point. This ensures all initial entries are filled into normal bins. Note that this cannot be guaranteed for further calls to Fill.

filler.Fill(1.0);
filler.Fill(1.5);
filler.Fill(2.0);
// The following will implicitly trigger the histogram creation
auto &hist = filler.GetHist();
// hist.GetNEntries() will return 3
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.
Warning
This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!

Definition at line 47 of file RHistAutoAxisFiller.hxx.

Public Member Functions

 RHistAutoAxisFiller (std::size_t nNormalBins, std::size_t maxBufferSize=1024, double marginFraction=0.05)
 Create a filler object.
 
void Fill (double x)
 Fill an entry into the histogram.
 
void Fill (double x, RWeight weight)
 Fill an entry into the histogram with a weight.
 
void Flush ()
 Flush the buffer of entries and construct the histogram.
 
RHist< BinContentType > & GetHist ()
 Return the constructed histogram.
 
double GetMarginFraction () const
 
std::size_t GetMaxBufferSize () const
 
std::size_t GetNNormalBins () const
 

Static Public Attributes

static constexpr bool SupportsWeightedFilling = RHistEngine<BinContentType>::SupportsWeightedFilling
 

Private Types

using BufferElement = std::conditional_t<SupportsWeightedFilling, std::pair<double, RWeight>, double>
 

Private Member Functions

void BufferImpl (double x, RWeight weight)
 

Private Attributes

std::vector< BufferElementfBuffer
 The buffer of filled entries.
 
std::optional< RHist< BinContentType > > fHist
 The filled histogram, after it has been constructed.
 
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.
 
double fMaximum = -std::numeric_limits<double>::infinity()
 The maximum of the filled entries.
 
double fMinimum = std::numeric_limits<double>::infinity()
 The minimum of the filled entries.
 
std::size_t fNNormalBins
 The number of normal bins.
 

#include <ROOT/RHistAutoAxisFiller.hxx>

Member Typedef Documentation

◆ BufferElement

using ROOT::Experimental::RHistAutoAxisFiller< BinContentType >::BufferElement = std::conditional_t<SupportsWeightedFilling, std::pair<double, RWeight>, double>
private

Definition at line 62 of file RHistAutoAxisFiller.hxx.

Constructor & Destructor Documentation

◆ RHistAutoAxisFiller()

ROOT::Experimental::RHistAutoAxisFiller< BinContentType >::RHistAutoAxisFiller ( std::size_t nNormalBins,
std::size_t maxBufferSize = 1024,
double marginFraction = 0.05 )
inlineexplicit

Create a filler object.

Parameters
[in]nNormalBinsthe number of normal bins, must be > 0
[in]maxBufferSizethe maximum buffer size, must be > 0
[in]marginFractionthe fraction of the axis interval to use as margin, must be > 0

Definition at line 77 of file RHistAutoAxisFiller.hxx.

Member Function Documentation

◆ BufferImpl()

void ROOT::Experimental::RHistAutoAxisFiller< BinContentType >::BufferImpl ( double x,
RWeight weight )
inlineprivate

Definition at line 96 of file RHistAutoAxisFiller.hxx.

◆ Fill() [1/2]

Fill an entry into the histogram.

Parameters
[in]xthe argument
See also
the overload for weighted filling

Definition at line 120 of file RHistAutoAxisFiller.hxx.

◆ Fill() [2/2]

Fill an entry into the histogram with a weight.

This overload is only available for floating-point bin content types (see RHistEngine::SupportsWeightedFilling).

Parameters
[in]xthe argument
[in]weightthe weight for this entry
See also
the overload for unweighted filling

Definition at line 139 of file RHistAutoAxisFiller.hxx.

◆ Flush()

Flush the buffer of entries and construct the histogram.

Throws an exception if the buffer is empty, the axis interval cannot be determined, or if it would be empty because the minimum equals the maximum.

Definition at line 153 of file RHistAutoAxisFiller.hxx.

◆ GetHist()

Return the constructed histogram.

See also
Flush()

Definition at line 191 of file RHistAutoAxisFiller.hxx.

◆ GetMarginFraction()

double ROOT::Experimental::RHistAutoAxisFiller< BinContentType >::GetMarginFraction ( ) const
inline

Definition at line 93 of file RHistAutoAxisFiller.hxx.

◆ GetMaxBufferSize()

std::size_t ROOT::Experimental::RHistAutoAxisFiller< BinContentType >::GetMaxBufferSize ( ) const
inline

Definition at line 92 of file RHistAutoAxisFiller.hxx.

◆ GetNNormalBins()

std::size_t ROOT::Experimental::RHistAutoAxisFiller< BinContentType >::GetNNormalBins ( ) const
inline

Definition at line 91 of file RHistAutoAxisFiller.hxx.

Member Data Documentation

◆ fBuffer

The buffer of filled entries.

Definition at line 65 of file RHistAutoAxisFiller.hxx.

◆ fHist

The filled histogram, after it has been constructed.

Definition at line 53 of file RHistAutoAxisFiller.hxx.

◆ fMarginFraction

The fraction of the axis interval to use as margin.

Definition at line 60 of file RHistAutoAxisFiller.hxx.

◆ fMaxBufferSize

std::size_t ROOT::Experimental::RHistAutoAxisFiller< BinContentType >::fMaxBufferSize
private

The maximum buffer size until Flush() is automatically called.

Definition at line 58 of file RHistAutoAxisFiller.hxx.

◆ fMaximum

double ROOT::Experimental::RHistAutoAxisFiller< BinContentType >::fMaximum = -std::numeric_limits<double>::infinity()
private

The maximum of the filled entries.

Definition at line 69 of file RHistAutoAxisFiller.hxx.

◆ fMinimum

double ROOT::Experimental::RHistAutoAxisFiller< BinContentType >::fMinimum = std::numeric_limits<double>::infinity()
private

The minimum of the filled entries.

Definition at line 67 of file RHistAutoAxisFiller.hxx.

◆ fNNormalBins

std::size_t ROOT::Experimental::RHistAutoAxisFiller< BinContentType >::fNNormalBins
private

The number of normal bins.

Definition at line 56 of file RHistAutoAxisFiller.hxx.

◆ SupportsWeightedFilling

constexpr bool ROOT::Experimental::RHistAutoAxisFiller< BinContentType >::SupportsWeightedFilling = RHistEngine<BinContentType>::SupportsWeightedFilling
staticconstexpr

Definition at line 49 of file RHistAutoAxisFiller.hxx.

  • hist/histv7/inc/ROOT/RHistAutoAxisFiller.hxx