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.

Date:
2012/07/16 07:32:42
Revision:
1.3
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.

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.

27  {
28  theBorders=bf.RBorders();
29  theBins=bf.RBins();
30  theNbins=theBins.size();
31  }
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 34 of file GeneralBinFinderInR.h.

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

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

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 48 of file GeneralBinFinderInR.h.

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

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

48  {
49  int i;
50  for (i = 0; i<theNbins; i++) {
51  if (R < theBorders[i]){
52  break;
53  }
54  }
55  return binIndex(i-1);
56  }
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 59 of file GeneralBinFinderInR.h.

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

59  {
60  return std::min( std::max( i, 0), theNbins-1);
61  }
int i
Definition: DBlmapReader.cc:9
#define min(a, b)
Definition: mlp_lapack.h:161
const T & max(const T &a, const T &b)
template<class T>
virtual T GeneralBinFinderInR< T >::binPosition ( int  ind) const
inlinevirtual

The middle of the bin.

Implements BaseBinFinder< T >.

Definition at line 64 of file GeneralBinFinderInR.h.

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

64  {
65  return theBins[binIndex(ind)];
66  }
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