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

virtual int binIndex (T z) const
 returns an index in the valid range for the bin that contains Z More...
 
virtual int binIndex (int i) const
 returns an index in the valid range More...
 
virtual T binPosition (int ind) const
 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

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

Definition at line 18 of file PeriodicBinFinderInZ.h.

19  :
21  {
22  float zFirst = (**first).surface().position().z();
23  theZStep = ((**(last-1)).surface().position().z() - zFirst) / (theNbins-1);
24  theZOffset = zFirst - 0.5*theZStep;
25  }

Member Function Documentation

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

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

Implements BaseBinFinder< T >.

Definition at line 28 of file PeriodicBinFinderInZ.h.

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

28  {
29  return binIndex( int((z-theZOffset)/theZStep));
30  }
virtual int binIndex(T z) const
returns an index in the valid range for the bin that contains Z
template<class T>
virtual int PeriodicBinFinderInZ< T >::binIndex ( int  i) const
inlinevirtual

returns an index in the valid range

Implements BaseBinFinder< T >.

Definition at line 33 of file PeriodicBinFinderInZ.h.

33  {
34  return std::min( std::max( i, 0), theNbins-1);
35  }
T min(T a, T b)
Definition: MathUtil.h:58
template<class T>
virtual T PeriodicBinFinderInZ< T >::binPosition ( int  ind) const
inlinevirtual

the middle of the bin

Implements BaseBinFinder< T >.

Definition at line 38 of file PeriodicBinFinderInZ.h.

Referenced by TOBRod::computeCrossings().

38  {
39  return theZOffset + theZStep * ( ind + 0.5);
40  }

Member Data Documentation

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