CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ThirdHitRZPrediction.h
Go to the documentation of this file.
1 #ifndef ThirdHitRZPrediction_H
2 #define ThirdHitRZPrediction_H
3 
9 #include <algorithm>
10 
12 
13 namespace helper {
14  // Helper template to define how the ThirdHitRZPrediction interfaces
15  // the prediction implementation
16  template<class Propagator>
18  public:
19  static inline float transform(const Propagator &propagator, bool barrel, float rOrZ);
20  };
21 
22  // generic: defaults to calling zAtR or rAtZ
23  // template can be specialized for individual classes if different
24  // are required
25  template<class Propagator>
27  const Propagator &propagator, bool barrel, float rOrZ)
28  { return barrel ? propagator.zAtR(rOrZ) : propagator.rAtZ(rOrZ); }
29 }
30 
31 template<class Propagator>
33 public:
35 
37  ThirdHitRZPrediction(const Propagator *propagator, float tolerance, const DetLayer* layer = 0) :
38  ThirdHitRZPredictionBase(tolerance, layer), thePropagator(propagator) {}
39 
40  Range operator()(const DetLayer *layer = 0);
41  inline Range operator()(float rORz) const { return (*this)(rORz, *thePropagator); }
42  Range operator()(float rORz, const Propagator &propagator) const;
43 
45 
46 private:
48 };
49 
50 template<class Propagator>
53 {
54  if (layer) initLayer(layer);
55  if (!theBarrel && !theForward) return Range(0., 0.);
56  float v1 = traits::transform(*thePropagator, theBarrel, theDetRange.min());
57  float v2 = traits::transform(*thePropagator, theBarrel, theDetRange.max());
58  if (v1 > v2) std::swap(v1, v2);
59  return Range(v1 - theTolerance.left(), v2 + theTolerance.right());
60 }
61 
62 template<class Propagator>
65 {
66  float v = traits::transform(propagator, theBarrel, rOrZ);
67  return Range(v - theTolerance.left(), v + theTolerance.right());
68 }
69 
70 #endif
void initPropagator(const Propagator *propagator)
helper::ThirdHitRZPredictionTraits< Propagator > traits
Range operator()(const DetLayer *layer=0)
PixelRecoRange< float > Range
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Range operator()(float rORz) const
PixelRecoRange< float > Range
const Propagator * thePropagator
mathSSE::Vec4< T > v
static float transform(const Propagator &propagator, bool barrel, float rOrZ)
ThirdHitRZPrediction(const Propagator *propagator, float tolerance, const DetLayer *layer=0)