CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/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 "TrackingTools/TrajectoryParametrization/interface/GlobalTrajectoryParameters.h"
00005 
00006 #include "MagneticField/Engine/interface/MagneticField.h"
00007 
00008 JacobianLocalToCurvilinear::
00009 JacobianLocalToCurvilinear(const Surface& surface, 
00010                            const LocalTrajectoryParameters& localParameters,
00011                            const MagneticField& magField) : theJacobian() {
00012   
00013 
00014   GlobalPoint  x = surface.toGlobal(localParameters.position());
00015   GlobalVector h  = magField.inInverseGeV(x);
00016   GlobalVector hq = h*localParameters.signedInverseMomentum();  // changed sign
00017 
00018  
00019   LocalVector tnl = localParameters.direction();
00020   GlobalVector tn = surface.toGlobal(tnl);
00021  
00022   // GlobalVector dj = surface.toGlobal(LocalVector(1., 0., 0.));
00023   // GlobalVector dk = surface.toGlobal(LocalVector(0., 1., 0.));
00024   Surface::RotationType const & rot = surface.rotation();
00025 
00026   compute(rot, tnl, tn, hq);
00027 }
00028 
00029 JacobianLocalToCurvilinear::
00030 JacobianLocalToCurvilinear(const Surface& surface, 
00031                            const LocalTrajectoryParameters& localParameters,
00032                            const GlobalTrajectoryParameters& globalParameters,
00033                            const MagneticField& magField) : theJacobian() {
00034 
00035   GlobalPoint  x =  globalParameters.position();
00036   GlobalVector h  = magField.inInverseGeV(x);
00037   GlobalVector hq = h*localParameters.signedInverseMomentum();  // changed sign
00038 
00039  
00040   LocalVector tnl = localParameters.direction();
00041   GlobalVector tn = surface.toGlobal(tnl);  // globalParameters.momentum().unit();
00042  
00043   // GlobalVector dj = surface.toGlobal(LocalVector(1., 0., 0.));
00044   // GlobalVector dk = surface.toGlobal(LocalVector(0., 1., 0.));
00045   Surface::RotationType const & rot = surface.rotation();
00046 
00047   compute(rot, tnl, tn, hq);
00048 }
00049  
00050 
00051 void JacobianLocalToCurvilinear::compute(Surface::RotationType const & rot, LocalVector const & tnl,  GlobalVector  const & tn, GlobalVector const & hq) {
00052   // Origin: TRSDSC
00053 
00054   GlobalVector dj(rot.x());
00055   GlobalVector dk(rot.y());
00056  
00057   // GlobalVector p = surface.toGlobal(localParameters.momentum());
00058   // GlobalVector pt(p.x(), p.y(), 0.);
00059   // pt = pt.unit();
00060   // GlobalVector tn = p.unit();
00061 
00062   //  GlobalVector di = tsos.surface().toGlobal(LocalVector(0., 0., 1.));
00063 
00064   // rotate coordinates because of wrong coordinate system in orca
00065   LocalVector tvw(tnl.z(), tnl.x(), tnl.y());
00066   double cosl = tn.perp(); if (cosl < 1.e-30) cosl = 1.e-30;
00067   double cosl1 = 1./cosl;
00068 
00069 
00070   GlobalVector un(-tn.y()*cosl1, tn.x()*cosl1, 0.);
00071   double uj = un.dot(dj);
00072   double uk = un.dot(dk);
00073   double sinz =-un.dot(hq);
00074 
00075   GlobalVector vn(-tn.z()*un.y(), tn.z()*un.x(), cosl);
00076   double vj = vn.dot(dj);
00077   double vk = vn.dot(dk);
00078   double cosz = vn.dot(hq);
00079  
00080 
00081   theJacobian(0,0) = 1.;
00082   theJacobian(1,1) = tvw.x()*vj;
00083   theJacobian(1,2) = tvw.x()*vk;
00084   theJacobian(2,1) = tvw.x()*uj*cosl1;
00085   theJacobian(2,2) = tvw.x()*uk*cosl1;
00086   theJacobian(3,3) = uj;
00087   theJacobian(3,4) = uk;
00088   theJacobian(4,3) = vj;
00089   theJacobian(4,4) = vk;
00090  
00091   theJacobian(1,3) = tvw.y()*sinz;
00092   theJacobian(1,4) = tvw.z()*sinz;
00093   theJacobian(2,3) = tvw.y()*(cosz*cosl1);
00094   theJacobian(2,4) = tvw.z()*(cosz*cosl1);
00095   // end of TRSDSC
00096 
00097   //dbg::dbg_trace(1,"Loc2Cu", localParameters.vector(),x,dj,dk,theJacobian);
00098 }
00099