CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TrackingJacobians.cc
Go to the documentation of this file.
2 
3 // Code moved from TrackingTools/AnalyticalJacobians
4 
6  AlgebraicMatrix65 theJacobian;
7  GlobalVector xt = momentum;
8  GlobalVector yt(-xt.y(), xt.x(), 0.);
9  GlobalVector zt = xt.cross(yt);
10 
11  const GlobalVector& pvec = momentum;
12  double pt = pvec.perp();
13  // for neutrals: qbp is 1/p instead of q/p -
14  // equivalent to charge 1
15  if (q == 0)
16  q = 1;
17 
18  xt = xt.unit();
19  if (fabs(pt) > 0) {
20  yt = yt.unit();
21  zt = zt.unit();
22  }
23 
25  R(0, 0) = xt.x();
26  R(0, 1) = yt.x();
27  R(0, 2) = zt.x();
28  R(1, 0) = xt.y();
29  R(1, 1) = yt.y();
30  R(1, 2) = zt.y();
31  R(2, 0) = xt.z();
32  R(2, 1) = yt.z();
33  R(2, 2) = zt.z();
34  R(3, 3) = 1.;
35  R(4, 4) = 1.;
36  R(5, 5) = 1.;
37 
38  double p = pvec.mag(), p2 = p * p;
39  double sinlambda = pvec.z() / p, coslambda = pt / p;
40  double sinphi = pvec.y() / pt, cosphi = pvec.x() / pt;
41 
42  theJacobian(1, 3) = 1.;
43  theJacobian(2, 4) = 1.;
44  theJacobian(3, 0) = -q * p2 * coslambda * cosphi;
45  theJacobian(3, 1) = -p * sinlambda * cosphi;
46  theJacobian(3, 2) = -p * coslambda * sinphi;
47  theJacobian(4, 0) = -q * p2 * coslambda * sinphi;
48  theJacobian(4, 1) = -p * sinlambda * sinphi;
49  theJacobian(4, 2) = p * coslambda * cosphi;
50  theJacobian(5, 0) = -q * p2 * sinlambda;
51  theJacobian(5, 1) = p * coslambda;
52  theJacobian(5, 2) = 0.;
53 
54  //ErrorPropagation:
55  // C(Cart) = R(6*6) * J(6*5) * C(Curvi) * J(5*6)_T * R(6*6)_T
56  theJacobian = R * theJacobian;
57  //dbg::dbg_trace(1,"Cu2Ca", globalParameters.vector(),theJacobian);
58  return theJacobian;
59 }
60 
62  AlgebraicMatrix56 theJacobian;
63  GlobalVector xt = momentum;
64  GlobalVector yt(-xt.y(), xt.x(), 0.);
65  GlobalVector zt = xt.cross(yt);
66  const GlobalVector& pvec = momentum;
67  double pt = pvec.perp(), p = pvec.mag();
68  double px = pvec.x(), py = pvec.y(), pz = pvec.z();
69  double pt2 = pt * pt, p2 = p * p, p3 = p * p * p;
70  // for neutrals: qbp is 1/p instead of q/p -
71  // equivalent to charge 1
72  if (q == 0)
73  q = 1;
74  xt = xt.unit();
75  if (fabs(pt) > 0) {
76  yt = yt.unit();
77  zt = zt.unit();
78  }
79 
81  R(0, 0) = xt.x();
82  R(0, 1) = xt.y();
83  R(0, 2) = xt.z();
84  R(1, 0) = yt.x();
85  R(1, 1) = yt.y();
86  R(1, 2) = yt.z();
87  R(2, 0) = zt.x();
88  R(2, 1) = zt.y();
89  R(2, 2) = zt.z();
90  R(3, 3) = 1.;
91  R(4, 4) = 1.;
92  R(5, 5) = 1.;
93 
94  theJacobian(0, 3) = -q * px / p3;
95  theJacobian(0, 4) = -q * py / p3;
96  theJacobian(0, 5) = -q * pz / p3;
97  if (fabs(pt) > 0) {
98  //theJacobian(1,3) = (px*pz)/(pt*p2); theJacobian(1,4) = (py*pz)/(pt*p2); theJacobian(1,5) = -pt/p2; //wrong sign
99  theJacobian(1, 3) = -(px * pz) / (pt * p2);
100  theJacobian(1, 4) = -(py * pz) / (pt * p2);
101  theJacobian(1, 5) = pt / p2;
102  theJacobian(2, 3) = -py / pt2;
103  theJacobian(2, 4) = px / pt2;
104  theJacobian(2, 5) = 0.;
105  }
106  theJacobian(3, 1) = 1.;
107  theJacobian(4, 2) = 1.;
108  theJacobian = theJacobian * R;
109  //dbg::dbg_trace(1,"Ca2Cu", globalParameters.vector(),theJacobian);
110  return theJacobian;
111 }
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:110
T perp() const
Definition: PV3DBase.h:69
const TString p2
Definition: fwPaths.cc:13
float const *__restrict__ zt
AlgebraicMatrix65 jacobianCurvilinearToCartesian(const GlobalVector &momentum, int charge)
T y() const
Definition: PV3DBase.h:60
AlgebraicMatrix56 jacobianCartesianToCurvilinear(const GlobalVector &momentum, int charge)
ROOT::Math::SMatrix< double, 5, 6, ROOT::Math::MatRepStd< double, 5, 6 > > AlgebraicMatrix56
T mag() const
Definition: PV3DBase.h:64
T z() const
Definition: PV3DBase.h:61
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepStd< double, 6, 6 > > AlgebraicMatrix66
Vector3DBase unit() const
Definition: Vector3DBase.h:54
ROOT::Math::SMatrix< double, 6, 5, ROOT::Math::MatRepStd< double, 6, 5 > > AlgebraicMatrix65
T x() const
Definition: PV3DBase.h:59