21 :
IAxis(
name), m_nbins(nbins), m_start(start), m_end(end)
34 throw std::runtime_error(
"FixedBinAxis::operator[] -> Error. Wrong index.");
37 return m_start + (index + 0.5) * step;
43 throw std::runtime_error(
"FixedBinAxis::bin() -> Error. Wrong index.");
59 return int((value -
m_start) / step);
64 std::vector<double> result;
65 result.resize(
size(), 0.0);
66 for (
size_t i = 0; i <
size(); ++i) {
74 std::vector<double> result;
75 result.resize(
size() + 1, 0.0);
76 for (
size_t i = 0; i <
size(); ++i) {
86 throw std::runtime_error(
"FixedBinAxis::createClippedAxis() -> Error. "
87 "'left' should be smaller than 'right'");
102 ostr <<
"FixedBinAxis(\"" <<
getName() <<
"\", " <<
size() <<
", "
103 << std::setprecision(std::numeric_limits<double>::digits10 + 2) <<
lowerBound() <<
", "
112 if (
size() != otherAxis->size())
Defines and implements namespace algo with some algorithms.
Defines class FixedBinAxis.
Axis with fixed bin size.
FixedBinAxis * createClippedAxis(double left, double right) const
Creates a new clipped axis.
virtual bool equals(const IAxis &other) const
double operator[](size_t index) const
indexed accessor retrieves a sample
size_t findClosestIndex(double value) const
find bin index which is best match for given value
void print(std::ostream &ostr) const
std::vector< double > binBoundaries() const
Bin1D bin(size_t index) const
retrieve a 1d bin for the given index
FixedBinAxis * clone() const
clone function
double lowerBound() const
Returns value of first point of axis.
double upperBound() const
Returns value of last point of axis.
std::vector< double > binCenters() const
FixedBinAxis(const std::string &name, size_t nbins, double start, double end)
FixedBinAxis constructor.
size_t size() const
retrieve the number of bins
Interface for one-dimensional axes.
virtual bool equals(const IAxis &other) const
std::string getName() const
retrieve the label of the axis
QString const & name(EShape k)
bool almostEqual(double a, double b)
Returns true if two doubles agree within machine epsilon.
double m_upper
upper bound of the bin
double m_lower
lower bound of the bin