Go to the documentation of this file.00001 #include "TrackingTools/AnalyticalJacobians/interface/JacobianCurvilinearToLocal.h"
00002 #include "DataFormats/GeometrySurface/interface/Surface.h"
00003 #include "TrackingTools/TrajectoryParametrization/interface/LocalTrajectoryParameters.h"
00004 #include "MagneticField/Engine/interface/MagneticField.h"
00005
00006 JacobianCurvilinearToLocal::
00007 JacobianCurvilinearToLocal(const Surface& surface,
00008 const LocalTrajectoryParameters& localParameters,
00009 const MagneticField& magField) : theJacobian() {
00010
00011
00012 GlobalPoint x = surface.toGlobal(localParameters.position());
00013
00014 GlobalVector h = magField.inTesla(x) * 2.99792458e-3;
00015 GlobalVector hdir = h.unit();
00016
00017 LocalVector tnl = localParameters.momentum().unit();
00018 GlobalVector tn = surface.toGlobal(tnl);
00019
00020
00021
00022
00023 Surface::RotationType const & rot = surface.rotation();
00024 GlobalVector dj(rot.x());
00025 GlobalVector dk(rot.y());
00026 GlobalVector di(rot.z());
00027
00028
00029
00030 double cosl = tn.perp(); if (cosl < 1.e-30) cosl = 1.e-30;
00031 double cosl1 = 1./cosl;
00032 GlobalVector un(-tn.y()*cosl1, tn.x()*cosl1, 0.);
00033 GlobalVector vn(-tn.z()*un.y(), tn.z()*un.x(), cosl);
00034
00035 double uj = un.dot(dj);
00036 double uk = un.dot(dk);
00037 double vj = vn.dot(dj);
00038 double vk = vn.dot(dk);
00039
00040
00041 double t1r = 1./tnl.z();
00042 double t2r = t1r*t1r;
00043 double t3r = t1r*t2r;
00044
00045 theJacobian(0,0) = 1.;
00046 theJacobian(1,1) = -uk*t2r;
00047 theJacobian(1,2) = vk*(cosl*t2r);
00048 theJacobian(2,1) = uj*t2r;
00049 theJacobian(2,2) = -vj*(cosl*t2r);
00050 theJacobian(3,3) = vk*t1r;
00051 theJacobian(3,4) = -uk*t1r;
00052 theJacobian(4,3) = -vj*t1r;
00053 theJacobian(4,4) = uj*t1r;
00054
00055 double q = -h.mag() * localParameters.signedInverseMomentum();
00056
00057 double sinz =-un.dot(hdir);
00058 double cosz = vn.dot(hdir);
00059 double ui = un.dot(di)*(q*t3r);
00060 double vi = vn.dot(di)*(q*t3r);
00061 theJacobian(1,3) =-ui*(vk*cosz-uk*sinz);
00062 theJacobian(1,4) =-vi*(vk*cosz-uk*sinz);
00063 theJacobian(2,3) = ui*(vj*cosz-uj*sinz);
00064 theJacobian(2,4) = vi*(vj*cosz-uj*sinz);
00065
00066
00067 }
00068 const AlgebraicMatrix55& JacobianCurvilinearToLocal::jacobian() const {
00069 return theJacobian;
00070 }
00071 const AlgebraicMatrix JacobianCurvilinearToLocal::jacobian_old() const {
00072 return asHepMatrix(theJacobian);
00073 }