Go to the documentation of this file.00001 #ifndef ThirdHitRZPrediction_H
00002 #define ThirdHitRZPrediction_H
00003
00009 #include <algorithm>
00010
00011 #include "ThirdHitRZPredictionBase.h"
00012
00013 template<class Propagator>
00014 class ThirdHitRZPrediction : public ThirdHitRZPredictionBase {
00015 public:
00016
00017 ThirdHitRZPrediction() : ThirdHitRZPredictionBase(), thePropagator(nullptr) {}
00018 ThirdHitRZPrediction(const Propagator *propagator, float tolerance, const DetLayer* layer = nullptr) :
00019 ThirdHitRZPredictionBase(tolerance, layer), thePropagator(propagator) {}
00020
00021 inline Range operator()(const DetLayer *layer = nullptr);
00022 inline Range operator()(float rORz) const { return (*this)(rORz, *thePropagator); }
00023 inline Range operator()(float rORz, const Propagator &propagator) const;
00024
00025 void initPropagator(const Propagator *propagator) { thePropagator = propagator; }
00026
00027 private:
00028 float transform( const Propagator &propagator, float rOrZ) const
00029 { return theBarrel ? propagator.zAtR(rOrZ) : propagator.rAtZ(rOrZ); }
00030
00031 const Propagator *thePropagator;
00032 };
00033
00034 template<class Propagator>
00035 typename ThirdHitRZPrediction<Propagator>::Range
00036 ThirdHitRZPrediction<Propagator>::operator()(const DetLayer *layer)
00037 {
00038 if (layer) initLayer(layer);
00039 if (!theBarrel && !theForward) return Range(0., 0.);
00040 float v1 = transform(*thePropagator, theDetRange.min());
00041 float v2 = transform(*thePropagator, theDetRange.max());
00042 if (v1 > v2) std::swap(v1, v2);
00043 return Range(v1 - theTolerance.left(), v2 + theTolerance.right());
00044 }
00045
00046 template<class Propagator>
00047 typename ThirdHitRZPrediction<Propagator>::Range
00048 ThirdHitRZPrediction<Propagator>::operator()(float rOrZ, const Propagator &propagator) const
00049 {
00050 float v = transform(propagator, rOrZ);
00051 return Range(v - theTolerance.left(), v + theTolerance.right());
00052 }
00053
00054 #endif