70 if( !(n==2||n==3||n==4) ){
71 printf(
"ERROR: function mzvscalar called with flag n out of range \n");
72 printf(
" => n should take the value 2,3 or 4 \n");
79 s = p[1]*q[1] + p[2]*q[2];
83 s = p[1]*q[1] + p[2]*q[2] + p[3]*q[3];
87 s = p[0]*q[0] -1.0*p[1]*q[1] -1.0*p[2]*q[2] -1.0*p[3]*q[3];
110 if( !(n==2||n==3||n==4) ){
111 printf(
"ERROR: function mzvmod2 called with flag n out of range \n");
112 printf(
" => n should take the value 2,3 or 4 \n");
123 void mzboost(
int flag,
double*
p,
double* q,
double* q_prime)
154 for (i=1; i<=3; i++) {
162 for (i=1; i<=3; i++) {
163 L[0][
i] = p_uni[
i] * pow((gamma*gamma - 1.0),0.5);
168 for (i=1; i<=3; i++) {
169 for (k=1; k<=3; k++) {
170 L[
i][k] =
mzdelta(i,k) + (gamma -1.0)*p_uni[
i]*p_uni[k];
181 for (i=1; i<=3; i++) {
182 LI[0][
i] = -1.0*L[
i][0];
183 LI[
i][0] = -1.0*L[0][
i];
186 for (i=1; i<=3; i++) {
187 for (k=1; k<=3; k++) {
196 for (i=0; i<=3; i++) {
198 for (k=0; k<=3; k++) {
199 if (flag==0) mztemp = mztemp + LI[
i][k]*q[k];
200 if (flag==1) mztemp = mztemp + L[
i][k]*q[k];
207 double mzenergy(
double m,
double p_x,
double p_y,
double p_z)
218 E=pow(m*m +p_x*p_x +p_y*p_y +p_z*p_z,0.5);
242 cerr <<
"WARNING: mzpolar called with p[1]=p[2]=p[3]=0.0 " << endl;
246 costheta = p[3]/pmod;
248 if(costheta > 1.0) costheta=1.0;
249 if(costheta < -1.0) costheta=-1.0;
251 theta =
acos(costheta) * 180.0 /
PI ;
271 if ( (p[1]==0.) && (p[2]==0.0) ) {
272 cerr <<
"WARNING: mzazimuthal called with p[1]=p[2]=0.0 " << endl;
280 if (phi<0.0) phi = phi + 360.0;
301 cerr <<
"WARNING: mzcospolar called with p[1]=p[2]=p[3]=0.0 " << endl;
305 costheta = p[3]/pmod;
324 double scalar, pmod, qmod, cosalpha;
332 cerr <<
"WARNING: mzangle called with p[1]=p[2]=p[3]=0.0 " << endl;
337 cerr <<
"WARNING: mzangle called with q[1]=q[2]=q[3]=0.0 " << endl;
342 cosalpha=scalar/(pmod*qmod);
344 if(cosalpha > 1.0) cosalpha=1.0;
345 if(cosalpha < -1.0) cosalpha=-1.0;
347 alpha=
acos(cosalpha) * 180.0 /
PI;
376 printf(
"ERROR: function mzrnd called with arguments b<=a \n");
377 printf(
" => argument b should be larger than argument a \n");
405 y=pow(Re_z*Re_z + Im_z*Im_z,0.5);
437 printf(
"ERROR: function mz_E_to_s called with argument E out of range \n");
438 printf(
" => E should be larger than the proton mass M = %5.3f GeV\n",M);
452 P=pow((E*E-M*M),0.5);
461 for(
int i=0;
i<4;
i++){
462 pbarp_p[
i]=p_p[
i]+pbar_p[
i];
488 if( !( (n>=0)&&(n<=10) ) ){
489 printf(
"ERROR: function mz_legendre_polynomial called with n out of range \n");
490 printf(
" => n should be contained in the interval [0,10]\n");
495 if( !( (x>=-1.0)&&(x<=1.0) ) ){
496 printf(
"ERROR: function mz_legendre_polynomial called with x out of range \n");
497 printf(
" => x should be contained in the interval [-1.0,1.0]\n");
512 y=(1.0/2.0)*(3.0*pow(x,2.0) -1.0);
516 y=(1.0/2.0)*(5.0*pow(x,3.0) -3.0*
x);
520 y=(1.0/8.0)*(35.0*pow(x,4.0) -30.0*pow(x,2.0) +3.0);
524 y=(1.0/8.0)*(63.0*pow(x,5.0) -70.0*pow(x,3.0) +15.0*
x);
528 y=(1.0/16.0)*(231.0*pow(x,6.0) -315.0*pow(x,4.0)
529 +105.0*pow(x,2.0) -5.0);
533 y=(1.0/16.0)*(429.0*pow(x,7.0) -693.0*pow(x,5.0)
534 +315.0*pow(x,3.0) -35.0*
x);
538 y=(1.0/128.0)*(6435.0*pow(x,8.0) -12012.0*pow(x,6.0)
539 +6930.0*pow(x,4.0) -1260.0*pow(x,2.0)
544 y=(1.0/128.0)*(12155.0*pow(x,9.0) -25740.0*pow(x,7.0)
545 +18018.0*pow(x,5.0) -4620.0*pow(x,3.0)
550 y=(1.0/256.0)*(46189.0*pow(x,10.0) -109395.0*pow(x,8.0)
551 +90090.0*pow(x,6.0) -30030*pow(x,4.0)
552 +3465.0*pow(x,2.0) -63.0);
559 double x2,
double y2,
584 printf(
"ERROR: function mz_linear_extrapolation called with x_2=x_1 \n");
585 printf(
" => argument x_2 should be different from argument x_1 \n");
friend F32vec4 acos(const F32vec4 &a)
void ranlxd(double r[], int n)
double mzcomplexmod(double Re_z, double Im_z)
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
double mzangle(double *p, double *q)
void rlxd_init(int level, int seed)
double mzdelta(int i, int k)
double mzvmod2(int n, double *p)
double mzcospolar(double *p)
void ranlxs(float r[], int n)
double mzrnd(double a, double b)
TString m2(TString pts, TString exts="e px py pz")
double mz_linear_extrapolation(double x1, double y1, double x2, double y2, double x)
void mzboost(int flag, double *p, double *q, double *q_prime)
double mzenergy(double m, double p_x, double p_y, double p_z)
double mzvscalar(int n, double *p, double *q)
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
double mzazimuthal(double *p)
double mz_E_to_s(double E)
void rlxs_init(int level, int seed)
double mz_legendre_polynomial(int n, double x)
double mzpolar(double *p)