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 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)
 

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(ROOT::Math::SMatrixNoInit()) {
12 
13  GlobalPoint x = surface.toGlobal(localParameters.position());
14  GlobalVector h = magField.inInverseGeV(x);
15  GlobalVector qh = h*localParameters.signedInverseMomentum(); // changed sign
16 
17  LocalVector tnl = localParameters.direction();
18  GlobalVector tn = surface.toGlobal(tnl);
19  double t1r = 1./tnl.z();
20 
21  Surface::RotationType const & rot = surface.rotation();
22 
23  compute(rot, tn, qh, t1r);
24 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
LocalVector direction() const
Momentum vector unit in the local frame.
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
LocalPoint position() const
Local x and y position coordinates.
float signedInverseMomentum() const
Signed inverse momentum q/p (zero for neutrals).
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:41
T z() const
Definition: PV3DBase.h:64
const RotationType & rotation() const
void compute(Surface::RotationType const &rot, GlobalVector const &tn, GlobalVector const &qh, double lz)
JacobianCurvilinearToLocal::JacobianCurvilinearToLocal ( const Surface surface,
const LocalTrajectoryParameters localParameters,
const GlobalTrajectoryParameters globalParameters,
const MagneticField magField 
)

Definition at line 27 of file JacobianCurvilinearToLocal.cc.

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

30  : theJacobian(ROOT::Math::SMatrixNoInit()) {
31 
32  // GlobalPoint x = globalParameters.position();
33  // GlobalVector h = magField.inInverseGeV(x);
34  GlobalVector h = globalParameters.magneticFieldInInverseGeV();
35  GlobalVector qh = h*localParameters.signedInverseMomentum(); // changed sign
36 
37  LocalVector tnl = localParameters.direction();
38  // GlobalVector tn = surface.toGlobal(tnl); // faster?
39  GlobalVector tn = globalParameters.momentum()*std::abs(localParameters.signedInverseMomentum());
40  double t1r = 1./tnl.z();
41 
42 
43  Surface::RotationType const & rot = surface.rotation();
44 
45  compute(rot, tn, qh, t1r);
46 }
LocalVector direction() const
Momentum vector unit in the local frame.
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
GlobalVector magneticFieldInInverseGeV(const GlobalPoint &x) const
float signedInverseMomentum() const
Signed inverse momentum q/p (zero for neutrals).
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const RotationType & rotation() const
void compute(Surface::RotationType const &rot, GlobalVector const &tn, GlobalVector const &qh, double lz)

Member Function Documentation

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

Definition at line 49 of file JacobianCurvilinearToLocal.cc.

References PV3DBase< T, PVType, FrameType >::basicVector(), Vector3DBase< T, FrameTag >::dot(), MillePedeFileConverter_cfg::e, mps_fire::i, 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 jacobian(), and JacobianCurvilinearToLocal().

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