CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PeriodicBinFinderInZ< T > Class Template Reference

#include <PeriodicBinFinderInZ.h>

Inheritance diagram for PeriodicBinFinderInZ< T >:
BaseBinFinder< T >

Public Member Functions

int binIndex (int i) const override
 returns an index in the valid range More...
 
int binIndex (T z) const override
 returns an index in the valid range for the bin that contains Z More...
 
T binPosition (int ind) const override
 the middle of the bin More...
 
 PeriodicBinFinderInZ ()
 
 PeriodicBinFinderInZ (std::vector< const GeomDet * >::const_iterator first, std::vector< const GeomDet * >::const_iterator last)
 
- Public Member Functions inherited from BaseBinFinder< T >
 BaseBinFinder ()
 
virtual ~BaseBinFinder ()
 

Private Attributes

int theNbins
 
T theZOffset
 
T theZStep
 

Detailed Description

template<class T>
class PeriodicBinFinderInZ< T >

Bin finder along the global Z for (almost) equidistant bins. The bins are computed from GeomDet positions.

Definition at line 13 of file PeriodicBinFinderInZ.h.

Constructor & Destructor Documentation

◆ PeriodicBinFinderInZ() [1/2]

template<class T>
PeriodicBinFinderInZ< T >::PeriodicBinFinderInZ ( )
inline

Definition at line 15 of file PeriodicBinFinderInZ.h.

15 : theNbins(0), theZStep(0), theZOffset(0) {}

◆ PeriodicBinFinderInZ() [2/2]

template<class T>
PeriodicBinFinderInZ< T >::PeriodicBinFinderInZ ( std::vector< const GeomDet * >::const_iterator  first,
std::vector< const GeomDet * >::const_iterator  last 
)
inline

Definition at line 17 of file PeriodicBinFinderInZ.h.

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  }

Member Function Documentation

◆ binIndex() [1/2]

template<class T>
int PeriodicBinFinderInZ< T >::binIndex ( int  i) const
inlineoverridevirtual

returns an index in the valid range

Implements BaseBinFinder< T >.

Definition at line 29 of file PeriodicBinFinderInZ.h.

29 { return std::min(std::max(i, 0), theNbins - 1); }

◆ binIndex() [2/2]

template<class T>
int PeriodicBinFinderInZ< T >::binIndex ( T  z) const
inlineoverridevirtual

returns an index in the valid range for the bin that contains Z

Implements BaseBinFinder< T >.

Definition at line 26 of file PeriodicBinFinderInZ.h.

26 { return binIndex(int((z - theZOffset) / theZStep)); }

Referenced by PeriodicBinFinderInZ< float >::binIndex(), PixelRod::compatibleDetsV(), and TOBRod::computeCrossings().

◆ binPosition()

template<class T>
T PeriodicBinFinderInZ< T >::binPosition ( int  ind) const
inlineoverridevirtual

the middle of the bin

Implements BaseBinFinder< T >.

Definition at line 32 of file PeriodicBinFinderInZ.h.

32 { return theZOffset + theZStep * (ind + 0.5); }

Referenced by TOBRod::computeCrossings().

Member Data Documentation

◆ theNbins

template<class T>
int PeriodicBinFinderInZ< T >::theNbins
private

◆ theZOffset

template<class T>
T PeriodicBinFinderInZ< T >::theZOffset
private

◆ theZStep

template<class T>
T PeriodicBinFinderInZ< T >::theZStep
private
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
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
PeriodicBinFinderInZ::theNbins
int theNbins
Definition: PeriodicBinFinderInZ.h:35
PeriodicBinFinderInZ::theZStep
T theZStep
Definition: PeriodicBinFinderInZ.h:36
PeriodicBinFinderInZ::theZOffset
T theZOffset
Definition: PeriodicBinFinderInZ.h:37