ATLAS Offline Software
Loading...
Searching...
No Matches
JacobianLocalToCurvilinear.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 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
20Trk::JacobianLocalToCurvilinear::JacobianLocalToCurvilinear( const Trk::CurvilinearUVT& curvUVT,
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
35Trk::JacobianLocalToCurvilinear::JacobianLocalToCurvilinear( const Amg::Vector3D& bfield,
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 = (sinTheta != 0.)? 1./sinTheta: 1.e20; // (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
82MsgStream& 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
99std::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
#define AmgMatrix(rows, cols)
Header file for AthHistogramAlgorithm.
simple class that constructs the curvilinear vectors curvU and curvV from a given momentum direction ...
const Amg::Vector3D & curvU() const
Access methods.
const Amg::Vector3D & curvT() const
const Amg::Vector3D & curvV() const
Eigen::Matrix< double, 3, 1 > Vector3D
MsgStream & operator<<(MsgStream &sl, const AlignModule &alignModule)
overload of << operator for MsgStream for debug output