Logo ROOT  
Reference Guide
ROOT::Experimental::RAxisIrregular Class Reference

An axis with non-equidistant bins (also known as "variable binning").

It is defined by an array of bin borders - one more than the number of (non-overflow-) bins it has! As an example, an axis with two bin needs three bin borders:

  • lower edge of the first bin;
  • higher edge of the first bin, identical to the lower edge of the second bin;
  • higher edge of the second bin

This axis cannot grow; the size of new bins would not be well defined.

Definition at line 595 of file RAxis.hxx.

Public Member Functions

 RAxisIrregular ()=default
 
 RAxisIrregular (const std::vector< double > &binborders)
 Construct a RAxisIrregular from a vector of bin borders. More...
 
 RAxisIrregular (std::string_view title, const std::vector< double > &binborders)
 Construct a RAxisIrregular from a vector of bin borders. More...
 
 RAxisIrregular (std::string_view title, std::vector< double > &&binborders) noexcept
 Construct a RAxisIrregular from a vector of bin borders. More...
 
 RAxisIrregular (std::vector< double > &&binborders) noexcept
 Construct a RAxisIrregular from a vector of bin borders. More...
 
int FindBin (double x) const noexcept
 Find the bin index corresponding to coordinate x. More...
 
const std::vector< double > & GetBinBorders () const noexcept
 Access to the bin borders used by this axis. More...
 
double GetBinCenter (int bin) const noexcept
 Get the bin center of the bin with the given index. More...
 
double GetBinFrom (int bin) const noexcept
 Get the lower bin border for a given bin index. More...
 
double GetBinTo (int bin) const noexcept
 Get the higher bin border for a given bin index. More...
 
 operator RAxisConfig () const
 Convert to RAxisConfig. More...
 
- Public Member Functions inherited from ROOT::Experimental::RAxisBase
 RAxisBase (int nbinsNoOver, bool canGrow) noexcept
 Construct a RAxisBase. More...
 
 RAxisBase (std::string_view title, int nbinsNoOver, bool canGrow) noexcept
 Construct a RAxisBase. More...
 
int GetNBins () const noexcept
 Get the number of bins, including under- and overflow. More...
 
int GetNBinsNoOver () const noexcept
 Get the number of bins, excluding under- and overflow. More...
 
int GetNOverflowBins () const noexcept
 Get the number of over- and underflow bins: 0 for growable axes, 2 otherwise. More...
 
int GetOverflowBin () const noexcept
 Get the bin index for the underflow bin (or the next bin outside range if CanGrow()). More...
 
const std::string & GetTitle () const
 
int GetUnderflowBin () const noexcept
 Get the bin index for the underflow bin. More...
 
bool IsOverflowBin (int bin) const noexcept
 Whether the bin index is referencing a bin higher than the axis range. More...
 
bool IsUnderflowBin (int bin) const noexcept
 Whether the bin index is referencing a bin lower than the axis range. More...
 
const_iterator begin () const noexcept
 Get a const_iterator pointing to the first non-underflow bin. More...
 
const_iterator begin_with_underflow () const noexcept
 Get a const_iterator pointing the underflow bin. More...
 
