Logo ROOT  
Reference Guide
ROOT::Experimental::RAxisGrow Class Reference

An axis that can extend its range, keeping the number of its bins unchanged.

The axis is constructed with an initial range. Apart from its ability to grow, this axis behaves like a RAxisEquidistant.

Definition at line 505 of file RAxis.hxx.

Public Member Functions

 RAxisGrow (int nbins, double low, double high) noexcept
 Initialize a RAxisGrow. More...
 
 RAxisGrow (std::string_view title, int nbins, double low, double high) noexcept
 Initialize a RAxisGrow. More...
 
bool CanGrow () const noexcept final override
 This axis kind can increase its range. More...
 
int Grow (int toBin)
 Grow this axis to make the "virtual bin" toBin in-range. More...
 
 operator RAxisConfig () const
 Convert to RAxisConfig. More...
 
- Public Member Functions inherited from ROOT::Experimental::RAxisEquidistant
 RAxisEquidistant ()=default
 
 RAxisEquidistant (int nbinsNoOver, double low, double high) noexcept
 Initialize a RAxisEquidistant. More...
 
 RAxisEquidistant (std::string_view title, 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
virtual bool CanGrow () const noexcept=0
 Whether this axis can grow (and thus has no overflow bins). More...
 
virtual int FindBin (double x) const noexcept=0
 Find the adjusted bin index (returning kUnderflowBin for underflow and kOverflowBin for overflow) for the given coordinate. More...
 
virtual double GetBinCenter (int bin) const =0
 Get the bin center for the given bin index. More...
 
virtual double GetBinFrom (int bin) const =0
 Get the low bin border ("left edge") for the given bin index. More...
 
virtual int GetBinIndexForLowEdge (double x) const noexcept=0
 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 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...
 
virtual int GetNBinsNoOver () const noexcept=0
 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 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...
 

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...
 
- Protected Member Functions inherited from ROOT::Experimental::RAxisEquidistant
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(noexcept(std::string()))=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...
 
virtual bool HasSameBinBordersAs (const RAxisBase &other) const
 Check if two axis have the same bin borders. More...
 
 RAxisBase (const RAxisBase &)=default
 
 RAxisBase (RAxisBase &&)=default
 
RAxisBaseoperator= (const RAxisBase &)=default
 
RAxisBaseoperator= (RAxisBase &&)=default
 
- Static Protected Member Functions inherited from ROOT::Experimental::RAxisEquidistant
static double GetInvBinWidth (int nbinsNoOver, double lowOrHigh, double highOrLow)
 Determine the inverse bin width. More...
 
- Protected Attributes inherited from ROOT::Experimental::RAxisEquidistant
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...
 

#include <ROOT/RAxis.hxx>

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

Constructor & Destructor Documentation

◆ RAxisGrow() [1/2]

ROOT::Experimental::RAxisGrow::RAxisGrow ( std::string_view  title,
int  nbins,
double  low,
double  high 
)
inlineexplicitnoexcept

Initialize a RAxisGrow.

Parameters
nbins- number of bins in the axis, excluding under- and overflow bins. This value is fixed over the lifetime of the object.
low- the initial value for the low axis range. Any coordinate below that is considered as underflow. To trigger the growing of the axis call Grow().
high- the initial value for the high axis range. Any coordinate above that is considered as overflow. To trigger the growing of the axis call Grow().

Definition at line 516 of file RAxis.hxx.

◆ RAxisGrow() [2/2]

ROOT::Experimental::RAxisGrow::RAxisGrow ( int  nbins,
double  low,
double  high 
)
inlineexplicitnoexcept

Initialize a RAxisGrow.

Parameters
[in]title- axis title used for graphics and text representation.
nbins- number of bins in the axis, excluding under- and overflow bins. This value is fixed over the lifetime of the object.
low- the initial value for the low axis range. Any coordinate below that is considered as underflow. To trigger the growing of the axis call Grow().
high- the initial value for the high axis range. Any coordinate above that is considered as overflow. To trigger the growing of the axis call Grow().

Definition at line 530 of file RAxis.hxx.

Member Function Documentation

◆ CanGrow()

bool ROOT::Experimental::RAxisGrow::CanGrow ( ) const
inlinefinaloverridevirtualnoexcept

This axis kind can increase its range.

Reimplemented from ROOT::Experimental::RAxisEquidistant.

Definition at line 562 of file RAxis.hxx.

◆ Grow()

int ROOT::Experimental::RAxisGrow::Grow ( int  toBin)

Grow this axis to make the "virtual bin" toBin in-range.

This keeps the non-affected axis limit unchanged, and extends the other axis limit such that a number of consecutive bins are merged.

Example, assuming an initial RAxisGrow with 10 bins from 0. to 1.:

  • Grow(0): that (virtual) bin spans from -0.1 to 0. To include it in the axis range, the lower limit must be shifted. The minimal number of bins that can be merged is 2, thus the new axis will span from -1. to 1.
  • Grow(-1): that (virtual) bin spans from -0.2 to 0.1. To include it in the axis range, the lower limit must be shifted. The minimal number of bins that can be merged is 2, thus the new axis will span from -1. to 1.
  • Grow(50): that (virtual) bin spans from 4.9 to 5.0. To include it in the axis range, the higher limit must be shifted. Five bins need to be merged, making the new axis range 0. to 5.0.
Parameters
toBin- the "virtual" bin number, as if the axis had an infinite number of bins with the current bin width. For instance, for an axis with ten bins in the range 0. to 1., the coordinate 2.05 has the virtual bin index 20.
Returns
Returns the number of bins that were merged to reach the value. A value of 1 means that no bins were merged (toBin was in the original axis range).

◆ operator RAxisConfig()

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

Convert to RAxisConfig.

Definition at line 533 of file RAxis.hxx.

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

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