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 
8  const LocalTrajectoryParameters& localParameters,
9  const MagneticField& magField) : 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 }
69  return theJacobian;
70 }
72  return asHepMatrix(theJacobian);
73 }
Basic3DVector< T > z() const
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
CLHEP::HepMatrix asHepMatrix(const ROOT::Math::SMatrix< double, N1, N2, typename ROOT::Math::MatRepStd< double, N1, N2 > > &rm)
Definition: Migration.h:49
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
JacobianCurvilinearToLocal(const Surface &surface, const LocalTrajectoryParameters &localParameters, const MagneticField &magField)
Basic3DVector< T > x() const
T mag() const
Definition: PV3DBase.h:61
CLHEP::HepMatrix AlgebraicMatrix
T z() const
Definition: PV3DBase.h:58
const AlgebraicMatrix55 & jacobian() const
LocalVector momentum() const
Momentum vector in the local frame.
Vector3DBase unit() const
Definition: Vector3DBase.h:57
const RotationType & rotation() const
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
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepStd< double, 5, 5 > > AlgebraicMatrix55
double signedInverseMomentum() const
Signed inverse momentum q/p (zero for neutrals).
const AlgebraicMatrix jacobian_old() const