Logo ROOT   master
Reference Guide
ROOT::Experimental::RAxisEquidistant Class Reference


Axis with equidistant bin borders.

Defined by lower l and upper u limit and the number of bins n. All bins have the same width (u-l)/n.

This axis cannot grow; use RAxisGrow for that.

Definition at line 384 of file RAxis.hxx.

Public Member Functions

 RAxisEquidistant ()=default
 
 RAxisEquidistant (std::string_view title, int nbinsNoOver, double low, double high) noexcept
 Initialize a RAxisEquidistant. More...
 
 RAxisEquidistant (int nbinsNoOver, double low, double high) noexcept
 Initialize a RAxisEquidistant. More...
 
bool CanGrow () const noexcept override
 This axis cannot grow. More...
 
int FindBin (double x) const noexcept final override
 Find the adjusted bin index (returning kUnderflowBin for underflow and kOverflowBin for overflow) for the given coordinate. More...
 
double GetBinCenter (int bin) const final override
 Get the bin center for the given bin index. More...
 
double GetBinFrom (int bin) const final override
 Get the low bin border for the given bin index. More...
 
int GetBinIndexForLowEdge (double x) const noexcept final override
 If the coordinate x is within 10 ULPs of a bin low edge coordinate, return the bin for which this is a low edge. More...
 
double GetBinWidth () const noexcept
 Get the width of the bins. More...
 
double GetInverseBinWidth () const noexcept
 Get the inverse of the width of the bins. More...
 
int GetNBinsNoOver () const noexcept final override
 Get the number of bins, excluding under- and overflow. More...
 
 operator RAxisConfig () const
 Convert to RAxisConfig. More...
 
- Public Member Functions inherited from ROOT::Experimental::RAxisBase
double GetBinTo (int bin) const
 Get the high bin border ("right edge") for the given bin index. More...
 
int GetFirstBin () const noexcept
 Get the bin index for the first bin of the axis. More...
 
int GetLastBin () const noexcept
 Get the bin index for the last bin of the axis. More...
 
double GetMaximum () const
 Get the high end of the axis range. More...
 
double GetMinimum () const
 Get the low end of the axis range. More...
 
int GetNBins () const noexcept
 Get the number of bins, including 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 overflow bin (or kInvalidBin if CanGrow()). More...
 
const std::string & GetTitle () const
 Get the axis's title. More...
 
int GetUnderflowBin () const noexcept
 Get the bin index for the underflow bin (or kInvalidBin if CanGrow()). More...
 
bool HasSameBinningAs (const RAxisBase &other) const
 Check if two axes use the same binning convention, i.e. More...
 
const_iterator begin () const noexcept
 Get a const_iterator pointing to the first regular bin. More...
 
const_iterator end () const noexcept
 Get a const_iterator pointing beyond the last regular bin. More...
 

Protected Member Functions

double FindBinRaw (double x) const noexcept
 Find the raw bin index (not adjusted) for the given coordinate. More...
 
bool HasSameBinBordersAs (const RAxisBase &other) const override
 See RAxisBase::HasSameBinBordersAs. More...
 
- Protected Member Functions inherited from ROOT::Experimental::RAxisBase
 RAxisBase () noexcept=default
 Default construct a RAxisBase (for use by derived classes for I/O) More...
 
 RAxisBase (std::string_view title) noexcept
 Construct a RAxisBase. More...
 
virtual ~RAxisBase ()
 Virtual destructor needed in this inheritance-based design. More...
 
int AdjustOverflowBinNumber (double rawbin) const
 Given rawbin (<0 for underflow, >=GetNBinsNoOver() for overflow), determine the 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
 

Static Protected Member Functions

static double GetInvBinWidth (int nbinsNoOver, double lowOrHigh, double highOrLow)
 Determine the inverse bin width. More...
 

Protected Attributes

double fInvBinWidth = 0.
 The inverse of the bin width. More...
 
double fLow = 0.
 The lower limit of the axis. More...
 
unsigned int fNBinsNoOver
 Number of bins excluding under- and overflow. More...
 

Additional Inherited Members

- Static Public Attributes inherited from ROOT::Experimental::RAxisBase
static constexpr const int kInvalidBin = 0
 Special bin index returned to signify that no bin matches a request. More...
 
static constexpr const int kOverflowBin = -2
 Index of the overflow bin, if any. More...
 
static constexpr const int kUnderflowBin = -1
 Index of the underflow bin, if any. More...
 

#include <ROOT/RAxis.hxx>

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

Constructor & Destructor Documentation

◆ RAxisEquidistant() [1/3]

ROOT::Experimental::RAxisEquidistant::RAxisEquidistant ( )
default

◆ RAxisEquidistant() [2/3]

ROOT::Experimental::RAxisEquidistant::RAxisEquidistant ( std::string_view  title,
int  nbinsNoOver,
double  low,
double  high 
)
inlineexplicitnoexcept

Initialize a RAxisEquidistant.

Parameters
[in]title- axis title used for graphics and text representation.
nbins- number of bins in the axis, excluding under- and overflow bins.
low- the low axis range. Any coordinate below that is considered as underflow. The first bin's lower edge is at this value.
high- the high axis range. Any coordinate above that is considered as overflow. The last bin's higher edge is at this value.

Definition at line 422 of file RAxis.hxx.

◆ RAxisEquidistant() [3/3]

