CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 MagneticField &magField)
 
 JacobianCurvilinearToLocal (const Surface &surface, const LocalTrajectoryParameters &localParameters, const GlobalTrajectoryParameters &globalParameters, const MagneticField &magField)
 

Private Member Functions

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

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::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 9 of file JacobianCurvilinearToLocal.cc.

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

11  : theJacobian() {
12 
13  GlobalPoint x = surface.toGlobal(localParameters.position());
14  GlobalVector h = magField.inInverseGeV(x);
15  GlobalVector qh = h*localParameters.signedInverseMomentum(); // changed sign
16 
17 
18  // GlobalVector hdir = h.unit();
19  //double q = -h.mag() * localParameters.signedInverseMomentum();
20 
21  LocalVector tnl = localParameters.direction();
22  GlobalVector tn = surface.toGlobal(tnl);
23  double t1r = 1./tnl.z();
24 
25  // GlobalVector dj = surface.toGlobal(LocalVector(1., 0., 0.));
26  // GlobalVector dk = surface.toGlobal(LocalVector(0., 1., 0.));
27  // GlobalVector di = surface.toGlobal(LocalVector(0., 0., 1.));
28  Surface::RotationType const & rot = surface.rotation();
29 
30  compute(rot, tn, qh, t1r);
31 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
LocalVector direction() const
Momentum vector unit in the local frame.
void compute(Surface::RotationType const &rot, GlobalVector const &tn, GlobalVector const &qh, double lz) dso_internal
LocalPoint position() const
Local x and y position coordinates.
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:40
T z() const
Definition: PV3DBase.h:63
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
const RotationType & rotation() const
Definition: DDAxes.h:10
double signedInverseMomentum() const
Signed inverse momentum q/p (zero for neutrals).
JacobianCurvilinearToLocal::JacobianCurvilinearToLocal ( const Surface surface,
const LocalTrajectoryParameters localParameters,
const GlobalTrajectoryParameters globalParameters,
const MagneticField magField 
)

Definition at line 34 of file JacobianCurvilinearToLocal.cc.

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

37  : theJacobian() {
38 
39  GlobalPoint x = globalParameters.position();
40  GlobalVector h = magField.inInverseGeV(x);
41  GlobalVector qh = h*globalParameters.signedInverseMomentum(); // changed sign
42 
43  //GlobalVector hdir = h.unit();
44  //double q = -h.mag() * localParameters.signedInverseMomentum();
45 
46 
47  // GlobalVector tn = globalParameters.momentum().unit();
48  // LocalVector tnl = localParameters.momentum().unit();
49 
50  LocalVector tnl = localParameters.direction();
51  GlobalVector tn = surface.toGlobal(tnl);
52  double t1r = 1./tnl.z();
53 
54 
55  Surface::RotationType const & rot = surface.rotation();
56 
57  compute(rot, tn, qh, t1r);
58 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
LocalVector direction() const
Momentum vector unit in the local frame.
void compute(Surface::RotationType const &rot, GlobalVector const &tn, GlobalVector const &qh, double lz) dso_internal
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:40
T z() const
Definition: PV3DBase.h:63
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
const RotationType & rotation() const
Definition: DDAxes.h:10

Member Function Documentation

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

Definition at line 61 of file JacobianCurvilinearToLocal.cc.

References Vector3DBase< T, FrameTag >::dot(), alignCSCRings::e, PV3DBase< T, PVType, FrameType >::perp(), theJacobian, interactiveExample::ui, PV3DBase< T, PVType, FrameType >::x(), TkRotation< T >::x(), PV3DBase< T, PVType, FrameType >::y(), TkRotation< T >::y(), PV3DBase< T, PVType, FrameType >::z(), and TkRotation< T >::z().

Referenced by JacobianCurvilinearToLocal().

61  {
62  // Origin: TRSCSD
63 
64  GlobalVector dj(rot.x());
65  GlobalVector dk(rot.y());
66  GlobalVector di(rot.z());
67 
68  double cosl = tn.perp(); if (cosl < 1.e-30) cosl = 1.e-30;
69  double cosl1 = 1./cosl;
70  GlobalVector un(-tn.y()*cosl1, tn.x()*cosl1, 0.);
71  GlobalVector vn(-tn.z()*un.y(), tn.z()*un.x(), cosl);
72 
73  double uj = un.dot(dj);
74  double uk = un.dot(dk);
75  double vj = vn.dot(dj);
76  double vk = vn.dot(dk);
77 
78  // double t1r = 1./tvw.x();
79  double t2r = t1r*t1r;
80  double t3r = t1r*t2r;
81 
82  theJacobian(0,0) = 1.;
83  theJacobian(1,1) = -uk*t2r;
84  theJacobian(1,2) = vk*(cosl*t2r);
85  theJacobian(2,1) = uj*t2r;
86  theJacobian(2,2) = -vj*(cosl*t2r);
87  theJacobian(3,3) = vk*t1r;
88  theJacobian(3,4) = -uk*t1r;
89  theJacobian(4,3) = -vj*t1r;
90  theJacobian(4,4) = uj*t1r;
91 
92 
93  double sinz = un.dot(qh);
94  double cosz =-vn.dot(qh);
95  double ui = un.dot(di)*(t3r);
96  double vi = vn.dot(di)*(t3r);
97  theJacobian(1,3) =-ui*(vk*cosz-uk*sinz);
98  theJacobian(1,4) =-vi*(vk*cosz-uk*sinz);
99  theJacobian(2,3) = ui*(vj*cosz-uj*sinz);
100  theJacobian(2,4) = vi*(vj*cosz-uj*sinz);
101  // end of TRSCSD
102  //dbg::dbg_trace(1,"Cu2L", localParameters.vector(),di,dj,dk,theJacobian);
103 }
T perp() const
Definition: PV3DBase.h:71
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:107
const AlgebraicMatrix55& JacobianCurvilinearToLocal::jacobian ( ) const
inline

Member Data Documentation

AlgebraicMatrix55 JacobianCurvilinearToLocal::theJacobian
private

Definition at line 46 of file JacobianCurvilinearToLocal.h.

Referenced by compute(), and jacobian().