GeoModel - GeoModelCore
CellBinning.h
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef GEOMODELKERNEL_CELLBINNING_H
6 #define GEOMODELKERNEL_CELLBINNING_H
7 
20 {
21 
22  public:
23 
27  CellBinning (double startVal, double endVal, unsigned int nBins, unsigned int firstDivisionNumber = 0);
28 
29 
33  double binLower (unsigned int i) const;
34 
38  double binUpper (unsigned int i) const;
39 
43  double binCenter (unsigned int i) const;
44 
48  double getStart () const;
49 
53  double getEnd () const;
54 
58  unsigned int getNumDivisions () const;
59 
63  double getDelta () const;
64 
68  unsigned int getFirstDivisionNumber () const;
69 
70 
71  private:
72 
73  double m_start;
74  double m_end;
75  unsigned int m_numDivisions;
76  double m_delta;
77  unsigned int m_firstDivisionNumber;
78 };
79 
80 inline double CellBinning::binLower (unsigned int i) const
81 {
82  return m_start + (i-m_firstDivisionNumber)*m_delta;
83 }
84 
85 inline double CellBinning::binUpper (unsigned int i) const
86 {
87  return m_start + (i-m_firstDivisionNumber+1)*m_delta;
88 }
89 
90 inline double CellBinning::binCenter (unsigned int i) const
91 {
92  return m_start + (i-m_firstDivisionNumber+0.5)*m_delta;
93 }
94 
95 inline double CellBinning::getStart () const
96 {
97  return m_start;
98 }
99 
100 inline double CellBinning::getEnd () const
101 {
102  return m_end;
103 }
104 
105 inline unsigned int CellBinning::getNumDivisions () const
106 {
107  return m_numDivisions;
108 }
109 
110 inline double CellBinning::getDelta () const
111 {
112  return m_delta;
113 }
114 
115 inline unsigned int CellBinning::getFirstDivisionNumber () const
116 {
117  return m_firstDivisionNumber;
118 }
119 
120 #endif
unsigned int getFirstDivisionNumber() const
Number for the first division. Optional, default=0.
Definition: CellBinning.h:115
unsigned int getNumDivisions() const
Number of Bins.
Definition: CellBinning.h:105
CellBinning(double startVal, double endVal, unsigned int nBins, unsigned int firstDivisionNumber=0)
Constructor.
Definition: CellBinning.cxx:7
double getDelta() const
gets the bin width
Definition: CellBinning.h:110
double binUpper(unsigned int i) const
gets the ith bin upper edge
Definition: CellBinning.h:85
double getStart() const
Starting value.
Definition: CellBinning.h:95
A simple class to specify a range, and a number of bins. The binning is specified as one would specif...
Definition: CellBinning.h:19
double getEnd() const
Ending Value.
Definition: CellBinning.h:100
double binCenter(unsigned int i) const
gets the ith bin center
Definition: CellBinning.h:90
double binLower(unsigned int i) const
Gets the ith bin lower edge.
Definition: CellBinning.h:80