const_iterator end () const noexcept
 Get a const_iterator pointing right beyond the last non-overflow bin (i.e. More...
 
const_iterator end_with_overflow () const noexcept
 Get a const_iterator pointing right beyond the overflow bin. More...
 

Static Public Member Functions

static bool CanGrow () noexcept
 This axis cannot be extended. More...
 

Private Attributes

std::vector< double > fBinBorders
 Bin borders, one more than the number of non-overflow bins. More...
 

Additional Inherited Members

- Public Types inherited from ROOT::Experimental::RAxisBase
enum class  EFindStatus { kCanGrow , kValid }
 Status of FindBin(x) More...
 
- Static Public Attributes inherited from ROOT::Experimental::RAxisBase
static constexpr const int kIgnoreBin = -1
 FindBin() returns this bin to signal that the bin number is invalid. More...
 
static constexpr const int kNOverflowBins [4] = {0, 1, 1, 2}
 Extra bins for each EAxisOverflow value. More...
 
- Protected Member Functions inherited from ROOT::Experimental::RAxisBase
 RAxisBase ()=default
 Default construct a RAxisBase (for use by derived classes for I/O) More...
 
int AdjustOverflowBinNumber (double rawbin) const
 Given rawbin (<0 for underflow, >= GetNBinsNoOver() for overflow), determine the actual bin number taking into account how over/underflow should be handled. More...
 
 RAxisBase (const RAxisBase &)=default
 
 RAxisBase (RAxisBase &&)=default
 
RAxisBaseoperator= (const RAxisBase &)=default
 
RAxisBaseoperator= (RAxisBase &&)=default
 

#include <ROOT/RAxis.hxx>

Inheritance diagram for ROOT::Experimental::RAxisIrregular:
[legend]

Constructor & Destructor Documentation

◆ RAxisIrregular() [1/5]

ROOT::Experimental::RAxisIrregular::RAxisIrregular ( )
default

◆ RAxisIrregular() [2/5]

ROOT::Experimental::RAxisIrregular::RAxisIrregular ( const std::vector< double > &  binborders)
inlineexplicit

Construct a RAxisIrregular from a vector of bin borders.

Note
The bin borders must be sorted in increasing order!

Definition at line 605 of file RAxis.hxx.

◆ RAxisIrregular() [3/5]

ROOT::Experimental::RAxisIrregular::RAxisIrregular ( std::vector< double > &&  binborders)
inlineexplicitnoexcept

Construct a RAxisIrregular from a vector of bin borders.

Note
The bin borders must be sorted in increasing order! Faster, noexcept version taking an rvalue of binborders. The compiler will know when it can take this one.

Definition at line 618 of file RAxis.hxx.

◆ RAxisIrregular() [4/5]

ROOT::Experimental::RAxisIrregular::RAxisIrregular ( std::string_view  title,
const std::vector< double > &  binborders 
)
inlineexplicit

Construct a RAxisIrregular from a vector of bin borders.

Note
The bin borders must be sorted in increasing order!

Definition at line 629 of file RAxis.hxx.

◆ RAxisIrregular() [5/5]

ROOT::Experimental::RAxisIrregular::RAxisIrregular ( std::string_view  title,
std::vector< double > &&  binborders 
)
inlineexplicitnoexcept

Construct a RAxisIrregular from a vector of bin borders.

Note
The bin borders must be sorted in increasing order! Faster, noexcept version taking an rvalue of binborders. The compiler will know when it can take this one.

Definition at line 642 of file RAxis.hxx.

Member Function Documentation

◆ CanGrow()

static bool ROOT::Experimental::RAxisIrregular::CanGrow ( )
inlinestaticnoexcept

This axis cannot be extended.

Definition at line 713 of file RAxis.hxx.

◆ FindBin()

int ROOT::Experimental::RAxisIrregular::FindBin ( double  x) const
inlinenoexcept

Find the bin index corresponding to coordinate x.

If the coordinate is below the axis range, return 0. If it is above, return N + 1 for an axis with N non-overflow bins.

Definition at line 657 of file RAxis.hxx.

◆ GetBinBorders()

const std::vector< double > & ROOT::Experimental::RAxisIrregular::GetBinBorders ( ) const
inlinenoexcept

Access to the bin borders used by this axis.

Definition at line 716 of file RAxis.hxx.

◆ GetBinCenter()

double ROOT::Experimental::RAxisIrregular::GetBinCenter ( int  bin) const
inlinenoexcept

Get the bin center of the bin with the given index.

For the bin at index 0 (i.e. the underflow bin), a bin center of std::numeric_limits<double>::min() is returned, i.e. the minimum value that can be held in a double. Similarly, for the bin at index N + 1 (i.e. the overflow bin), a bin center of std::numeric_limits<double>::max() is returned, i.e. the maximum value that can be held in a double.

Definition at line 677 of file RAxis.hxx.

◆ GetBinFrom()

double ROOT::Experimental::RAxisIrregular::GetBinFrom ( int  bin) const
inlinenoexcept

Get the lower bin border for a given bin index.

For the bin at index 0 (i.e. the underflow bin), a lower bin border of std::numeric_limits<double>::min() is returned, i.e. the minimum value that can be held in a double.

Definition at line 691 of file RAxis.hxx.

◆ GetBinTo()

double ROOT::Experimental::RAxisIrregular::GetBinTo ( int  bin) const
inlinenoexcept

Get the higher bin border for a given bin index.

For the bin at index N + 1 (i.e. the overflow bin), a bin border of std::numeric_limits<double>::max() is returned, i.e. the maximum value that can be held in a double.

Definition at line 705 of file RAxis.hxx.

◆ operator RAxisConfig()

ROOT::Experimental::RAxisIrregular::operator RAxisConfig ( ) const
inline

Convert to RAxisConfig.

Definition at line 652 of file RAxis.hxx.

Member Data Documentation

◆ fBinBorders

std::vector<double> ROOT::Experimental::RAxisIrregular::fBinBorders
private

Bin borders, one more than the number of non-overflow bins.

Definition at line 598 of file RAxis.hxx.

Libraries for ROOT::Experimental::RAxisIrregular:
[legend]

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