CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/TrackingTools/AnalyticalJacobians/src/JacobianCartesianToLocal.cc

Go to the documentation of this file.
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   //LocalCoordinates 1 = (q/|p|, dx/dz, dy/dz, x, y)
00009   //LocalCoordinates 2 = (x, y, z, px, py, pz)
00010   //Transformation: q/|p| = q/sqrt(px*px + py*py + pz*pz)
00011   //                dx/dz = px/pz
00012   //                dy/dz = py/pz
00013   //                x     = x
00014   //                y     = y
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   // for neutrals: qbp is 1/p instead of q/p - 
00020   //   equivalent to charge 1
00021   if ( q==0 )  q = 1;
00022   //Jacobian theJacobian( (q/|p|, dx/dz, dy/dz, x, y) = f(x, y, z, px, py, pz) )
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 
00031   /*
00032   LocalVector l1 = surface.toLocal(GlobalVector(1., 0., 0.));
00033   LocalVector l2 = surface.toLocal(GlobalVector(0., 1., 0.));
00034   LocalVector l3 = surface.toLocal(GlobalVector(0., 0., 1.));
00035   AlgebraicMatrix33 Rsub;
00036   Rsub(0,0) = l1.x(); Rsub(0,1) = l2.x(); Rsub(0,2) = l3.x();
00037   Rsub(1,0) = l1.y(); Rsub(1,1) = l2.y(); Rsub(1,2) = l3.y();
00038   Rsub(2,0) = l1.z(); Rsub(2,1) = l2.z(); Rsub(2,2) = l3.z();
00039   */
00040   
00041   AlgebraicMatrix33 Rsub;
00042   // need to be copied anhhow to go from float to double...
00043   Surface::RotationType const & rot = surface.rotation();
00044   Rsub(0,0) = rot.xx(); Rsub(0,1) = rot.xy(); Rsub(0,2) = rot.xz();
00045   Rsub(1,0) = rot.yx(); Rsub(1,1) = rot.yy(); Rsub(1,2) = rot.yz();
00046   Rsub(2,0) = rot.zx(); Rsub(2,1) = rot.zy(); Rsub(2,2) = rot.zz();
00047 
00048 
00049 
00050   AlgebraicMatrix66 R;
00051   R.Place_at(Rsub,0,0);
00052   R.Place_at(Rsub,3,3);
00053   theJacobian = theJacobian * R;
00054   //dbg::dbg_trace(1,"Ca2L", localParameters.vector(),l1,l2,l3,theJacobian);
00055 }