CMS 3D CMS Logo

PeriodicBinFinderInZ< T > Class Template Reference

Bin finder along the global Z for (almost) equidistant bins. More...

#include <TrackingTools/DetLayers/interface/PeriodicBinFinderInZ.h>

Inheritance diagram for PeriodicBinFinderInZ< T >:

BaseBinFinder< T >

List of all members.

Public Member Functions

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

Private Attributes

int theNbins
theZOffset
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.

00016 : 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.

References PeriodicBinFinderInZ< T >::theNbins, PeriodicBinFinderInZ< T >::theZOffset, and PeriodicBinFinderInZ< T >::theZStep.

00019                                                                      :
00020     theNbins( last-first) 
00021   {
00022     float zFirst = (**first).surface().position().z();
00023     theZStep = ((**(last-1)).surface().position().z() - zFirst) / (theNbins-1);
00024     theZOffset = zFirst - 0.5*theZStep;
00025   }


Member Function Documentation

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.

References max, min, and PeriodicBinFinderInZ< T >::theNbins.

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

template<class T>
virtual int PeriodicBinFinderInZ< T >::binIndex ( 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.

References PeriodicBinFinderInZ< T >::theZOffset, and PeriodicBinFinderInZ< T >::theZStep.

Referenced by PixelRod::compatibleDetsV().

00028                                    {
00029     return binIndex( int((z-theZOffset)/theZStep));
00030   }

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.

References PeriodicBinFinderInZ< T >::theZOffset, and PeriodicBinFinderInZ< T >::theZStep.

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


Member Data Documentation

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

Definition at line 44 of file PeriodicBinFinderInZ.h.

Referenced by PeriodicBinFinderInZ< T >::binIndex(), and PeriodicBinFinderInZ< T >::PeriodicBinFinderInZ().

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

Definition at line 46 of file PeriodicBinFinderInZ.h.

Referenced by PeriodicBinFinderInZ< T >::binIndex(), PeriodicBinFinderInZ< T >::binPosition(), and PeriodicBinFinderInZ< T >::PeriodicBinFinderInZ().

template<class T>
T PeriodicBinFinderInZ< T >::theZStep [private]

Definition at line 45 of file PeriodicBinFinderInZ.h.

Referenced by PeriodicBinFinderInZ< T >::binIndex(), PeriodicBinFinderInZ< T >::binPosition(), and PeriodicBinFinderInZ< T >::PeriodicBinFinderInZ().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:29:38 2009 for CMSSW by  doxygen 1.5.4