53 _xlo(0), _xhi(0), _ownBoundLo(true), _ownBoundHi(true),
64 _xlo(0), _xhi(0), _ownBoundLo(true), _ownBoundHi(true),
78 _xlo(0), _xhi(0), _ownBoundLo(true), _ownBoundHi(true),
83 setRange(boundaries[0], boundaries[nbins]);
92 _ownBoundLo(other._ownBoundLo), _ownBoundHi(other._ownBoundHi),
93 _nbins(other._nbins), _boundaries(other._boundaries), _array(0),
111 std::vector<double>::iterator it =
140 std::vector<double>::iterator it = std::lower_bound(
_boundaries.begin(),
166 for (
Int_t i = 0; i <= nbins; ++i)
167 addBoundary((
double(nbins - i) /
double(nbins)) * xlo +
168 (
double(i) /
double(nbins)) * xhi);
173inline int rawBinNumberImpl(
double x, std::vector<double>
const& boundaries) {
174 auto it = std::lower_bound(boundaries.begin(), boundaries.end(),
x);
176 while (boundaries.begin() != it &&
177 (boundaries.end() == it || boundaries.end() == it + 1 ||
x < *it)) --it;
178 return it - boundaries.begin();
190 for(std::size_t i = 0; i <
n; ++i) {
213 return (std::abs(xl -
x) < std::abs(xh -
x)) ? xl : xh;
236 coutE(InputArguments) <<
"RooBinning::setRange: ERROR low bound > high bound" << endl;
260 std::vector<double>::const_iterator it = std::lower_bound(
273 if (0 > bin || bin >=
_nbins) {
274 coutE(InputArguments) <<
"RooBinning::binEdges ERROR: bin number must be in range (0," <<
_nbins <<
")" << endl;
287 if (
binEdges(bin, xlo, xhi))
return 0;
288 return 0.5 * (xlo + xhi);
297 if (
binEdges(bin, xlo, xhi))
return 0;
307 if (
binEdges(bin, xlo, xhi))
return 0;
317 if (
binEdges(bin, xlo, xhi))
return 0;
353 for(
auto * el : static_range_cast<RooDouble*>(tmp)) {
360 throw std::string(
"Unknown class version!");
RooAbsBinning is the 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.
Class RooBinning is an implements RooAbsBinning in terms of an array of boundary values,...
double binLow(Int_t bin) const override
Return the lower bound of the requested bin.
double * array() const override
Return array of boundary values.
Int_t rawBinNumber(double x) const
Return sequential bin number that contains value x where bin zero is the first bin that is defined,...
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
Numer 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.
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
void Streamer(TBuffer &) override
Stream all objects in the collection to or from the I/O buffer.