CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/TrackingTools/AnalyticalJacobians/src/JacobianCartesianToCurvilinear.cc

Go to the documentation of this file.
00001 #include "TrackingTools/AnalyticalJacobians/interface/JacobianCartesianToCurvilinear.h"
00002 #include "TrackingTools/TrajectoryParametrization/interface/GlobalTrajectoryParameters.h"
00003 
00004 JacobianCartesianToCurvilinear::
00005 JacobianCartesianToCurvilinear(const GlobalTrajectoryParameters& globalParameters) : theJacobian() {
00006   
00007   GlobalVector xt = globalParameters.momentum();
00008   //GlobalVector yt(xt.y(), -xt.x(), 0.); \\wrong direction of the axis
00009   //GlobalVector zt(xt.x()*xt.z(), xt.y()*xt.z(), -xt.perp2()); \\and then also on this one
00010   GlobalVector yt(-xt.y(), xt.x(), 0.);
00011   GlobalVector zt = xt.cross(yt);
00012   GlobalVector pvec = globalParameters.momentum();
00013   double pt = pvec.perp(), p = pvec.mag();
00014   double px = pvec.x(), py = pvec.y(), pz = pvec.z();
00015   double pt2 = pt*pt, p2 = p*p, p3 = p*p*p;
00016   TrackCharge q = globalParameters.charge();
00017   // for neutrals: qbp is 1/p instead of q/p - 
00018   //   equivalent to charge 1
00019   if ( q==0 )  q = 1;
00020   xt = xt.unit(); 
00021   if(fabs(pt) > 0){
00022     yt = yt.unit(); 
00023     zt = zt.unit();
00024   }
00025   
00026   AlgebraicMatrix66 R;
00027   R(0,0) = xt.x(); R(0,1) = xt.y(); R(0,2) = xt.z();
00028   R(1,0) = yt.x(); R(1,1) = yt.y(); R(1,2) = yt.z();
00029   R(2,0) = zt.x(); R(2,1) = zt.y(); R(2,2) = zt.z();
00030   R(3,3) = 1.;
00031   R(4,4) = 1.;
00032   R(5,5) = 1.;
00033 
00034   theJacobian(0,3) = -q*px/p3;        theJacobian(0,4) = -q*py/p3;        theJacobian(0,5) = -q*pz/p3;
00035   if(fabs(pt) > 0){
00036     //theJacobian(1,3) = (px*pz)/(pt*p2); theJacobian(1,4) = (py*pz)/(pt*p2); theJacobian(1,5) = -pt/p2; //wrong sign
00037     theJacobian(1,3) = -(px*pz)/(pt*p2); theJacobian(1,4) = -(py*pz)/(pt*p2); theJacobian(1,5) = pt/p2;
00038     theJacobian(2,3) = -py/pt2;         theJacobian(2,4) = px/pt2;          theJacobian(2,5) = 0.;
00039   }
00040   theJacobian(3,1) = 1.;
00041   theJacobian(4,2) = 1.;
00042   theJacobian = theJacobian * R;
00043   //dbg::dbg_trace(1,"Ca2Cu", globalParameters.vector(),theJacobian);
00044 }