76 setRange(boundaries[0], boundaries[nbins]);
85 _ownBoundLo(
other._ownBoundLo), _ownBoundHi(
other._ownBoundHi),
86 _nbins(
other._nbins), _boundaries(
other._boundaries),
104 std::vector<double>::iterator it =
133 std::vector<double>::iterator it = std::lower_bound(
_boundaries.begin(),
159 for (
Int_t i = 0; i <= nbins; ++i) {
160 addBoundary((
double(nbins - i) /
double(nbins)) * xlo + (
double(i) /
double(nbins)) * xhi);
167 auto it = std::lower_bound(boundaries.begin(), boundaries.end(),
x);
169 while (boundaries.begin() != it &&
170 (boundaries.end() == it || boundaries.end() == it + 1 ||
x < *it)) --it;
171 return it - boundaries.begin();
183 for(std::size_t i = 0; i <
n; ++i) {
196 return (std::abs(
xl -
x) < std::abs(
xh -
x)) ?
xl :
xh;
219 coutE(InputArguments) <<
"RooBinning::setRange: ERROR low bound > high bound" << endl;
243 std::vector<double>::const_iterator it = std::lower_bound(
256 if (0 > bin || bin >=
_nbins) {
257 coutE(InputArguments) <<
"RooBinning::binEdges ERROR: bin number must be in range (0," <<
_nbins <<
")" << endl;
271 if (
binEdges(bin, xlo, xhi))
return 0;
272 return 0.5 * (xlo + xhi);
282 if (
binEdges(bin, xlo, xhi))
return 0;
293 if (
binEdges(bin, xlo, xhi))
return 0;
304 if (
binEdges(bin, xlo, xhi))
return 0;
313 if (
R__b.IsReading()) {
349 throw std::string(
"Unknown class version!");
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Abstract base class for RooRealVar binning definitions.
int binNumber(double x) const
Returns the bin number corresponding to the value x.
void Streamer(TBuffer &) override
Custom streamer implementing schema evolution between V1 and V2 persistent binnings.
Implements a RooAbsBinning in terms of an array of boundary values, posing no constraints on the choi...
double binLow(Int_t bin) const override
Return the lower bound of the requested bin.
double * array() const override
Return array of boundary values.
void updateBinCount()
Update the internal bin counter.
TClass * IsA() const override
Int_t _blo
! bin number for _xlo
std::vector< double > _boundaries
Boundaries.
Int_t numBoundaries() const override
Return the number boundaries.
~RooBinning() override
Destructor.
bool addBoundary(double boundary)
Add bin boundary at given value.
void binNumbers(double const *x, int *bins, std::size_t n, int coef) const override
Return sequential bin number that contains value x where bin zero is the first bin with an upper boun...
RooBinning(double xlo=-RooNumber::infinity(), double xhi=RooNumber::infinity(), const char *name=nullptr)
Constructor for an initially empty binning defining the range [xlo,xhi].
void addUniform(Int_t nBins, double xlo, double xhi)
Add array of nbins uniformly sized bins in range [xlo,xhi].
double binCenter(Int_t bin) const override
Return the position of the center of bin 'bin'.
double binHigh(Int_t bin) const override
Return the upper bound of the requested bin.
void Streamer(TBuffer &) override
Custom streamer that provides backward compatibility to read v1 data.
bool _ownBoundHi
Does the upper bound coincide with a bin boundary.
double * _array
! Array of boundaries
double binWidth(Int_t bin) const override
Return the width of the requested bin.
Int_t _nbins
Number of bins.
void addBoundaryPair(double boundary, double mirrorPoint=0)
Add pair of boundaries: one at 'boundary' and one at 2*mirrorPoint-boundary.
bool _ownBoundLo
Does the lower bound coincide with a bin boundary.
bool removeBoundary(double boundary)
Remove boundary at given value.
virtual double nearestBoundary(double x) const
Return the value of the nearest boundary to x.
bool binEdges(Int_t bin, double &xlo, double &xhi) const
Return upper and lower bound of bin 'bin'.
void setRange(double xlo, double xhi) override
Change the defined range associated with this binning.
Buffer base class used for serializing objects.