CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/RecoPixelVertexing/PixelTrackFitting/src/ConformalMappingFit.h

Go to the documentation of this file.
00001 #ifndef ConformalMappingFit_H
00002 #define ConformalMappingFit_H
00003 
00004 #include "DataFormats/GeometryVector/interface/Basic2DVector.h"
00005 #include "DataFormats/GeometryVector/interface/Basic3DVector.h"
00006 #include "DataFormats/GeometrySurface/interface/TkRotation.h"
00007 #include "DataFormats/GeometryCommonDetAlgo/interface/Measurement1D.h"
00008 
00009 #include "ParabolaFit.h"
00010 #include <vector>
00011 
00012 namespace edm {class ParameterSet;}
00013 
00014 class ConformalMappingFit {
00015 public:
00016   typedef TkRotation<double> Rotation;
00017   typedef Basic2DVector<double> PointXY;
00018 
00019   ConformalMappingFit( const std::vector<PointXY> & hits, const std::vector<float> & errRPhi2,
00020       const Rotation * rotation = 0);
00021 
00022   ~ConformalMappingFit();
00023 
00024   Measurement1D curvature() const;
00025   Measurement1D directionPhi() const;
00026   Measurement1D impactParameter() const;
00027 
00028   int charge() const;
00029   double chi2() const { return theFit.chi2(); }
00030 
00031   const Rotation * rotation() const { return theRotation; }
00032 
00033   void fixImpactParmaeter(double ip) { theFit.fixParC(ip); }
00034   void skipErrorCalculation() { theFit.skipErrorCalculationByDefault(); }
00035 
00036 private:
00037   double phiRot() const;
00038   void findRot( const PointXY &);
00039 
00040 private:
00041   const Rotation *theRotation; bool myRotation;
00042   ParabolaFit theFit;
00043 
00044   template <class T> class MappedPoint {
00045   public:
00046     typedef Basic2DVector<T> PointXY;
00047     MappedPoint() : theU(0), theV(0), theW(0), pRot(0) { }
00048     MappedPoint( const T & aU, const T & aV, const T & aWeight, 
00049         const TkRotation<T> * aRot)
00050       : theU(aU), theV(aV), theW(aWeight), pRot(aRot) { }
00051     MappedPoint(
00052         const PointXY & point, const T & weight, const TkRotation<T> * aRot) 
00053       : pRot(aRot) {
00054       T radius2 = point.mag2();
00055       Basic3DVector<T> rotated = (*pRot) * point;
00056       theU = rotated.x() / radius2;
00057       theV = rotated.y() / radius2;
00058       theW = weight * radius2 * radius2; 
00059     }
00060     T u() const {return theU; }
00061     T v() const {return theV; }
00062     T weight() const {return theW; }
00063     PointXY unmap () const {
00064       T invRadius2 = theU*theU+theV*theV;
00065       Basic3DVector<T> tmp
00066           = (*pRot).multiplyInverse(Basic2DVector<T>(theU,theV));
00067       return PointXY(tmp.x()/invRadius2, tmp.y()/invRadius2);
00068     }
00069     T unmappedWeight() const {
00070       T invRadius2 = theU*theU+theV*theV;
00071       return theW * invRadius2 * invRadius2;
00072     }
00073   private:
00074     T theU, theV, theW;
00075     const TkRotation<T> * pRot;
00076   };
00077 
00078 };
00079 
00080 #endif