CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
JacobianLocalToCurvilinear.cc
Go to the documentation of this file.
5 
8  const LocalTrajectoryParameters& localParameters,
9  const MagneticField& magField) : theJacobian() {
10 
11  // Origin: TRSDSC
12 
13  GlobalPoint x = surface.toGlobal(localParameters.position());
14  GlobalVector h = magField.inInverseGeV(x);
15 
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  Surface::RotationType const & rot = surface.rotation();
23  GlobalVector dj(rot.x());
24  GlobalVector dk(rot.y());
25 
26  // GlobalVector p = surface.toGlobal(localParameters.momentum());
27  // GlobalVector pt(p.x(), p.y(), 0.);
28  // pt = pt.unit();
29  // GlobalVector tn = p.unit();
30 
31  // GlobalVector di = tsos.surface().toGlobal(LocalVector(0., 0., 1.));
32 
33  // rotate coordinates because of wrong coordinate system in orca
34  LocalVector tvw(tnl.z(), tnl.x(), tnl.y());
35  double cosl = tn.perp(); if (cosl < 1.e-30) cosl = 1.e-30;
36  double cosl1 = 1./cosl;
37 
38  double q = -h.mag() * localParameters.signedInverseMomentum();
39 
40  GlobalVector un(-tn.y()*cosl1, tn.x()*cosl1, 0.);
41  double uj = un.dot(dj);
42  double uk = un.dot(dk);
43  double sinz =-un.dot(h.unit());
44 
45  GlobalVector vn(-tn.z()*un.y(), tn.z()*un.x(), cosl);
46  double vj = vn.dot(dj);
47  double vk = vn.dot(dk);
48  double cosz = vn.dot(h.unit());
49 
50 
51  theJacobian(0,0) = 1.;
52  theJacobian(1,1) = tvw.x()*vj;
53  theJacobian(1,2) = tvw.x()*vk;
54  theJacobian(2,1) = tvw.x()*uj*cosl1;
55  theJacobian(2,2) = tvw.x()*uk*cosl1;
56  theJacobian(3,3) = uj;
57  theJacobian(3,4) = uk;
58  theJacobian(4,3) = vj;
59  theJacobian(4,4) = vk;
60 
61  theJacobian(1,3) = -q*tvw.y()*sinz;
62  theJacobian(1,4) = -q*tvw.z()*sinz;
63  theJacobian(2,3) = -q*tvw.y()*(cosz*cosl1);
64  theJacobian(2,4) = -q*tvw.z()*(cosz*cosl1);
65  // end of TRSDSC
66 
67  //dbg::dbg_trace(1,"Loc2Cu", localParameters.vector(),x,dj,dk,theJacobian);
68 }
70  return asHepMatrix(theJacobian);
71 }
73  return theJacobian;
74 }
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.
T y() const
Definition: PV3DBase.h:57
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:107
const AlgebraicMatrix55 & jacobian() const
Basic3DVector< T > x() const
virtual GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
T mag() const
Definition: PV3DBase.h:61
CLHEP::HepMatrix AlgebraicMatrix
const AlgebraicMatrix jacobian_old() const
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
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
JacobianLocalToCurvilinear(const Surface &surface, const LocalTrajectoryParameters &localParameters, const MagneticField &magField)
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).