CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
JacobianLocalToCartesian Class Reference

#include <JacobianLocalToCartesian.h>

Public Member Functions

const AlgebraicMatrix65jacobian () const
 
 JacobianLocalToCartesian (const Surface &surface, const LocalTrajectoryParameters &localParameters)
 

Private Attributes

AlgebraicMatrix65 theJacobian
 

Detailed Description

Class which calculates the Jacobian matrix of the transformation from the local to the Caresian frame. The Jacobian is calculated during construction and thereafter cached, enabling reuse of the same Jacobian without calculating it again.

Definition at line 15 of file JacobianLocalToCartesian.h.

Constructor & Destructor Documentation

◆ JacobianLocalToCartesian()

JacobianLocalToCartesian::JacobianLocalToCartesian ( const Surface surface,
const LocalTrajectoryParameters localParameters 
)

Constructor from local trajectory parameters and surface defining the local frame. NB!! No default constructor exists!

Definition at line 5 of file JacobianLocalToCartesian.cc.

References LocalTrajectoryParameters::charge(), dxdz, LocalTrajectoryParameters::dxdz(), dydz, LocalTrajectoryParameters::dydz(), LocalTrajectoryParameters::pzSign(), submitPVResolutionJobs::q, LocalTrajectoryParameters::qbp(), dttmaxenums::R, makeMuonMisalignmentScenario::rot, GloballyPositioned< T >::rotation(), sqr(), mathSSE::sqrt(), and theJacobian.

7  : theJacobian() {
8  //LocalCoordinates 1 = (x, y, z, px, py, pz)
9  //LocalCoordinates 2 = (q/|p|, dx/dz, dy/dz, x, y)
10  //Transformation: x = x
11  // y = y
12  // px = (q/(q/|p|)) * (dx/dz) * sqrt(1./(1.+(dx/dz)^2+(dy/dz)^2))
13  // py = (q/(q/|p|)) * (dy/dz) * sqrt(1./(1.+(dx/dz)^2+(dy/dz)^2))
14  // pz = (q/(q/|p|)) * sqrt(1./(1.+(dx/dz)^2+(dy/dz)^2))
15  //Jacobian J((x, y, px, py, pz) = f(q/|p|, dx/dz, dy/dz, x, y))
16 
17  // AlgebraicVector5 localTrackParams = localParameters.mixedFormatVector();
18  double qbp = localParameters.qbp();
19  double dxdz = localParameters.dxdz();
20  double dydz = localParameters.dydz();
21  TrackCharge iq = localParameters.charge();
22  // for neutrals: qbp is 1/p instead of q/p -
23  // equivalent to charge 1
24  if (iq == 0)
25  iq = 1;
26  double pzSign = localParameters.pzSign();
27  double q = iq * pzSign;
28  double sqr = sqrt(dxdz * dxdz + dydz * dydz + 1);
29  double den = -q / (sqr * sqr * sqr * qbp);
30 
31  // no difference between local and data member
32  AlgebraicMatrix65& lJacobian = theJacobian;
33  lJacobian(0, 3) = 1.;
34  lJacobian(1, 4) = 1.;
35  lJacobian(3, 0) = (dxdz * (-q / (sqr * qbp * qbp)));
36  lJacobian(3, 1) = (q / (sqr * qbp) + (den * dxdz * dxdz));
37  lJacobian(3, 2) = ((den * dxdz * dydz));
38  lJacobian(4, 0) = (dydz * (-q / (sqr * qbp * qbp)));
39  lJacobian(4, 1) = ((den * dxdz * dydz));
40  lJacobian(4, 2) = (q / (sqr * qbp) + (den * dydz * dydz));
41  lJacobian(5, 0) = (-q / (sqr * qbp * qbp));
42  lJacobian(5, 1) = ((den * dxdz));
43  lJacobian(5, 2) = ((den * dydz));
44 
45  /*
46  GlobalVector g1 = surface.toGlobal(LocalVector(1., 0., 0.));
47  GlobalVector g2 = surface.toGlobal(LocalVector(0., 1., 0.));
48  GlobalVector g3 = surface.toGlobal(LocalVector(0., 0., 1.));
49  */
50  AlgebraicMatrix33 Rsub;
51  /*
52  Rsub(0,0) = g1.x(); Rsub(0,1) = g2.x(); Rsub(0,2) = g3.x();
53  Rsub(1,0) = g1.y(); Rsub(1,1) = g2.y(); Rsub(1,2) = g3.y();
54  Rsub(2,0) = g1.z(); Rsub(2,1) = g2.z(); Rsub(2,2) = g3.z();
55  */
56  // need to be copied anhhow to go from float to double...
57  Surface::RotationType const& rot = surface.rotation();
58  Rsub(0, 0) = rot.xx();
59  Rsub(0, 1) = rot.yx();
60  Rsub(0, 2) = rot.zx();
61  Rsub(1, 0) = rot.xy();
62  Rsub(1, 1) = rot.yy();
63  Rsub(1, 2) = rot.zy();
64  Rsub(2, 0) = rot.xz();
65  Rsub(2, 1) = rot.yz();
66  Rsub(2, 2) = rot.zz();
67 
69  R.Place_at(Rsub, 0, 0);
70  R.Place_at(Rsub, 3, 3);
71  theJacobian = R * lJacobian;
72  //dbg::dbg_trace(1,"Loc2Ca", localParameters.vector(),g1,g2,g3,theJacobian);
73 }
float pzSign() const
Sign of the z-component of the momentum in the local frame.
float dydz
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepStd< double, 3, 3 > > AlgebraicMatrix33
float dxdz
int sqr(const T &t)
int TrackCharge
Definition: TrackCharge.h:4
T sqrt(T t)
Definition: SSEVec.h:19
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepStd< double, 6, 6 > > AlgebraicMatrix66
TrackCharge charge() const
Charge (-1, 0 or 1)
const RotationType & rotation() const
ROOT::Math::SMatrix< double, 6, 5, ROOT::Math::MatRepStd< double, 6, 5 > > AlgebraicMatrix65

Member Function Documentation

◆ jacobian()

const AlgebraicMatrix65& JacobianLocalToCartesian::jacobian ( ) const
inline

Access to Jacobian.

Definition at line 26 of file JacobianLocalToCartesian.h.

References theJacobian.

26 { return theJacobian; }

Member Data Documentation

◆ theJacobian

AlgebraicMatrix65 JacobianLocalToCartesian::theJacobian
private

Definition at line 29 of file JacobianLocalToCartesian.h.

Referenced by jacobian(), and JacobianLocalToCartesian().