65 }
else if(axisTag==
"yz"){
74 std::cout<<
"EvtmyEulerAngles::EvtmyEulerAngles bad axisTag option"<<std::endl;
85 if(fabs(cp-1)<0.00001)
return 0;
86 double acoscp = acos(cp);
88 if(xyz>=0){
return acoscp;}
else{
return 2*3.1415926-acoscp;}
100 if(fabs(cp-1)<0.00001)
return 0;
102 if(xyz>=0){
return acos(cp);}
else{
return 2*3.1415926-acos(cp);}
106 for (
int i=1;i<4;i++){
107 _Yaxis.
set(i-1,Pyaxis.
get(i));
108 _Zaxis.
set(i-1,Pzaxis.
get(i));
134 if(_ry==0 ||_rz==0) {
135 report(
ERROR,
"") <<
"Euler angle calculation specified by zero modules of the axis!"<<endl;
136 report(
ERROR,
"EvtGen") <<
"Will terminate execution!"<<endl;
139 double tolerance=1e-10;
140 bool Y1is0=fabs(_Yaxis.
get(0))<tolerance;
141 bool Y2is0=fabs(_Yaxis.
get(1))<tolerance;
142 bool Y3is0=fabs(_Yaxis.
get(2))<tolerance;
143 bool Z1is0=fabs(_Zaxis.
get(0))<tolerance;
144 bool Z2is0=fabs(_Zaxis.
get(1))<tolerance;
145 bool Z3is0=fabs(_Zaxis.
get(2))<tolerance;
147 if(Y1is0 && Y3is0 && Z1is0 && Z2is0 ){
148 _alpha=0; _beta=0; _gamma=0;
152 if( Z1is0 && Z2is0 && !Y2is0){
154 _gamma=acos(_Yaxis.
get(0)/_ry);
155 if(_Yaxis.
get(1)<0) _gamma=2*
pi - _gamma;
164 }
else{ _beta =acos(_Zaxis.
get(2)/_rz);}
171 double cosalpha=_Zaxis.
get(0)/_rz/
sin(_beta);
172 if(fabs(cosalpha)>1.0) cosalpha=cosalpha/fabs(cosalpha);
173 _alpha=acos(cosalpha);
174 if(_Zaxis.
get(1)<0.0) _alpha=2*
pi - _alpha;
179 double singamma=_Yaxis.
get(2)/_ry/
sin(_beta);
180 double cosgamma=(-_Yaxis.
get(0)/_ry-
cos(_alpha)*
cos(_beta)*singamma)/
sin(_alpha);
181 if(fabs(singamma)>1.0) singamma=singamma/fabs(singamma);
182 _gamma=asin(singamma);
183 if(singamma>0 && cosgamma<0 ) _gamma=
pi - _gamma;
184 if(singamma<0 && cosgamma<0 ) _gamma=
pi - _gamma;
185 if(singamma<0 && cosgamma>0 ) _gamma=2*
pi + _gamma;
double sin(const BesAngle a)
double cos(const BesAngle a)
ostream & report(Severity severity, const char *facility)
void set(int i, double d)
double dot(const EvtVector4R &v2) const
EvtVector4R cross(const EvtVector4R &v2)
virtual ~EvtmyEulerAngles()