#include "TpcAlignmentHelper.h" #include #include #include TpcAlignmentHelper::TpcAlignmentHelper():deg2rad(TMath::Pi()/180) { } //rotation phi around z, then theta around y, then psi around x std::vector TpcAlignmentHelper::getRotationMatrixZYX(double phi, double theta, double psi,bool print){ //Matematica //d=xrot.yrot.zrot //d//MatrixForm // (cos[a]*cos[b] cos[b]*sin[a] -sin[b] // -cos[c]*sin[a]+cos[a]*sin[b]*sin[c] cos[a]*cos[c]+sin[a]*sin[b]*sin[c] cos[b]*sin[c] // cos[a]*cos[c]*sin[b]+sin[a]*sin[c] cos[c]*sin[a]*sin[b]-cos[a]*sin[c] cos[b]*cos[c] // ) //std::cerr<<"getRotMat"< ret; //std::cerr<<"test1"<Print(); ////std::cerrr<<"test0"<IsIdentity()<IsIdentity()){ //std::cout<<"ret"<GetRotationMatrix(); if(matrix==NULL){ //std::cout<<"ret2"< matrix, double &phi, double &theta, double &psi){ //What checks do I need? phi=atan2(matrix[3],matrix[0]); // the other program used atan2 here as well, why? //theta=asin(-matrix[6]); theta=atan2(-matrix[6],sqrt(matrix[7]*matrix[7]+matrix[8]*matrix[8])); psi=atan2(matrix[7],matrix[8]); phi/=deg2rad; theta/=deg2rad; psi/=deg2rad; } std::vector TpcAlignmentHelper::getAnglesZYX(std::vector mat){ double phi; double theta; double psi; getAnglesZYX(mat,phi,theta,psi); std::vector ret; ret.push_back(phi); ret.push_back(theta); ret.push_back(psi); return ret; } std::vector TpcAlignmentHelper::getAnglesZYX(TGeoRotation* rot){ double phi; double theta; double psi; getAnglesZYX(rot,phi,theta,psi); std::vector ret; ret.push_back(phi); ret.push_back(theta); ret.push_back(psi); return ret; }