CMS 3D CMS Logo

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   LocalVector l1 = surface.toLocal(GlobalVector(1., 0., 0.));
00031   LocalVector l2 = surface.toLocal(GlobalVector(0., 1., 0.));
00032   LocalVector l3 = surface.toLocal(GlobalVector(0., 0., 1.));
00033   AlgebraicMatrix33 Rsub;
00034   Rsub(0,0) = l1.x(); Rsub(0,1) = l2.x(); Rsub(0,2) = l3.x();
00035   Rsub(1,0) = l1.y(); Rsub(1,1) = l2.y(); Rsub(1,2) = l3.y();
00036   Rsub(2,0) = l1.z(); Rsub(2,1) = l2.z(); Rsub(2,2) = l3.z();
00037 
00038   AlgebraicMatrix66 R;
00039   R.Place_at(Rsub,0,0);
00040   R.Place_at(Rsub,3,3);
00041   theJacobian = theJacobian * R;
00042   //dbg::dbg_trace(1,"Ca2L", localParameters.vector(),l1,l2,l3,theJacobian);
00043 }
00044 const AlgebraicMatrix JacobianCartesianToLocal::jacobian_old() const {
00045   return asHepMatrix(theJacobian);
00046 }
00047 const AlgebraicMatrix56& JacobianCartesianToLocal::jacobian() const {
00048   return theJacobian;
00049 }

Generated on Tue Jun 9 17:48:15 2009 for CMSSW by  doxygen 1.5.4