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*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 }
60 
61 
62 void JacobianCurvilinearToLocal::compute(Surface::RotationType const & rot, GlobalVector const & tn, GlobalVector const & qh, double t1r) {
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 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
LocalVector direction() const
Momentum vector unit in the local frame.
int i
Definition: DBlmapReader.cc:9
void compute(Surface::RotationType const &rot, GlobalVector const &tn, GlobalVector const &qh, double lz) dso_internal
T perp() const
Definition: PV3DBase.h:72
LocalPoint position() const
Local x and y position coordinates.
T y() const
Definition: PV3DBase.h:63
#define abs(x)
Definition: mlp_lapack.h:159
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)
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:40
Basic3DVector< T > rotate(const Basic3DVector< T > &v) const
T z() const
Definition: PV3DBase.h:64
int j
Definition: DBlmapReader.cc:9
int k[5][pyjets_maxn]
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:62
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:56
double signedInverseMomentum() const
Signed inverse momentum q/p (zero for neutrals).