37 Axis(
int n,
double lo,
double up)
38 : lower(lo), upper(up), nbins(n) {}
44 : IAxis(a), lower(a.lower), upper(a.upper), nbins(a.nbins) {}
76 int bins()
const {
return nbins; }
87 return index < 0? -std::numeric_limits<double>::max():
88 lower + double(std::min(index, nbins))*binWidth(0);
100 return index >= nbins? std::numeric_limits<double>::max():
101 lower + double(std::max(index, -1) + 1)*binWidth(0);
112 return (upper - lower)/double(nbins);
125 if ( coord >= upper )
return OVERFLOW_BIN;
126 else if ( coord < lower )
return UNDERFLOW_BIN;
127 else return int((coord - lower)/binWidth(0));
135 return lower + (double(index) + 0.5)*binWidth(0);
double binWidth(int) const
Get the width of the specified bin.
double binUpperEdge(int index) const
Get the upper edge of the specified bin.
bool isFixedBinning() const
Check if the IAxis has fixed binning, i.e.
int coordToIndex(double coord) const
Convert a coordinate on the axis to a bin number.
double binMidPoint(int index) const
Return the midpoint of the specified bin.
double lower
The lower edge.
double upperEdge() const
Get the upper edge of the IAxis.
Axis(int n, double lo, double up)
Standard constructor.
int nbins
The number of bins.
virtual ~Axis()
Destructor.
double binLowerEdge(int index) const
Get the lower edge of the specified bin.
An Axis represents a binned histogram axis.
double lowerEdge() const
Get the lower edge of the IAxis.
int bins() const
The number of bins (excluding underflow and overflow) on the IAxis.
The LWH namespace contains a Light-Weight Histogram package which implements the most rudimentary his...
double upper
The upper edge.
Axis(const Axis &a)
Copy constructor.