ATLAS Offline Software
JacobianLocalAnglesPhiTheta.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 // JacobianLocalAnglesPhiTheta.cxx, (c) ATLAS Detector software
8 
10 #include <cmath>
11 
12 Trk::JacobianLocalAnglesPhiTheta::JacobianLocalAnglesPhiTheta(const double angleXZ, const double angleYZ, const Amg::RotationMatrix3D& rot):
13  AmgMatrix(2,2)()
14 {
15 
16  this->setIdentity();
17 
18 // Rot is a 3x3 rotation matrix from local 3-vector to global 3-vector
19 
20  double cx = std::cos(angleXZ);
21  double sx = std::sin(angleXZ);
22  double cy = std::cos(angleYZ);
23  double sy = std::sin(angleYZ);
24  double norm = std::sqrt(cx*sy*cx*sy + cy*sx*cy*sx + sx*sy*sx*sy);
25  double zinv = norm/(sx*sy) ;
26 //
27 // local direction x = cx * sy / norm
28 // y = cy * sx / norm
29 // z = sx * sy / norm
30 //
31 
32 // Determine Global theta and phi
33 
35  Amg::Vector3D gdir = rot*locdir;
36  double phi = gdir.phi();
37  double theta = gdir.theta();
38 // std::cout << " phi " << phi << " theta " << theta << std::endl;
39  double cp = std::cos(phi);
40  double sp = std::sin(phi);
41  double ct = std::cos(theta);
42  double st = std::sin(theta);
43  AmgMatrix(3,2) J2 = AmgMatrix(3,2)::Zero(); // row, column
44 //
45 // derivatives dx/dphi dx/dtheta
46 // dy/dphi dy/dtheta
47 // dz/dphi dz/dtheta
48 //
49 // x = std::sin(theta)*std::cos(phi)
50 // y = std::sin(theta)*std::sin(phi)
51 // z = std::cos(theta)
52 //
53 
54  J2(0,0) = -st*sp;
55  J2(1,0) = st*cp;
56  J2(0,1) = ct*cp;
57  J2(1,1) = ct*sp;
58  J2(2,1) = -st;
59 
60  AmgMatrix(2,3) J1 = AmgMatrix(2,3)::Zero();
61 //
62 // derivatives d alphaXZ/dx d alphaXZ/dy d alphaXZ/dz
63 // d alphaYZ/dx d alphaYZ/dy d alphaYZ/dz
64 //
65 // tan(alphaXZ) = z / x
66 // tan(alhpaYZ) = z / y
67 //
68 
69  J1(0,0) = -sx*sx*zinv;
70  J1(1,1) = -sy*sy*zinv;
71  J1(0,2) = cx*sx*zinv;
72  J1(1,2) = cy*sy*zinv;
73 
74  const AmgMatrix(3,3)& Rot = rot;
75  AmgMatrix(2,2) Jinv = AmgMatrix(2,2)::Zero();
76 //
77 // Jacobian Inverse: lefthand local righthand global
78 //
79  AmgMatrix(3,3) RI = Rot.inverse();
80  Jinv = J1*(RI*J2);
81 //
82 // Default Matrix
83 //
84  (*this)(0,0) = 1.;
85  (*this)(0,1) = 0.;
86  (*this)(1,0) = 0.;
87  (*this)(1,1) = 1.;
88 //
89 // Store Jacobian J: right hand local
90 //
91 // if (succes==0) {
92 // AmgMatrix(2,2) J = Jinv.inverse(succes);
93 // if (succes==0) {
95 // (*this)(0,0) = J(0,0);
96 // (*this)(0,1) = J(0,1);
97 // (*this)(1,0) = J(1,0);
98 // (*this)(1,1) = J(1,1);
99 // }
100 // }
101 }
102 
JacobianLocalAnglesPhiTheta.h
Trk::AmgMatrix
AmgMatrix(3, 3) NeutralParticleParameterCalculator
Definition: NeutralParticleParameterCalculator.cxx:233
PlotCalibFromCool.norm
norm
Definition: PlotCalibFromCool.py:100
fitman.sy
sy
Definition: fitman.py:524
python.compressB64.sx
string sx
Definition: compressB64.py:96
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
AmgMatrix
#define AmgMatrix(rows, cols)
Definition: EventPrimitives.h:49
PlotCalibFromCool.cx
cx
Definition: PlotCalibFromCool.py:666
Trk::theta
@ theta
Definition: ParamDefs.h:66
calibdata.ct
ct
Definition: calibdata.py:418
LArNewCalib_PedestalAutoCorr.cp
cp
Definition: LArNewCalib_PedestalAutoCorr.py:188
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
PlotCalibFromCool.cy
cy
Definition: PlotCalibFromCool.py:667
Amg::RotationMatrix3D
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Definition: GeoPrimitives.h:49
Trk::phi
@ phi
Definition: ParamDefs.h:75
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
Trk::JacobianLocalAnglesPhiTheta::JacobianLocalAnglesPhiTheta
JacobianLocalAnglesPhiTheta(const double angleXZ, const double angleYZ, const Amg::RotationMatrix3D &rot)
Definition: JacobianLocalAnglesPhiTheta.cxx:12