#include <EvtEulerAngles.hh>
Public Member Functions | |
virtual | ~EvtEulerAngles () |
EvtEulerAngles () | |
EvtEulerAngles (const EvtVector3R &Yaxis, const EvtVector3R &Zaxis) | |
EvtEulerAngles (const EvtVector4R &Pyaxis, const EvtVector4R &Pzaxis) | |
void | EulerAngles () |
double | getAlpha () |
double | getBeta () |
double | getGamma () |
Private Attributes | |
EvtVector3R | _Yaxis |
EvtVector3R | _Zaxis |
double | _alpha |
double | _beta |
double | _gamma |
double | _ry |
double | _rz |
Definition at line 32 of file EvtEulerAngles.hh.
EvtEulerAngles::~EvtEulerAngles | ( | ) | [virtual] |
EvtEulerAngles::EvtEulerAngles | ( | ) |
EvtEulerAngles::EvtEulerAngles | ( | const EvtVector3R & | Yaxis, | |
const EvtVector3R & | Zaxis | |||
) |
Definition at line 32 of file EvtEulerAngles.cc.
References _Yaxis, _Zaxis, and EulerAngles().
00032 { 00033 _Yaxis=Yaxis; 00034 _Zaxis=Zaxis; 00035 EulerAngles(); 00036 }
EvtEulerAngles::EvtEulerAngles | ( | const EvtVector4R & | Pyaxis, | |
const EvtVector4R & | Pzaxis | |||
) |
Definition at line 38 of file EvtEulerAngles.cc.
References _Yaxis, _Zaxis, EulerAngles(), EvtVector4R::get(), genRecEmupikp::i, and EvtVector3R::set().
00038 { 00039 for (int i=1;i<4;i++){ 00040 _Yaxis.set(i-1,Pyaxis.get(i)); 00041 _Zaxis.set(i-1,Pzaxis.get(i)); 00042 } 00043 EulerAngles(); 00044 }
void EvtEulerAngles::EulerAngles | ( | ) |
Definition at line 61 of file EvtEulerAngles.cc.
References _alpha, _beta, _gamma, _ry, _rz, _Yaxis, _Zaxis, cos(), EvtVector3R::d3mag(), calibUtil::ERROR, EvtVector3R::get(), pi, report(), and sin().
Referenced by EvtEulerAngles().
00061 { 00062 // to calculate Euler angles with y-convention, i.e. R=R(Z, alpha).R(Y,beta).R(Z,gamma) 00063 double pi=3.1415926; 00064 _ry=_Yaxis.d3mag(); 00065 _rz=_Zaxis.d3mag(); 00066 00067 if(_ry==0 ||_rz==0) { 00068 report(ERROR,"") << "Euler angle calculation specified by zero modules of the axis!"<<endl; 00069 report(ERROR,"EvtGen") << "Will terminate execution!"<<endl; 00070 ::abort(); 00071 } 00072 double tolerance=1e-10; 00073 bool Y1is0=fabs(_Yaxis.get(0))<tolerance; 00074 bool Y2is0=fabs(_Yaxis.get(1))<tolerance; 00075 bool Y3is0=fabs(_Yaxis.get(2))<tolerance; 00076 bool Z1is0=fabs(_Zaxis.get(0))<tolerance; 00077 bool Z2is0=fabs(_Zaxis.get(1))<tolerance; 00078 bool Z3is0=fabs(_Zaxis.get(2))<tolerance; 00079 00080 if(Y1is0 && Y3is0 && Z1is0 && Z2is0 ){ 00081 _alpha=0; _beta=0; _gamma=0; 00082 return; 00083 } 00084 00085 if( Z1is0 && Z2is0 && !Y2is0){ 00086 _alpha=0; _beta=0; 00087 _gamma=acos(_Yaxis.get(0)/_ry); 00088 if(_Yaxis.get(1)<0) _gamma=2*pi - _gamma; 00089 return; 00090 } 00091 00092 // For general case to calculate Euler angles 00093 // to calculate beta 00094 00095 if(Z1is0 && Z2is0) { 00096 _beta=0; 00097 } else{ _beta =acos(_Zaxis.get(2)/_rz);} 00098 00099 //to calculate alpha 00100 00101 if(_beta==0){ 00102 _alpha=0.0; 00103 }else { 00104 double cosalpha=_Zaxis.get(0)/_rz/sin(_beta); 00105 if(fabs(cosalpha)>1.0) cosalpha=cosalpha/fabs(cosalpha); 00106 _alpha=acos(cosalpha); 00107 if(_Zaxis.get(1)<0.0) _alpha=2*pi - _alpha; 00108 } 00109 00110 //to calculate gamma, alpha=0 and beta=0 case has been calculated, so only alpha !=0 and beta !=0 case left 00111 00112 double singamma=_Yaxis.get(2)/_ry/sin(_beta); 00113 double cosgamma=(-_Yaxis.get(0)/_ry-cos(_alpha)*cos(_beta)*singamma)/sin(_alpha); 00114 if(fabs(singamma)>1.0) singamma=singamma/fabs(singamma); 00115 _gamma=asin(singamma); 00116 if(singamma>0 && cosgamma<0 ) _gamma=pi - _gamma; // _gamma>0 00117 if(singamma<0 && cosgamma<0 ) _gamma=pi - _gamma; //_gamma<0 00118 if(singamma<0 && cosgamma>0 ) _gamma=2*pi + _gamma; //_gamma<0 00119 00120 00121 }
double EvtEulerAngles::getAlpha | ( | ) |
Definition at line 49 of file EvtEulerAngles.cc.
References _alpha.
Referenced by EvtJTO3P::decay().
00049 { 00050 return _alpha; 00051 }
double EvtEulerAngles::getBeta | ( | ) |
Definition at line 53 of file EvtEulerAngles.cc.
References _beta.
Referenced by EvtJTO3P::decay().
00053 { 00054 return _beta; 00055 }
double EvtEulerAngles::getGamma | ( | ) |
Definition at line 57 of file EvtEulerAngles.cc.
References _gamma.
Referenced by EvtJTO3P::decay().
00057 { 00058 return _gamma; 00059 }
double EvtEulerAngles::_alpha [private] |
double EvtEulerAngles::_beta [private] |
double EvtEulerAngles::_gamma [private] |
double EvtEulerAngles::_ry [private] |
double EvtEulerAngles::_rz [private] |
EvtVector3R EvtEulerAngles::_Yaxis [private] |
EvtVector3R EvtEulerAngles::_Zaxis [private] |