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
JacobianCartesianToLocal Class Reference

#include <JacobianCartesianToLocal.h>

Public Member Functions

const AlgebraicMatrix56jacobian () const
 
 JacobianCartesianToLocal (const Surface &surface, const LocalTrajectoryParameters &localParameters)
 

Private Attributes

AlgebraicMatrix56 theJacobian
 

Detailed Description

Class which calculates the Jacobian matrix of the transformation from the Cartesian 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 15 of file JacobianCartesianToLocal.h.

Constructor & Destructor Documentation

JacobianCartesianToLocal::JacobianCartesianToLocal ( const Surface surface,
const LocalTrajectoryParameters localParameters 
)

Constructor from local trajectory parameters and surface defining the local frame. NB!! No default constructor exists!

Definition at line 5 of file JacobianCartesianToLocal.cc.

References LocalTrajectoryParameters::charge(), PV3DBase< T, PVType, FrameType >::mag(), LocalTrajectoryParameters::momentum(), AlCaHLTBitMon_ParallelJobs::p, lumiQueryAPI::q, dttmaxenums::R, makeMuonMisalignmentScenario::rot, GloballyPositioned< T >::rotation(), theJacobian, PV3DBase< T, PVType, FrameType >::x(), TkRotation< T >::xx(), TkRotation< T >::xy(), TkRotation< T >::xz(), PV3DBase< T, PVType, FrameType >::y(), TkRotation< T >::yx(), TkRotation< T >::yy(), TkRotation< T >::yz(), PV3DBase< T, PVType, FrameType >::z(), TkRotation< T >::zx(), TkRotation< T >::zy(), and TkRotation< T >::zz().

6  : theJacobian() {
7 
8  //LocalCoordinates 1 = (q/|p|, dx/dz, dy/dz, x, y)
9  //LocalCoordinates 2 = (x, y, z, px, py, pz)
10  //Transformation: q/|p| = q/sqrt(px*px + py*py + pz*pz)
11  // dx/dz = px/pz
12  // dy/dz = py/pz
13  // x = x
14  // y = y
15  LocalVector plocal = localParameters.momentum();
16  double px = plocal.x(), py = plocal.y(), pz = plocal.z();
17  double p = plocal.mag();
18  TrackCharge q = localParameters.charge();
19  // for neutrals: qbp is 1/p instead of q/p -
20  // equivalent to charge 1
21  if ( q==0 ) q = 1;
22  //Jacobian theJacobian( (q/|p|, dx/dz, dy/dz, x, y) = f(x, y, z, px, py, pz) )
23  theJacobian(0,3) = -q*px/(p*p*p); theJacobian(0,4) = -q*py/(p*p*p); theJacobian(0,5) = -q*pz/(p*p*p);
24  if(fabs(pz) > 0){
25  theJacobian(1,3) = 1./pz; theJacobian(1,5) = -px/(pz*pz);
26  theJacobian(2,4) = 1./pz; theJacobian(2,5) = -py/(pz*pz);
27  }
28  theJacobian(3,0) = 1.;
29  theJacobian(4,1) = 1.;
30 
31  /*
32  LocalVector l1 = surface.toLocal(GlobalVector(1., 0., 0.));
33  LocalVector l2 = surface.toLocal(GlobalVector(0., 1., 0.));
34  LocalVector l3 = surface.toLocal(GlobalVector(0., 0., 1.));
35  AlgebraicMatrix33 Rsub;
36  Rsub(0,0) = l1.x(); Rsub(0,1) = l2.x(); Rsub(0,2) = l3.x();
37  Rsub(1,0) = l1.y(); Rsub(1,1) = l2.y(); Rsub(1,2) = l3.y();
38  Rsub(2,0) = l1.z(); Rsub(2,1) = l2.z(); Rsub(2,2) = l3.z();
39  */
40 
41  AlgebraicMatrix33 Rsub;
42  // need to be copied anhhow to go from float to double...
43  Surface::RotationType const & rot = surface.rotation();
44  Rsub(0,0) = rot.xx(); Rsub(0,1) = rot.xy(); Rsub(0,2) = rot.xz();
45  Rsub(1,0) = rot.yx(); Rsub(1,1) = rot.yy(); Rsub(1,2) = rot.yz();
46  Rsub(2,0) = rot.zx(); Rsub(2,1) = rot.zy(); Rsub(2,2) = rot.zz();
47 
48 
49 
51  R.Place_at(Rsub,0,0);
52  R.Place_at(Rsub,3,3);
54  //dbg::dbg_trace(1,"Ca2L", localParameters.vector(),l1,l2,l3,theJacobian);
55 }
T xx() const
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepStd< double, 6, 6 > > AlgebraicMatrix66
T y() const
Definition: PV3DBase.h:63
T yx() const
T zx() const
T xy() const
int TrackCharge
Definition: TrackCharge.h:4
T zz() const
T mag() const
Definition: PV3DBase.h:67
T z() const
Definition: PV3DBase.h:64
T zy() const
LocalVector momentum() const
Momentum vector in the local frame.
T yy() const
TrackCharge charge() const
Charge (-1, 0 or 1)
T xz() const
const RotationType & rotation() const
T x() const
Definition: PV3DBase.h:62
T yz() const
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepStd< double, 3, 3 > > AlgebraicMatrix33

Member Function Documentation

const AlgebraicMatrix56& JacobianCartesianToLocal::jacobian ( ) const
inline

Access to Jacobian.

Definition at line 28 of file JacobianCartesianToLocal.h.

References theJacobian.

Referenced by ME0SegmentMatcher::produce().

28 { return theJacobian;}

Member Data Documentation

AlgebraicMatrix56 JacobianCartesianToLocal::theJacobian
private

Definition at line 33 of file JacobianCartesianToLocal.h.

Referenced by jacobian(), and JacobianCartesianToLocal().