Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Experimental::RRegularAxis Class Referencefinal

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:

A regular axis with equidistant bins in the interval .

It is possible to disable underflow and overflow bins by passing enableFlowBins = false. In that case, arguments outside the axis will be silently discarded.

Warning
This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!

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>

Member Typedef Documentation

◆ ArgumentType

Constructor & Destructor Documentation

◆ RRegularAxis()

ROOT::Experimental::RRegularAxis::RRegularAxis ( std::uint64_t nNormalBins,
std::pair< double, double > interval,
bool enableFlowBins = true )
inline

Construct a regular axis object.

Parameters
[in]nNormalBinsthe number of normal bins, must be > 0
[in]intervalthe axis interval (lower end inclusive, upper end exclusive), must be finite
[in]enableFlowBinswhether to enable underflow and overflow bins

Definition at line 60 of file RRegularAxis.hxx.

Member Function Documentation

◆ GetFullRange()

RBinIndexRange ROOT::Experimental::RRegularAxis::GetFullRange ( ) const
inline

Get the full range of all bins.

This includes underflow and overflow bins, if enabled.

Returns
the bin index range of all bins

Definition at line 191 of file RRegularAxis.hxx.

◆ GetHigh()

double ROOT::Experimental::RRegularAxis::GetHigh ( ) const
inline

Definition at line 83 of file RRegularAxis.hxx.

◆ GetLinearizedIndex()

RLinearizedIndex ROOT::Experimental::RRegularAxis::GetLinearizedIndex ( RBinIndex index) const
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\).

Parameters
[in]indexthe RBinIndex
Returns
the linearized index that may be invalid

Definition at line 131 of file RRegularAxis.hxx.

◆ GetLow()

double ROOT::Experimental::RRegularAxis::GetLow ( ) const
inline

Definition at line 82 of file RRegularAxis.hxx.

◆ GetNNormalBins()

std::uint64_t ROOT::Experimental::RRegularAxis::GetNNormalBins ( ) const
inline

Definition at line 80 of file RRegularAxis.hxx.

◆ GetNormalRange() [1/2]

RBinIndexRange ROOT::Experimental::RRegularAxis::GetNormalRange ( ) const
inline

Get the range of all normal bins.

Returns
the bin index range from the first to the last normal bin, inclusive

Definition at line 156 of file RRegularAxis.hxx.

◆ GetNormalRange() [2/2]

RBinIndexRange ROOT::Experimental::RRegularAxis::GetNormalRange ( RBinIndex begin,
RBinIndex end ) const
inline

Get a range of normal bins.

Parameters
[in]beginthe begin of the bin index range (inclusive), must be normal
[in]endthe end of the bin index range (exclusive), must be normal and >= begin
Returns
a bin index range \([begin, end)\)

Definition at line 166 of file RRegularAxis.hxx.

◆ GetTotalNBins()

std::uint64_t ROOT::Experimental::RRegularAxis::GetTotalNBins ( ) const
inline

Definition at line 81 of file RRegularAxis.hxx.

◆ HasFlowBins()

bool ROOT::Experimental::RRegularAxis::HasFlowBins ( ) const
inline

Definition at line 84 of file RRegularAxis.hxx.

◆ Streamer()

void ROOT::Experimental::RRegularAxis::Streamer ( TBuffer & )
inline

ROOT Streamer function to throw when trying to store an object of this class.

Definition at line 198 of file RRegularAxis.hxx.

Friends And Related Symbol Documentation

◆ operator==

bool operator== ( const RRegularAxis & lhs,
const RRegularAxis & rhs )
friend

Definition at line 86 of file RRegularAxis.hxx.

Member Data Documentation

◆ fEnableFlowBins

bool ROOT::Experimental::RRegularAxis::fEnableFlowBins
private

Whether underflow and overflow bins are enabled.

Definition at line 52 of file RRegularAxis.hxx.

◆ fHigh

double ROOT::Experimental::RRegularAxis::fHigh
private

The upper end of the axis interval.

Definition at line 48 of file RRegularAxis.hxx.

◆ fInvBinWidth

double ROOT::Experimental::RRegularAxis::fInvBinWidth
private

The cached inverse of the bin width to speed up ComputeLinearizedIndex.

Definition at line 50 of file RRegularAxis.hxx.

◆ fLow

double ROOT::Experimental::RRegularAxis::fLow
private

The lower end of the axis interval.

Definition at line 46 of file RRegularAxis.hxx.

◆ fNNormalBins

std::uint64_t ROOT::Experimental::RRegularAxis::fNNormalBins
private

The number of normal bins.

Definition at line 44 of file RRegularAxis.hxx.

Libraries for ROOT::Experimental::RRegularAxis:

The documentation for this class was generated from the following file: