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). 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... | |
Iterator interfaces | |
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... | |
Static Public Attributes | |
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 | |
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... | |
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. More... | |
#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.
[out] | result | status of the bin determination. |
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 |