BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtmyEulerAngles Class Reference

#include <EvtmyEulerAngles.hh>

Public Member Functions

virtual ~EvtmyEulerAngles ()
 
 EvtmyEulerAngles ()
 
 EvtmyEulerAngles (const EvtVector3R &Yaxis, const EvtVector3R &Zaxis)
 
 EvtmyEulerAngles (const EvtVector4R &Pyaxis, const EvtVector4R &Pzaxis)
 
 EvtmyEulerAngles (EvtVector4R &h1, EvtVector4R &h2)
 
 EvtmyEulerAngles (EvtVector4R x1, EvtVector4R y1, EvtVector4R x2, EvtVector4R y2, std::string axisTag)
 
void EulerAngles ()
 
double getAlpha ()
 
double getBeta ()
 
double getGamma ()
 
double getphi ()
 
double gettheta ()
 
double getpsi ()
 

Detailed Description

Definition at line 32 of file EvtmyEulerAngles.hh.

Constructor & Destructor Documentation

◆ ~EvtmyEulerAngles()

EvtmyEulerAngles::~EvtmyEulerAngles ( )
virtual

Definition at line 31 of file EvtmyEulerAngles.cc.

31{}

◆ EvtmyEulerAngles() [1/5]

EvtmyEulerAngles::EvtmyEulerAngles ( )

Definition at line 113 of file EvtmyEulerAngles.cc.

113 {
114}

◆ EvtmyEulerAngles() [2/5]

EvtmyEulerAngles::EvtmyEulerAngles ( const EvtVector3R & Yaxis,
const EvtVector3R & Zaxis )

Definition at line 32 of file EvtmyEulerAngles.cc.

32 {
33 _Yaxis=Yaxis;
34 _Zaxis=Zaxis;
36}

◆ EvtmyEulerAngles() [3/5]

EvtmyEulerAngles::EvtmyEulerAngles ( const EvtVector4R & Pyaxis,
const EvtVector4R & Pzaxis )

Definition at line 105 of file EvtmyEulerAngles.cc.

105 {
106 for (int i=1;i<4;i++){
107 _Yaxis.set(i-1,Pyaxis.get(i));
108 _Zaxis.set(i-1,Pzaxis.get(i));
109 }
110 EulerAngles();
111}
void set(int i, double d)
double get(int i) const

◆ EvtmyEulerAngles() [4/5]

EvtmyEulerAngles::EvtmyEulerAngles ( EvtVector4R & h1,
EvtVector4R & h2 )

Definition at line 38 of file EvtmyEulerAngles.cc.

38 {
39 EvtVector4R z0(0,0,0,1);
40 Zcm=z0;
41 _x=h1;
42 _X=h2;
43 yy=Zcm.cross(_x);
44 zz=h1;
45 xx=yy.cross(zz);
46
47 YY=Zcm.cross(_X);
48 ZZ=_X;
49 XX=YY.cross(ZZ);
50 _N=zz.cross(ZZ);
51
52}
EvtVector4R cross(const EvtVector4R &v2)

◆ EvtmyEulerAngles() [5/5]

EvtmyEulerAngles::EvtmyEulerAngles ( EvtVector4R x1,
EvtVector4R y1,
EvtVector4R x2,
EvtVector4R y2,
std::string axisTag )

Definition at line 54 of file EvtmyEulerAngles.cc.

54 {
55
56 EvtVector4R z0(0,0,0,1);
57 if(axisTag=="xy"){
58 xx = x1;
59 yy = y1;
60 zz=xx.cross(yy);
61
62 XX = x2;
63 YY = y2;
64 ZZ=XX.cross(YY);
65 }else if(axisTag=="yz"){
66 yy=x1;
67 zz=y1;
68 xx=yy.cross(zz);
69
70 YY=x2;
71 ZZ=y2;
72 XX=YY.cross(ZZ);
73 }else{
74 std::cout<<"EvtmyEulerAngles::EvtmyEulerAngles bad axisTag option"<<std::endl;
75 abort();
76 }
77
78 _N=zz.cross(ZZ);
79 //std::cout<<" _N "<<zz<<ZZ<<_N<<yy<<std::endl;
80
81}

