CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/RecoPixelVertexing/PixelTrackFitting/src/ConformalMappingFit.cc

Go to the documentation of this file.
00001 #include "ConformalMappingFit.h"
00002 
00003 using namespace std;
00004 
00005 template <class T> T sqr( T t) {return t*t;}
00006 
00007 ConformalMappingFit::ConformalMappingFit(
00008   const std::vector<PointXY> & hits, const std::vector<float> & errRPhi2, const Rotation * rot)
00009   : theRotation(rot), myRotation(rot==0)
00010 {
00011   typedef ConformalMappingFit::MappedPoint<double> PointUV;
00012   int hits_size = hits.size();
00013   for ( int i= 0; i < hits_size; i++) {
00014     if (!theRotation) findRot( hits[i] );
00015     PointUV point( hits[i], 1./errRPhi2[i], theRotation); 
00016     theFit.addPoint( point.u(), point.v(), point.weight());
00017   }
00018 }
00019 
00020 void ConformalMappingFit::findRot(const PointXY & p) 
00021 {
00022   myRotation = true;
00023   typedef  Rotation::GlobalVector GlobalVector; // ::GlobalVector is float!
00024   GlobalVector aX = GlobalVector( p.x(), p.y(), 0.).unit();
00025   GlobalVector aY( -aX.y(), aX.x(), 0.);
00026   GlobalVector aZ( 0., 0., 1.);
00027   theRotation = new Rotation(aX,aY,aZ);
00028 }
00029 
00030 ConformalMappingFit::~ConformalMappingFit()
00031 { if( myRotation) delete theRotation; }
00032 
00033 double ConformalMappingFit::phiRot() const
00034 { return atan2( theRotation->xy(), theRotation->xx() ); }
00035 
00036 Measurement1D ConformalMappingFit::curvature() const
00037 {
00038   double val = fabs( 2. * theFit.parA() );
00039   double err  = 2.*sqrt(theFit.varAA());
00040   return Measurement1D(val,err);
00041 }
00042 
00043 Measurement1D ConformalMappingFit::directionPhi() const
00044 {
00045   double val = phiRot() + atan(theFit.parB());
00046   double err = sqrt(theFit.varBB());
00047   return Measurement1D(val,err);
00048 }
00049 
00050 Measurement1D ConformalMappingFit::impactParameter() const
00051 {
00052   double val = -theFit.parC(); 
00053   double err = sqrt(theFit.varCC());
00054   return Measurement1D(val,err);
00055 }
00056 
00057 int ConformalMappingFit::charge() const
00058 { return (theFit.parA() > 0.) ? -1 : 1; }
00059