YODA is hosted by Hepforge, IPPP Durham
YODA::Axis1D< BIN1D, DBN > Class Template Reference

1D bin container More...

#include <Axis1D.h>

Public Types

typedef BIN1D Bin
 Typedefs. More...
 
typedef std::vector< BinBins
 A vector containing 1D bins. Not used for searching. More...
 

Public Member Functions

Constructors
 Axis1D ()
 Empty constructor. More...
 
 Axis1D (const std::vector< double > &binedges)
 Constructor accepting a list of bin edges. More...
 
 Axis1D (const std::vector< BIN1D > &bins)
 Constructor accepting a vector of bins. More...
 
 Axis1D (size_t nbins, double lower, double upper)
 
 Axis1D (const Bins &bins, const DBN &dbn_tot, const DBN &dbn_uflow, const DBN &dbn_oflow)
 Constructor accepting a vector of bins. More...
 
Statistics accessor functions
size_t numBins () const
 Get the number of bins on the axis. More...
 
const Binsbins () const
 Return a vector of bins (const) More...
 
Binsbins ()
 Return a vector of bins (non-const) More...
 
double xMin () const
 Return the lowest-value bin edge on the axis. More...
 
double xMax () const
 Return the highest-value bin edge on the axis. More...
 
BIN1D & bin (size_t index)
 Return a bin at a given index (non-const) More...
 
const BIN1D & bin (size_t index) const
 Return a bin at a given index (const) More...
 
ssize_t binIndexAt (double coord) const
 Returns an index of a bin at a given coord, -1 if no bin matches. More...
 
BIN1D & binAt (double x)
 Return a bin at a given coordinate (non-const) More...
 
const BIN1D & binAt (double x) const
 Return a bin at a given coordinate (const) More...
 
const DBN & totalDbn () const
 Return the total distribution (const) More...
 
DBN & totalDbn ()
 Return the total distribution (non-const) More...
 
const DBN & underflow () const
 Return underflow (const) More...
 
DBN & underflow ()
 Return underflow (non-const) More...
 
const DBN & overflow () const
 Return overflow (const) More...
 
DBN & overflow ()
 Return overflow (non-const) More...
 
Modifiers and helpers
void reset ()
 Reset all the bin statistics on the axis. More...
 
void mergeBins (size_t from, size_t to)
 
void rebin (size_t n)
 Merge every group of n bins, starting from the LHS. More...
 
void addBin (double low, double high)
 Add a bin, providing its low and high edge. More...
 
void addBins (const std::vector< double > &binedges)
 Add a contiguous set of bins to an axis, via their list of edges. More...
 
void addBins (const std::vector< std::pair< double, double > > &binpairs)
 Add a list of bins as pairs of lowEdge, highEdge. More...
 
void addBins (const Bins &bins)
 
void eraseBin (const size_t i)
 Remove a bin. More...
 
void eraseBins (const size_t from, const size_t to)
 Remove a bin range. More...
 
void scaleX (double scalefactor)
 Scale the size of an axis by a factor. More...
 
void scaleW (double scalefactor)
 Scale the amount of fills by a factor. More...
 
Operators
bool operator== (const Axis1D &other) const
 Check if two of the Axis have the same binning. More...
 
bool operator!= (const Axis1D &other) const
 Check if the binning of two of the Axis is different. More...
 
Axis1D< BIN1D, DBN > & operator+= (const Axis1D< BIN1D, DBN > &toAdd)
 Add two axes together. More...
 
Axis1D< BIN1D, DBN > & operator-= (const Axis1D< BIN1D, DBN > &toSubtract)
 Subtract two axes. More...
 

Detailed Description

template<typename BIN1D, typename DBN>
class YODA::Axis1D< BIN1D, DBN >

1D bin container

This class handles most of the low-level operations on an axis of bins arranged in a 1D line (including gaps).

Definition at line 20 of file Axis1D.h.

