CMS 3D CMS Logo

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

#include <JacobianCurvilinearToLocal.h>

Public Member Functions

const AlgebraicMatrix55jacobian () const
 
 JacobianCurvilinearToLocal (const Surface &surface, const LocalTrajectoryParameters &localParameters, const GlobalTrajectoryParameters &globalParameters, const MagneticField &magField)
 
 JacobianCurvilinearToLocal (const Surface &surface, const LocalTrajectoryParameters &localParameters, const MagneticField &magField)
 

Private Member Functions

void compute (Surface::RotationType const &rot, GlobalVector const &tn, GlobalVector const &qh, double lz)
 

Private Attributes

AlgebraicMatrix55 theJacobian
 

Detailed Description

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

Definition at line 19 of file JacobianCurvilinearToLocal.h.

Constructor & Destructor Documentation

◆ JacobianCurvilinearToLocal() [1/2]

JacobianCurvilinearToLocal::JacobianCurvilinearToLocal ( const Surface surface,
const LocalTrajectoryParameters localParameters,
const MagneticField magField 
)

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

Definition at line 8 of file JacobianCurvilinearToLocal.cc.

11  : theJacobian(ROOT::Math::SMatrixNoInit()) {
12  GlobalPoint x = surface.toGlobal(localParameters.position());
13  GlobalVector h = magField.inInverseGeV(x);
14  GlobalVector qh = h * localParameters.signedInverseMomentum(); // changed sign
15 
16  LocalVector tnl = localParameters.direction();
17  GlobalVector tn = surface.toGlobal(tnl);
18  double t1r = 1. / tnl.z();
19 
20  Surface::RotationType const& rot = surface.rotation();
21 
22  compute(rot, tn, qh, t1r);
23 }

References compute(), LocalTrajectoryParameters::direction(), MagneticField::inInverseGeV(), LocalTrajectoryParameters::position(), makeMuonMisalignmentScenario::rot, GloballyPositioned< T >::rotation(), LocalTrajectoryParameters::signedInverseMomentum(), Surface::toGlobal(), x, and PV3DBase< T, PVType, FrameType >::z().

◆ JacobianCurvilinearToLocal() [2/2]

JacobianCurvilinearToLocal::JacobianCurvilinearToLocal ( const Surface surface,
const LocalTrajectoryParameters localParameters,
const GlobalTrajectoryParameters globalParameters,
const MagneticField magField 
)

Definition at line 25 of file JacobianCurvilinearToLocal.cc.

29  : theJacobian(ROOT::Math::SMatrixNoInit()) {
30  // GlobalPoint x = globalParameters.position();
31  // GlobalVector h = magField.inInverseGeV(x);
32  GlobalVector h = globalParameters.magneticFieldInInverseGeV();
33  GlobalVector qh = h * localParameters.signedInverseMomentum(); // changed sign
34 
35  LocalVector tnl = localParameters.direction();
36  // GlobalVector tn = surface.toGlobal(tnl); // faster?
37  GlobalVector tn = globalParameters.momentum() * std::abs(localParameters.signedInverseMomentum());
38  double t1r = 1. / tnl.z();
39 
40  Surface::RotationType const& rot = surface.rotation();
41 
42  compute(rot, tn, qh, t1r);
43 }

References funct::abs(), compute(), LocalTrajectoryParameters::direction(), GlobalTrajectoryParameters::magneticFieldInInverseGeV(), GlobalTrajectoryParameters::momentum(), makeMuonMisalignmentScenario::rot, GloballyPositioned< T >::rotation(), LocalTrajectoryParameters::signedInverseMomentum(), and PV3DBase< T, PVType, FrameType >::z().

Member Function Documentation

◆ compute()

void JacobianCurvilinearToLocal::compute ( Surface::RotationType const &  rot,
GlobalVector const &  tn,
GlobalVector const &  qh,
double  lz 
)
private

Definition at line 45 of file JacobianCurvilinearToLocal.cc.

