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 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< 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::size_t | fNNormalBins |
| The number of normal bins. | |
#include <ROOT/RHistAutoAxisFiller.hxx>
|
private |
Definition at line 62 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 77 of file RHistAutoAxisFiller.hxx.
|
inlineprivate |
Definition at line 96 of file RHistAutoAxisFiller.hxx.
|
inline |
Fill an entry into the histogram.
| [in] | x | the argument |
Definition at line 120 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 139 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 153 of file RHistAutoAxisFiller.hxx.
|
inline |
Return the constructed histogram.
Definition at line 191 of file RHistAutoAxisFiller.hxx.
|
inline |
Definition at line 93 of file RHistAutoAxisFiller.hxx.
|
inline |
Definition at line 92 of file RHistAutoAxisFiller.hxx.
|
inline |
Definition at line 91 of file RHistAutoAxisFiller.hxx.
|
private |
The buffer of filled entries.
Definition at line 65 of file RHistAutoAxisFiller.hxx.
|
private |
The filled histogram, after it has been constructed.
Definition at line 53 of file RHistAutoAxisFiller.hxx.
|
private |
The fraction of the axis interval to use as margin.
Definition at line 60 of file RHistAutoAxisFiller.hxx.
|
private |
The maximum buffer size until Flush() is automatically called.
Definition at line 58 of file RHistAutoAxisFiller.hxx.
|
private |
The maximum of the filled entries.
Definition at line 69 of file RHistAutoAxisFiller.hxx.
|
private |
The minimum of the filled entries.
Definition at line 67 of file RHistAutoAxisFiller.hxx.
|
private |
The number of normal bins.
Definition at line 56 of file RHistAutoAxisFiller.hxx.
|
staticconstexpr |
Definition at line 49 of file RHistAutoAxisFiller.hxx.