CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/TrackingTools/AnalyticalJacobians/src/JacobianLocalToCartesian.cc

Go to the documentation of this file.
00001 #include "TrackingTools/AnalyticalJacobians/interface/JacobianLocalToCartesian.h"
00002 #include "DataFormats/GeometrySurface/interface/Surface.h"
00003 #include "DataFormats/TrajectoryState/interface/LocalTrajectoryParameters.h"
00004 
00005 JacobianLocalToCartesian::JacobianLocalToCartesian(const Surface& surface, 
00006                              const LocalTrajectoryParameters& localParameters) : theJacobian() {
00007   
00008   //LocalCoordinates 1 = (x, y, z, px, py, pz)
00009   //LocalCoordinates 2 = (q/|p|, dx/dz, dy/dz, x, y)
00010   //Transformation: x  = x
00011   //                y  = y
00012   //          px = (q/(q/|p|)) * (dx/dz) *  sqrt(1./(1.+(dx/dz)^2+(dy/dz)^2))
00013   //          py = (q/(q/|p|)) * (dy/dz) * sqrt(1./(1.+(dx/dz)^2+(dy/dz)^2))
00014   //          pz = (q/(q/|p|)) * sqrt(1./(1.+(dx/dz)^2+(dy/dz)^2))
00015   //Jacobian J((x, y, px, py, pz)  = f(q/|p|, dx/dz, dy/dz, x, y))
00016 
00017   // AlgebraicVector5 localTrackParams = localParameters.mixedFormatVector();
00018   double qbp = localParameters.qbp();
00019   double dxdz = localParameters.dxdz();
00020   double dydz = localParameters.dydz();
00021   TrackCharge iq = localParameters.charge();
00022   // for neutrals: qbp is 1/p instead of q/p - 
00023   //   equivalent to charge 1
00024   if ( iq==0 )  iq = 1;
00025   double pzSign = localParameters.pzSign();
00026   double q = iq*pzSign;
00027   double sqr = sqrt(dxdz*dxdz + dydz*dydz + 1);
00028   double den = -q/(sqr*sqr*sqr*qbp);
00029 
00030   // no difference between local and data member
00031   AlgebraicMatrix65 & lJacobian = theJacobian;
00032   lJacobian(0,3) = 1.;
00033   lJacobian(1,4) = 1.;
00034   lJacobian(3,0) = ( dxdz*(-q/(sqr*qbp*qbp)) ); 
00035   lJacobian(3,1) = ( q/(sqr*qbp) + (den*dxdz*dxdz) );
00036   lJacobian(3,2) = ( (den*dxdz*dydz) );
00037   lJacobian(4,0) = ( dydz*(-q/(sqr*qbp*qbp)) );
00038   lJacobian(4,1) = ( (den*dxdz*dydz) );
00039   lJacobian(4,2) = ( q/(sqr*qbp) + (den*dydz*dydz) );
00040   lJacobian(5,0) = ( -q/(sqr*qbp*qbp) );
00041   lJacobian(5,1) = ( (den*dxdz) );
00042   lJacobian(5,2) = ( (den*dydz) );
00043   
00044   /*
00045   GlobalVector g1 = surface.toGlobal(LocalVector(1., 0., 0.));
00046   GlobalVector g2 = surface.toGlobal(LocalVector(0., 1., 0.));
00047   GlobalVector g3 = surface.toGlobal(LocalVector(0., 0., 1.));
00048   */
00049   AlgebraicMatrix33 Rsub;
00050   /*
00051   Rsub(0,0) = g1.x(); Rsub(0,1) = g2.x(); Rsub(0,2) = g3.x();
00052   Rsub(1,0) = g1.y(); Rsub(1,1) = g2.y(); Rsub(1,2) = g3.y();
00053   Rsub(2,0) = g1.z(); Rsub(2,1) = g2.z(); Rsub(2,2) = g3.z();
00054   */
00055   // need to be copied anhhow to go from float to double...
00056   Surface::RotationType const & rot = surface.rotation();
00057   Rsub(0,0) = rot.xx(); Rsub(0,1) = rot.yx(); Rsub(0,2) = rot.zx();
00058   Rsub(1,0) = rot.xy(); Rsub(1,1) = rot.yy(); Rsub(1,2) = rot.zy();
00059   Rsub(2,0) = rot.xz(); Rsub(2,1) = rot.yz(); Rsub(2,2) = rot.zz();
00060 
00061   AlgebraicMatrix66 R;
00062   R.Place_at(Rsub, 0,0);
00063   R.Place_at(Rsub, 3,3);
00064   theJacobian = R * lJacobian;
00065   //dbg::dbg_trace(1,"Loc2Ca", localParameters.vector(),g1,g2,g3,theJacobian);
00066 }
00067