Member Typedef Documentation

template<typename BIN1D, typename DBN>
typedef BIN1D YODA::Axis1D< BIN1D, DBN >::Bin

Typedefs.

Bin type

Definition at line 27 of file Axis1D.h.

template<typename BIN1D, typename DBN>
typedef std::vector<Bin> YODA::Axis1D< BIN1D, DBN >::Bins

A vector containing 1D bins. Not used for searching.

Definition at line 30 of file Axis1D.h.

Constructor & Destructor Documentation

template<typename BIN1D, typename DBN>
YODA::Axis1D< BIN1D, DBN >::Axis1D ( )
inline

Empty constructor.

Definition at line 38 of file Axis1D.h.

39  : _locked(false)
40  { }
template<typename BIN1D, typename DBN>
YODA::Axis1D< BIN1D, DBN >::Axis1D ( const std::vector< double > &  binedges)
inline

Constructor accepting a list of bin edges.

Definition at line 44 of file Axis1D.h.

References YODA::Axis1D< BIN1D, DBN >::addBins().

45  : _locked(false)
46  {
47  addBins(binedges);
48  }
void addBins(const std::vector< double > &binedges)
Add a contiguous set of bins to an axis, via their list of edges.
Definition: Axis1D.h:239
template<typename BIN1D, typename DBN>
YODA::Axis1D< BIN1D, DBN >::Axis1D ( const std::vector< BIN1D > &  bins)
inline

Constructor accepting a vector of bins.

Note that not only dimensions of these bins will be set, all the contents of the bins will be copied across, including the statistics

Definition at line 56 of file Axis1D.h.

References YODA::Axis1D< BIN1D, DBN >::addBins().

57  : _locked(false)
58  {
59  addBins(bins);
60  }
void addBins(const std::vector< double > &binedges)
Add a contiguous set of bins to an axis, via their list of edges.
Definition: Axis1D.h:239
template<typename BIN1D, typename DBN>
YODA::Axis1D< BIN1D, DBN >::Axis1D ( size_t  nbins,
double  lower,
double  upper 
)
inline

Constructor with the number of bins and the axis limits

Todo:
Rewrite interface to use a pair for the low/high

Definition at line 65 of file Axis1D.h.

References YODA::Axis1D< BIN1D, DBN >::addBins(), and YODA::linspace().

66  : _locked(false)
67  {
68  addBins(linspace(nbins, lower, upper));
69  }
std::vector< double > linspace(size_t nbins, double start, double end, bool include_end=true)
Make a list of nbins + 1 values equally spaced between start and end inclusive.
Definition: MathUtils.h:248
void addBins(const std::vector< double > &binedges)
Add a contiguous set of bins to an axis, via their list of edges.
Definition: Axis1D.h:239
template<typename BIN1D, typename DBN>
YODA::Axis1D< BIN1D, DBN >::Axis1D ( const Bins bins,
const DBN &  dbn_tot,
const DBN &  dbn_uflow,
const DBN &  dbn_oflow 
)
inline

Constructor accepting a vector of bins.

Note that not only dimensions of these bins will be set, all the contents of the bins will be copied across, including the statistics

Definition at line 77 of file Axis1D.h.

References YODA::Axis1D< BIN1D, DBN >::addBins().

78  : _dbn(dbn_tot), _underflow(dbn_uflow), _overflow(dbn_oflow), _locked(false)
79  {
80  addBins(bins);
81  }
void addBins(const std::vector< double > &binedges)
Add a contiguous set of bins to an axis, via their list of edges.
Definition: Axis1D.h:239
const Bins & bins() const
Return a vector of bins (const)
Definition: Axis1D.h:92

Member Function Documentation

template<typename BIN1D, typename DBN>
void YODA::Axis1D< BIN1D, DBN >::addBin ( double  low,
double  high 
)
inline

Add a bin, providing its low and high edge.

