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.
Definition at line 50 of file RHistAutoAxisFiller.hxx.
Public Member Functions | |
| RHistAutoAxisFiller (std::uint64_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::uint64_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< BufferElement > | fBuffer |
| 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::uint64_t | fNNormalBins |
| The number of normal bins. | |
#include <ROOT/RHistAutoAxisFiller.hxx>
|
private |
Definition at line 65 of file RHistAutoAxisFiller.hxx.
|
inlineexplicit |
Create a filler object.
| [in] | nNormalBins | the number of normal bins, must be > 0 |
| [in] | maxBufferSize | the maximum buffer size, must be > 0 |
| [in] | marginFraction | the fraction of the axis interval to use as margin, must be > 0 |
Definition at line 80 of file RHistAutoAxisFiller.hxx.
|
inlineprivate |
Definition at line 100 of file RHistAutoAxisFiller.hxx.
|
inline |
Fill an entry into the histogram.
| [in] | x | the argument |
Definition at line 124 of file RHistAutoAxisFiller.hxx.
|
inline |
Fill an entry into the histogram with a weight.
This overload is only available for floating-point bin content types (see RHistEngine::SupportsWeightedFilling).
| [in] | x | the argument |
| [in] | weight | the weight for this entry |
Definition at line 143 of file RHistAutoAxisFiller.hxx.
|
inline |
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 157 of file RHistAutoAxisFiller.hxx.
|
inline |
Return the constructed histogram.
Definition at line 195 of file RHistAutoAxisFiller.hxx.
|
inline |
Definition at line 97 of file RHistAutoAxisFiller.hxx.
|
inline |
Definition at line 96 of file RHistAutoAxisFiller.hxx.
|
inline |
Definition at line 95 of file RHistAutoAxisFiller.hxx.
|
private |
The buffer of filled entries.
Definition at line 68 of file RHistAutoAxisFiller.hxx.
|
private |
The filled histogram, after it has been constructed.
Definition at line 56 of file RHistAutoAxisFiller.hxx.
|
private |
The fraction of the axis interval to use as margin.
Definition at line 63 of file RHistAutoAxisFiller.hxx.
|
private |
The maximum buffer size until Flush() is automatically called.
Definition at line 61 of file RHistAutoAxisFiller.hxx.
|
private |
The maximum of the filled entries.
Definition at line 72 of file RHistAutoAxisFiller.hxx.
|
private |
The minimum of the filled entries.
Definition at line 70 of file RHistAutoAxisFiller.hxx.
|
private |
The number of normal bins.
Definition at line 59 of file RHistAutoAxisFiller.hxx.
|
staticconstexpr |
Definition at line 52 of file RHistAutoAxisFiller.hxx.