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