CMS 3D CMS Logo

GeneralBinFinderInR< T > Class Template Reference

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

#include <RecoMuon/DetLayers/src/GeneralBinFinderInR.h>

Inheritance diagram for GeneralBinFinderInR< T >:

BaseBinFinder< T >

List of all members.

Public Types

typedef RBorderFinder::Det Det

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< Det * >::const_iterator first, std::vector< Det * >::const_iterator last)
 Construct from the list of Det*.
 GeneralBinFinderInR (const RBorderFinder &bf)
 Construct from an already initialized RBorderFinder.
 GeneralBinFinderInR ()

Private Attributes

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


Detailed Description

template<class T>
class GeneralBinFinderInR< T >

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

Date
2007/02/03 16:15:59
Revision
1.4
Author:
N. Amapane - INFN Torino
Date
2006/11/16 16:11:58
Revision
1.2
Author:
N. Amapane - INFN Torino

Definition at line 19 of file GeneralBinFinderInR.h.


Member Typedef Documentation

template<class T>
typedef RBorderFinder::Det GeneralBinFinderInR< T >::Det

Definition at line 22 of file GeneralBinFinderInR.h.


Constructor & Destructor Documentation

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

Definition at line 24 of file GeneralBinFinderInR.h.

00024 : theNbins(0) {}

template<class T>
GeneralBinFinderInR< T >::GeneralBinFinderInR ( const RBorderFinder bf  )  [inline]

Construct from an already initialized RBorderFinder.

Definition at line 27 of file GeneralBinFinderInR.h.

References RBorderFinder::RBins(), RBorderFinder::RBorders(), GeneralBinFinderInR< T >::theBins, GeneralBinFinderInR< T >::theBorders, and GeneralBinFinderInR< T >::theNbins.

00027                                                {
00028     theBorders=bf.RBorders();
00029     theBins=bf.RBins();
00030     theNbins=theBins.size();
00031   }

template<class T>
GeneralBinFinderInR< T >::GeneralBinFinderInR ( std::vector< Det * >::const_iterator  first,
std::vector< Det * >::const_iterator  last 
) [inline]

Construct from the list of Det*.

Definition at line 34 of file GeneralBinFinderInR.h.

References RBorderFinder::RBins(), RBorderFinder::RBorders(), GeneralBinFinderInR< T >::theBins, GeneralBinFinderInR< T >::theBorders, and GeneralBinFinderInR< T >::theNbins.

00036     : theNbins( last-first)
00037   {
00038     std::vector<Det*> dets(first,last);
00039     RBorderFinder bf(dets);
00040     theBorders=bf.RBorders();
00041     theBins=bf.RBins();
00042     theNbins=theBins.size();
00043   }


Member Function Documentation

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

Returns an index in the valid range.

Implements BaseBinFinder< T >.

Definition at line 59 of file GeneralBinFinderInR.h.

References max, min, and GeneralBinFinderInR< T >::theNbins.

00059                                      {
00060     return std::min( std::max( i, 0), theNbins-1);
00061   }

template<class T>
virtual int 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 48 of file GeneralBinFinderInR.h.

References i, GeneralBinFinderInR< T >::theBorders, and GeneralBinFinderInR< T >::theNbins.

Referenced by GeneralBinFinderInR< T >::binPosition().

00048                                    {
00049     int i;
00050     for (i = 0; i<theNbins; i++) {
00051       if (R < theBorders[i]){
00052          break;
00053       }
00054     }
00055     return binIndex(i-1);
00056   }

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

The middle of the bin.

Implements BaseBinFinder< T >.

Definition at line 64 of file GeneralBinFinderInR.h.

References GeneralBinFinderInR< T >::binIndex(), and GeneralBinFinderInR< T >::theBins.

00064                                         {
00065     return theBins[binIndex(ind)];
00066   }


Member Data Documentation

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

Definition at line 72 of file GeneralBinFinderInR.h.

Referenced by GeneralBinFinderInR< T >::binPosition(), and GeneralBinFinderInR< T >::GeneralBinFinderInR().

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

Definition at line 71 of file GeneralBinFinderInR.h.

Referenced by GeneralBinFinderInR< T >::binIndex(), and GeneralBinFinderInR< T >::GeneralBinFinderInR().

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

Definition at line 70 of file GeneralBinFinderInR.h.

Referenced by GeneralBinFinderInR< T >::binIndex(), and GeneralBinFinderInR< T >::GeneralBinFinderInR().


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