ATLAS Offline Software
Loading...
Searching...
No Matches
CLHEPtoEigenEulerAnglesConverters.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5/*
6 * eigen_migration
7 * main.cpp
8 *
9 * Created on: Feb 4, 2014
10 * Author: rbianchi <Riccardo.Maria.Bianchi@cern.ch>
11 *
12 */
13
14#ifndef _GEOPRIMITIVES_CLHEPTOEIGENEULERANGLESCONVERTERS_H
15#define _GEOPRIMITIVES_CLHEPTOEIGENEULERANGLESCONVERTERS_H
16
18
19#include <math.h> // for M_PI definition
20
21
22
23namespace Amg {
24
25
35{
36 Amg::Vector3D eigen_angles;
37
38 // using Z-X-Z convention (CLHEP): (2,0,2) == "Z,X,Z". // DEFAULT
39 if (convention == 0) {
40 eigen_angles(2) = -clhep_angles(0); // Phi-->Z
41 eigen_angles(1) = -clhep_angles(1); // Theta-->X
42 eigen_angles(0) = -clhep_angles(2); // Psi-->Z
43 }
44 // using Z-Y-Z convention: (2,1,2) == "Z,Y,Z"
45 else {
46 eigen_angles(0) = -0.5 * clhep_angles(0); // Phi-->Z
47 eigen_angles(1) = clhep_angles(1); // Theta-->Y
48 eigen_angles(2) = clhep_angles(2); // Psi-->Z
49 }
50
51 return eigen_angles;
52}
53
63{
64 Amg::Vector3D clhep_angles;
65
66 double phi;
67 double theta;
68 double psi;
69
84 // using Z-X-Z convention: (2,0,2) == "Z,X,Z". // DEFAULT
85 if (convention == 0) {
86 phi = -eigen_angles(2); // Z-->Phi
87 theta = -eigen_angles(1); // X-->Theta
88 psi = -eigen_angles(0); // Z-->Psi
89 }
90 // using Z-Y-Z convention: (2,1,2) == "Z,Y,Z"
91 else {
92 phi = -2 * eigen_angles(0); // Z-->Phi
93 theta = eigen_angles(1); // Y-->Theta
94 psi = eigen_angles(2); // Z-->Psi
95 }
96
97 clhep_angles(0) = phi;
98 clhep_angles(1) = theta;
99 clhep_angles(2) = psi;
100
101 return clhep_angles;
102
103}
104
105
106} // end of namespace Amg
107
108
109#endif
110
111
112
113
114
Scalar phi() const
phi method
Scalar theta() const
theta method
Definition of ATLAS Math & Geometry primitives (Amg)
Amg::Vector3D convert_EigenEulerAngles_to_CLHEPPhiThetaPsi(Amg::Vector3D eigen_angles, int convention=0)
Convert Eigen euler angles to CLEHP Phi,Theta,Psi angles.
Amg::Vector3D convert_CLHEPPhiThetaPsi_to_EigenEulerAngles(Amg::Vector3D clhep_angles, int convention=0)
Convert CLEHP Phi,Theta,Psi angles to Eigen euler angles using Z-X-Z convention.
Eigen::Matrix< double, 3, 1 > Vector3D