00001 #include "TrackingTools/AnalyticalJacobians/interface/JacobianCartesianToLocal.h"
00002 #include "DataFormats/GeometrySurface/interface/Surface.h"
00003 #include "TrackingTools/TrajectoryParametrization/interface/LocalTrajectoryParameters.h"
00004
00005 JacobianCartesianToLocal::JacobianCartesianToLocal(const Surface& surface,
00006 const LocalTrajectoryParameters& localParameters) : theJacobian() {
00007
00008
00009
00010
00011
00012
00013
00014
00015 LocalVector plocal = localParameters.momentum();
00016 double px = plocal.x(), py = plocal.y(), pz = plocal.z();
00017 double p = plocal.mag();
00018 TrackCharge q = localParameters.charge();
00019
00020
00021 if ( q==0 ) q = 1;
00022
00023 theJacobian(0,3) = -q*px/(p*p*p); theJacobian(0,4) = -q*py/(p*p*p); theJacobian(0,5) = -q*pz/(p*p*p);
00024 if(fabs(pz) > 0){
00025 theJacobian(1,3) = 1./pz; theJacobian(1,5) = -px/(pz*pz);
00026 theJacobian(2,4) = 1./pz; theJacobian(2,5) = -py/(pz*pz);
00027 }
00028 theJacobian(3,0) = 1.;
00029 theJacobian(4,1) = 1.;
00030 LocalVector l1 = surface.toLocal(GlobalVector(1., 0., 0.));
00031 LocalVector l2 = surface.toLocal(GlobalVector(0., 1., 0.));
00032 LocalVector l3 = surface.toLocal(GlobalVector(0., 0., 1.));
00033 AlgebraicMatrix33 Rsub;
00034 Rsub(0,0) = l1.x(); Rsub(0,1) = l2.x(); Rsub(0,2) = l3.x();
00035 Rsub(1,0) = l1.y(); Rsub(1,1) = l2.y(); Rsub(1,2) = l3.y();
00036 Rsub(2,0) = l1.z(); Rsub(2,1) = l2.z(); Rsub(2,2) = l3.z();
00037
00038 AlgebraicMatrix66 R;
00039 R.Place_at(Rsub,0,0);
00040 R.Place_at(Rsub,3,3);
00041 theJacobian = theJacobian * R;
00042
00043 }
00044 const AlgebraicMatrix JacobianCartesianToLocal::jacobian_old() const {
00045 return asHepMatrix(theJacobian);
00046 }
00047 const AlgebraicMatrix56& JacobianCartesianToLocal::jacobian() const {
00048 return theJacobian;
00049 }