Definition at line 231 of file Axis1D.h.

231  {
232  Bins newBins(_bins);
233  newBins.push_back(Bin(low, high));
234  _updateAxis(newBins);
235  }
BIN1D Bin
Typedefs.
Definition: Axis1D.h:27
std::vector< Bin > Bins
A vector containing 1D bins. Not used for searching.
Definition: Axis1D.h:30
template<typename BIN1D, typename DBN>
void YODA::Axis1D< BIN1D, DBN >::addBins ( const std::vector< double > &  binedges)
inline

Add a contiguous set of bins to an axis, via their list of edges.

Definition at line 239 of file Axis1D.h.

Referenced by YODA::Axis1D< BIN1D, DBN >::Axis1D().

239  {
240  Bins newBins(_bins);
241  if (binedges.size() == 0)
242  return;
243 
244  double low = binedges.front();
245 
246  for (size_t i = 1; i < binedges.size(); i++) {
247  double high = binedges[i];
248  newBins.push_back(Bin(low, high));
249  low = high;
250  }
251 
252  _updateAxis(newBins);
253  }
BIN1D Bin
Typedefs.
Definition: Axis1D.h:27
std::vector< Bin > Bins
A vector containing 1D bins. Not used for searching.
Definition: Axis1D.h:30
template<typename BIN1D, typename DBN>
void YODA::Axis1D< BIN1D, DBN >::addBins ( const std::vector< std::pair< double, double > > &  binpairs)
inline

Add a list of bins as pairs of lowEdge, highEdge.

Definition at line 261 of file Axis1D.h.

261  {
262  // Make a copy of the current binning
263  Bins newBins(_bins);
264 
265  // Iterate over given bins
266  for (size_t i = 0; i < binpairs.size(); i++) {
267  std::pair<double, double> b = binpairs[i];
268  newBins.push_back(Bin(b.first, b.second));
269  }
270  _updateAxis(newBins);
271  }
BIN1D Bin
Typedefs.
Definition: Axis1D.h:27
std::vector< Bin > Bins
A vector containing 1D bins. Not used for searching.
Definition: Axis1D.h:30
template<typename BIN1D, typename DBN>
void YODA::Axis1D< BIN1D, DBN >::addBins ( const Bins bins)
inline

Definition at line 274 of file Axis1D.h.

274  {
275  Bins newBins(_bins);
276  BOOST_FOREACH(const Bin& b, bins) newBins.push_back(b);
277  _updateAxis(newBins);
278  }
BIN1D Bin
Typedefs.
Definition: Axis1D.h:27
const Bins & bins() const
Return a vector of bins (const)
Definition: Axis1D.h:92
std::vector< Bin > Bins
A vector containing 1D bins. Not used for searching.
Definition: Axis1D.h:30
template<typename BIN1D, typename DBN>
BIN1D& YODA::Axis1D< BIN1D, DBN >::bin ( size_t  index)
inline

Return a bin at a given index (non-const)

Definition at line 114 of file Axis1D.h.

References YODA::Axis1D< BIN1D, DBN >::numBins().

Referenced by YODA::Axis1D< BIN1D, DBN >::binAt(), YODA::Axis1D< BIN1D, DBN >::mergeBins(), YODA::Axis1D< BIN1D, DBN >::operator==(), and YODA::Axis1D< BIN1D, DBN >::reset().

114  {
115  if (index >= numBins()) throw RangeError("YODA::Histo1D: index out of range!");
116  return _bins[index];
117  }
size_t numBins() const
Get the number of bins on the axis.
Definition: Axis1D.h:87
template<typename BIN1D, typename DBN>
const BIN1D& YODA::Axis1D< BIN1D, DBN >::bin ( size_t  index) const
inline

Return a bin at a given index (const)

Definition at line 120 of file Axis1D.h.

References YODA::Axis1D< BIN1D, DBN >::numBins().

