CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/TrackingTools/AnalyticalJacobians/src/JacobianLocalToCurvilinear.cc

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