1 #include "PhotosUtilities.h"
13 void fill_val(
int beg,
int end,
double* array,
double value)
15 for (
int i = beg; i < end; i++)
38 void PHOEPS(
double vec1[4],
double vec2[4],
double eps[4]){
42 eps[1-j]=vec1[2-j]*vec2[3-j] - vec1[3-j]*vec2[2-j];
43 eps[2-j]=vec1[3-j]*vec2[1-j] - vec1[1-j]*vec2[3-j];
44 eps[3-j]=vec1[1-j]*vec2[2-j] - vec1[2-j]*vec2[1-j];
47 xn=sqrt( eps[1-j]*eps[1-j] + eps[2-j]*eps[2-j] + eps[3-j]*eps[3-j]);
75 double PHOSPI(
int idhep){
76 static double SPIN[100] = { 0 };
85 fill_val(0 , 8, SPIN, 0.5);
86 fill_val(8 , 9, SPIN, 1.0);
87 fill_val(9 , 10, SPIN, 0.0);
88 fill_val(10, 18, SPIN, 0.5);
89 fill_val(18, 20, SPIN, 0.0);
90 fill_val(20, 24, SPIN, 1.0);
91 fill_val(24,100, SPIN, 0.0);
97 if (idabs-1<100)
return SPIN[idabs-1];
100 double xx=((idabs % 10)-1.0)/2.0;
124 double PHOCHA(
int idhep){
125 static double CHARGE[101] = { 0 };
134 fill_val(0 , 1, CHARGE, 0.0 );
135 fill_val(1 , 2, CHARGE,-0.3333333333);
136 fill_val(2 , 3, CHARGE, 0.6666666667);
137 fill_val(3 , 4, CHARGE,-0.3333333333);
138 fill_val(4 , 5, CHARGE, 0.6666666667);
139 fill_val(5 , 6, CHARGE,-0.3333333333);
140 fill_val(6 , 7, CHARGE, 0.6666666667);
141 fill_val(7 , 8, CHARGE,-0.3333333333);
142 fill_val(8 , 9, CHARGE, 0.6666666667);
143 fill_val(9 , 11, CHARGE, 0.0 );
144 fill_val(11 ,12, CHARGE,-1.0 );
145 fill_val(12 ,13, CHARGE, 0.0 );
146 fill_val(13 ,14, CHARGE,-1.0 );
147 fill_val(14, 15, CHARGE, 0.0 );
148 fill_val(15 ,16, CHARGE,-1.0 );
149 fill_val(16, 17, CHARGE, 0.0 );
150 fill_val(17 ,18, CHARGE,-1.0 );
151 fill_val(18, 24, CHARGE, 0.0 );
152 fill_val(24, 25, CHARGE, 1.0 );
153 fill_val(25, 37, CHARGE, 0.0 );
154 fill_val(37, 38, CHARGE, 1.0 );
155 fill_val(38,101, CHARGE, 0.0 );
158 int idabs=abs(idhep);
163 if (idabs<=100) phoch=CHARGE[idabs];
165 int Q3= idabs/1000 % 10;
166 int Q2= idabs/100 % 10;
167 int Q1= idabs/10 % 10;
171 if(Q2 % 2==0) phoch=CHARGE[Q2]-CHARGE[Q1];
172 else phoch=CHARGE[Q1]-CHARGE[Q2];
177 phoch=CHARGE[Q1]+CHARGE[Q2]+CHARGE[Q3];
182 if (idhep<0.0) phoch=-phoch;
183 if (phoch*phoch<0.000001) phoch=0.0;
206 double PHOTRI(
double A,
double B,
double C){
207 double DA,DB,DC,DAPB,DAMB,DTRIAN;
213 DTRIAN=sqrt((DAMB-DC)*(DAPB+DC)*(DAMB+DC)*(DAPB-DC));
214 return DTRIAN/(DA+DA);
230 double PHOAN1(
double X,
double Y){
234 static double PI=3.14159265358979324, TWOPI=6.28318530717958648;
236 if (fabs(Y)<fabs(X)){
237 phoan1=atan(fabs(Y/X));
238 if (X<0.0) phoan1=PI-phoan1;
240 else phoan1=acos(X/sqrt(X*X+Y*Y));
242 if (Y<0.0) phoan1=TWOPI-phoan1;
261 double PHOAN2(
double X,
double Y){
265 static double PI=3.14159265358979324;
267 if (fabs(Y)<fabs(X)){
268 phoan2=atan(fabs(Y/X));
269 if (X<0.0) phoan2=PI-phoan2;
271 else phoan2=acos(X/sqrt(X*X+Y*Y));
290 void PHORO2(
double ANGLE,
double PVEC[4]){
294 CS= cos(ANGLE)*PVEC[1-j]+sin(ANGLE)*PVEC[3-j];
295 SN=-sin(ANGLE)*PVEC[1-j]+cos(ANGLE)*PVEC[3-j];
315 void PHORO3(
double ANGLE,
double PVEC[4]){
318 CS=cos(ANGLE)*PVEC[1-j]-sin(ANGLE)*PVEC[2-j];
319 SN=sin(ANGLE)*PVEC[1-j]+cos(ANGLE)*PVEC[2-j];
341 void PHOB(
int MODE,
double PBOOS1[4],
double vec[4]){
342 double BET1[3],GAM1,PB;
347 PB=sqrt(PBOOS1[4-j0]*PBOOS1[4-j0]-PBOOS1[3-j0]*PBOOS1[3-j0]-PBOOS1[2-j0]*PBOOS1[2-j0]-PBOOS1[1-j0]*PBOOS1[1-j0]);
349 if (MODE==1) BET1[J-j0]=-PBOOS1[J-j0]/PB;
350 else BET1[J-j0]= PBOOS1[J-j0]/PB;
353 GAM1=PBOOS1[4-j0]/PB;
358 PB=BET1[1-j0]*vec[1-j0]+BET1[2-j0]*vec[2-j0]+BET1[3-j0]*vec[3-j0];
360 for( J=1; J<4;J++) vec[J-j0]=vec[J-j0]+BET1[J-j0]*(vec[4-j0]+PB/(GAM1+1.0));
361 vec[4-j0]=GAM1*vec[4-j0]+PB;
372 void bostdq(
int mode,
double qq[4],
double pp[4],
double r[4]){
373 double q[4],p[4],amq,fac;
381 amq =sqrt(q[4-i]*q[4-i]-q[1-i]*q[1-i]-q[2-i]*q[2-i]-q[3-i]*q[3-i]);
384 r[4-i] = (p[1-i]*q[1-i]+p[2-i]*q[2-i]+p[3-i]*q[3-i]+p[4-i]*q[4-i])/amq;
385 fac = (r[4-i]+p[4-i])/(q[4-i]+amq);
388 r[4-i] =(-p[1-i]*q[1-i]-p[2-i]*q[2-i]-p[3-i]*q[3-i]+p[4-i]*q[4-i])/amq;
389 fac =-(r[4-i]+p[4-i])/(q[4-i]+amq);
392 cout <<
" ++++++++ wrong mode in boostdq " << endl;
395 r[1-i]=p[1-i]+fac*q[1-i];
396 r[2-i]=p[2-i]+fac*q[2-i];
397 r[3-i]=p[3-i]+fac*q[3-i];
416 void PHOBO3(
double ANGLE,
double PVEC[4]){
419 QPL=(PVEC[4-j]+PVEC[3-j])*ANGLE;
420 QMI=(PVEC[4-j]-PVEC[3-j])/ANGLE;
421 PVEC[3-j]=(QPL-QMI)/2.0;
422 PVEC[4-j]=(QPL+QMI)/2.0;