CMS 3D CMS Logo

Public Member Functions | Private Attributes

PeriodicBinFinderInZ< T > Class Template Reference

#include <PeriodicBinFinderInZ.h>

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

List of all members.

Public Member Functions

virtual int binIndex (T z) const
 returns an index in the valid range for the bin that contains Z
virtual int binIndex (int i) const
 returns an index in the valid range
virtual T binPosition (int ind) const
 the middle of the bin
 PeriodicBinFinderInZ ()
 PeriodicBinFinderInZ (std::vector< const GeomDet * >::const_iterator first, std::vector< const GeomDet * >::const_iterator last)

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]

Definition at line 16 of file PeriodicBinFinderInZ.h.

: theNbins(0), theZStep(0), theZOffset(0) {}
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.

                                                                     :
    theNbins( last-first) 
  {
    float zFirst = (**first).surface().position().z();
    theZStep = ((**(last-1)).surface().position().z() - zFirst) / (theNbins-1);
    theZOffset = zFirst - 0.5*theZStep;
  }

Member Function Documentation

template<class T>
virtual int PeriodicBinFinderInZ< T >::binIndex ( T  z) const [inline, virtual]

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().

                                   {
    return binIndex( int((z-theZOffset)/theZStep));
  }
template<class T>
virtual int PeriodicBinFinderInZ< T >::binIndex ( int  i) const [inline, virtual]

returns an index in the valid range

Implements BaseBinFinder< T >.

Definition at line 33 of file PeriodicBinFinderInZ.h.

                                     {
    return std::min( std::max( i, 0), theNbins-1);
  }
template<class T>
virtual T PeriodicBinFinderInZ< T >::binPosition ( int  ind) const [inline, virtual]

the middle of the bin

Implements BaseBinFinder< T >.

Definition at line 38 of file PeriodicBinFinderInZ.h.

Referenced by TOBRod::computeCrossings().

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

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]