48  {
49  // Origin: TRSCSD
50 
51  double cosl = tn.perp();
52  if (cosl < 1.e-30)
53  cosl = 1.e-30;
54  double cosl1 = 1. / cosl;
55  GlobalVector un(-tn.y() * cosl1, tn.x() * cosl1, 0.);
56  GlobalVector vn(-tn.z() * un.y(), tn.z() * un.x(), cosl);
57 
58  auto u = rot.rotate(un.basicVector());
59  auto v = rot.rotate(vn.basicVector());
60 
61  int j = 0, k = 1, i = 2;
62 
63  double t2r = t1r * t1r;
64  double t3r = t1r * t2r;
65 
66  theJacobian(0, 0) = 1.;
67  for (auto i = 1; i < 5; ++i)
68  theJacobian(0, i) = 0.;
69  theJacobian(1, 0) = 0.;
70  theJacobian(2, 0) = 0.;
71 
72  theJacobian(1, 1) = -u[k] * t2r;
73  theJacobian(1, 2) = v[k] * (cosl * t2r);
74  theJacobian(2, 1) = u[j] * t2r;
75  theJacobian(2, 2) = -v[j] * (cosl * t2r);
76 
77  for (auto i = 0; i < 3; ++i) {
78  theJacobian(3, i) = 0.;
79  theJacobian(4, i) = 0.;
80  }
81 
82  theJacobian(3, 3) = v[k] * t1r;
83  theJacobian(3, 4) = -u[k] * t1r;
84  theJacobian(4, 3) = -v[j] * t1r;
85  theJacobian(4, 4) = u[j] * t1r;
86 
87  double sinz = un.dot(qh);
88  double cosz = -vn.dot(qh);
89  double ui = u[i] * (t3r);
90  double vi = v[i] * (t3r);
91  theJacobian(1, 3) = -ui * (v[k] * cosz - u[k] * sinz);
92  theJacobian(1, 4) = -vi * (v[k] * cosz - u[k] * sinz);
93  theJacobian(2, 3) = ui * (v[j] * cosz - u[j] * sinz);
94  theJacobian(2, 4) = vi * (v[j] * cosz - u[j] * sinz);
95  // end of TRSCSD
96  //dbg::dbg_trace(1,"Cu2L", localParameters.vector(),di,dj,dk,theJacobian);
97 }

References PV3DBase< T, PVType, FrameType >::basicVector(), Vector3DBase< T, FrameTag >::dot(), MillePedeFileConverter_cfg::e, mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, PV3DBase< T, PVType, FrameType >::perp(), makeMuonMisalignmentScenario::rot, theJacobian, interactiveExample::ui, findQualityFiles::v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by JacobianCurvilinearToLocal().

◆ jacobian()

const AlgebraicMatrix55& JacobianCurvilinearToLocal::jacobian ( ) const
inline

Member Data Documentation

◆ theJacobian

AlgebraicMatrix55 JacobianCurvilinearToLocal::theJacobian
private

Definition at line 42 of file JacobianCurvilinearToLocal.h.

Referenced by compute(), and jacobian().

Vector3DBase
Definition: Vector3DBase.h:8
interactiveExample.ui
ui
Definition: interactiveExample.py:13
JacobianCurvilinearToLocal::compute
void compute(Surface::RotationType const &rot, GlobalVector const &tn, GlobalVector const &qh, double lz)
Definition: JacobianCurvilinearToLocal.cc:45
TkRotation< float >
mps_fire.i
i
Definition: mps_fire.py:428
LocalTrajectoryParameters::signedInverseMomentum
float signedInverseMomentum() const
Signed inverse momentum q/p (zero for neutrals).
Definition: LocalTrajectoryParameters.h:113
LocalTrajectoryParameters::direction
LocalVector direction() const
Momentum vector unit in the local frame.
Definition: LocalTrajectoryParameters.h:99
DDAxes::x
findQualityFiles.v
v
Definition: findQualityFiles.py:179
JacobianCurvilinearToLocal::theJacobian
AlgebraicMatrix55 theJacobian
Definition: JacobianCurvilinearToLocal.h:42
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
LocalTrajectoryParameters::position
LocalPoint position() const
Local x and y position coordinates.
Definition: LocalTrajectoryParameters.h:85
Surface::toGlobal
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
h
dqmdumpme.k
k
Definition: dqmdumpme.py:60
Point3DBase< float, GlobalTag >
GlobalTrajectoryParameters::momentum
GlobalVector momentum() const
Definition: GlobalTrajectoryParameters.h:65
MagneticField::inInverseGeV
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:36
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
GlobalTrajectoryParameters::magneticFieldInInverseGeV
GlobalVector magneticFieldInInverseGeV(const GlobalPoint &x) const
Definition: GlobalTrajectoryParameters.cc:35
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
GloballyPositioned::rotation
const RotationType & rotation() const
Definition: GloballyPositioned.h:38
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37