CMS 3D CMS Logo

PeriodicBinFinderInZ.h
Go to the documentation of this file.
1 #ifndef DetLayers_PeriodicBinFinderInZ_H
2 #define DetLayers_PeriodicBinFinderInZ_H
3 
6 #include <cmath>
7 
12 template <class T>
14 public:
16 
17  PeriodicBinFinderInZ(std::vector<const GeomDet*>::const_iterator first,
18  std::vector<const GeomDet*>::const_iterator last)
19  : theNbins(last - first) {
20  float zFirst = (**first).surface().position().z();
21  theZStep = ((**(last - 1)).surface().position().z() - zFirst) / (theNbins - 1);
22  theZOffset = zFirst - 0.5 * theZStep;
23  }
24 
26  int binIndex(T z) const override { return binIndex(int((z - theZOffset) / theZStep)); }
27 
29  int binIndex(int i) const override { return std::min(std::max(i, 0), theNbins - 1); }
30 
32  T binPosition(int ind) const override { return theZOffset + theZStep * (ind + 0.5); }
33 
34 private:
35  int theNbins;
38 };
39 #endif
mps_fire.i
i
Definition: mps_fire.py:428
min
T min(T a, T b)
Definition: MathUtil.h:58
PeriodicBinFinderInZ::binIndex
int binIndex(T z) const override
returns an index in the valid range for the bin that contains Z
Definition: PeriodicBinFinderInZ.h:26
dqmdumpme.first
first
Definition: dqmdumpme.py:55
dqmdumpme.last
last
Definition: dqmdumpme.py:56
DDAxes::z
PeriodicBinFinderInZ::PeriodicBinFinderInZ
PeriodicBinFinderInZ()
Definition: PeriodicBinFinderInZ.h:15
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
PeriodicBinFinderInZ::theNbins
int theNbins
Definition: PeriodicBinFinderInZ.h:35
BaseBinFinder.h
PeriodicBinFinderInZ::binPosition
T binPosition(int ind) const override
the middle of the bin
Definition: PeriodicBinFinderInZ.h:32
PeriodicBinFinderInZ::theZStep
T theZStep
Definition: PeriodicBinFinderInZ.h:36
GeomDet.h
T
long double T
Definition: Basic3DVectorLD.h:48
BaseBinFinder
Definition: BaseBinFinder.h:11
PeriodicBinFinderInZ::PeriodicBinFinderInZ
PeriodicBinFinderInZ(std::vector< const GeomDet * >::const_iterator first, std::vector< const GeomDet * >::const_iterator last)
Definition: PeriodicBinFinderInZ.h:17
PeriodicBinFinderInZ
Definition: PeriodicBinFinderInZ.h:13
PeriodicBinFinderInZ::theZOffset
T theZOffset
Definition: PeriodicBinFinderInZ.h:37
PeriodicBinFinderInZ::binIndex
int binIndex(int i) const override
returns an index in the valid range
Definition: PeriodicBinFinderInZ.h:29