Member Function Documentation

◆ EulerAngles()

void EvtmyEulerAngles::EulerAngles ( )

Definition at line 128 of file EvtmyEulerAngles.cc.

128 {
129 // to calculate Euler angles with y-convention, i.e. R=R(Z, alpha).R(Y,beta).R(Z,gamma)
130 double pi=3.1415926;
131 _ry=_Yaxis.d3mag();
132 _rz=_Zaxis.d3mag();
133
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;
137 ::abort();
138 }
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;
146
147 if(Y1is0 && Y3is0 && Z1is0 && Z2is0 ){
148 _alpha=0; _beta=0; _gamma=0;
149 return;
150 }
151
152 if( Z1is0 && Z2is0 && !Y2is0){
153 _alpha=0; _beta=0;
154 _gamma=acos(_Yaxis.get(0)/_ry);
155 if(_Yaxis.get(1)<0) _gamma=2*pi - _gamma;
156 return;
157 }
158
159 // For general case to calculate Euler angles
160 // to calculate beta
161
162 if(Z1is0 && Z2is0) {
163 _beta=0;
164 } else{ _beta =acos(_Zaxis.get(2)/_rz);}
165
166 //to calculate alpha
167
168 if(_beta==0){
169 _alpha=0.0;
170 }else {
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;
175 }
176
177 //to calculate gamma, alpha=0 and beta=0 case has been calculated, so only alpha !=0 and beta !=0 case left
178
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; // _gamma>0
184 if(singamma<0 && cosgamma<0 ) _gamma=pi - _gamma; //_gamma<0
185 if(singamma<0 && cosgamma>0 ) _gamma=2*pi + _gamma; //_gamma<0
186
187
188}
double sin(const BesAngle a)
Definition BesAngle.h:210
double cos(const BesAngle a)
Definition BesAngle.h:213
ostream & report(Severity severity, const char *facility)
Definition EvtReport.cc:36
@ ERROR
Definition EvtReport.hh:49
double get(int i) const
double d3mag() const
const float pi
Definition vector3.h:133

Referenced by EvtmyEulerAngles(), and EvtmyEulerAngles().

◆ getAlpha()

double EvtmyEulerAngles::getAlpha ( )

Definition at line 116 of file EvtmyEulerAngles.cc.

116 {
117 return _alpha;
118}

◆ getBeta()

double EvtmyEulerAngles::getBeta ( )

Definition at line 120 of file EvtmyEulerAngles.cc.

120 {
121 return _beta;
122}

◆ getGamma()

double EvtmyEulerAngles::getGamma ( )

Definition at line 124 of file EvtmyEulerAngles.cc.

124 {
125 return _gamma;
126}

◆ getphi()

double EvtmyEulerAngles::getphi ( )

Definition at line 83 of file EvtmyEulerAngles.cc.

83 {
84 double cp=yy.dot(_N)/yy.d3mag()/_N.d3mag();
85 if(fabs(cp-1)<0.00001) return 0;
86 double acoscp = acos(cp);
87 double xyz=zz.dot(yy.cross(_N));
88 if(xyz>=0){return acoscp;}else{ return 2*3.1415926-acoscp;}
89
90}
double dot(const EvtVector4R &v2) const
double d3mag() const

◆ getpsi()

double EvtmyEulerAngles::getpsi ( )

Definition at line 98 of file EvtmyEulerAngles.cc.

98 {
99 double cp=YY.dot(_N)/YY.d3mag()/_N.d3mag();
100 if(fabs(cp-1)<0.00001) return 0;
101 double xyz=ZZ.dot(_N.cross(YY));
102 if(xyz>=0){return acos(cp);}else{ return 2*3.1415926-acos(cp);}
103}

◆ gettheta()

double EvtmyEulerAngles::gettheta ( )

Definition at line 92 of file EvtmyEulerAngles.cc.

92 {
93 double cp=zz.dot(ZZ)/zz.d3mag()/ZZ.d3mag();
94 return acos(cp);
95}

The documentation for this class was generated from the following files: