CMS 3D CMS Logo

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

int binIndex (T R) const override
 
int binIndex (int i) const override
 Returns an index in the valid range. More...
 
T binPosition (int ind) const override
 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

◆ Det

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

Definition at line 19 of file GeneralBinFinderInR.h.

Constructor & Destructor Documentation

◆ GeneralBinFinderInR() [1/3]

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

Definition at line 21 of file GeneralBinFinderInR.h.

◆ GeneralBinFinderInR() [2/3]

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

Construct from an already initialized RBorderFinder.

Definition at line 24 of file GeneralBinFinderInR.h.

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

24  {
25  theBorders = bf.RBorders();
26  theBins = bf.RBins();
27  theNbins = theBins.size();
28  }
std::vector< T > theBins
std::vector< double > RBorders() const
Definition: RBorderFinder.h:39
std::vector< T > theBorders
std::vector< double > RBins() const
The centers of the Dets.
Definition: RBorderFinder.h:42

◆ GeneralBinFinderInR() [3/3]

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

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

32  : theNbins(last - first) {
33  std::vector<const Det*> dets(first, last);
34  RBorderFinder bf(dets);
35  theBorders = bf.RBorders();
36  theBins = bf.RBins();
37  theNbins = theBins.size();
38  }
std::vector< T > theBins
std::vector< T > theBorders

Member Function Documentation

◆ binIndex() [1/2]

template<class T>
int GeneralBinFinderInR< T >::binIndex ( T  R) const
inlineoverridevirtual

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

Implements BaseBinFinder< T >.

Definition at line 42 of file GeneralBinFinderInR.h.

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

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

42  {
43  int i;
44  for (i = 0; i < theNbins; i++) {
45  if (R < theBorders[i]) {
46  break;
47  }
48  }
49  return binIndex(i - 1);
50  }
int binIndex(T R) const override
std::vector< T > theBorders

◆ binIndex() [2/2]

template<class T>
int GeneralBinFinderInR< T >::binIndex ( int  i) const
inlineoverridevirtual

◆ binPosition()

template<class T>
T GeneralBinFinderInR< T >::binPosition ( int  ind) const
inlineoverridevirtual

The middle of the bin.

Implements BaseBinFinder< T >.

Definition at line 56 of file GeneralBinFinderInR.h.

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

56 { return theBins[binIndex(ind)]; }
int binIndex(T R) const override
std::vector< T > theBins

Member Data Documentation

◆ theBins

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

◆ theBorders

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

◆ theNbins

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