CMS 3D CMS Logo

Functions
TrackingJacobians.h File Reference
#include "DataFormats/Math/interface/AlgebraicROOTObjects.h"
#include "DataFormats/GeometryVector/interface/GlobalVector.h"

Go to the source code of this file.

Functions

AlgebraicMatrix56 jacobianCartesianToCurvilinear (const GlobalVector &momentum, int charge)
 
AlgebraicMatrix65 jacobianCurvilinearToCartesian (const GlobalVector &momentum, int charge)
 

Function Documentation

◆ jacobianCartesianToCurvilinear()

AlgebraicMatrix56 jacobianCartesianToCurvilinear ( const GlobalVector momentum,
int  charge 
)

Definition at line 63 of file TrackingJacobians.cc.

63  {
64  AlgebraicMatrix56 theJacobian;
65  GlobalVector xt = momentum;
66  GlobalVector yt(-xt.y(), xt.x(), 0.);
67  GlobalVector zt = xt.cross(yt);
68  const GlobalVector& pvec = momentum;
69  double pt = pvec.perp(), p = pvec.mag();
70  double px = pvec.x(), py = pvec.y(), pz = pvec.z();
71  double pt2 = pt * pt, p2 = p * p, p3 = p * p * p;
72  // for neutrals: qbp is 1/p instead of q/p -
73  // equivalent to charge 1
74  if (q == 0)
75  q = 1;
76  xt = xt.unit();
77  if (fabs(pt) > 0) {
78  yt = yt.unit();
79  zt = zt.unit();
80  }
81 
83  R(0, 0) = xt.x();
84  R(0, 1) = xt.y();
85  R(0, 2) = xt.z();
86  R(1, 0) = yt.x();
87  R(1, 1) = yt.y();
88  R(1, 2) = yt.z();
89  R(2, 0) = zt.x();
90  R(2, 1) = zt.y();
91  R(2, 2) = zt.z();
92  R(3, 3) = 1.;
93  R(4, 4) = 1.;
94  R(5, 5) = 1.;
95 
96  theJacobian(0, 3) = -q * px / p3;
97  theJacobian(0, 4) = -q * py / p3;
98  theJacobian(0, 5) = -q * pz / p3;
99  if (fabs(pt) > 0) {
100  //theJacobian(1,3) = (px*pz)/(pt*p2); theJacobian(1,4) = (py*pz)/(pt*p2); theJacobian(1,5) = -pt/p2; //wrong sign
101  theJacobian(1, 3) = -(px * pz) / (pt * p2);
102  theJacobian(1, 4) = -(py * pz) / (pt * p2);
103  theJacobian(1, 5) = pt / p2;
104  theJacobian(2, 3) = -py / pt2;
105  theJacobian(2, 4) = px / pt2;
106  theJacobian(2, 5) = 0.;
107  }
108  theJacobian(3, 1) = 1.;
109  theJacobian(4, 2) = 1.;
110  theJacobian = theJacobian * R;
111  //dbg::dbg_trace(1,"Ca2Cu", globalParameters.vector(),theJacobian);
112  return theJacobian;
113 }

References Vector3DBase< T, FrameTag >::cross(), PV3DBase< T, PVType, FrameType >::mag(), AlCaHLTBitMon_ParallelJobs::p, p2, p3, PV3DBase< T, PVType, FrameType >::perp(), DiDispStaMuonMonitor_cfi::pt, HLT_FULL_cff::pt2, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, submitPVResolutionJobs::q, dttmaxenums::R, Vector3DBase< T, FrameTag >::unit(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

◆ jacobianCurvilinearToCartesian()

AlgebraicMatrix65 jacobianCurvilinearToCartesian ( const GlobalVector momentum,
int  charge 
)

Definition at line 5 of file TrackingJacobians.cc.

5  {
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 lambda = 0.5 * M_PI - pvec.theta();
40  double phi = pvec.phi();
41  double sinlambda = sin(lambda), coslambda = cos(lambda);
42  double sinphi = sin(phi), cosphi = cos(phi);
43 
44  theJacobian(1, 3) = 1.;
45  theJacobian(2, 4) = 1.;
46  theJacobian(3, 0) = -q * p2 * coslambda * cosphi;
47  theJacobian(3, 1) = -p * sinlambda * cosphi;
48  theJacobian(3, 2) = -p * coslambda * sinphi;
49  theJacobian(4, 0) = -q * p2 * coslambda * sinphi;
50  theJacobian(4, 1) = -p * sinlambda * sinphi;
51  theJacobian(4, 2) = p * coslambda * cosphi;
52  theJacobian(5, 0) = -q * p2 * sinlambda;
53  theJacobian(5, 1) = p * coslambda;
54  theJacobian(5, 2) = 0.;
55 
56  //ErrorPropagation:
57  // C(Cart) = R(6*6) * J(6*5) * C(Curvi) * J(5*6)_T * R(6*6)_T
58  theJacobian = R * theJacobian;
59  //dbg::dbg_trace(1,"Cu2Ca", globalParameters.vector(),theJacobian);
60  return theJacobian;
61 }

References funct::cos(), Vector3DBase< T, FrameTag >::cross(), M_PI, PV3DBase< T, PVType, FrameType >::mag(), AlCaHLTBitMon_ParallelJobs::p, p2, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), PVValHelper::phi, DiDispStaMuonMonitor_cfi::pt, submitPVResolutionJobs::q, dttmaxenums::R, funct::sin(), PV3DBase< T, PVType, FrameType >::theta(), Vector3DBase< T, FrameTag >::unit(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Vector3DBase
Definition: Vector3DBase.h:8
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
PV3DBase::theta
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
AlgebraicMatrix56
ROOT::Math::SMatrix< double, 5, 6, ROOT::Math::MatRepStd< double, 5, 6 > > AlgebraicMatrix56
Definition: AlgebraicROOTObjects.h:56
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
Vector3DBase::unit
Vector3DBase unit() const
Definition: Vector3DBase.h:54
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
p2
double p2[4]
Definition: TauolaWrapper.h:90
PVValHelper::phi
Definition: PVValidationHelpers.h:68
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
Vector3DBase::cross
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:110
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
HLT_FULL_cff.pt2
pt2
Definition: HLT_FULL_cff.py:9872
AlgebraicMatrix65
ROOT::Math::SMatrix< double, 6, 5, ROOT::Math::MatRepStd< double, 6, 5 > > AlgebraicMatrix65
Definition: AlgebraicROOTObjects.h:61
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
AlgebraicMatrix66
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepStd< double, 6, 6 > > AlgebraicMatrix66
Definition: AlgebraicROOTObjects.h:62
p3
double p3[4]
Definition: TauolaWrapper.h:91
dttmaxenums::R
Definition: DTTMax.h:29
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66