120  {
121  if (index >= numBins()) throw RangeError("YODA::Histo1D: index out of range!");
122  return _bins[index];
123  }
size_t numBins() const
Get the number of bins on the axis.
Definition: Axis1D.h:87
template<typename BIN1D, typename DBN>
BIN1D& YODA::Axis1D< BIN1D, DBN >::binAt ( double  x)
inline

Return a bin at a given coordinate (non-const)

Definition at line 132 of file Axis1D.h.

References YODA::Axis1D< BIN1D, DBN >::bin(), and YODA::Axis1D< BIN1D, DBN >::binIndexAt().

132  {
133  const ssize_t index = binIndexAt(x);
134  if (index == -1) throw RangeError("There is no bin at the specified x");
135  return bin(index);
136  }
BIN1D & bin(size_t index)
Return a bin at a given index (non-const)
Definition: Axis1D.h:114
ssize_t binIndexAt(double coord) const
Returns an index of a bin at a given coord, -1 if no bin matches.
Definition: Axis1D.h:126
template<typename BIN1D, typename DBN>
const BIN1D& YODA::Axis1D< BIN1D, DBN >::binAt ( double  x) const
inline

Return a bin at a given coordinate (const)

Definition at line 139 of file Axis1D.h.

References YODA::Axis1D< BIN1D, DBN >::bin(), and YODA::Axis1D< BIN1D, DBN >::binIndexAt().

139  {
140  const ssize_t index = binIndexAt(x);
141  if (index == -1) throw RangeError("There is no bin at the specified x");
142  return bin(index);
143  }
BIN1D & bin(size_t index)
Return a bin at a given index (non-const)
Definition: Axis1D.h:114
ssize_t binIndexAt(double coord) const
Returns an index of a bin at a given coord, -1 if no bin matches.
Definition: Axis1D.h:126
template<typename BIN1D, typename DBN>
ssize_t YODA::Axis1D< BIN1D, DBN >::binIndexAt ( double  coord) const
inline

Returns an index of a bin at a given coord, -1 if no bin matches.

Definition at line 126 of file Axis1D.h.

Referenced by YODA::Axis1D< BIN1D, DBN >::binAt().

126  {
127  // Yes, this is robust even with an empty axis: there's always at least one outflow
128  return _indexes[_binsearcher.index(coord)];
129  }
template<typename BIN1D, typename DBN>
const Bins& YODA::Axis1D< BIN1D, DBN >::bins ( ) const
inline
template<typename BIN1D, typename DBN>
Bins& YODA::Axis1D< BIN1D, DBN >::bins ( )
inline

Return a vector of bins (non-const)

Definition at line 97 of file Axis1D.h.

97  {
98  return _bins;
99  }
template<typename BIN1D, typename DBN>
void YODA::Axis1D< BIN1D, DBN >::eraseBin ( const size_t  i)
inline

Remove a bin.

Definition at line 281 of file Axis1D.h.

References YODA::Axis1D< BIN1D, DBN >::numBins().

281  {
282  // Might as well erase from the internal bins, as we can guarantee
283  // consistency.
284  if (i >= numBins())
285  throw RangeError("Bin index is out of range");
286 
287  const bool wasLocked = _locked;
288  _locked = false;
289  _bins.erase(_bins.begin() + i);
290  _updateAxis(_bins);
291  _locked = wasLocked;
292  }
size_t numBins() const
Get the number of bins on the axis.
Definition: Axis1D.h:87
template<typename BIN1D, typename DBN>
void YODA::Axis1D< BIN1D, DBN >::eraseBins ( const size_t  from,
const size_t  to 
)
inline

Remove a bin range.

Definition at line 295 of file Axis1D.h.

References YODA::Axis1D< BIN1D, DBN >::numBins().

Referenced by YODA::Axis1D< BIN1D, DBN >::mergeBins().

