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 upperEdge() const
Get the upper edge of the IAxis.
double lower
The lower edge.
double binMidPoint(int index) const
Return the midpoint of the specified bin.
int coordToIndex(double coord) const
Convert a coordinate on the axis to a bin number.
Axis(int n, double lo, double up)
Standard constructor.
double binWidth(int) const
Get the width of the specified bin.
double binLowerEdge(int index) const
Get the lower edge of the specified bin.
int bins() const
The number of bins (excluding underflow and overflow) on the IAxis.
int nbins
The number of bins.
virtual ~Axis()
Destructor.
double lowerEdge() const
Get the lower edge of the IAxis.
An Axis represents a binned histogram axis.
The LWH namespace contains a Light-Weight Histogram package which implements the most rudimentary his...
double upper
The upper edge.
bool isFixedBinning() const
Check if the IAxis has fixed binning, i.e.
Axis(const Axis &a)
Copy constructor.
double binUpperEdge(int index) const
Get the upper edge of the specified bin.