CMS 3D CMS Logo

GeneralBinFinderInR.h
Go to the documentation of this file.
1 #ifndef TrackingTools_DetLayers_GeneralBinFinderInR_H
2 #define TrackingTools_DetLayers_GeneralBinFinderInR_H
3 
12 
13 #include <cmath>
14 #include <vector>
15 
16 template <class T>
18 public:
19  typedef RBorderFinder::Det Det; //FIXME!!!
20 
22 
25  theBorders = bf.RBorders();
26  theBins = bf.RBins();
27  theNbins = theBins.size();
28  }
29 
31  GeneralBinFinderInR(std::vector<Det*>::const_iterator first, std::vector<Det*>::const_iterator last)
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  }
39 
42  int binIndex(T R) const override {
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  }
51 
53  int binIndex(int i) const override { return std::min(std::max(i, 0), theNbins - 1); }
54 
56  T binPosition(int ind) const override { return theBins[binIndex(ind)]; }
57 
58 private:
59  int theNbins;
60  std::vector<T> theBorders;
61  std::vector<T> theBins;
62 };
63 #endif
GeneralBinFinderInR
Definition: GeneralBinFinderInR.h:17
mps_fire.i
i
Definition: mps_fire.py:428
GeneralBinFinderInR::theBorders
std::vector< T > theBorders
Definition: GeneralBinFinderInR.h:60
GeneralBinFinderInR::binIndex
int binIndex(int i) const override
Returns an index in the valid range.
Definition: GeneralBinFinderInR.h:53
min
T min(T a, T b)
Definition: MathUtil.h:58
GeneralBinFinderInR::theNbins
int theNbins
Definition: GeneralBinFinderInR.h:59
GeneralBinFinderInR::GeneralBinFinderInR
GeneralBinFinderInR()
Definition: GeneralBinFinderInR.h:21
RBorderFinder.h
dqmdumpme.first
first
Definition: dqmdumpme.py:55
GeneralBinFinderInR::Det
RBorderFinder::Det Det
Definition: GeneralBinFinderInR.h:19
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
GeneralBinFinderInR::GeneralBinFinderInR
GeneralBinFinderInR(const RBorderFinder &bf)
Construct from an already initialized RBorderFinder.
Definition: GeneralBinFinderInR.h:24
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
BaseBinFinder.h
GeneralBinFinderInR::binPosition
T binPosition(int ind) const override
The middle of the bin.
Definition: GeneralBinFinderInR.h:56
T
long double T
Definition: Basic3DVectorLD.h:48
BaseBinFinder
Definition: BaseBinFinder.h:11
GeneralBinFinderInR::GeneralBinFinderInR
GeneralBinFinderInR(std::vector< Det * >::const_iterator first, std::vector< Det * >::const_iterator last)
Construct from the list of Det*.
Definition: GeneralBinFinderInR.h:31
dttmaxenums::R
Definition: DTTMax.h:29
ForwardDetRing
Definition: ForwardDetRing.h:11