FairRoot/PandaRoot
mzfunctions_pp_to_leplep_vandewi.cxx
Go to the documentation of this file.
1 //c/c++
2 #include <stdlib.h>
3 #include <iostream>
4 #include <fstream>
5 #include <sstream>
6 #include <cmath>
7 
8 //ranlux
9 #include "ranlxs.h"
10 #include "ranlxd.h"
11 
12 void ranlxs(float r[], int n);
13 void ranlxd(double r[], int n);
14 
15 void rlxs_init(int level, int seed);
16 void rlxd_init(int level, int seed);
17 
18 
19 //mz general
20 #include "mzparameters.h"
21 #include "mzfunctions.h"
22 
23 //mz for pp_to_leplep_vandewi
25 
26 using namespace std;
27 
28 
29 
30 void mz_pp_to_leplep_vandewi_init(int seed, int particle_flag,
31  double P, double GE_to_GM,
32  double cos_theta_min, double cos_theta_max)
33 {
62  double P_PANDA_THRESHOLD=1.5; //pbar momentum threshold in PANDA
63  double P_PANDA_UP=15.0; //pbar momentum upper limit in PANDA
64 
65  double M=mp; //proton mass
66 
67  double E; //lab frame: pbar energy
68  double S; //center-of-mass energy squared of pbarpsystem
69  double sqrt_S; //center-of-mass energy of pbarpsystem
70  double S_min; //threshold for tau+tau- production: center-of-mass energy squared of pbarpsystem
71  double E_min; //threshold for tau+tau- production: (lab frame) pbar energy
72  double P_min; //threshold for tau+tau- production: (lab frame) pbar momentum
73 
74  //checking parameter range...
75 
76  if( (seed<1)||(seed>2147483647) ){
77  printf("ERROR: RANLUX seed out of range: \n");
78  printf(" => RANLUX seed should be contained within [1,2^31-1]\n");
79  printf(" => job killed!!! \n");
80  printf("\n\n");
81  exit(1);
82  }
83 
84 
85  if( !( ( particle_flag==0)||( particle_flag==1)||( particle_flag==2) ) ){
86  printf("ERROR: particle flag out of range: \n");
87  printf(" => particle flag should be 0 (=electron), 1 (=muon) or 2 (=tau)\n");
88  printf(" => job killed!!! \n");
89  printf("\n\n");
90  exit(1);
91  }
92 
93 
94  if(P<0.0){
95  printf("ERROR: P (anti-proton momentum) out of range: \n");
96  printf(" => P should be a positive real number \n");
97  printf(" => job killed!!! \n");
98  printf("\n\n");
99  exit(1);
100  }
101 
102 
103  if(P<P_PANDA_THRESHOLD){
104  printf("WARNING: P (anti-proton momentum) smaller than PANDA threshold %4.2f GeV \n",
105  P_PANDA_THRESHOLD);
106  printf("\n\n");
107  }
108 
109 
110  if(P>P_PANDA_UP){
111  printf("WARNING: P (anti-proton momentum) larger than PANDA upper limit %4.2f GeV \n",
112  P_PANDA_UP);
113  printf("\n\n");
114  }
115 
116 
117  if(GE_to_GM<0.0){
118  printf("ERROR: |G_E|/|G_M| out of range: \n");
119  printf(" => |G_E|/|G_M| should be a positive real number \n");
120  printf(" => job killed!!! \n");
121  printf("\n\n");
122  exit(1);
123  }
124 
125 
126  if( !( (cos_theta_min>=-1.0)&&(cos_theta_max>cos_theta_min)&&(cos_theta_max<=1.0) ) ){
127  printf("ERROR: cos(theta*) range NOT allowed \n");
128  printf(" => cos(theta*) range [cos(theta*) min, cos(theta*) max]\n");
129  printf(" should be contained within [-1.0,1.0]\n");
130  printf(" => job killed!!! \n");
131  printf("\n\n");
132  exit(1);
133  }
134 
135 
136 
137  //initial state kinematics
138 
139 
140  //antiproton energy
141  E=pow((P*P+M*M),0.5);
142 
143 
144  //center-of-mass energy squared and center-of-mass energy of pbarpsystem
145  S=2.0*M*(M+E);
146  sqrt_S=pow(S,0.5);
147 
148 
149  //kinematic thershold for tau production
150  S_min=4.0*mtau*mtau;
151  E_min=S_min/(2.0*M)-M;
152  P_min=pow((E_min*E_min-M*M),0.5);
153 
154 
155  //check if tau production is possible
156  if( (particle_flag==2)&&(S<=S_min) ){
157  printf("ERROR: center of mass energy below threshold for tau+tau- production \n");
158  printf(" => tau+tau- production requires: \n");
159  printf(" center-of-mass energy squared s > 4.0*m_{tau}^2 = %4.2f GeV^2, i.e. \n", S_min);
160  printf(" antiproton energy E > %4.2f GeV, i.e. \n", E_min);
161  printf(" antiproton momentum P > %4.2f GeV \n", P_min);
162  printf(" => job killed!!! \n");
163  exit(1);
164  printf("\n\n");
165  }
166 
167  //print out kinematics
168  printf("Initial state kinematics\n");
169  printf("------------------------\n");
170  printf("\n");
171  printf("=> CM energy square: S = %5.2f GeV^2 \n", S);
172  printf(" CM energy: sqrt(S) = %5.2f GeV \n", sqrt_S);
173  printf("\n\n\n\n");
174 
175 
176  //initialize RANLUX
177  rlxd_init(1,seed);
178 
179 }
180 
181 
182 
183 double mz_pp_to_leplep_vandewi_sigma(int particle_flag,
184  double P, double GE, double GM,
185  double cos_theta){
205  double sigma;
206 
207  double hc2_units=hc2*1000000000000.0; //(hbar*c)^2 [fb*GeV^2]
208 
209  double PI=acos(-1.0);
210 
211  double M=mp; //proton mass
212  double mlepton; //lepton mass
213 
214  double E; //lab frame: pbar energy
215  double S; //center-of-mass-energy squared of pbarpsystem
216 
217  double tau; // q^2/(4M^2) M: proton mass
218  double beta_l; // sqrt{1-4m^2/s} m: lepton mass
219  double beta_p; // sqrt{1-4M^2/s}
220 
221  double A_1, A_2, A_3, A_4; //kinematic factors
222 
223  double S_min; //threshold for tau+tau- production: center-of-mass energy squared of pbarpsystem
224 
225  //set the lepton mass
226  if(particle_flag==0) mlepton=me;
227  if(particle_flag==1) mlepton=mmu;
228  if(particle_flag==2) mlepton=mtau;
229 
230  //antiproton energy
231  E=pow((P*P+M*M),0.5);
232 
233  //center-of-mass-energy squared of pbarpsystem
234  S=2.0*M*(M+E);
235 
236  //kinematic factors
237  tau=S/(4.0*M*M);
238  beta_l=pow(1.0-4.0*mlepton*mlepton/S,0.5);
239  beta_p=pow(1.0-4.0*M*M/S,0.5);
240 
241  A_1 = hc2_units*PI*alpha_QED*alpha_QED/2.0;
242 
243  A_2 = beta_l/(beta_p*S);
244 
245  A_3 = (2.0 -beta_l*beta_l +beta_l*beta_l*cos_theta*cos_theta)*GM*GM;
246 
247  A_4 = (1.0/tau)*(1.0 -beta_l*beta_l*cos_theta*cos_theta)*GE*GE;
248 
249  //calculate cross section
250  sigma = A_1*A_2*(A_3+A_4);
251 
252  //return null value for tau production below threshold
253  S_min=4.0*mtau*mtau;
254  if( (particle_flag==2)&&(S<=S_min) ) sigma=0.0;
255 
256  return sigma;
257 }
258 
259 
260 
261 
262 
263 double mz_pp_to_leplep_vandewi_sigma_nonorm(int particle_flag,
264  double P, double GE_to_GM,
265  double cos_theta){
290  double sigma;
291 
292  double M=mp; //proton mass
293  double mlepton; //lepton mass
294 
295  double E; //lab frame: pbar energy
296  double S; //center-of-mass-energy squared of pbarpsystem
297 
298  double tau; // q^2/(4M^2) M: proton mass
299  double beta_l; // sqrt{1-4m^2/s} m: lepton mass
300  double R; // |G_E|/|G_M|
301  double A; // beta_l^2[1-R^2/tau] / ( 2-beta_l^2 + R^2/tau )
302 
303 
304  //set the lepton mass
305  if(particle_flag==0) mlepton=me;
306  if(particle_flag==1) mlepton=mmu;
307  if(particle_flag==2) mlepton=mtau;
308 
309  //antiproton energy
310  E=pow((P*P+M*M),0.5);
311 
312  //center-of-mass-energy squared of pbarpsystem
313  S=2.0*M*(M+E);
314 
315  //kinematic factors
316  tau=S/(4.0*M*M);
317  beta_l=pow(1.0-4.0*mlepton*mlepton/S,0.5);
318  R=GE_to_GM;
319  A=( beta_l*beta_l*(1.0-R*R/tau) )/( 2.0-beta_l*beta_l + R*R/tau );
320 
321  //cross section
322  sigma = 1.0 +A*cos_theta*cos_theta;
323 
324  return sigma;
325 }
326 
327 
328 
329 
330 
331 void mz_pp_to_leplep_vandewi_event(int particle_flag,
332  double P, double GE_to_GM,
333  double cos_theta_min, double cos_theta_max,
334  double* lepplus_p, double* lepminus_p)
335 {
353  double M=mp; //proton mass
354  double PI=acos(-1.0);
355 
356  double p_p[4]; //lab frame: 4-mom p (proton target)
357  double pbar_p[4]; //lab frame: 4-mom pbar (anti-proton beam)
358  double pbarp_p[4]; //lab frame: 4-mom pbarpsystem
359  double E; //lab frame: energy pbar
360  double S; //invariant mass square pbarpsystem
361  double sqrt_S; //invariant mass pbarpsystem
362 
363  double mlepton; //lepton mass
364 
365  double tau; // q^2/(4M^2) M: proton mass
366  double beta_l; // sqrt{1-4m^2/s} m: lepton mass
367  double R; // |G_E|/|G_M|
368  double A; // beta_l^2[1-R^2/tau] / ( 2-beta_l^2 + R^2/tau )
369 
370  int flag;
371  double x,y;
372  double max;
373  double prob;
374  double costheta, theta, phi;
375 
376  double lepplus_pcm[4]; //CMS frame: 4-mom lepton+
377  double lepminus_pcm[4]; //CMS frame: 4-mom lepton-
378 
379 
380  //set the lepton mass
381  if(particle_flag==0) mlepton=me;
382  if(particle_flag==1) mlepton=mmu;
383  if(particle_flag==2) mlepton=mtau;
384 
385 
386  //initial state kinematic
387 
388  //4-mom of p (lab frame)
389  p_p[0]=M;
390  p_p[1]=0.;
391  p_p[2]=0.;
392  p_p[3]=0.;
393 
394  //4-mom of pbar (lab frame)
395  E=pow((P*P+M*M),0.5);
396 
397  pbar_p[0]=E;
398  pbar_p[1]=0.;
399  pbar_p[2]=0.;
400  pbar_p[3]=P;
401 
402  //4-mom pbarpsystem (lab frame)
403  for(int i=0; i<4; i++){
404  pbarp_p[i]=p_p[i]+pbar_p[i];
405  }
406 
407  //invariant mass pbarpsystem (cms energy)
408  S=mzvmod2(4,pbarp_p);
409  sqrt_S=pow(S,0.5);
410 
411 
412  //get upper bound to non-normalized cross section
413  tau=S/(4.0*M*M);
414  beta_l=pow(1.0-4.0*mlepton*mlepton/S,0.5);
415  R=GE_to_GM;
416  A=( beta_l*beta_l*(1.0-R*R/tau) )/( 2.0-beta_l*beta_l + R*R/tau );
417  max=1.0 + fabs(A);
418 
419 
420  flag=0;
421 
422  while(flag==0){
423  x=mzrnd(cos_theta_min,cos_theta_max); //random cos(theta*) in range [cos_theta_min,cos_theta_max]
424  y=mzrnd(0.0,max); //random in range [0.0,upper bound to the cross section]
425  prob=mz_pp_to_leplep_vandewi_sigma_nonorm(particle_flag,P,GE_to_GM,x); //cross section at generated cos(theta*)
426 
427  if(y<prob){ //accept event
428  flag=1;
429 
430  costheta=x;
431  if(costheta > 1.0) costheta=1.0; //just make sure about range...
432  if(costheta < -1.0) costheta=-1.0;
433  theta=acos(costheta); //theta* lepton- in [0,PI]
434  phi=mzrnd(0.0,2.0*PI); //phi lepton- in [0,2.0*PI]
435 
436  //build lepton- 4-momentum in CMS frame
437  lepminus_pcm[0]=sqrt_S/2.0;
438  lepminus_pcm[1]=pow(S/4.0-mlepton*mlepton,0.5)*sin(theta)*cos(phi);
439  lepminus_pcm[2]=pow(S/4.0-mlepton*mlepton,0.5)*sin(theta)*sin(phi);
440  lepminus_pcm[3]=pow(S/4.0-mlepton*mlepton,0.5)*cos(theta);
441 
442  //build lepton+ 4-momentum in CMS frame
443  lepplus_pcm[0]=lepminus_pcm[0];
444  lepplus_pcm[1]=-1.0*lepminus_pcm[1];
445  lepplus_pcm[2]=-1.0*lepminus_pcm[2];
446  lepplus_pcm[3]=-1.0*lepminus_pcm[3];
447 
448  //boost lep+ and lep- 4-momenta to lab frame
449  mzboost(1,pbarp_p,lepplus_pcm,lepplus_p);
450  mzboost(1,pbarp_p,lepminus_pcm,lepminus_p);
451  }
452 
453  }
454 
455 
456 }
457 
458 
459 
460 
friend F32vec4 acos(const F32vec4 &a)
Definition: P4_F32vec4.h:113
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
void mz_pp_to_leplep_vandewi_init(int seed, int particle_flag, double P, double GE_to_GM, double cos_theta_min, double cos_theta_max)
double r
Definition: RiemannTest.C:14
Int_t i
Definition: run_full.C:25
static const double me
Definition: mzparameters.h:12
exit(0)
double mzvmod2(int n, double *p)
Definition: mzfunctions.cxx:93
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
int n
Double_t sigma[nsteps]
Definition: dedx_bands.C:65
static const double mmu
Definition: mzparameters.h:13
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:26
double mz_pp_to_leplep_vandewi_sigma(int particle_flag, double P, double GE, double GM, double cos_theta)
static const double mp
Definition: mzparameters.h:11
double mzrnd(double a, double b)
double mz_pp_to_leplep_vandewi_sigma_nonorm(int particle_flag, double P, double GE_to_GM, double cos_theta)
void ranlxs(float r[], int n)
Definition: ranlxs.cxx:566
static const double mtau
Definition: mzparameters.h:14
void ranlxd(double r[], int n)
Definition: ranlxd.cxx:571
const Double_t PI
unsigned int seed
void rlxs_init(int level, int seed)
Definition: ranlxs.cxx:495
void mzboost(int flag, double *p, double *q, double *q_prime)
static const double hc2
Definition: mzparameters.h:25
void mz_pp_to_leplep_vandewi_event(int particle_flag, double P, double GE_to_GM, double cos_theta_min, double cos_theta_max, double *lepplus_p, double *lepminus_p)
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
void rlxd_init(int level, int seed)
Definition: ranlxd.cxx:501
static const double alpha_QED
Definition: mzparameters.h:23
GeV c P
Double_t x
float GM[1000]
Double_t y
Double_t R
Definition: checkhelixhit.C:61