CMS 3D CMS Logo

MagBinFinders::GeneralBinFinderInR< T > Class Template Reference

#include <MagneticField/Layers/src/MagBinFinders.h>

Inheritance diagram for MagBinFinders::GeneralBinFinderInR< T >:

BaseBinFinder< T >

List of all members.

Public Member Functions

virtual int binIndex (int i) const
 Returns an index in the valid range.
virtual int binIndex (T R) const
 Returns an index in the valid range for the bin that contains AND is closest to R.
virtual T binPosition (int ind) const
 The middle of the bin.
 GeneralBinFinderInR (std::vector< T > &borders)
 GeneralBinFinderInR ()

Private Attributes

std::vector< T > theBins
std::vector< T > theBorders
int theNbins


Detailed Description

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

Definition at line 29 of file MagBinFinders.h.


Constructor & Destructor Documentation

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

Definition at line 32 of file MagBinFinders.h.

00032 : theNbins(0) {}

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

Definition at line 34 of file MagBinFinders.h.

00034                                              :
00035     theNbins(borders.size()), 
00036     theBorders(borders) {
00037     // FIXME: compute bin positions.
00038 //     for (vector<T>::const_iterator i=theBorders.begin();
00039 //       i<theBorders.end(); ++i) {
00040 //      theBorders.push_back(((*i) + (*(i+1))) / 2.);
00041 
00042 //     cout << "GeneralBinFinderInR_ " << theNbins << " " << theBorders.size() << " " << (int) this << endl;
00043 }
  


Member Function Documentation

template<class T>
virtual int MagBinFinders::GeneralBinFinderInR< T >::binIndex ( int  i  )  const [inline, virtual]

Returns an index in the valid range.

Implements BaseBinFinder< T >.

Definition at line 79 of file MagBinFinders.h.

00079                                      {
00080     return std::min( std::max( i, 0), theNbins-1);
00081   }

template<class T>
virtual int MagBinFinders::GeneralBinFinderInR< T >::binIndex ( R  )  const [inline, virtual]

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

Implements BaseBinFinder< T >.

Definition at line 68 of file MagBinFinders.h.

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

00068                                    {
00069     int i;
00070     for (i = 0; i<theNbins; ++i) {
00071       if (R < theBorders[i]){ // FIXME: one can be skipped?
00072          break;
00073       }
00074     }
00075     return binIndex(i-1);
00076   }

template<class T>
virtual T MagBinFinders::GeneralBinFinderInR< T >::binPosition ( int  ind  )  const [inline, virtual]

The middle of the bin.

Implements BaseBinFinder< T >.

Definition at line 84 of file MagBinFinders.h.

00084                                         {
00085     return theBins[binIndex(ind)];
00086   }


Member Data Documentation

template<class T>
std::vector<T> MagBinFinders::GeneralBinFinderInR< T >::theBins [private]

Definition at line 92 of file MagBinFinders.h.

Referenced by MagBinFinders::GeneralBinFinderInR< double >::binPosition().

template<class T>
std::vector<T> MagBinFinders::GeneralBinFinderInR< T >::theBorders [private]

Definition at line 91 of file MagBinFinders.h.

Referenced by MagBinFinders::GeneralBinFinderInR< double >::binIndex().

template<class T>
int MagBinFinders::GeneralBinFinderInR< T >::theNbins [private]

Definition at line 90 of file MagBinFinders.h.

Referenced by MagBinFinders::GeneralBinFinderInR< double >::binIndex().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:48:53 2009 for CMSSW by  doxygen 1.5.4