295  {
296  if (from >= numBins())
297  throw RangeError("Initial index out of range");
298  if (to >= numBins())
299  throw RangeError("Final index out of range");
300  if (from > to)
301  throw RangeError("Final index is less than initial index");
302 
303  const bool wasLocked = _locked;
304  _locked = false;
305  _bins.erase(_bins.begin() + from, _bins.begin() + to + 1);
306  _updateAxis(_bins);
307  _locked = wasLocked;
308  }
size_t numBins() const
Get the number of bins on the axis.
Definition: Axis1D.h:87
template<typename BIN1D, typename DBN>
void YODA::Axis1D< BIN1D, DBN >::mergeBins ( size_t  from,
size_t  to 
)
inline

Merge together the bin range with indices from from to to, inclusive. Merge a series of bins, between the bins identified by indices from and to

Definition at line 201 of file Axis1D.h.

References YODA::Axis1D< BIN1D, DBN >::bin(), YODA::Axis1D< BIN1D, DBN >::eraseBins(), and YODA::Axis1D< BIN1D, DBN >::numBins().

Referenced by YODA::Axis1D< BIN1D, DBN >::rebin().

201  {
202  // Correctness checking
203  if (from >= numBins())
204  throw RangeError("Initial merge index is out of range");
205  if (to >= numBins())
206  throw RangeError("Final merge index is out of range");
207  if (from > to)
208  throw RangeError("Final bin must be greater than initial bin");
209  if (_gapInRange(from, to))
210  throw RangeError("Bin ranges containing gaps cannot be merged");
211 
212  Bin& b = bin(from);
213  for (size_t i = from + 1; i <= to; i++)
214  b.merge(_bins[i]);
215  eraseBins(from+1, to);
216  }
BIN1D Bin
Typedefs.
Definition: Axis1D.h:27
size_t numBins() const
Get the number of bins on the axis.
Definition: Axis1D.h:87
void eraseBins(const size_t from, const size_t to)
Remove a bin range.
Definition: Axis1D.h:295
BIN1D & bin(size_t index)
Return a bin at a given index (non-const)
Definition: Axis1D.h:114
template<typename BIN1D, typename DBN>
size_t YODA::Axis1D< BIN1D, DBN >::numBins ( ) const
inline
template<typename BIN1D, typename DBN>
bool YODA::Axis1D< BIN1D, DBN >::operator!= ( const Axis1D< BIN1D, DBN > &  other) const
inline

Check if the binning of two of the Axis is different.

Definition at line 349 of file Axis1D.h.

References YODA::Axis1D< BIN1D, DBN >::operator==().

349  {
350  return ! operator == (other);
351  }
bool operator==(const Axis1D &other) const
Check if two of the Axis have the same binning.
Definition: Axis1D.h:336
template<typename BIN1D, typename DBN>
Axis1D<BIN1D,DBN>& YODA::Axis1D< BIN1D, DBN >::operator+= ( const Axis1D< BIN1D, DBN > &  toAdd)
inline

Add two axes together.

Definition at line 355 of file Axis1D.h.

References YODA::Axis1D< BIN1D, DBN >::bins().

355  {
356  if (*this != toAdd) throw LogicError("YODA::Histo1D: Cannot add axes with different binnings.");
357 
358  for (size_t i = 0; i < _bins.size(); ++i) {
359  _bins[i] += toAdd.bins().at(i);
360  }
361 
362  _dbn += toAdd._dbn;
363  _underflow += toAdd._underflow;
364  _overflow += toAdd._overflow;
365  return *this;
366  }
template<typename BIN1D, typename DBN>
Axis1D<BIN1D,DBN>& YODA::Axis1D< BIN1D, DBN >::operator-= ( const Axis1D< BIN1D, DBN > &  toSubtract)
inline

Subtract two axes.

Definition at line 370 of file Axis1D.h.

References YODA::Axis1D< BIN1D, DBN >::bins().

