CMS 3D CMS Logo

PeriodicBinFinderInPhi< T > Class Template Reference

Periodic Bin Finder around a circle for (almost) equidistant bins. More...

#include <Utilities/BinningTools/interface/PeriodicBinFinderInPhi.h>

Inheritance diagram for PeriodicBinFinderInPhi< T >:

BaseBinFinder< T >

List of all members.

Public Member Functions

virtual int binIndex (int i) const
 returns an index in the valid range, modulo Nbins
virtual int binIndex (T phi) const
 returns an index in the valid range for the bin that contains phi
virtual T binPosition (int ind) const
 the middle of the bin in radians
 PeriodicBinFinderInPhi (T firstPhi, int nbins)
 PeriodicBinFinderInPhi ()

Static Public Member Functions

static T pi ()
static T twoPi ()

Private Attributes

int theNbins
thePhiOffset
thePhiStep


Detailed Description

template<class T>
class PeriodicBinFinderInPhi< T >

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.


Constructor & Destructor Documentation

template<class T>
PeriodicBinFinderInPhi< T >::PeriodicBinFinderInPhi (  )  [inline]

Definition at line 16 of file PeriodicBinFinderInPhi.h.

00016 : theNbins(0), thePhiStep(0), thePhiOffset(0) {}

template<class T>
PeriodicBinFinderInPhi< T >::PeriodicBinFinderInPhi ( firstPhi,
int  nbins 
) [inline]

Definition at line 18 of file PeriodicBinFinderInPhi.h.

00018                                                  :
00019     theNbins( nbins), thePhiStep( twoPi() / nbins),
00020     thePhiOffset( firstPhi - thePhiStep/2.) {}


Member Function Documentation

template<class T>
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.

00030                                      {
00031     int ind = i % theNbins;
00032     return ind < 0 ? ind+theNbins : ind;
00033   }

template<class T>
virtual int PeriodicBinFinderInPhi< T >::binIndex ( 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(), TIDRing::computeCrossings(), PixelBarrelLayer::computeCrossings(), TIBRing::computeCrossings(), TOBLayer::computeCrossings(), TECLayer::computeCrossings(), PixelForwardLayer::computeCrossings(), MagGeometry::findVolume(), MagBLayer::findVolume(), and PixelForwardLayer::groupedCompatibleDetsV().

00023                                       {
00024     T tmp = fmod((phi - thePhiOffset), twoPi()) / thePhiStep;
00025     if ( tmp < 0) tmp += theNbins;
00026     return std::min( int(tmp), theNbins-1);
00027   }

template<class T>
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.

Referenced by PixelBarrelLayer::computeCrossings(), and TOBLayer::computeCrossings().

00036                                         {
00037     return thePhiOffset + thePhiStep * ( ind + 0.5);
00038   }

template<class T>
static T PeriodicBinFinderInPhi< T >::pi (  )  [inline, static]

Definition at line 40 of file PeriodicBinFinderInPhi.h.

Referenced by PeriodicBinFinderInPhi< float >::twoPi().

00040 { return 3.141592653589793238;}

template<class T>
static T PeriodicBinFinderInPhi< T >::twoPi (  )  [inline, static]

Definition at line 41 of file PeriodicBinFinderInPhi.h.

Referenced by PeriodicBinFinderInPhi< float >::binIndex().

00041 { return 2.*pi();}


Member Data Documentation

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

Definition at line 45 of file PeriodicBinFinderInPhi.h.

Referenced by PeriodicBinFinderInPhi< float >::binIndex().

template<class T>
T PeriodicBinFinderInPhi< T >::thePhiOffset [private]

Definition at line 47 of file PeriodicBinFinderInPhi.h.

Referenced by PeriodicBinFinderInPhi< float >::binIndex(), and PeriodicBinFinderInPhi< float >::binPosition().

template<class T>
T PeriodicBinFinderInPhi< T >::thePhiStep [private]

Definition at line 46 of file PeriodicBinFinderInPhi.h.

Referenced by PeriodicBinFinderInPhi< float >::binIndex(), and PeriodicBinFinderInPhi< float >::binPosition().


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