Go to the documentation of this file.00001 #ifndef ThirdHitPredictionFromInvParabola_H
00002 #define ThirdHitPredictionFromInvParabola_H
00003
00012 #include "DataFormats/GeometryVector/interface/Basic2DVector.h"
00013 #include "DataFormats/GeometryVector/interface/Basic3DVector.h"
00014 #include "DataFormats/GeometrySurface/interface/TkRotation.h"
00015
00016 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00017 #include "RecoTracker/TkMSParametrization/interface/PixelRecoRange.h"
00018
00019
00020 class TrackingRegion;
00021 class OrderedHitPair;
00022
00023
00024 class ThirdHitPredictionFromInvParabola {
00025
00026 public:
00027
00028 typedef TkRotation<double> Rotation;
00029 typedef PixelRecoRange<float> Range;
00030
00031 ThirdHitPredictionFromInvParabola(const GlobalPoint & P1, const GlobalPoint & P2,
00032 double ip, double curv, double tolerance);
00033
00034
00035 inline Range operator()(double radius, int charge) const { return rangeRPhi(radius,charge); }
00036
00037 Range rangeRPhi(double radius, int charge) const;
00038 Range rangeRPhiSlow(double radius, int charge, int nIter=5) const;
00039
00040 void init( const GlobalPoint & P1, const GlobalPoint & P2, double ip, double curv);
00041 private:
00042
00043 inline double coeffA(double impactParameter, int charge) const;
00044 inline double coeffB(double impactParameter, int charge) const;
00045 double predV(double u, double ip, int charge) const;
00046 double ipFromCurvature(double curvature, int charge) const;
00047
00048
00049 private:
00050
00051 template <class T> class MappedPoint {
00052 public:
00053 MappedPoint() : theU(0), theV(0), pRot(0) { }
00054 MappedPoint(const T & aU, const T & aV, const TkRotation<T> * aRot)
00055 : theU(aU), theV(aV), pRot(aRot) { }
00056 MappedPoint(const Basic2DVector<T> & point, const TkRotation<T> * aRot)
00057 : pRot(aRot) {
00058 T invRadius2 = T(1)/point.mag2();
00059 Basic3DVector<T> rotated = (*pRot) * point;
00060 theU = rotated.x() * invRadius2;
00061 theV = rotated.y() * invRadius2;
00062 }
00063 T u() const {return theU; }
00064 T v() const {return theV; }
00065 Basic2DVector<T> unmap () const {
00066 T radius2 = T(1)/(theU*theU+theV*theV);
00067 Basic3DVector<T> tmp
00068 = (*pRot).multiplyInverse(Basic2DVector<T>(theU,theV));
00069 return Basic2DVector<T>( tmp.x()*radius2, tmp.y()*radius2);
00070 }
00071 private:
00072 T theU, theV;
00073 const TkRotation<T> * pRot;
00074 };
00075
00076 private:
00077
00078 Rotation theRotation;
00079 typedef MappedPoint<double> PointUV;
00080 PointUV p1, p2;
00081 PointUV findPointAtCurve(double radius, int charge, double ip) const;
00082
00083 Range theIpRangePlus, theIpRangeMinus;
00084 double theTolerance;
00085
00086 };
00087
00088
00089
00090 double ThirdHitPredictionFromInvParabola::
00091 coeffA(double impactParameter, int charge) const
00092 {
00093 double u1u2 = p1.u()*p2.u();
00094 double du = p2.u() - p1.u();
00095 double pv = p1.v()*p2.u() - p2.v()*p1.u();
00096 return -charge*pv/du - u1u2*impactParameter;
00097 }
00098
00099 double ThirdHitPredictionFromInvParabola::
00100 coeffB(double impactParameter,int charge) const
00101 {
00102 double dv = p2.v() - p1.v();
00103 double du = p2.u() - p1.u();
00104 double su = p2.u() + p1.u();
00105 return charge*dv/du - su*impactParameter;
00106 }
00107
00108
00109 #endif