370  {
371  if (*this != toSubtract) throw LogicError("YODA::Histo1D: Cannot add axes with different binnings.");
372 
373  for (size_t i = 0; i < _bins.size(); ++i) {
374  _bins[i] -= toSubtract.bins().at(i);
375  }
376 
377  _dbn -= toSubtract._dbn;
378  _underflow -= toSubtract._underflow;
379  _overflow -= toSubtract._overflow;
380  return *this;
381  }
template<typename BIN1D, typename DBN>
bool YODA::Axis1D< BIN1D, DBN >::operator== ( const Axis1D< BIN1D, DBN > &  other) const
inline

Check if two of the Axis have the same binning.

Definition at line 336 of file Axis1D.h.

References YODA::Axis1D< BIN1D, DBN >::bin(), YODA::fuzzyEquals(), YODA::Axis1D< BIN1D, DBN >::numBins(), and YODA::Axis1D< BIN1D, DBN >::xMin().

Referenced by YODA::Axis1D< BIN1D, DBN >::operator!=().

336  {
337  if (numBins() != other.numBins())
338  return false;
339  for (size_t i = 0; i < numBins(); i++)
340  if (!(fuzzyEquals(bin(i).xMin(), other.bin(i).xMin()) &&
341  fuzzyEquals(bin(i).xMax(), other.bin(i).xMax())))
342  return false;
343 
344  return true;
345  }
size_t numBins() const
Get the number of bins on the axis.
Definition: Axis1D.h:87
bool fuzzyEquals(double a, double b, double tolerance=1E-5)
Compare two floating point numbers for equality with a degree of fuzziness.
Definition: MathUtils.h:68
BIN1D & bin(size_t index)
Return a bin at a given index (non-const)
Definition: Axis1D.h:114
double xMin() const
Return the lowest-value bin edge on the axis.
Definition: Axis1D.h:102
template<typename BIN1D, typename DBN>
const DBN& YODA::Axis1D< BIN1D, DBN >::overflow ( ) const
inline

Return overflow (const)

Definition at line 167 of file Axis1D.h.

167  {
168  return _overflow;
169  }
template<typename BIN1D, typename DBN>
DBN& YODA::Axis1D< BIN1D, DBN >::overflow ( )
inline

Return overflow (non-const)

Definition at line 172 of file Axis1D.h.

172  {
173  return _overflow;
174  }
template<typename BIN1D, typename DBN>
void YODA::Axis1D< BIN1D, DBN >::rebin ( size_t  n)
inline

Merge every group of n bins, starting from the LHS.

If the number of bins is not a multiple of n, the last m < n bins on the RHS will also be merged, as the closest possible approach to factor
rebinning everywhere.

Definition at line 223 of file Axis1D.h.

References YODA::Axis1D< BIN1D, DBN >::mergeBins(), and YODA::Axis1D< BIN1D, DBN >::numBins().

223  {
224  for (size_t m = 0; m < numBins(); m++) {
225  const size_t end = (m + n - 1 < numBins()) ? m + n -1 : numBins() - 1;
226  if (end > m) mergeBins(m, end);
227  }
228  }
size_t numBins() const
Get the number of bins on the axis.
Definition: Axis1D.h:87
void mergeBins(size_t from, size_t to)
Definition: Axis1D.h:201
template<typename BIN1D, typename DBN>
void YODA::Axis1D< BIN1D, DBN >::reset ( )
inline

Reset all the bin statistics on the axis.

Definition at line 184 of file Axis1D.h.

References YODA::Axis1D< BIN1D, DBN >::bin().

184  {
185  _dbn.reset();
186  _underflow.reset();
187  _overflow.reset();
188  BOOST_FOREACH(Bin& bin, _bins) bin.reset();
189  _locked = false;
190  }
BIN1D Bin
Typedefs.
Definition: Axis1D.h:27
BIN1D & bin(size_t index)
Return a bin at a given index (non-const)
Definition: Axis1D.h:114
void reset()
Reset all the bin statistics on the axis.
Definition: Axis1D.h:184
template<typename BIN1D, typename DBN>
void YODA::Axis1D< BIN1D, DBN >::scaleW ( double  scalefactor)
inline

