CMS 3D CMS Logo

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

#include <MagBinFinders.h>

Inheritance diagram for MagBinFinders::GeneralBinFinderInR< T >:
BaseBinFinder< T >

Public Member Functions

virtual int binIndex (T R) const
 
virtual int binIndex (int i) const
 Returns an index in the valid range. More...
 
virtual T binPosition (int ind) const
 The middle of the bin. More...
 
 GeneralBinFinderInR ()
 
 GeneralBinFinderInR (std::vector< T > &borders)
 
- Public Member Functions inherited from BaseBinFinder< T >
 BaseBinFinder ()
 
virtual ~BaseBinFinder ()
 

Private Attributes

std::vector< TtheBins
 
std::vector< TtheBorders
 
int theNbins
 

Detailed Description

template<class T>
class MagBinFinders::GeneralBinFinderInR< T >

A R binfinder for a non-periodic group of detectors.

Author
N. Amapane - INFN Torino

Definition at line 7 of file MagBinFinders.h.

Constructor & Destructor Documentation

template<class T>
MagBinFinders::GeneralBinFinderInR< T >::GeneralBinFinderInR ( )
inline

Definition at line 30 of file MagBinFinders.h.

template<class T>
MagBinFinders::GeneralBinFinderInR< T >::GeneralBinFinderInR ( std::vector< T > &  borders)
inline

Definition at line 32 of file MagBinFinders.h.

32  :
33  theNbins(borders.size()),
34  theBorders(borders) {
35  // FIXME: compute bin positions.
36 // for (vector<T>::const_iterator i=theBorders.begin();
37 // i<theBorders.end(); ++i) {
38 // theBorders.push_back(((*i) + (*(i+1))) / 2.);
39 
40 // cout << "GeneralBinFinderInR_ " << theNbins << " " << theBorders.size() << " " << (int) this << endl;
41 }

Member Function Documentation

template<class T>
virtual int MagBinFinders::GeneralBinFinderInR< T >::binIndex ( T  R) const
inlinevirtual

Returns an index in the valid range for the bin that contains AND is closest to R

Implements BaseBinFinder< T >.

Definition at line 66 of file MagBinFinders.h.

Referenced by MagBinFinders::GeneralBinFinderInR< double >::binIndex(), MagBinFinders::GeneralBinFinderInR< double >::binPosition(), and MagGeometry::findVolume().

66  {
67  int i;
68  for (i = 0; i<theNbins; ++i) {
69  if (R < theBorders[i]){ // FIXME: one can be skipped?
70  break;
71  }
72  }
73  return binIndex(i-1);
74  }
int i
Definition: DBlmapReader.cc:9
virtual int binIndex(T R) const
Definition: MagBinFinders.h:66
template<class T>
virtual int MagBinFinders::GeneralBinFinderInR< T >::binIndex ( int  i) const
inlinevirtual

Returns an index in the valid range.

Implements BaseBinFinder< T >.

Definition at line 77 of file MagBinFinders.h.

77  {
78  return std::min( std::max( i, 0), theNbins-1);
79  }
int i
Definition: DBlmapReader.cc:9
T min(T a, T b)
Definition: MathUtil.h:58
template<class T>
virtual T MagBinFinders::GeneralBinFinderInR< T >::binPosition ( int  ind) const
inlinevirtual

The middle of the bin.

Implements BaseBinFinder< T >.

Definition at line 82 of file MagBinFinders.h.

82  {
83  return theBins[binIndex(ind)];
84  }
virtual int binIndex(T R) const
Definition: MagBinFinders.h:66

Member Data Documentation

template<class T>
std::vector<T> MagBinFinders::GeneralBinFinderInR< T >::theBins
private
template<class T>
std::vector<T> MagBinFinders::GeneralBinFinderInR< T >::theBorders
private
template<class T>
int MagBinFinders::GeneralBinFinderInR< T >::theNbins
private