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

21 : theNbins(0) {}

◆ 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.

24  {
25  theBorders = bf.RBorders();
26  theBins = bf.RBins();
27  theNbins = theBins.size();
28  }

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

◆ 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.

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  }

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

Member Function Documentation

◆ binIndex() [1/2]

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

Returns an index in the valid range.

Implements BaseBinFinder< T >.

Definition at line 53 of file GeneralBinFinderInR.h.

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

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

◆ binIndex() [2/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.

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  }

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

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

◆ 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.

56 { return theBins[binIndex(ind)]; }

References GeneralBinFinderInR< T >::binIndex(), and GeneralBinFinderInR< 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
mps_fire.i
i
Definition: mps_fire.py:355
GeneralBinFinderInR::theBorders
std::vector< T > theBorders
Definition: GeneralBinFinderInR.h:60
min
T min(T a, T b)
Definition: MathUtil.h:58
GeneralBinFinderInR::theNbins
int theNbins
Definition: GeneralBinFinderInR.h:59
dqmdumpme.first
first
Definition: dqmdumpme.py:55
dqmdumpme.last
last
Definition: dqmdumpme.py:56
GeneralBinFinderInR::theBins
std::vector< T > theBins
Definition: GeneralBinFinderInR.h:61
RBorderFinder::RBins
std::vector< double > RBins() const
The centers of the Dets.
Definition: RBorderFinder.h:42
RBorderFinder::RBorders
std::vector< double > RBorders() const
Definition: RBorderFinder.h:39
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
RBorderFinder
Definition: RBorderFinder.h:22
GeneralBinFinderInR::binIndex
int binIndex(T R) const override
Definition: GeneralBinFinderInR.h:42
dttmaxenums::R
Definition: DTTMax.h:29