CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
PeriodicBinFinderInPhi< T > Class Template Reference

#include <MagBLayer.h>

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

Public Member Functions

virtual int binIndex (T phi) const
 returns an index in the valid range for the bin that contains phi More...
 
virtual int binIndex (int i) const
 returns an index in the valid range, modulo Nbins More...
 
virtual T binPosition (int ind) const
 the middle of the bin in radians More...
 
 PeriodicBinFinderInPhi ()
 
 PeriodicBinFinderInPhi (T firstPhi, int nbins)
 
- Public Member Functions inherited from BaseBinFinder< T >
 BaseBinFinder ()
 
virtual ~BaseBinFinder ()
 

Static Public Member Functions

static T pi ()
 
static T twoPi ()
 

Private Attributes

int theNbins
 
T thePhiOffset
 
T 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 23 of file MagBLayer.h.

Constructor & Destructor Documentation

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

Member Function Documentation

template<class T>
virtual int PeriodicBinFinderInPhi< T >::binIndex ( T  phi) const
inlinevirtual

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(), MagBLayer::findVolume(), MagGeometry::findVolume(), and TECLayer::searchNeighbors().

23  {
24  T tmp = fmod((phi - thePhiOffset), twoPi()) / thePhiStep;
25  if ( tmp < 0) tmp += theNbins;
26  return std::min( int(tmp), theNbins-1);
27  }
#define min(a, b)
Definition: mlp_lapack.h:161
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
long double T
Definition: DDAxes.h:10
template<class T>
virtual int PeriodicBinFinderInPhi< T >::binIndex ( int  i) const
inlinevirtual

returns an index in the valid range, modulo Nbins

Implements BaseBinFinder< T >.

Definition at line 30 of file PeriodicBinFinderInPhi.h.

30  {
31  int ind = i % theNbins;
32  return ind < 0 ? ind+theNbins : ind;
33  }
int i
Definition: DBlmapReader.cc:9
template<class T>
virtual T PeriodicBinFinderInPhi< T >::binPosition ( int  ind) const
inlinevirtual

the middle of the bin in radians

Implements BaseBinFinder< T >.

Definition at line 36 of file PeriodicBinFinderInPhi.h.

36  {
37  return thePhiOffset + thePhiStep * ( ind + 0.5);
38  }
template<class T>
static T PeriodicBinFinderInPhi< T >::pi ( )
inlinestatic

Definition at line 40 of file PeriodicBinFinderInPhi.h.

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

40 { return 3.141592653589793238;}
template<class T>
static T PeriodicBinFinderInPhi< T >::twoPi ( )
inlinestatic

Definition at line 41 of file PeriodicBinFinderInPhi.h.

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

41 { 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
template<class T>
T PeriodicBinFinderInPhi< T >::thePhiStep
private