Scale the amount of fills by a factor.

Definition at line 322 of file Axis1D.h.

322  {
323  _dbn.scaleW(scalefactor);
324  _underflow.scaleW(scalefactor);
325  _overflow.scaleW(scalefactor);
326  for (size_t i = 0; i < _bins.size(); ++i) _bins[i].scaleW(scalefactor);
327  }
void scaleW(double scalefactor)
Scale the amount of fills by a factor.
Definition: Axis1D.h:322
template<typename BIN1D, typename DBN>
void YODA::Axis1D< BIN1D, DBN >::scaleX ( double  scalefactor)
inline

Scale the size of an axis by a factor.

Definition at line 312 of file Axis1D.h.

312  {
313  _dbn.scaleX(scalefactor);
314  _underflow.scaleX(scalefactor);
315  _overflow.scaleX(scalefactor);
316  for (size_t i = 0; i < _bins.size(); ++i)
317  _bins[i].scaleX(scalefactor);
318  _updateAxis(_bins);
319  }
void scaleX(double scalefactor)
Scale the size of an axis by a factor.
Definition: Axis1D.h:312
template<typename BIN1D, typename DBN>
const DBN& YODA::Axis1D< BIN1D, DBN >::totalDbn ( ) const
inline

Return the total distribution (const)

Definition at line 147 of file Axis1D.h.

147  {
148  return _dbn;
149  }
template<typename BIN1D, typename DBN>
DBN& YODA::Axis1D< BIN1D, DBN >::totalDbn ( )
inline

Return the total distribution (non-const)

Definition at line 152 of file Axis1D.h.

152  {
153  return _dbn;
154  }
template<typename BIN1D, typename DBN>
const DBN& YODA::Axis1D< BIN1D, DBN >::underflow ( ) const
inline

Return underflow (const)

Definition at line 157 of file Axis1D.h.

157  {
158  return _underflow;
159  }
template<typename BIN1D, typename DBN>
DBN& YODA::Axis1D< BIN1D, DBN >::underflow ( )
inline

Return underflow (non-const)

Definition at line 162 of file Axis1D.h.

162  {
163  return _underflow;
164  }
template<typename BIN1D, typename DBN>
double YODA::Axis1D< BIN1D, DBN >::xMax ( ) const
inline

Return the highest-value bin edge on the axis.

Definition at line 108 of file Axis1D.h.

References YODA::Axis1D< BIN1D, DBN >::bins(), and YODA::Axis1D< BIN1D, DBN >::numBins().

108  {
109  if (numBins() == 0) throw RangeError("This axis contains no bins and so has no defined range");
110  return bins().back().xMax();
111  }
size_t numBins() const
Get the number of bins on the axis.
Definition: Axis1D.h:87
const Bins & bins() const
Return a vector of bins (const)
Definition: Axis1D.h:92
template<typename BIN1D, typename DBN>
double YODA::Axis1D< BIN1D, DBN >::xMin ( ) const
inline

Return the lowest-value bin edge on the axis.

Definition at line 102 of file Axis1D.h.

References YODA::Axis1D< BIN1D, DBN >::bins(), and YODA::Axis1D< BIN1D, DBN >::numBins().

Referenced by YODA::Axis1D< BIN1D, DBN >::operator==().

102  {
103  if (numBins() == 0) throw RangeError("This axis contains no bins and so has no defined range");
104  return bins().front().xMin();
105  }
size_t numBins() const
Get the number of bins on the axis.
Definition: Axis1D.h:87
const Bins & bins() const
Return a vector of bins (const)
Definition: Axis1D.h:92

The documentation for this class was generated from the following file: