CLHEP 2.0.4.7 Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

eulerProb.cc

Go to the documentation of this file.
00001 // HepRotatonTest.cc
00002 
00003 #include <iostream>
00004 #include "CLHEP/Units/SystemOfUnits.h"
00005 #include "CLHEP/Vector/Rotation.h"
00006 
00007 using std::cout;
00008 using std::endl;
00009 using namespace CLHEP;
00010 
00011 
00012 class myRotClass: public HepRotation {
00013 public:
00014   myRotClass (const HepRotationZ& rot): HepRotation (rot) {;};
00015   void setXX (const double& v) {rxx = v;};
00016   void setXY (const double& v) {rxy = v;};
00017   void setXZ (const double& v) {rxz = v;};
00018   void setYX (const double& v) {ryx = v;};
00019   void setYY (const double& v) {ryy = v;};
00020   void setYZ (const double& v) {ryz = v;};
00021   void setZX (const double& v) {rzx = v;};
00022   void setZY (const double& v) {rzy = v;};
00023   void setZZ (const double& v) {rzz = v;};
00024 };
00025 
00026 
00027 int main () {
00028   HepRotationZ az (120*deg); // az.set (120*degree);
00029   // HepRotation rot (az);
00030   myRotClass rot(az);
00031 
00032   const double corr = 0.9999999999999999;
00033   rot.setZZ (corr);
00034   // Make sure that det(rot)=1, so that its still a valid rotation
00035   // (in principal I would expect that HepRotation should be robust
00036   // enough to give reasonable results even without this step since
00037   // round off errors in floating point operations could also cause
00038   // such a loss of precision).
00039   rot.setXX (rot.xx()/sqrt(corr));  rot.setXY (rot.xy()/sqrt(corr));
00040   rot.setYX (rot.yx()/sqrt(corr));  rot.setYY (rot.yy()/sqrt(corr));
00041 
00042   cout.setf (std::ios::scientific, std::ios::floatfield);
00043   rot.print (cout); cout << "\n";
00044   cout.precision (30);
00045   cout << rot.xx() << "\t" << rot.xy() << "\t" << rot.xz() << "\n"
00046        << rot.yx() << "\t" << rot.yy() << "\t" << rot.yz() << "\n"
00047        << rot.zx() << "\t" << rot.zy() << "\t" << rot.zz() << endl;
00048   cout << "\nEuler angles:"
00049        << "\nphi = "   << rot.phi()
00050        << "\ttheta = " << rot.theta()
00051        << "\tpsi = "   << rot.psi()
00052        << endl;
00053 
00054   HepRotation newrot (rot.phi(), rot.theta(), rot.psi());
00055   newrot.print(cout);
00056 
00057   return 0;
00058 }
00059 

Generated on Thu Jul 1 22:02:30 2010 for CLHEP by  doxygen 1.4.7