Histogram axis base class.
Keeps track of the number of bins and overflow handling. Offers bin iteration.
Regular bin indices are starting from 1, up to N + 1 for an axis with N bins. Index -1 is for the underflow bin, representing values that are lower than the axis range. Index -2 is the overflow bin for values larger than the axis range. Growable axes do not have underflow or overflow bins, as they don't need them.
Classes | |
class | const_iterator |
Random const_iterator through bins. More... | |
Public Member Functions | |
virtual bool | CanGrow () const noexcept=0 |
Whether this axis can grow (and thus has no overflow bins). | |
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. | |
virtual double | GetBinCenter (int bin) const =0 |
Get the bin center for the given bin index. | |
virtual double | GetBinFrom (int bin) const =0 |
Get the low bin border ("left edge") for the given bin index. | |
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. | |
double | GetBinTo (int bin) const |
Get the high bin border ("right edge") for the given bin index. | |
int | GetFirstBin () const noexcept |
Get the bin index for the first bin of the axis. | |
int | GetLastBin () const noexcept |
Get the bin index for the last bin of the axis. | |
double | GetMaximum () const |
Get the high end of the axis range. | |
double | GetMinimum () const |
Get the low end of the axis range. | |
int | GetNBins () const noexcept |
Get the number of bins, including under- and overflow. | |
virtual int | GetNBinsNoOver () const noexcept=0 |
Get the number of bins, excluding under- and overflow. | |
int | GetNOverflowBins () const noexcept |
Get the number of over- and underflow bins: 0 for growable axes, 2 otherwise. | |
int | GetOverflowBin () const noexcept |
Get the bin index for the overflow bin (or kInvalidBin if CanGrow()). | |
const std::string & | GetTitle () const |
Get the axis's title. | |
int | GetUnderflowBin () const noexcept |
Get the bin index for the underflow bin (or kInvalidBin if CanGrow()). | |
bool | HasSameBinningAs (const RAxisBase &other) const |
Check if two axes use the same binning convention, i.e. | |
Iterator interfaces | |
const_iterator | begin () const noexcept |
Get a const_iterator pointing to the first regular bin. | |
const_iterator | end () const noexcept |
Get a const_iterator pointing beyond the last regular bin. | |
Static Public Attributes | |
static constexpr const int | kInvalidBin = 0 |
Special bin index returned to signify that no bin matches a request. | |
static constexpr const int | kOverflowBin = -2 |
Index of the overflow bin, if any. | |
static constexpr const int | kUnderflowBin = -1 |
Index of the underflow bin, if any. | |
Protected Member Functions | |
RAxisBase () noexcept(noexcept(std::string()))=default | |
Default construct a RAxisBase (for use by derived classes for I/O) | |
RAxisBase (std::string_view title) noexcept | |
Construct a RAxisBase. | |
virtual | ~RAxisBase () |
Virtual destructor needed in this inheritance-based design. | |
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. | |
virtual bool | HasSameBinBordersAs (const RAxisBase &other) const |
Check if two axis have the same bin borders. | |
Inaccessible copy, assignment | |
The copy and move constructors and assignment operators are protected to prevent slicing. | |
RAxisBase (const RAxisBase &)=default | |
RAxisBase (RAxisBase &&)=default | |
RAxisBase & | operator= (const RAxisBase &)=default |
RAxisBase & | operator= (RAxisBase &&)=default |
Private Attributes | |
std::string | fTitle |
Title of this axis, used for graphics / text. | |
#include <ROOT/RAxis.hxx>
|
protecteddefault |
|
protecteddefault |
|
protecteddefaultnoexcept |
Default construct a RAxisBase (for use by derived classes for I/O)
|
protectedvirtual |
|
inlineprotectednoexcept |
Given rawbin (<0
for underflow, >=GetNBinsNoOver()
for overflow), determine the bin number taking into account how over/underflow should be handled.
[in] | rawbin | for which to determine the bin number. |
kInvalidBin
if the axis cannot handle the over- / underflow.
|
inlinenoexcept |
Get a const_iterator pointing to the first regular bin.
|
pure virtualnoexcept |
Whether this axis can grow (and thus has no overflow bins).
Implemented in ROOT::Experimental::RAxisGrow, ROOT::Experimental::RAxisIrregular, and ROOT::Experimental::RAxisEquidistant.
|
inlinenoexcept |
Get a const_iterator pointing beyond the last regular bin.
Find the adjusted bin index (returning kUnderflowBin
for underflow and kOverflowBin
for overflow) for the given coordinate.
Implemented in ROOT::Experimental::RAxisEquidistant, and ROOT::Experimental::RAxisIrregular.
Get the bin center for the given bin index.
The result of this method on an overflow or underflow bin is unspecified.
Implemented in ROOT::Experimental::RAxisEquidistant, and ROOT::Experimental::RAxisIrregular.
Get the low bin border ("left edge") for the given bin index.
The result of this method on an underflow bin is unspecified.
Implemented in ROOT::Experimental::RAxisEquidistant, and ROOT::Experimental::RAxisIrregular.
|
pure virtualnoexcept |
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
.
Implemented in ROOT::Experimental::RAxisEquidistant, and ROOT::Experimental::RAxisIrregular.
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inline |
|
inlinenoexcept |
|
pure virtualnoexcept |
Get the number of bins, excluding under- and overflow.
Implemented in ROOT::Experimental::RAxisEquidistant, and ROOT::Experimental::RAxisIrregular.
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
|
inlineprotectedvirtual |
Check if two axis have the same bin borders.
Default implementation should work for any RAxis type, but is quite inefficient as it does virtual GetBinFrom calls in a loop. RAxis implementations are encouraged to provide optimized overrides for common axis binning comparison scenarios.
Reimplemented in ROOT::Experimental::RAxisEquidistant, and ROOT::Experimental::RAxisIrregular.
|
private |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |