1#ifndef YODA_BINESTIMATORS_H
2#define YODA_BINESTIMATORS_H
21 if (_N == 0)
return 0;
22 const int i = _est(x);
24 const size_t i2 = (size_t) i;
25 if (i2 >= _N)
return _N+1;
38 virtual int _est(
double x)
const = 0;
55 _m = (double) nbins / (xhigh - xlow);
66 int _est(
double x)
const {
67 int res = (int) floor(_m * (x - _c));
88 _c = Utils::fastlog2(xlow);
89 _m = nbins / (Utils::fastlog2(xhigh) - _c);
93 int _est(
double x)
const {
94 if (x <= 0.)
return -1;
95 int res = (int) floor(_m * (Utils::fastlog2(x) - _c));
Logarithmic bin estimator.
LogBinEstimator(size_t nbins, double xlow, double xhigh)
Constructor.
Anonymous namespace to limit visibility.
size_t operator()(double x) const
Return offset bin index estimate, with 0 = underflow and Nbins+1 = overflow.
size_t estindex(double x) const
Return offset bin index estimate, with 0 = underflow and Nbins+1 = overflow.
virtual ~BinEstimator()
Virtual destructor needed for inheritance.
LinBinEstimator(size_t nbins, double xlow, double xhigh)
Constructor.
LinBinEstimator(const LinBinEstimator &other)
Copy constructor.