A regular axis with equidistant bins in the interval \([fLow, fHigh)\).
For example, the following creates a regular axis with 10 normal bins between 5 and 15:
It is possible to disable underflow and overflow bins by passing enableFlowBins = false. In that case, arguments outside the axis will be silently discarded.
Definition at line 38 of file RRegularAxis.hxx.
Public Types | |
| using | ArgumentType = double |
Public Member Functions | |
| RRegularAxis (std::uint64_t nNormalBins, std::pair< double, double > interval, bool enableFlowBins=true) | |
| Construct a regular axis object. | |
| RBinIndexRange | GetFullRange () const |
| Get the full range of all bins. | |
| double | GetHigh () const |
| RLinearizedIndex | GetLinearizedIndex (RBinIndex index) const |
| Compute the linarized index for a single argument. | |
| double | GetLow () const |
| std::uint64_t | GetNNormalBins () const |
| RBinIndexRange | GetNormalRange () const |
| Get the range of all normal bins. | |
| RBinIndexRange | GetNormalRange (RBinIndex begin, RBinIndex end) const |
| Get a range of normal bins. | |
| std::uint64_t | GetTotalNBins () const |
| bool | HasFlowBins () const |
| void | Streamer (TBuffer &) |
| ROOT Streamer function to throw when trying to store an object of this class. | |
Private Attributes | |
| bool | fEnableFlowBins |
| Whether underflow and overflow bins are enabled. | |
| double | fHigh |
| The upper end of the axis interval. | |
| double | fInvBinWidth |
| The cached inverse of the bin width to speed up ComputeLinearizedIndex. | |
| double | fLow |
| The lower end of the axis interval. | |
| std::uint64_t | fNNormalBins |
| The number of normal bins. | |
Friends | |
| bool | operator== (const RRegularAxis &lhs, const RRegularAxis &rhs) |
#include <ROOT/RRegularAxis.hxx>
Definition at line 40 of file RRegularAxis.hxx.
|
inline |
Construct a regular axis object.
| [in] | nNormalBins | the number of normal bins, must be > 0 |
| [in] | interval | the axis interval (lower end inclusive, upper end exclusive), must be finite |
| [in] | enableFlowBins | whether to enable underflow and overflow bins |
Definition at line 60 of file RRegularAxis.hxx.
|
inline |
Get the full range of all bins.
This includes underflow and overflow bins, if enabled.
Definition at line 191 of file RRegularAxis.hxx.
|
inline |
Definition at line 83 of file RRegularAxis.hxx.
|
inline |
Compute the linarized index for a single argument.
If flow bins are disabled, the normal bins have indices \(0\) to \(fNNormalBins - 1\). Otherwise the underflow bin has index \(0\$, the indices of all normal bins shift by one, and the overflow bin has index \)@_fakenlfNNormalBins + 1 \(. If the argument is outside the interval \)[fLow, fHigh) \( and the flow bins are disabled, the return value is invalid. \param[in] x the argument \return the linearized index that may be invalid RLinearizedIndex ComputeLinearizedIndex(double x) const { bool underflow = x < fLow; // Put NaNs into overflow bin. bool overflow = !(x < fHigh); if (underflow) { return {0, fEnableFlowBins}; } else if (overflow) { return {fNNormalBins + 1, fEnableFlowBins}; } std::uint64_t bin = (x - fLow) * fInvBinWidth; if (bin >= fNNormalBins) { bin = fNNormalBins - 1; } // If the underflow bin is enabled, shift the normal bins by one. if (fEnableFlowBins) { bin += 1; } return {bin, true}; } Get the linearized index for an RBinIndex. If flow bins are disabled, the normal bins have indices \)@_fakenl0 \( to \)fNNormalBins - 1 \(. Otherwise the underflow bin has index \)@_fakenl0$, the indices of all normal bins shift by one, and the overflow bin has index \(fNNormalBins + 1\).
| [in] | index | the RBinIndex |
Definition at line 131 of file RRegularAxis.hxx.
|
inline |
Definition at line 82 of file RRegularAxis.hxx.
|
inline |
Definition at line 80 of file RRegularAxis.hxx.
|
inline |
Get the range of all normal bins.
Definition at line 156 of file RRegularAxis.hxx.
|
inline |
Get a range of normal bins.
| [in] | begin | the begin of the bin index range (inclusive), must be normal |
| [in] | end | the end of the bin index range (exclusive), must be normal and >= begin |
Definition at line 166 of file RRegularAxis.hxx.
|
inline |
Definition at line 81 of file RRegularAxis.hxx.
|
inline |
Definition at line 84 of file RRegularAxis.hxx.
|
inline |
ROOT Streamer function to throw when trying to store an object of this class.
Definition at line 198 of file RRegularAxis.hxx.
|
friend |
Definition at line 86 of file RRegularAxis.hxx.
|
private |
Whether underflow and overflow bins are enabled.
Definition at line 52 of file RRegularAxis.hxx.
|
private |
The upper end of the axis interval.
Definition at line 48 of file RRegularAxis.hxx.
|
private |
The cached inverse of the bin width to speed up ComputeLinearizedIndex.
Definition at line 50 of file RRegularAxis.hxx.
|
private |
The lower end of the axis interval.
Definition at line 46 of file RRegularAxis.hxx.
|
private |
The number of normal bins.
Definition at line 44 of file RRegularAxis.hxx.