ATLAS Offline Software
JacobianLocalToCurvilinear.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 // JacobianLocalToCurvilinear.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 
21  const Amg::Vector3D& locX,
22  const Amg::Vector3D& locY
23  ) :
24  AmgMatrix(5,5)()
25 {
26  // initialize to zero
27  this->setIdentity();
28 
29  (*this)(0,0) = curvUVT.curvU().dot(locX); // d(u)/d(locX)
30  (*this)(0,1) = curvUVT.curvU().dot(locY); // d(u)/d(locY)
31  (*this)(1,0) = curvUVT.curvV().dot(locX); // d(v)/d(locX)
32  (*this)(1,1) = curvUVT.curvV().dot(locY); // d(v)/d(locY)
33 }
34 
36  double qOp,
37  double sinTheta,
38  const Trk::CurvilinearUVT& curvUVT,
39  const Amg::Vector3D& locX,
40  const Amg::Vector3D& locY
41  ) :
42  AmgMatrix(5,5)()
43 {
44 
45  // initialize to zero
46  this->setIdentity();
47 
48  // identical to the straight line case
49  (*this)(0,0) = curvUVT.curvU().dot(locX); // d(u)/d(locX)
50  (*this)(0,1) = curvUVT.curvU().dot(locY); // d(u)/d(locY)
51  (*this)(1,0) = curvUVT.curvV().dot(locX); // d(v)/d(locX)
52  (*this)(1,1) = curvUVT.curvV().dot(locY); // d(v)/d(locY)
53  // specific for the helix
54  const Amg::Vector3D& h = bfield.normalized();
55  Amg::Vector3D n(h.cross(curvUVT.curvT())); // direction normal to track and magnetic field direction
56  double alpha = n.mag(); // | h x t | projection of track normal to magnetic field direction
57  if(alpha!=0.) n /= alpha; // normalization
58  double B = bfield.mag();
59 
60  // -> Psi and pathlength related variables
61  double Q = - B * Gaudi::Units::c_light * qOp;
62 
63  // prepare the parameters
64  double tlx = curvUVT.curvT().dot(locX); // t * locX
65  double tly = curvUVT.curvT().dot(locY); // t * locY
66  double nu = n.dot(curvUVT.curvU()); // n * u
67  double nv = n.dot(curvUVT.curvV()); // n * v
68 
69  double oneOverSinTheta = 1./sinTheta; // (helix.startParameters().sinTheta());
70 
71  // fill the components
72  (*this)(2,0) = -alpha*Q*oneOverSinTheta*nu*tlx; // d(phi)/d(locX)
73  (*this)(2,1) = - alpha*Q*oneOverSinTheta*nu*tly; // d(phi)/d(locY)
74 
75  (*this)(3,0) = alpha*Q*nv*tlx; // d(theta)/d(locX)
76  (*this)(3,1) = alpha*Q*nv*tly; // d(theta)/d(locY)
77 
78 }
79 
80 
82 MsgStream& Trk::operator << ( MsgStream& sl, const Trk::JacobianLocalToCurvilinear& jac)
83 {
84  sl << std::setiosflags(std::ios::fixed);
85  sl << std::setprecision(6);
86  sl << MSG::DEBUG << "Trk::JacobianLocalToCurvilinear" << std::endl;
87  sl << "______________________________________________________________________" << std::endl;
88  for (int irow = 0; irow<5; irow++){
89  for (int icol =0; icol<5; icol++){
90  sl << (jac)(irow,icol);
91  if (irow < 4 || icol < 4 ) { sl << " ";}
92  }
93  sl << std::endl;
94  }
95  sl << "______________________________________________________________________";
96  return sl;
97 }
98 
99 std::ostream& Trk::operator << ( std::ostream& sl, const Trk::JacobianLocalToCurvilinear& jac)
100 {
101  sl << std::setiosflags(std::ios::fixed);
102  sl << std::setprecision(7);
103  sl << "Trk::JacobianLocalToCurvilinear " << std::endl;
104  sl << "______________________________________________________________________" << std::endl;
105  for (int irow = 0; irow<5; irow++){
106  for (int icol =0; icol<5; icol++){
107  sl << (jac)(irow,icol);
108  if (irow < 4 || icol < 4 ) { sl << " "; }
109  }
110  sl << std::endl;
111  }
112  sl << "______________________________________________________________________";
113  return sl;
114 }
115 
Trk::AmgMatrix
AmgMatrix(3, 3) NeutralParticleParameterCalculator
Definition: NeutralParticleParameterCalculator.cxx:233
Trk::locX
@ locX
Definition: ParamDefs.h:37
Trk::locY
@ locY
local cartesian
Definition: ParamDefs.h:38
Trk::JacobianLocalToCurvilinear
Definition: JacobianLocalToCurvilinear.h:66
AmgMatrix
#define AmgMatrix(rows, cols)
Definition: EventPrimitives.h:49
atlasStyleMacro.icol
int icol
Definition: atlasStyleMacro.py:13
JacobianLocalToCurvilinear.h
Trk::CurvilinearUVT::curvT
const Amg::Vector3D & curvT() const
Trk::JacobianLocalToCurvilinear::JacobianLocalToCurvilinear
JacobianLocalToCurvilinear(const CurvilinearUVT &curvUVT, const Amg::Vector3D &locX, const Amg::Vector3D &locY)
Constructor for straight line track model.
Definition: JacobianLocalToCurvilinear.cxx:20
Trk::CurvilinearUVT::curvU
const Amg::Vector3D & curvU() const
Access methods.
beamspotman.n
n
Definition: beamspotman.py:731
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