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

An axis with variable bins defined by their edges.

For example, the following creates an axis with 3 log-spaced bins:

std::vector<double> binEdges = {1, 10, 100, 1000};
An axis with variable bins defined by their edges.

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 39 of file RVariableBinAxis.hxx.

Public Member Functions

 RVariableBinAxis (std::vector< double > binEdges, bool enableFlowBins=true)
 Construct an axis object with variable bins.
 
RLinearizedIndex ComputeLinearizedIndex (double x) const
 Compute the linarized index for a single argument.
 
const std::vector< double > & GetBinEdges () const
 
RBinIndexRange GetFullRange () const
 Get the full range of all bins.
 
RLinearizedIndex GetLinearizedIndex (RBinIndex index) const
 Get the linearized index for an RBinIndex.
 
std::size_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::size_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

std::vector< doublefBinEdges
 The (ordered) edges of the normal bins.
 
bool fEnableFlowBins
 Whether underflow and overflow bins are enabled.
 

Friends

bool operator== (const RVariableBinAxis &lhs, const RVariableBinAxis &rhs)
 

#include <ROOT/RVariableBinAxis.hxx>

Constructor & Destructor Documentation

◆ RVariableBinAxis()

ROOT::Experimental::RVariableBinAxis::RVariableBinAxis ( std::vector< double > binEdges,
bool enableFlowBins = true )
inlineexplicit

Construct an axis object with variable bins.

Parameters
[in]binEdgesthe (ordered) edges of the normal bins, must define at least one bin (i.e. size >= 2)
[in]enableFlowBinswhether to enable underflow and overflow bins

Definition at line 50 of file RVariableBinAxis.hxx.

Member Function Documentation

◆ ComputeLinearizedIndex()

RLinearizedIndex ROOT::Experimental::RVariableBinAxis::ComputeLinearizedIndex ( double x) const
inline

Compute the linarized index for a single argument.

The normal bins have indices \(0\) to \(fBinEdges.size() - 2\), the underflow bin has index \(fBinEdges.size() - 1\), and the overflow bin has index \(fBinEdges.size()\). If the argument is outside all bin edges and the flow bins are disabled, the return value is invalid.

Parameters
[in]xthe argument
Returns
the linearized index that may be invalid

Definition at line 83 of file RVariableBinAxis.hxx.

◆ GetBinEdges()

const std::vector< double > & ROOT::Experimental::RVariableBinAxis::GetBinEdges ( ) const
inline

Definition at line 67 of file RVariableBinAxis.hxx.

◆ GetFullRange()

RBinIndexRange ROOT::Experimental::RVariableBinAxis::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 163 of file RVariableBinAxis.hxx.

◆ GetLinearizedIndex()

RLinearizedIndex ROOT::Experimental::RVariableBinAxis::GetLinearizedIndex ( RBinIndex index) const
inline

Get the linearized index for an RBinIndex.

The normal bins have indices \(0\) to \(fBinEdges.size() - 2\), the underflow bin has index \(fBinEdges.size() - 1\), and the overflow bin has index \(fBinEdges.size()\).

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

Definition at line 111 of file RVariableBinAxis.hxx.

◆ GetNNormalBins()

std::size_t ROOT::Experimental::RVariableBinAxis::GetNNormalBins ( ) const
inline

Definition at line 65 of file RVariableBinAxis.hxx.

◆ GetNormalRange() [1/2]

RBinIndexRange ROOT::Experimental::RVariableBinAxis::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 128 of file RVariableBinAxis.hxx.

◆ GetNormalRange() [2/2]

RBinIndexRange ROOT::Experimental::RVariableBinAxis::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 138 of file RVariableBinAxis.hxx.

◆ GetTotalNBins()

std::size_t ROOT::Experimental::RVariableBinAxis::GetTotalNBins ( ) const
inline

Definition at line 66 of file RVariableBinAxis.hxx.

◆ HasFlowBins()

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

Definition at line 68 of file RVariableBinAxis.hxx.

◆ Streamer()

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

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

Definition at line 170 of file RVariableBinAxis.hxx.

Friends And Related Symbol Documentation

◆ operator==

Definition at line 70 of file RVariableBinAxis.hxx.

Member Data Documentation

◆ fBinEdges

std::vector<double> ROOT::Experimental::RVariableBinAxis::fBinEdges
private

The (ordered) edges of the normal bins.

Definition at line 41 of file RVariableBinAxis.hxx.

◆ fEnableFlowBins

bool ROOT::Experimental::RVariableBinAxis::fEnableFlowBins
private

Whether underflow and overflow bins are enabled.

Definition at line 43 of file RVariableBinAxis.hxx.

Libraries for ROOT::Experimental::RVariableBinAxis:

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