ROOT::Experimental::RAxisEquidistant::RAxisEquidistant ( int  nbinsNoOver,
double  low,
double  high 
)
inlineexplicitnoexcept

Initialize a RAxisEquidistant.

Parameters
nbins- number of bins in the axis, excluding under- and overflow bins.
low- the low axis range. Any coordinate below that is considered as underflow. The first bin's lower edge is at this value.
high- the high axis range. Any coordinate above that is considered as overflow. The last bin's higher edge is at this value.
canGrow- whether this axis can extend its range.

Definition at line 437 of file RAxis.hxx.

Member Function Documentation

◆ CanGrow()

bool ROOT::Experimental::RAxisEquidistant::CanGrow ( ) const
inlineoverridevirtualnoexcept

This axis cannot grow.

Implements ROOT::Experimental::RAxisBase.

Reimplemented in ROOT::Experimental::RAxisGrow.

Definition at line 458 of file RAxis.hxx.

◆ FindBin()

int ROOT::Experimental::RAxisEquidistant::FindBin ( double  x) const
inlinefinaloverridevirtualnoexcept

Find the adjusted bin index (returning kUnderflowBin for underflow and kOverflowBin for overflow) for the given coordinate.

Note
Passing a bin border coordinate can either return the bin above or below the bin border. I.e. don't do that for reliable results!

Implements ROOT::Experimental::RAxisBase.

Definition at line 451 of file RAxis.hxx.

◆ FindBinRaw()

double ROOT::Experimental::RAxisEquidistant::FindBinRaw ( double  x) const
inlineprotectednoexcept

Find the raw bin index (not adjusted) for the given coordinate.

The resulting raw bin is 0-based.

Note
Passing a bin border coordinate can either return the bin above or below the bin border. I.e. don't do that for reliable results!

Definition at line 406 of file RAxis.hxx.

◆ GetBinCenter()

double ROOT::Experimental::RAxisEquidistant::GetBinCenter ( int  bin) const
inlinefinaloverridevirtual

Get the bin center for the given bin index.

For the bin == 1 (the first bin) of 2 bins for an axis (0., 1.), this returns 0.25. The result of this method on an overflow or underflow bin is unspecified.

Implements ROOT::Experimental::RAxisBase.

Definition at line 470 of file RAxis.hxx.

◆ GetBinFrom()

double ROOT::Experimental::RAxisEquidistant::GetBinFrom ( int  bin) const
inlinefinaloverridevirtual

Get the low bin border for the given bin index.

For the bin == 1 (the first bin) of 2 bins for an axis (0., 1.), this returns 0. The result of this method on an underflow bin is unspecified.

Implements ROOT::Experimental::RAxisBase.

Definition at line 476 of file RAxis.hxx.

◆ GetBinIndexForLowEdge()

int ROOT::Experimental::RAxisEquidistant::GetBinIndexForLowEdge ( double  x) const
finaloverridevirtualnoexcept

If the coordinate x is within 10 ULPs of a bin low edge coordinate, return the bin for which this is a low edge.

If it's not a bin edge, return kInvalidBin.

Implements ROOT::Experimental::RAxisBase.

Definition at line 41 of file RAxis.cxx.

◆ GetBinWidth()

double ROOT::Experimental::RAxisEquidistant::GetBinWidth ( ) const
inlinenoexcept

Get the width of the bins.

Definition at line 461 of file RAxis.hxx.

◆ GetInvBinWidth()

static double ROOT::Experimental::RAxisEquidistant::GetInvBinWidth ( int  nbinsNoOver,
double  lowOrHigh,
double  highOrLow 
)
inlinestaticprotected

Determine the inverse bin width.

Parameters
nbinsNoOver- number of bins without unter-/overflow
lowOrHigh- first axis boundary
lighOrLow- second axis boundary

Definition at line 394 of file RAxis.hxx.

◆ GetInverseBinWidth()

double ROOT::Experimental::RAxisEquidistant::GetInverseBinWidth ( ) const
inlinenoexcept

Get the inverse of the width of the bins.

Definition at line 464 of file RAxis.hxx.

◆ GetNBinsNoOver()

int ROOT::Experimental::RAxisEquidistant::GetNBinsNoOver ( ) const
inlinefinaloverridevirtualnoexcept

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

Implements ROOT::Experimental::RAxisBase.

Definition at line 445 of file RAxis.hxx.

◆ HasSameBinBordersAs()

bool ROOT::Experimental::RAxisEquidistant::HasSameBinBordersAs ( const RAxisBase other) const
overrideprotectedvirtual

See RAxisBase::HasSameBinBordersAs.

Reimplemented from ROOT::Experimental::RAxisBase.

Definition at line 66 of file RAxis.cxx.

◆ operator RAxisConfig()

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

Convert to RAxisConfig.

Definition at line 442 of file RAxis.hxx.

Member Data Documentation

◆ fInvBinWidth

double ROOT::Experimental::RAxisEquidistant::fInvBinWidth = 0.
protected

The inverse of the bin width.

Definition at line 387 of file RAxis.hxx.

◆ fLow

double ROOT::Experimental::RAxisEquidistant::fLow = 0.
protected

The lower limit of the axis.

Definition at line 386 of file RAxis.hxx.

◆ fNBinsNoOver

unsigned int ROOT::Experimental::RAxisEquidistant::fNBinsNoOver
protected

Number of bins excluding under- and overflow.

Definition at line 388 of file RAxis.hxx.


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