5#ifndef ROOT_RRegularAxis
6#define ROOT_RRegularAxis
20namespace Experimental {
59 throw std::invalid_argument(
"nNormalBins must be > 0");
62 std::string
msg =
"high must be > low, but " + std::to_string(low) +
" >= " + std::to_string(high);
63 throw std::invalid_argument(
msg);
76 return lhs.fNNormalBins ==
rhs.fNNormalBins &&
lhs.fLow ==
rhs.fLow &&
lhs.fHigh ==
rhs.fHigh &&
77 lhs.fEnableFlowBins ==
rhs.fEnableFlowBins;
92 bool overflow = !(
x <
fHigh);
95 }
else if (overflow) {
112 if (
index.IsUnderflow()) {
114 }
else if (
index.IsOverflow()) {
116 }
else if (
index.IsInvalid()) {
120 std::size_t bin =
index.GetIndex();
140 throw std::invalid_argument(
"begin must be a normal bin");
143 throw std::invalid_argument(
"begin must be inside the axis");
145 if (!end.IsNormal()) {
146 throw std::invalid_argument(
"end must be a normal bin");
149 throw std::invalid_argument(
"end must be inside or past the axis");
151 if (!(end >= begin)) {
152 throw std::invalid_argument(
"end must be >= begin");
169 void Streamer(
TBuffer &) {
throw std::runtime_error(
"unable to store RRegularAxis"); }
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
A bin index with special values for underflow and overflow bins.
std::size_t GetIndex() const
Return the index for a normal bin.
bool IsNormal() const
A bin index is normal iff it is not one of the special values.
static RBinIndex Underflow()
A regular axis with equidistant bins in the interval .
std::size_t GetNNormalBins() const
RBinIndexRange GetNormalRange(RBinIndex begin, RBinIndex end) const
Get a range of normal bins.
bool fEnableFlowBins
Whether underflow and overflow bins are enabled.
friend bool operator==(const RRegularAxis &lhs, const RRegularAxis &rhs)
RLinearizedIndex ComputeLinearizedIndex(double x) const
Compute the linarized index for a single argument.
RBinIndexRange GetFullRange() const
Get the full range of all bins.
std::size_t GetTotalNBins() const
RRegularAxis(std::size_t nNormalBins, double low, double high, bool enableFlowBins=true)
Construct a regular axis object.
double fInvBinWidth
The cached inverse of the bin width to speed up ComputeLinearizedIndex.
double fLow
The lower end of the axis interval.
RBinIndexRange GetNormalRange() const
Get the range of all normal bins.
void Streamer(TBuffer &)
ROOT Streamer function to throw when trying to store an object of this class.
double fHigh
The upper end of the axis interval.
RLinearizedIndex GetLinearizedIndex(RBinIndex index) const
Get the linearized index for an RBinIndex.
std::size_t fNNormalBins
The number of normal bins.
Buffer base class used for serializing objects.
RBinIndexRange CreateBinIndexRange(RBinIndex begin, RBinIndex end, std::size_t nNormalBins)
Internal function to create RBinIndexRange.
Namespace for new ROOT classes and functions.
A linearized index that can be invalid.