CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
JacobianCurvilinearToLocal.cc
Go to the documentation of this file.
5 
7 
10  const LocalTrajectoryParameters& localParameters,
11  const MagneticField& magField) : 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 }
32 
35  const LocalTrajectoryParameters& localParameters,
36  const GlobalTrajectoryParameters& globalParameters,
37  const MagneticField& magField) : 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 }
59 
60 
61 void JacobianCurvilinearToLocal::compute(Surface::RotationType const & rot, GlobalVector const & tn, GlobalVector const & qh, double t1r) {
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 }
Basic3DVector< T > z() const
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
T perp() const
Definition: PV3DBase.h:71
Basic3DVector< T > y() const
LocalPoint position() const
Local x and y position coordinates.
T y() const
Definition: PV3DBase.h:62
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:107
JacobianCurvilinearToLocal(const Surface &surface, const LocalTrajectoryParameters &localParameters, const MagneticField &magField)
Basic3DVector< T > x() const
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
T x() const
Definition: PV3DBase.h:61
double signedInverseMomentum() const
Signed inverse momentum q/p (zero for neutrals).