CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
eulerProb.cc
Go to the documentation of this file.
1// HepRotatonTest.cc
2
3#include <iostream>
4#include "CLHEP/Units/SystemOfUnits.h"
5#include "CLHEP/Vector/Rotation.h"
6
7using std::cout;
8using std::endl;
9using namespace CLHEP;
10
11
12class myRotClass: public HepRotation {
13public:
14 myRotClass (const HepRotationZ& rot): HepRotation (rot) {;};
15 void setXX (const double& v) {rxx = v;};
16 void setXY (const double& v) {rxy = v;};
17 void setXZ (const double& v) {rxz = v;};
18 void setYX (const double& v) {ryx = v;};
19 void setYY (const double& v) {ryy = v;};
20 void setYZ (const double& v) {ryz = v;};
21 void setZX (const double& v) {rzx = v;};
22 void setZY (const double& v) {rzy = v;};
23 void setZZ (const double& v) {rzz = v;};
24};
25
26
27int main () {
28 HepRotationZ az (120*deg); // az.set (120*degree);
29 // HepRotation rot (az);
30 myRotClass rot(az);
31
32 const double corr = 0.9999999999999999;
33 rot.setZZ (corr);
34 // Make sure that det(rot)=1, so that its still a valid rotation
35 // (in principal I would expect that HepRotation should be robust
36 // enough to give reasonable results even without this step since
37 // round off errors in floating point operations could also cause
38 // such a loss of precision).
39 rot.setXX (rot.xx()/std::sqrt(corr)); rot.setXY (rot.xy()/std::sqrt(corr));
40 rot.setYX (rot.yx()/std::sqrt(corr)); rot.setYY (rot.yy()/std::sqrt(corr));
41
42 cout.setf (std::ios::scientific, std::ios::floatfield);
43 rot.print (cout); cout << "\n";
44 cout.precision (30);
45 cout << rot.xx() << "\t" << rot.xy() << "\t" << rot.xz() << "\n"
46 << rot.yx() << "\t" << rot.yy() << "\t" << rot.yz() << "\n"
47 << rot.zx() << "\t" << rot.zy() << "\t" << rot.zz() << endl;
48 cout << "\nEuler angles:"
49 << "\nphi = " << rot.phi()
50 << "\ttheta = " << rot.theta()
51 << "\tpsi = " << rot.psi()
52 << endl;
53
54 HepRotation newrot (rot.phi(), rot.theta(), rot.psi());
55 newrot.print(cout);
56
57 return 0;
58}
59
double zz() const
double yz() const
double zx() const
std::ostream & print(std::ostream &os) const
Definition: RotationIO.cc:18
double phi() const
Definition: RotationE.cc:70
double yx() const
double zy() const
double xx() const
double psi() const
Definition: RotationE.cc:110
double theta() const
Definition: RotationE.cc:104
double yy() const
double xz() const
double xy() const
void setXY(const double &v)
Definition: eulerProb.cc:16
myRotClass(const HepRotationZ &rot)
Definition: eulerProb.cc:14
void setYZ(const double &v)
Definition: eulerProb.cc:20
void setZZ(const double &v)
Definition: eulerProb.cc:23
void setXX(const double &v)
Definition: eulerProb.cc:15
void setYY(const double &v)
Definition: eulerProb.cc:19
void setZX(const double &v)
Definition: eulerProb.cc:21
void setZY(const double &v)
Definition: eulerProb.cc:22
void setXZ(const double &v)
Definition: eulerProb.cc:17
void setYX(const double &v)
Definition: eulerProb.cc:18
int main()
Definition: eulerProb.cc:27