35 if (!HasSameBinBordersAs(other))
39 auto lbl_ptr =
dynamic_cast<const RAxisLabels*
>(
this);
40 auto other_lbl_ptr =
dynamic_cast<const RAxisLabels*
>(&other);
41 if (
bool(lbl_ptr) !=
bool(other_lbl_ptr)) {
55 double fracBinIdx = GetFirstBin() + FindBinRaw(
x);
59 int binIdx = std::round(fracBinIdx);
60 double binOffset = fracBinIdx - binIdx;
61 if (std::fabs(binOffset) > 10 * std::numeric_limits<double>::epsilon())
66 if (binIdx < GetFirstBin())
70 if (binIdx > GetLastBin() + 1)
86 fLow == other_eq.
fLow &&
88 CanGrow() == other_eq.
CanGrow();
94 double fracBinIdx = FindBinRaw(
x);
95 const int binIdx = fracBinIdx;
98 constexpr double tol = 10 * std::numeric_limits<double>::epsilon();
99 if (binIdx >= GetFirstBin()) {
100 const double lowBound = GetBinFrom(binIdx);
101 if (std::fabs(
x - lowBound) < tol * std::fabs(lowBound))
104 if (binIdx <= GetLastBin()) {
105 const double upBound = GetBinTo(binIdx);
106 if (std::fabs(
x - upBound) < tol * std::fabs(upBound))
130 if (source.HasSameBinningAs(target))
134 int idxTargetLow = target.GetBinIndexForLowEdge(source.GetMinimum());
135 int idxTargetHigh = target.GetBinIndexForLowEdge(source.GetMaximum());
136 if (idxTargetLow < 0 || idxTargetHigh < 0)
143 if (source.GetInverseBinWidth() == target.GetInverseBinWidth())
151 if (std::fabs(target.GetInverseBinWidth() * source.GetNBinsNoOver() -
152 source.GetInverseBinWidth() * (idxTargetHigh - idxTargetLow)) > 1E-6 * target.GetInverseBinWidth())
Histogram axis base class.
virtual bool HasSameBinBordersAs(const RAxisBase &other) const
Check if two axis have the same bin borders.
static constexpr const int kInvalidBin
Special bin index returned to signify that no bin matches a request.
bool HasSameBinningAs(const RAxisBase &other) const
Check if two axes use the same binning convention, i.e.
virtual ~RAxisBase()
Virtual destructor needed in this inheritance-based design.
Axis with equidistant bin borders.
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 ...
bool HasSameBinBordersAs(const RAxisBase &other) const override
See RAxisBase::HasSameBinBordersAs.
double fInvBinWidth
The inverse of the bin width.
bool CanGrow() const noexcept override
This axis cannot grow.
unsigned int fNBinsNoOver
Number of bins excluding under- and overflow.
double fLow
The lower limit of the axis.
An axis with non-equidistant bins (also known as "variable binning").
bool HasSameBinBordersAs(const RAxisBase &other) const override
See RAxisBase::HasSameBinBordersAs.
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 ...
std::vector< double > fBinBorders
Bin borders, one more than the number of regular bins.
A RAxisGrow that has a label assigned to each bin and a bin width of 1.
@ kLabelsCmpSame
Both axes have the same labels, mapping to the same bins.
LabelsCmpFlags CompareBinLabels(const RAxisLabels &other) const noexcept
Compare the labels of this axis with those of another axis.
A log configuration for a channel, e.g.
EAxisCompatibility CanMap(const RAxisEquidistant &target, const RAxisEquidistant &source) noexcept
Whether (and how) the source axis can be merged into the target axis.
RLogChannel & HistLog()
Log channel for Hist diagnostics.
@ kContains
The source is a subset of bins of the target axis.
@ kIdentical
Source and target axes are identical.
@ kIncompatible
The source axis and target axis have different binning.
@ kSampling
The bins of the source axis have finer granularity, but the bin borders are compatible.