CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10/src/TrackingTools/AnalyticalJacobians/src/JacobianCurvilinearToCartesian.cc

Go to the documentation of this file.
00001 #include "TrackingTools/AnalyticalJacobians/interface/JacobianCurvilinearToCartesian.h"
00002 #include "TrackingTools/TrajectoryParametrization/interface/GlobalTrajectoryParameters.h"
00003 
00004 JacobianCurvilinearToCartesian::
00005 JacobianCurvilinearToCartesian(const GlobalTrajectoryParameters& globalParameters) : theJacobian() {
00006   GlobalVector xt = globalParameters.momentum();
00007   //GlobalVector yt(xt.y(), -xt.x(), 0.); \\wrong direction of the axis
00008   //GlobalVector zt(xt.x()*xt.z(), xt.y()*xt.z(), -xt.perp2()); \\and then also on this one
00009   GlobalVector yt(-xt.y(), xt.x(), 0.); 
00010   GlobalVector zt = xt.cross(yt);
00011 
00012   GlobalVector pvec = globalParameters.momentum();
00013   double pt = pvec.perp();
00014   TrackCharge q = globalParameters.charge();
00015   // for neutrals: qbp is 1/p instead of q/p - 
00016   //   equivalent to charge 1
00017   if ( q==0 )  q = 1;
00018 
00019   xt = xt.unit(); 
00020   if(fabs(pt) > 0){
00021     yt = yt.unit(); 
00022     zt = zt.unit();
00023   }
00024   
00025   AlgebraicMatrix66 R;
00026   R(0,0) = xt.x(); R(0,1) = yt.x(); R(0,2) = zt.x();
00027   R(1,0) = xt.y(); R(1,1) = yt.y(); R(1,2) = zt.y();
00028   R(2,0) = xt.z(); R(2,1) = yt.z(); R(2,2) = zt.z();
00029   R(3,3) = 1.;
00030   R(4,4) = 1.;
00031   R(5,5) = 1.;
00032 
00033   double p = pvec.mag(), p2 = p*p;
00034   double lambda = 0.5 * M_PI - pvec.theta();
00035   double phi = pvec.phi();
00036   double sinlambda = sin(lambda), coslambda = cos(lambda);
00037   double sinphi = sin(phi), cosphi = cos(phi);
00038 
00039   theJacobian(1,3) = 1.;
00040   theJacobian(2,4) = 1.;
00041   theJacobian(3,0) = -q * p2 * coslambda * cosphi;
00042   theJacobian(3,1) = -p * sinlambda * cosphi;
00043   theJacobian(3,2) = -p * coslambda * sinphi;
00044   theJacobian(4,0) = -q * p2 * coslambda * sinphi;
00045   theJacobian(4,1) = -p * sinlambda * sinphi;
00046   theJacobian(4,2) = p * coslambda * cosphi;
00047   theJacobian(5,0) = -q * p2 * sinlambda;
00048   theJacobian(5,1) = p * coslambda;
00049   theJacobian(5,2) = 0.;
00050 
00051   //ErrorPropagation: 
00052   //    C(Cart) = R(6*6) * J(6*5) * C(Curvi) * J(5*6)_T * R(6*6)_T
00053   theJacobian = R*theJacobian;
00054   //dbg::dbg_trace(1,"Cu2Ca", globalParameters.vector(),theJacobian);
00055 }