#include <GeneralBinFinderInZforGeometricSearchDet.h>
Public Member Functions | |
virtual int | binIndex (T z) const |
returns an index in the valid range for the bin closest to 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. | |
GeneralBinFinderInZforGeometricSearchDet () | |
GeneralBinFinderInZforGeometricSearchDet (std::vector< const GeometricSearchDet * >::const_iterator first, std::vector< const GeometricSearchDet * >::const_iterator last) | |
Static Public Member Functions | |
static double | pi () |
static double | twoPi () |
Private Attributes | |
std::vector< T > | theBins |
std::vector< float > | theBorders |
int | theNbins |
T | theZOffset |
T | theZStep |
Definition at line 13 of file GeneralBinFinderInZforGeometricSearchDet.h.
GeneralBinFinderInZforGeometricSearchDet< T >::GeneralBinFinderInZforGeometricSearchDet | ( | ) | [inline] |
Definition at line 16 of file GeneralBinFinderInZforGeometricSearchDet.h.
: theNbins(0), theZStep(0), theZOffset(0) {}
GeneralBinFinderInZforGeometricSearchDet< T >::GeneralBinFinderInZforGeometricSearchDet | ( | std::vector< const GeometricSearchDet * >::const_iterator | first, |
std::vector< const GeometricSearchDet * >::const_iterator | last | ||
) | [inline] |
Definition at line 18 of file GeneralBinFinderInZforGeometricSearchDet.h.
: theNbins( last-first) { theBins.reserve(theNbins); for (std::vector<const GeometricSearchDet*>::const_iterator i=first; i<last-1; i++) { theBins.push_back((**i).position().z()); theBorders.push_back(((**i).position().z() + (**(i+1)).position().z()) / 2.); } theZOffset = theBorders.front(); theZStep = (theBorders.back() - theBorders.front()) / (theNbins-2); }
virtual int GeneralBinFinderInZforGeometricSearchDet< T >::binIndex | ( | T | z | ) | const [inline, virtual] |
returns an index in the valid range for the bin closest to Z
Implements BaseBinFinder< T >.
Definition at line 35 of file GeneralBinFinderInZforGeometricSearchDet.h.
Referenced by GeneralBinFinderInZforGeometricSearchDet< float >::binIndex(), and GeneralBinFinderInZforGeometricSearchDet< float >::binPosition().
{ int bin = binIndex( int((z-theZOffset)/theZStep)+1); // check left border if (bin > 0) { if ( z < theBorders[bin-1]) { // z is to the left of the left border, the correct bin is left for (int i=bin-1; ; i--) { if (i <= 0) return 0; if ( z > theBorders[i-1]) return i; } } } else return 0; // check right border if (bin < theNbins-1) { if ( z > theBorders[bin]) { // z is to the right of the right border, the correct bin is right for (int i=bin+1; ; i++) { if (i >= theNbins-1) return theNbins-1; if ( z < theBorders[i]) return i; } } } else return theNbins-1; // if we arrive here it means that the bin is ok return bin; }
virtual int GeneralBinFinderInZforGeometricSearchDet< T >::binIndex | ( | int | i | ) | const [inline, virtual] |
returns an index in the valid range
Implements BaseBinFinder< T >.
Definition at line 67 of file GeneralBinFinderInZforGeometricSearchDet.h.
virtual T GeneralBinFinderInZforGeometricSearchDet< T >::binPosition | ( | int | ind | ) | const [inline, virtual] |
the middle of the bin.
Implements BaseBinFinder< T >.
Definition at line 72 of file GeneralBinFinderInZforGeometricSearchDet.h.
static double GeneralBinFinderInZforGeometricSearchDet< T >::pi | ( | ) | [inline, static] |
Definition at line 76 of file GeneralBinFinderInZforGeometricSearchDet.h.
Referenced by GeneralBinFinderInZforGeometricSearchDet< float >::twoPi().
{ return 3.141592653589793238;}
static double GeneralBinFinderInZforGeometricSearchDet< T >::twoPi | ( | ) | [inline, static] |
Definition at line 77 of file GeneralBinFinderInZforGeometricSearchDet.h.
{ return 2.*pi();}
std::vector<T> GeneralBinFinderInZforGeometricSearchDet< T >::theBins [private] |
Definition at line 85 of file GeneralBinFinderInZforGeometricSearchDet.h.
Referenced by GeneralBinFinderInZforGeometricSearchDet< float >::binPosition(), and GeneralBinFinderInZforGeometricSearchDet< float >::GeneralBinFinderInZforGeometricSearchDet().
std::vector<float> GeneralBinFinderInZforGeometricSearchDet< T >::theBorders [private] |
Definition at line 84 of file GeneralBinFinderInZforGeometricSearchDet.h.
Referenced by GeneralBinFinderInZforGeometricSearchDet< float >::binIndex(), and GeneralBinFinderInZforGeometricSearchDet< float >::GeneralBinFinderInZforGeometricSearchDet().
int GeneralBinFinderInZforGeometricSearchDet< T >::theNbins [private] |
Definition at line 81 of file GeneralBinFinderInZforGeometricSearchDet.h.
Referenced by GeneralBinFinderInZforGeometricSearchDet< float >::binIndex(), and GeneralBinFinderInZforGeometricSearchDet< float >::GeneralBinFinderInZforGeometricSearchDet().
T GeneralBinFinderInZforGeometricSearchDet< T >::theZOffset [private] |
Definition at line 83 of file GeneralBinFinderInZforGeometricSearchDet.h.
Referenced by GeneralBinFinderInZforGeometricSearchDet< float >::binIndex(), and GeneralBinFinderInZforGeometricSearchDet< float >::GeneralBinFinderInZforGeometricSearchDet().
T GeneralBinFinderInZforGeometricSearchDet< T >::theZStep [private] |
Definition at line 82 of file GeneralBinFinderInZforGeometricSearchDet.h.
Referenced by GeneralBinFinderInZforGeometricSearchDet< float >::binIndex(), and GeneralBinFinderInZforGeometricSearchDet< float >::GeneralBinFinderInZforGeometricSearchDet().