Logo ROOT  
Reference Guide
ROOT::Experimental::RAxisBase Class Reference

Histogram axis base class.

Keeps track of the number of bins and overflow handling. Offers bin iteration.

Bin indices are starting from 0 for the underflow bin (representing values that are lower than the axis range). Starting at index 1 are the actual bins of the axis, up to N + 1 for an axis with N bins. Index N + 2 is the overflow bin for values larger than the axis range.

Definition at line 42 of file RAxis.hxx.

Classes

class  const_iterator
 Random const_iterator through bins. More...
 

Public Types

enum class  EFindStatus { kCanGrow , kValid }
 Status of FindBin(x) More...
 

Public Member Functions

 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...
 
Iterator interfaces
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 Attributes

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

 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...
 
Inaccessible copy, assignment

The copy and move constructors and assignment operators are protected to prevent slicing.

 RAxisBase (const RAxisBase &)=default
 
 RAxisBase (RAxisBase &&)=default
 
RAxisBaseoperator= (const RAxisBase &)=default
 
RAxisBaseoperator= (RAxisBase &&)=default
 

Private Attributes

bool fCanGrow = false
 Whether this axis can grow (and thus has no overflow bins). More...
 
unsigned int fNBins
 Number of bins including under- and overflow. More...
 
std::string fTitle
 Title of this axis, used for graphics / text. More...
 

#include <ROOT/RAxis.hxx>

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

Member Enumeration Documentation

◆ EFindStatus

Status of FindBin(x)

Enumerator
kCanGrow 

Coordinate could fit after growing the axis.

kValid 

The returned bin index is valid.

Definition at line 45 of file RAxis.hxx.

Constructor & Destructor Documentation

◆ RAxisBase() [1/5]

ROOT::Experimental::RAxisBase::RAxisBase ( const RAxisBase )
protecteddefault

◆ RAxisBase() [2/5]

ROOT::Experimental::RAxisBase::RAxisBase ( RAxisBase &&  )
protecteddefault

◆ RAxisBase() [3/5]

ROOT::Experimental::RAxisBase::RAxisBase ( )
protecteddefault

Default construct a RAxisBase (for use by derived classes for I/O)

◆ RAxisBase() [4/5]

ROOT::Experimental::RAxisBase::RAxisBase ( std::string_view  title,
int  nbinsNoOver,
bool  canGrow 
)
inlinenoexcept

Construct a RAxisBase.

Parameters
[in]title- axis title used for graphics and text representation.
[in]nbins- number of bins in this axis, excluding under- and overflow bins.
[in]canGrow- whether this axis can extend its range.

Definition at line 189 of file RAxis.hxx.

◆ RAxisBase() [5/5]

ROOT::Experimental::RAxisBase::RAxisBase ( int  nbinsNoOver,
bool  canGrow 
)
inlinenoexcept

Construct a RAxisBase.

Parameters
[in]nbins- number of bins in this axis, excluding under- and overflow bins.
[in]canGrow- whether this axis can extend its range.

Definition at line 198 of file RAxis.hxx.

Member Function Documentation

◆ AdjustOverflowBinNumber()

int ROOT::Experimental::RAxisBase::AdjustOverflowBinNumber ( double  rawbin) const
inlineprotected

Given rawbin (<0 for underflow, >= GetNBinsNoOver() for overflow), determine the actual bin number taking into account how over/underflow should be handled.

Parameters
[out]statusresult status of the bin determination.
Returns
Returns the bin number adjusted for potential over- and underflow bins. Returns kIgnoreBin if the axis cannot handle the over- / underflow, in which case status will tell how to deal with this overflow.

Definition at line 72 of file RAxis.hxx.

◆ begin()

const_iterator ROOT::Experimental::RAxisBase::begin ( ) const
inlinenoexcept

Get a const_iterator pointing to the first non-underflow bin.

Definition at line 234 of file RAxis.hxx.

◆ begin_with_underflow()

