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:114
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:64
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 abs, compute(), LocalTrajectoryParameters::direction(), h, MagneticField::inInverseGeV(), GlobalTrajectoryParameters::momentum(), GlobalTrajectoryParameters::position(), makeMuonMisalignmentScenario::rot, GloballyPositioned< T >::rotation(), LocalTrajectoryParameters::signedInverseMomentum(), 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*localParameters.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); // faster?
52  GlobalVector tn = globalParameters.momentum()*std::abs(localParameters.signedInverseMomentum());
53  double t1r = 1./tnl.z();
54 
55 
56  Surface::RotationType const & rot = surface.rotation();
57 
58  compute(rot, tn, qh, t1r);
59 }
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
#define abs(x)
Definition: mlp_lapack.h:159
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:64
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).

Member Function Documentation

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

Definition at line 62 of file JacobianCurvilinearToLocal.cc.

References PV3DBase< T, PVType, FrameType >::basicVector(), Vector3DBase< T, FrameTag >::dot(), alignCSCRings::e, i, j, gen::k, PV3DBase< T, PVType, FrameType >::perp(), TkRotation< T >::rotate(), theJacobian, interactiveExample::ui, findQualityFiles::v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by JacobianCurvilinearToLocal().

62  {
63  // Origin: TRSCSD
64 
65  double cosl = tn.perp(); if (cosl < 1.e-30) cosl = 1.e-30;
66  double cosl1 = 1./cosl;
67  GlobalVector un(-tn.y()*cosl1, tn.x()*cosl1, 0.);
68  GlobalVector vn(-tn.z()*un.y(), tn.z()*un.x(), cosl);
69 
70  auto u = rot.rotate(un.basicVector());
71  auto v = rot.rotate(vn.basicVector());
72 
73  int j=0, k=1, i=2;
74 
75  // double t1r = 1./tvw.x();
76  double t2r = t1r*t1r;
77  double t3r = t1r*t2r;
78 
79  theJacobian(0,0) = 1.;
80  theJacobian(1,1) = -u[k]*t2r;
81  theJacobian(1,2) = v[k]*(cosl*t2r);
82  theJacobian(2,1) = u[j]*t2r;
83  theJacobian(2,2) = -v[j]*(cosl*t2r);
84  theJacobian(3,3) = v[k]*t1r;
85  theJacobian(3,4) = -u[k]*t1r;
86  theJacobian(4,3) = -v[j]*t1r;
87  theJacobian(4,4) = u[j]*t1r;
88 
89 
90  double sinz = un.dot(qh);
91  double cosz =-vn.dot(qh);
92  double ui = u[i]*(t3r);
93  double vi = v[i]*(t3r);
94  theJacobian(1,3) =-ui*(v[k]*cosz-u[k]*sinz);
95  theJacobian(1,4) =-vi*(v[k]*cosz-u[k]*sinz);
96  theJacobian(2,3) = ui*(v[j]*cosz-u[j]*sinz);
97  theJacobian(2,4) = vi*(v[j]*cosz-u[j]*sinz);
98  // end of TRSCSD
99  //dbg::dbg_trace(1,"Cu2L", localParameters.vector(),di,dj,dk,theJacobian);
100 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
int k[5][pyjets_maxn]
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().