#include <PeriodicBinFinderInPhi.h>
Public Member Functions | |
virtual int | binIndex (T phi) const |
returns an index in the valid range for the bin that contains phi | |
virtual int | binIndex (int i) const |
returns an index in the valid range, modulo Nbins | |
virtual T | binPosition (int ind) const |
the middle of the bin in radians | |
PeriodicBinFinderInPhi () | |
PeriodicBinFinderInPhi (T firstPhi, int nbins) | |
Static Public Member Functions | |
static T | pi () |
static T | twoPi () |
Private Attributes | |
int | theNbins |
T | thePhiOffset |
T | thePhiStep |
Periodic Bin Finder around a circle for (almost) equidistant bins. Phi is the angle on the circle in radians.
Definition at line 13 of file PeriodicBinFinderInPhi.h.
PeriodicBinFinderInPhi< T >::PeriodicBinFinderInPhi | ( | ) | [inline] |
Definition at line 16 of file PeriodicBinFinderInPhi.h.
: theNbins(0), thePhiStep(0), thePhiOffset(0) {}
PeriodicBinFinderInPhi< T >::PeriodicBinFinderInPhi | ( | T | firstPhi, |
int | nbins | ||
) | [inline] |
Definition at line 18 of file PeriodicBinFinderInPhi.h.
: theNbins( nbins), thePhiStep( twoPi() / nbins), thePhiOffset( firstPhi - thePhiStep/2.) {}
virtual int PeriodicBinFinderInPhi< T >::binIndex | ( | T | phi | ) | const [inline, virtual] |
returns an index in the valid range for the bin that contains phi
Implements BaseBinFinder< T >.
Definition at line 23 of file PeriodicBinFinderInPhi.h.
Referenced by MuDetRing::compatibleDets(), TECLayer::computeCrossings(), MagGeometry::findVolume(), and MagBLayer::findVolume().
{ T tmp = fmod((phi - thePhiOffset), twoPi()) / thePhiStep; if ( tmp < 0) tmp += theNbins; return std::min( int(tmp), theNbins-1); }
virtual int PeriodicBinFinderInPhi< T >::binIndex | ( | int | i | ) | const [inline, virtual] |
returns an index in the valid range, modulo Nbins
Implements BaseBinFinder< T >.
Definition at line 30 of file PeriodicBinFinderInPhi.h.
virtual T PeriodicBinFinderInPhi< T >::binPosition | ( | int | ind | ) | const [inline, virtual] |
the middle of the bin in radians
Implements BaseBinFinder< T >.
Definition at line 36 of file PeriodicBinFinderInPhi.h.
{ return thePhiOffset + thePhiStep * ( ind + 0.5); }
static T PeriodicBinFinderInPhi< T >::pi | ( | ) | [inline, static] |
Definition at line 40 of file PeriodicBinFinderInPhi.h.
Referenced by PeriodicBinFinderInPhi< float >::twoPi().
{ return 3.141592653589793238;}
static T PeriodicBinFinderInPhi< T >::twoPi | ( | ) | [inline, static] |
Definition at line 41 of file PeriodicBinFinderInPhi.h.
Referenced by PeriodicBinFinderInPhi< float >::binIndex().
{ return 2.*pi();}
int PeriodicBinFinderInPhi< T >::theNbins [private] |
Definition at line 45 of file PeriodicBinFinderInPhi.h.
Referenced by PeriodicBinFinderInPhi< float >::binIndex().
T PeriodicBinFinderInPhi< T >::thePhiOffset [private] |
Definition at line 47 of file PeriodicBinFinderInPhi.h.
Referenced by PeriodicBinFinderInPhi< float >::binIndex(), and PeriodicBinFinderInPhi< float >::binPosition().
T PeriodicBinFinderInPhi< T >::thePhiStep [private] |
Definition at line 46 of file PeriodicBinFinderInPhi.h.
Referenced by PeriodicBinFinderInPhi< float >::binIndex(), and PeriodicBinFinderInPhi< float >::binPosition().