Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:08:22

0001 #include <iostream>
0002 #include <vector>
0003 #include <cmath>
0004 #include "CLHEP/Vector/ThreeVector.h"
0005 #include "CLHEP/Vector/Rotation.h"
0006 #include "CLHEP/Units/GlobalSystemOfUnits.h"
0007 
0008 using namespace std;
0009 
0010 /* 
0011   print a rotationmatrix in phiX, thetaX, phiY, ... representation
0012   when given in an (rotation-axis, rotation-angle)-representation
0013 */
0014 int main()
0015 {
0016   double phi,theta,alpha;
0017   
0018   cout << " axis:    phi[deg]="; cin >> phi; phi = phi*deg;
0019   cout << " axis:  theta[deg]="; cin >> theta; theta = theta*deg;
0020   cout << " angle: alpha[deg]="; cin >> alpha; alpha = alpha*deg;
0021   cout << endl;
0022   CLHEP::Hep3Vector axis;
0023   axis[0] = cos(phi)*sin(theta);
0024   axis[1] = sin(phi)*sin(theta);
0025   axis[2] = cos(theta);
0026   cout << " axis: (" << axis[0] << ',' 
0027                      << axis[1] << ','
0028              << axis[2] << ')' << endl;
0029   CLHEP::HepRotation rot(axis,alpha);             
0030   cout << endl;
0031   cout << "<Rotation name=\"YourNameHere\"" << endl;
0032   cout << "  phiX=\"" << rot.phiX()/deg << "*deg\"" << endl;
0033   cout << "  thetaX=\"" << rot.thetaX()/deg << "*deg\"" << endl;
0034   cout << "  phiY=\"" << rot.phiY()/deg << "*deg\"" << endl;
0035   cout << "  thetaY=\"" << rot.thetaY()/deg << "*deg\"" << endl;
0036   cout << "  phiZ=\"" << rot.phiZ()/deg << "*deg\"" << endl;
0037   cout << "  thetaZ=\"" << rot.thetaZ()/deg << "*deg\"/>" << endl;
0038   
0039   return 0;
0040 }