const_iterator ROOT::Experimental::RAxisBase::begin_with_underflow ( ) const
inlinenoexcept

Get a const_iterator pointing the underflow bin.

Definition at line 237 of file RAxis.hxx.

◆ end()

const_iterator ROOT::Experimental::RAxisBase::end ( ) const
inlinenoexcept

Get a const_iterator pointing right beyond the last non-overflow bin (i.e.

pointing to the overflow bin).

Definition at line 241 of file RAxis.hxx.

◆ end_with_overflow()

const_iterator ROOT::Experimental::RAxisBase::end_with_overflow ( ) const
inlinenoexcept

Get a const_iterator pointing right beyond the overflow bin.

Definition at line 244 of file RAxis.hxx.

◆ GetNBins()

int ROOT::Experimental::RAxisBase::GetNBins ( ) const
inlinenoexcept

Get the number of bins, including under- and overflow.

Definition at line 206 of file RAxis.hxx.

◆ GetNBinsNoOver()

int ROOT::Experimental::RAxisBase::GetNBinsNoOver ( ) const
inlinenoexcept

Get the number of bins, excluding under- and overflow.

Definition at line 203 of file RAxis.hxx.

◆ GetNOverflowBins()

int ROOT::Experimental::RAxisBase::GetNOverflowBins ( ) const
inlinenoexcept

Get the number of over- and underflow bins: 0 for growable axes, 2 otherwise.

Definition at line 209 of file RAxis.hxx.

◆ GetOverflowBin()

int ROOT::Experimental::RAxisBase::GetOverflowBin ( ) const
inlinenoexcept

Get the bin index for the underflow bin (or the next bin outside range if CanGrow()).

Definition at line 222 of file RAxis.hxx.

◆ GetTitle()

const std::string & ROOT::Experimental::RAxisBase::GetTitle ( ) const
inline

Definition at line 200 of file RAxis.hxx.

◆ GetUnderflowBin()

int ROOT::Experimental::RAxisBase::GetUnderflowBin ( ) const
inlinenoexcept

Get the bin index for the underflow bin.

Definition at line 218 of file RAxis.hxx.

◆ IsOverflowBin()

bool ROOT::Experimental::RAxisBase::IsOverflowBin ( int  bin) const
inlinenoexcept

Whether the bin index is referencing a bin higher than the axis range.

Definition at line 228 of file RAxis.hxx.

◆ IsUnderflowBin()

bool ROOT::Experimental::RAxisBase::IsUnderflowBin ( int  bin) const
inlinenoexcept

Whether the bin index is referencing a bin lower than the axis range.

Definition at line 225 of file RAxis.hxx.

◆ operator=() [1/2]

RAxisBase & ROOT::Experimental::RAxisBase::operator= ( const RAxisBase )
protecteddefault

◆ operator=() [2/2]

RAxisBase & ROOT::Experimental::RAxisBase::operator= ( RAxisBase &&  )
protecteddefault

Member Data Documentation

◆ fCanGrow

bool ROOT::Experimental::RAxisBase::fCanGrow = false
private

Whether this axis can grow (and thus has no overflow bins).

Definition at line 250 of file RAxis.hxx.

◆ fNBins

unsigned int ROOT::Experimental::RAxisBase::fNBins
private

Number of bins including under- and overflow.

Definition at line 248 of file RAxis.hxx.

◆ fTitle

std::string ROOT::Experimental::RAxisBase::fTitle
private

Title of this axis, used for graphics / text.

Definition at line 249 of file RAxis.hxx.

◆ kIgnoreBin

constexpr const int ROOT::Experimental::RAxisBase::kIgnoreBin = -1
staticconstexpr

FindBin() returns this bin to signal that the bin number is invalid.

Definition at line 178 of file RAxis.hxx.

◆ kNOverflowBins

constexpr const int ROOT::Experimental::RAxisBase::kNOverflowBins = {0, 1, 1, 2}
staticconstexpr

Extra bins for each EAxisOverflow value.

Definition at line 181 of file RAxis.hxx.

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

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