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 Attributes
JacobianCurvilinearToLocal Class Reference

#include <JacobianCurvilinearToLocal.h>

Public Member Functions

const AlgebraicMatrix55jacobian () const
 
const AlgebraicMatrix jacobian_old () const
 
 JacobianCurvilinearToLocal (const Surface &surface, const LocalTrajectoryParameters &localParameters, const MagneticField &magField)
 

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

References Vector3DBase< T, FrameTag >::dot(), h, MagneticField::inTesla(), PV3DBase< T, PVType, FrameType >::mag(), LocalTrajectoryParameters::momentum(), PV3DBase< T, PVType, FrameType >::perp(), LocalTrajectoryParameters::position(), lumiQueryAPI::q, GloballyPositioned< T >::rotation(), LocalTrajectoryParameters::signedInverseMomentum(), theJacobian, Surface::toGlobal(), interactiveExample::ui, Vector3DBase< T, FrameTag >::unit(), x, 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().

9  : theJacobian() {
10 
11  // Origin: TRSCSD
12  GlobalPoint x = surface.toGlobal(localParameters.position());
13  // GlobalVector h = MagneticField::inInverseGeV(x);
14  GlobalVector h = magField.inTesla(x) * 2.99792458e-3;
15  GlobalVector hdir = h.unit();
16 
17  LocalVector tnl = localParameters.momentum().unit();
18  GlobalVector tn = surface.toGlobal(tnl);
19 
20  // GlobalVector dj = surface.toGlobal(LocalVector(1., 0., 0.));
21  // GlobalVector dk = surface.toGlobal(LocalVector(0., 1., 0.));
22  // GlobalVector di = surface.toGlobal(LocalVector(0., 0., 1.));
23  Surface::RotationType const & rot = surface.rotation();
24  GlobalVector dj(rot.x());
25  GlobalVector dk(rot.y());
26  GlobalVector di(rot.z());
27 
28  // rotate coordinates because of wrong coordinate system in orca
29  // LocalVector tvw(tnl.z(), tnl.x(), tnl.y());
30  double cosl = tn.perp(); if (cosl < 1.e-30) cosl = 1.e-30;
31  double cosl1 = 1./cosl;
32  GlobalVector un(-tn.y()*cosl1, tn.x()*cosl1, 0.);
33  GlobalVector vn(-tn.z()*un.y(), tn.z()*un.x(), cosl);
34 
35  double uj = un.dot(dj);
36  double uk = un.dot(dk);
37  double vj = vn.dot(dj);
38  double vk = vn.dot(dk);
39 
40  // double t1r = 1./tvw.x();
41  double t1r = 1./tnl.z();
42  double t2r = t1r*t1r;
43  double t3r = t1r*t2r;
44 
45  theJacobian(0,0) = 1.;
46  theJacobian(1,1) = -uk*t2r;
47  theJacobian(1,2) = vk*(cosl*t2r);
48  theJacobian(2,1) = uj*t2r;
49  theJacobian(2,2) = -vj*(cosl*t2r);
50  theJacobian(3,3) = vk*t1r;
51  theJacobian(3,4) = -uk*t1r;
52  theJacobian(4,3) = -vj*t1r;
53  theJacobian(4,4) = uj*t1r;
54 
55  double q = -h.mag() * localParameters.signedInverseMomentum();
56 
57  double sinz =-un.dot(hdir);
58  double cosz = vn.dot(hdir);
59  double ui = un.dot(di)*(q*t3r);
60  double vi = vn.dot(di)*(q*t3r);
61  theJacobian(1,3) =-ui*(vk*cosz-uk*sinz);
62  theJacobian(1,4) =-vi*(vk*cosz-uk*sinz);
63  theJacobian(2,3) = ui*(vj*cosz-uj*sinz);
64  theJacobian(2,4) = vi*(vj*cosz-uj*sinz);
65  // end of TRSCSD
66  //dbg::dbg_trace(1,"Cu2L", localParameters.vector(),di,dj,dk,theJacobian);
67 }
Basic3DVector< T > z() const
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
T perp() const
Definition: PV3DBase.h:66
Basic3DVector< T > y() const
LocalPoint position() const
Local x and y position coordinates.
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
T y() const
Definition: PV3DBase.h:57
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:107
Basic3DVector< T > x() const
T mag() const
Definition: PV3DBase.h:61
T z() const
Definition: PV3DBase.h:58
LocalVector momentum() const
Momentum vector in the local frame.
Vector3DBase unit() const
Definition: Vector3DBase.h:57
const RotationType & rotation() const
Definition: DDAxes.h:10
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
T x() const
Definition: PV3DBase.h:56
double signedInverseMomentum() const
Signed inverse momentum q/p (zero for neutrals).

Member Function Documentation

const AlgebraicMatrix55 & JacobianCurvilinearToLocal::jacobian ( ) const
const AlgebraicMatrix JacobianCurvilinearToLocal::jacobian_old ( ) const

Definition at line 71 of file JacobianCurvilinearToLocal.cc.

References asHepMatrix(), and theJacobian.

71  {
72  return asHepMatrix(theJacobian);
73 }
CLHEP::HepMatrix asHepMatrix(const ROOT::Math::SMatrix< double, N1, N2, typename ROOT::Math::MatRepStd< double, N1, N2 > > &rm)
Definition: Migration.h:49

Member Data Documentation

AlgebraicMatrix55 JacobianCurvilinearToLocal::theJacobian
private

Definition at line 37 of file JacobianCurvilinearToLocal.h.

Referenced by jacobian(), jacobian_old(), and JacobianCurvilinearToLocal().