CMS 3D CMS Logo

ThirdHitRZPrediction.h
Go to the documentation of this file.
1 #ifndef ThirdHitRZPrediction_H
2 #define ThirdHitRZPrediction_H
3 
9 #include <algorithm>
10 
12 
13 template<class Propagator>
15 public:
16 
18  ThirdHitRZPrediction(const Propagator *propagator, float tolerance, const DetLayer* layer = nullptr) :
19  ThirdHitRZPredictionBase(tolerance, layer), thePropagator(propagator) {}
20 
21  inline Range operator()(const DetLayer *layer = nullptr);
22  inline Range operator()(float rORz) const { return (*this)(rORz, *thePropagator); }
23  inline Range operator()(float rORz, const Propagator &propagator) const;
24 
25  void initPropagator(const Propagator *propagator) { thePropagator = propagator; }
26 
27 private:
28  float transform( const Propagator &propagator, float rOrZ) const
29  { return theBarrel ? propagator.zAtR(rOrZ) : propagator.rAtZ(rOrZ); }
30 
32 };
33 
34 template<class Propagator>
37 {
38  if (layer) initLayer(layer);
39  if (!theBarrel && !theForward) return Range(0., 0.);
40  float v1 = transform(*thePropagator, theDetRange.min());
41  float v2 = transform(*thePropagator, theDetRange.max());
42  if (v1 > v2) std::swap(v1, v2);
43  return Range(v1 - theTolerance.left(), v2 + theTolerance.right());
44 }
45 
46 template<class Propagator>
49 {
50  float v = transform(propagator, rOrZ);
51  return Range(v - theTolerance.left(), v + theTolerance.right());
52 }
53 
54 #endif
void initPropagator(const Propagator *propagator)
T max() const
void initLayer(const DetLayer *layer)
const double tolerance
PixelRecoRange< float > Range
T min() const
#define nullptr
float transform(const Propagator &propagator, float rOrZ) const
ThirdHitRZPrediction(const Propagator *propagator, float tolerance, const DetLayer *layer=nullptr)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Range operator()(float rORz) const
const Propagator * thePropagator
Range operator()(const DetLayer *layer=nullptr)