test
CMS 3D CMS Logo

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

#include <GeneralBinFinderInR.h>

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

Public Types

typedef RBorderFinder::Det Det
 

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

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

Author
N. Amapane - INFN Torino

Definition at line 17 of file GeneralBinFinderInR.h.

Member Typedef Documentation

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

Definition at line 20 of file GeneralBinFinderInR.h.

Constructor & Destructor Documentation

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

Definition at line 22 of file GeneralBinFinderInR.h.

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

Construct from an already initialized RBorderFinder.

Definition at line 25 of file GeneralBinFinderInR.h.

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

25  {
26  theBorders=bf.RBorders();
27  theBins=bf.RBins();
28  theNbins=theBins.size();
29  }
std::vector< T > theBins
std::vector< double > RBins() const
The centers of the Dets.
std::vector< T > theBorders
std::vector< double > RBorders() const
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 32 of file GeneralBinFinderInR.h.

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

34  : theNbins( last-first)
35  {
36  std::vector<const Det*> dets(first,last);
37  RBorderFinder bf(dets);
38  theBorders=bf.RBorders();
39  theBins=bf.RBins();
40  theNbins=theBins.size();
41  }
std::vector< T > theBins
std::vector< T > theBorders
bool first
Definition: L1TdeRCT.cc:75

Member Function Documentation

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

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

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

46  {
47  int i;
48  for (i = 0; i<theNbins; i++) {
49  if (R < theBorders[i]){
50  break;
51  }
52  }
53  return binIndex(i-1);
54  }
int i
Definition: DBlmapReader.cc:9
virtual int binIndex(T R) const
std::vector< T > theBorders
template<class T>
virtual int GeneralBinFinderInR< T >::binIndex ( int  i) const
inlinevirtual

Returns an index in the valid range.

Implements BaseBinFinder< T >.

Definition at line 57 of file GeneralBinFinderInR.h.

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

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

The middle of the bin.

Implements BaseBinFinder< T >.

Definition at line 62 of file GeneralBinFinderInR.h.

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

62  {
63  return theBins[binIndex(ind)];
64  }
std::vector< T > theBins
virtual int binIndex(T R) const

Member Data Documentation

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