ATLAS Offline Software
JacobianCurvilinearToLocal.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // JacobianCurvilinearToLocal.cxx, (c) ATLAS Detector software
8 
9 
10 //Trk
13 //Gaudi
14 #include "GaudiKernel/PhysicalConstants.h"
15 #include "GaudiKernel/MsgStream.h"
16 //STD
17 #include <iostream>
18 #include <iomanip>
19 
20 
25  const Amg::Vector3D& locX,
26  const Amg::Vector3D& locY,
27  const Amg::Vector3D& locZ
28  ) :
29  AmgMatrix(5,5)()
30 {
31  //initialize to zero
32  this->setIdentity();
33 
34  double locZdotCurvT = locZ.dot(curvUVT.curvT());
35  (*this)(0,0) = curvUVT.curvV().dot(locY)/locZdotCurvT; // d(locX)/d(u)
36  (*this)(0,1) = - curvUVT.curvU().dot(locY)/locZdotCurvT; // d(locX)/d(v)
37  (*this)(1,0) = - curvUVT.curvV().dot(locX)/locZdotCurvT; // d(locY)/d(u)
38  (*this)(1,1) = curvUVT.curvU().dot(locX)/locZdotCurvT; // d(locY)/d(v)
39 
40 }
41 
46  const Amg::Vector3D& bfield,
47  double qOp,
48  double sinTheta,
49  const CurvilinearUVT& curvUVT,
50  const Amg::Vector3D& locX,
51  const Amg::Vector3D& locY,
52  const Amg::Vector3D& locZ)
53  : AmgMatrix(5, 5)()
54 {
55  this->setIdentity();
56 
57  // prepare the dot products
58  double oneOverZt = 1./locZ.dot(curvUVT.curvT()); // 1./locZ * t
59  double ux = curvUVT.curvU().dot(locX); // u * locX
60  double uy = curvUVT.curvU().dot(locY); // u * locY
61  double uz = curvUVT.curvU().dot(locZ); // u * locZ
62  double vx = curvUVT.curvV().dot(locX); // v * locX
63  double vy = curvUVT.curvV().dot(locY); // v * locY
64  double vz = curvUVT.curvV().dot(locZ); // v * locZ
65  // specific for the helix
66  const Amg::Vector3D& h = bfield.normalized();
67  Amg::Vector3D n(h.cross(curvUVT.curvT())); // direction normal to track and magnetic field direction
68  double alpha = n.mag(); // | h x t | projection of track normal to magnetic field direction
69  n /= alpha; // normalization
70  double B = bfield.mag();
71 
72  // -> Psi and pathlength related variables
73  double Q = - B * Gaudi::Units::c_light * qOp;
74  double alphaQ = alpha*Q;
75 
76  double un = curvUVT.curvU().dot(n);
77  double vn = curvUVT.curvV().dot(n);
78  // fill the components
79  (*this)(0,0) = vy*oneOverZt; // d(locX)/d(u)
80  (*this)(0,1) = - uy*oneOverZt; // d(locX)/d(v)
81  (*this)(1,0) = - vx*oneOverZt; // d(locY)/d(u)
82  (*this)(1,1) = ux*oneOverZt; // d(locY)/d(v)
83  (*this)(2,0) = - alphaQ/sinTheta*un*uz*oneOverZt; // d(phi)/d(u)
84  (*this)(2,1) = - alphaQ/sinTheta*un*vz*oneOverZt; // d(phi)/d(v)
85  (*this)(3,0) = alphaQ*vn*uz*oneOverZt; // d(theta)/d(v)
86  (*this)(3,1) = alphaQ*vn*vz*oneOverZt; // d(theta)/d(v)
87 
88 }
89 
90 
91 
93 MsgStream& Trk::operator << ( MsgStream& sl, const Trk::JacobianCurvilinearToLocal& jac)
94 {
95  sl << std::setiosflags(std::ios::fixed);
96  sl << std::setprecision(6);
97  sl << MSG::DEBUG << "Trk::JacobianCurvilinearToLocal" << std::endl;
98  sl << "______________________________________________________________________" << std::endl;
99  for (int irow = 0; irow<5; irow++){
100  for (int icol =0; icol<5; icol++){
101  sl << (jac)(irow,icol);
102  if (irow < 4 || icol < 4 ) { sl << " "; }
103  }
104  sl << std::endl;
105  }
106  sl << "______________________________________________________________________";
107  return sl;
108 }
109 
110 std::ostream& Trk::operator << ( std::ostream& sl, const Trk::JacobianCurvilinearToLocal& jac)
111 {
112  sl << std::setiosflags(std::ios::fixed);
113  sl << std::setprecision(7);
114  sl << "Trk::JacobianCurvilinearToLocal " << std::endl;
115  sl << "______________________________________________________________________" << std::endl;
116  for (int irow = 0; irow<5; irow++){
117  for (int icol =0; icol<5; icol++){
118  sl << (jac)(irow,icol);
119  if (irow < 4 || icol < 4 ) { sl << " ";}
120  }
121  sl << std::endl;
122  }
123  sl << "______________________________________________________________________";
124  return sl;
125 }
Trk::AmgMatrix
AmgMatrix(3, 3) NeutralParticleParameterCalculator
Definition: NeutralParticleParameterCalculator.cxx:233
Trk::locX
@ locX
Definition: ParamDefs.h:43
Trk::locY
@ locY
local cartesian
Definition: ParamDefs.h:44
AmgMatrix
#define AmgMatrix(rows, cols)
Definition: EventPrimitives.h:51
atlasStyleMacro.icol
int icol
Definition: atlasStyleMacro.py:13
Trk::JacobianCurvilinearToLocal
Definition: JacobianCurvilinearToLocal.h:74
Trk::CurvilinearUVT::curvT
const Amg::Vector3D & curvT() const
Trk::locZ
@ locZ
local cylindrical
Definition: ParamDefs.h:48
Trk::CurvilinearUVT::curvU
const Amg::Vector3D & curvU() const
Access methods.
beamspotman.n
n
Definition: beamspotman.py:731
Trk::JacobianCurvilinearToLocal::JacobianCurvilinearToLocal
JacobianCurvilinearToLocal(const Trk::CurvilinearUVT &curvUVT, const Amg::Vector3D &locX, const Amg::Vector3D &locY, const Amg::Vector3D &locZ)
Constructor for straight line track model.
Definition: JacobianCurvilinearToLocal.cxx:24
python.PhysicalConstants.c_light
float c_light
Definition: PhysicalConstants.py:63
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
CurvilinearUVT.h
h
Trk::CurvilinearUVT
Definition: CurvilinearUVT.h:45
Trk::CurvilinearUVT::curvV
const Amg::Vector3D & curvV() const
Trk::operator<<
MsgStream & operator<<(MsgStream &sl, const AlignModule &alignModule)
overload of << operator for MsgStream for debug output
Definition: AlignModule.cxx:204
DEBUG
#define DEBUG
Definition: page_access.h:11
JacobianCurvilinearToLocal.h