CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/RecoEgamma/EgammaElectronAlgos/src/FTSFromVertexToPointFactory.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    EgammaElectronAlgos
00004 // Class:      FTSFromVertexToPointFactory
00005 // 
00013 //
00014 // Original Author:  Ursula Berthon, Claude Charlot
00015 //         Created:  Mon Mar 27 13:22:06 CEST 2006
00016 // $Id: FTSFromVertexToPointFactory.cc,v 1.6 2011/03/21 17:10:32 innocent Exp $
00017 //
00018 //
00019 #include "RecoEgamma/EgammaElectronAlgos/interface/FTSFromVertexToPointFactory.h"
00020 #include "MagneticField/Engine/interface/MagneticField.h"
00021 
00022 
00023 FreeTrajectoryState FTSFromVertexToPointFactory::operator()(const MagneticField *magField, const GlobalPoint& xmeas,  
00024                                                             const GlobalPoint& xvert, 
00025                                                             float momentum, 
00026                                                             TrackCharge charge)
00027 {
00028   double BInTesla = magField->inTesla(xmeas).z();
00029   GlobalVector xdiff = xmeas -xvert;
00030   double theta = xdiff.theta();
00031   double phi= xdiff.phi();
00032   double pt = momentum*sin(theta);
00033   double pz = momentum*cos(theta);
00034   double pxOld = pt*cos(phi);
00035   double pyOld = pt*sin(phi);
00036 
00037   double RadCurv = 100*pt/(BInTesla*0.29979);
00038   double alpha = asin(0.5*xdiff.perp()/RadCurv);
00039 
00040   float ca = cos(charge*alpha);
00041   float sa = sin(charge*alpha);
00042   double pxNew =   ca*pxOld + sa*pyOld;
00043   double pyNew =  -sa*pxOld + ca*pyOld;
00044   GlobalVector pNew(pxNew, pyNew, pz);  
00045 
00046   GlobalTrajectoryParameters gp(xmeas, pNew, charge, magField);
00047   
00048   AlgebraicSymMatrix55 C = AlgebraicMatrixID();
00049   FreeTrajectoryState VertexToPoint(gp,CurvilinearTrajectoryError(C));
00050 
00051   return VertexToPoint;
00052 }
00053 
00054 
00055 
00056 
00057 
00058