ATLAS Offline Software
JacobianPhiThetaLocalAngles.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 // JacobianPhiThetaLocalAngles.cxx, (c) ATLAS Detector software
8 
10 #include <cmath>
11 
12 
14  AmgMatrix(2,2)()
15 {
16  // initialize
17  this->setIdentity();
18 
19  // Rot is a 3x3 rotation matrix from global 3-vector to local 3-vector
20  double cp = std::cos(phi);
21  double sp = std::sin(phi);
22  double ct = std::cos(theta);
23  double st = std::sin(theta);
24 
25  AmgMatrix(3,2) J2 = AmgMatrix(3,2)::Zero();
26 //
27 // derivatives dx/dphi dx/dtheta
28 // dy/dphi dy/dtheta
29 // dz/dphi dz/dtheta
30 //
31 // x = sin(theta)*cos(phi)
32 // y = sin(theta)*sin(phi)
33 // z = cos(theta)
34 //
35  J2(0,0) = -st*sp;
36  J2(1,0) = st*cp;
37  J2(0,1) = ct*cp;
38  J2(1,1) = ct*sp;
39  J2(2,1) = -st;
40 
41 // Determine Local theta and phi
42 
43  Amg::Vector3D gdir(st*cp,st*sp,ct);
44  Amg::Vector3D ldir = rot*gdir;
45  double angleXZ = std::atan2(ldir.z(),ldir.x());
46  double angleYZ = std::atan2(ldir.z(),ldir.y());
47 
48  double cx = std::cos(angleXZ);
49  double sx = std::sin(angleXZ);
50  double cy = std::cos(angleYZ);
51  double sy = std::sin(angleYZ);
52  double norm = std::sqrt(cx*sy*cx*sy + cy*sx*cy*sx + sx*sy*sx*sy);
53  double zinv = norm/(sx*sy) ;
54 
55 // std::cout << " Local angles XZ " << angleXZ << " YZ " << angleYZ << std::endl;
56 //
57 // local direction x = cx * sy / norm
58 // y = cy * sx / norm
59 // z = sx * sy / norm
60 //
61  AmgMatrix(2,3) J1 = AmgMatrix(2,3)::Zero();
62 //
63 // derivatives d alphaXZ/dx d alphaXZ/dy d alphaXZ/dz
64 // d alphaYZ/dx d alphaYZ/dy d alphaYZ/dz
65 //
66 // tan(alphaXZ) = z / x
67 // tan(alhpaYZ) = z / y
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) J = AmgMatrix(2,2)::Zero();
76 //
77 // Jacobian: lefthand local righthand global
78 //
79  J = J1*(Rot*J2);
80 //
81 // Store Jacobian J
82 //
83  (*this)(0,0) = J(0,0);
84  (*this)(0,1) = J(0,1);
85  (*this)(1,0) = J(1,0);
86  (*this)(1,1) = J(1,1);
87 }
88 
Trk::AmgMatrix
AmgMatrix(3, 3) NeutralParticleParameterCalculator
Definition: NeutralParticleParameterCalculator.cxx:233
PlotCalibFromCool.norm
norm
Definition: PlotCalibFromCool.py:100
fitman.sy
sy
Definition: fitman.py:524
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:75
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
Trk::JacobianPhiThetaLocalAngles::JacobianPhiThetaLocalAngles
JacobianPhiThetaLocalAngles(const Amg::RotationMatrix3D &rot)
PlotCalibFromCool.cx
cx
Definition: PlotCalibFromCool.py:666
Trk::theta
@ theta
Definition: ParamDefs.h:66
calibdata.ct
ct
Definition: calibdata.py:418
JacobianPhiThetaLocalAngles.h
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