47 using namespace starlightConstants;
54 ,_gamma(inputParametersInstance.beamLorentzGamma())
55 ,_nWbins(inputParametersInstance.nmbWBins())
56 ,_nYbins(inputParametersInstance.nmbRapidityBins())
57 ,_wMin(inputParametersInstance.minW())
58 ,_yMin(-inputParametersInstance.maxRapidity())
59 ,_wMax(inputParametersInstance.maxW())
60 ,_yMax(inputParametersInstance.maxRapidity())
61 ,_productionMode(inputParametersInstance.productionMode())
62 ,_beamBreakupMode(inputParametersInstance.beamBreakupMode())
63 ,_interferenceEnabled(inputParametersInstance.interferenceEnabled())
64 ,_interferenceStrength(inputParametersInstance.interferenceStrength())
65 ,_maxPtInterference(inputParametersInstance.maxPtInterference())
66 ,_nmbPtBinsInterference(inputParametersInstance.nmbPtBinsInterference())
67 ,_xsecCalcMethod(inputParametersInstance.xsecCalcMethod())
68 ,_baseFileName(inputParametersInstance.baseFileName())
83 std::string wyFileName;
87 wylumfile.precision(15);
88 wylumfile.open(wyFileName.c_str());
92 double Normalize = 0.,OldNorm;
103 wylumfile <<
_gamma <<endl;
104 wylumfile <<
_wMax <<endl;
105 wylumfile <<
_wMin <<endl;
107 wylumfile <<
_yMax <<endl;
108 wylumfile << _nYbins <<endl;
116 for (
unsigned int i = 0; i <
_nWbins; ++i) {
118 wylumfile << w[i] <<endl;
120 for (
unsigned int i = 0; i <
_nYbins; ++i) {
122 wylumfile << y[i] <<endl;
127 for (
unsigned int i = 0; i <
_nWbins; ++i) {
128 for (
unsigned int j = 0; j <
_nYbins; ++j) {
130 xlum = wmev *
D2LDMDY(wmev,y[j],Normalize);
131 if (j==0) OldNorm = Normalize;
132 wylumfile << xlum <<endl;
140 for (
unsigned int i = 0; i <
_nWbins; i++) {
141 printf(
"Calculating cross section: %2.0f %% \r",
float(i)/
float(_nWbins)*100);
143 for (
unsigned int j = 0; j <
_nYbins; j++) {
144 xlum = w[i] *
D2LDMDY(w[i],y[j]);
145 wylumfile << xlum <<endl;
158 double D2LDMDYx = 0.;
165 Normalize = D2LDMDYx*M/(2.0*Zin1*Zin1*Zin2*Zin2*
177 double D2LDMDYx = 0.;
178 double w1 = M/2.0*exp(Y);
179 double w2 = M/2.0*exp(-Y);
184 double b1min = r_nuc1;
185 double b2min = r_nuc2;
190 const int nbins_b1 = 120;
191 const int nbins_b2 = 120;
193 double log_delta_b1 = (log(b1max)-log(b1min))/nbins_b1;
194 double log_delta_b2 = (log(b2max)-log(b2min))/nbins_b2;
196 for(
int i = 0; i < nbins_b1; ++i)
200 double b1_low = b1min*exp(i*log_delta_b1);
201 double b1_high = b1min*exp((i+1)*log_delta_b1);
202 double b1_cent = (b1_high+b1_low)/2.;
203 for(
int j = 0; j < nbins_b2; ++j)
207 double b2_low = b2min*exp(j*log_delta_b2);
208 double b2_high = b2min*exp((j+1)*log_delta_b2);
209 double b2_cent = (b2_high+b2_low)/2.;
215 double weights[ngi] =
224 double abscissas[ngi] =
233 for(
int k = 0;
k < ngi; ++
k)
235 double b_rel = sqrt(b1_cent*b1_cent+b2_cent*b2_cent + 2.*b1_cent*b2_cent*
cos(
pi*(abscissas[
k]+1)));
245 D2LDMDYx = 2.*
pi*M/2.*sum;
274 double Integrala = 0.;
275 double totsummary = 0.;
279 double *WK =
new double[500000];
280 double Result, Summary, ResErr, NFNEVL;
288 NIter = 10000 + (int)1000000*(
int)Normalize;
317 radmul(3,Lower,Upper,NIterMin,NIter,EPS,WK,NIter,Result,ResErr,NFNEVL,Summary);
318 Integrala = Integrala + Result;
319 totsummary = totsummary + 1000*Summary;
320 NEval = NEval + NFNEVL;
325 radmul(3,Lower,Upper,NIterMin,NIter,EPS,WK,NIter,Result,ResErr,NFNEVL,Summary);
326 Integrala = Integrala + Result;
327 totsummary = totsummary + 100*Summary;
328 NEval = NEval + NFNEVL;
333 radmul(3,Lower,Upper,NIterMin,NIter,EPS,WK,NIter,Result,ResErr,NFNEVL,Summary);
334 Integrala = Integrala + Result;
335 totsummary = totsummary + 100*Summary;
336 NEval = NEval + NFNEVL;
341 radmul(3,Lower,Upper,NIterMin,NIter,EPS,WK,NIter,Result,ResErr,NFNEVL,Summary);
342 Integrala = Integrala + Result;
343 totsummary = totsummary + Summary;
344 NEval = NEval + NFNEVL;
357 radmul(3,Lower,Upper,NIterMin,NIter,EPS,WK,NIter,Result,ResErr,NFNEVL,Summary);
358 Integrala = Integrala + Result;
359 totsummary = totsummary + 100*Summary;
360 NEval = NEval + NFNEVL;
363 radmul(3,Lower,Upper,NIterMin,NIter,EPS,WK,NIter,Result,ResErr,NFNEVL,Summary);
364 Integrala = Integrala + Result;
365 totsummary = totsummary + Summary;
366 NEval = NEval + NFNEVL;
386 radmul(3,Lower,Upper,NIterMin,NIter,EPS,WK,NIter,Result,ResErr,NFNEVL,Summary);
387 Integrala = Integrala + Result;
388 totsummary = totsummary + 100*Summary;
389 NEval = NEval + NFNEVL;
392 radmul(3,Lower,Upper,NIterMin,NIter,EPS,WK,NIter,Result,ResErr,NFNEVL,Summary);
393 Integrala = Integrala + Result;
394 totsummary = totsummary + Summary;
395 NEval = NEval + NFNEVL;
407 radmul(3,Lower,Upper,NIterMin,NIter,EPS,WK,NIter,Result,ResErr,NFNEVL,Summary);
408 Integrala = Integrala + Result;
409 totsummary = totsummary + Summary;
410 NEval = NEval + NFNEVL;
419 double twoPhotonLuminosity::radmul(
int N,
double *A,
double *B,
int MINPTS,
int MAXPTS,
double EPS,
double *WK,
int IWK,
double &RESULT,
double &RELERR,
double &NFNEVL,
double &IFAIL)
421 double wn1[14] = { -0.193872885230909911, -0.555606360818980835,
422 -0.876695625666819078, -1.15714067977442459, -1.39694152314179743,
423 -1.59609815576893754, -1.75461057765584494, -1.87247878880251983,
424 -1.94970278920896201, -1.98628257887517146, -1.98221815780114818,
425 -1.93750952598689219, -1.85215668343240347, -1.72615963013768225};
427 double wn3[14] = { 0.0518213686937966768, 0.0314992633236803330,
428 0.0111771579535639891, -0.00914494741655235473, -0.0294670527866686986,
429 -0.0497891581567850424, -0.0701112635269013768, -0.0904333688970177241,
430 -0.110755474267134071, -0.131077579637250419, -0.151399685007366752,
431 -0.171721790377483099, -0.192043895747599447, -0.212366001117715794};
433 double wn5[14] = { 0.871183254585174982e-01, 0.435591627292587508e-01,
434 0.217795813646293754e-01, 0.108897906823146873e-01, 0.544489534115734364e-02,
435 0.272244767057867193e-02, 0.136122383528933596e-02, 0.680611917644667955e-03,
436 0.340305958822333977e-03, 0.170152979411166995e-03, 0.850764897055834977e-04,
437 0.425382448527917472e-04, 0.212691224263958736e-04, 0.106345612131979372e-04};
439 double wpn1[14] = { -1.33196159122085045, -2.29218106995884763,
440 -3.11522633744855959, -3.80109739368998611, -4.34979423868312742,
441 -4.76131687242798352, -5.03566529492455417, -5.17283950617283939,
442 -5.17283950617283939, -5.03566529492455417, -4.76131687242798352,
443 -4.34979423868312742, -3.80109739368998611, -3.11522633744855959};
445 double wpn3[14] = { 0.0445816186556927292, -0.0240054869684499309,
446 -0.0925925925925925875, -0.161179698216735251, -0.229766803840877915,
447 -0.298353909465020564, -0.366941015089163228, -0.435528120713305891,
448 -0.504115226337448555, -0.572702331961591218, -0.641289437585733882,
449 -0.709876543209876532, -0.778463648834019195, -0.847050754458161859};
454 double ctr[15], wth[15], wthl[15],
z[15];
457 double xl2 = 0.358568582800318073;
458 double xl4 = 0.948683298050513796;
459 double xl5 = 0.688247201611685289;
460 double w2 = 980./6561.;
461 double w4 = 200./19683.;
462 double wp2 = 245./486.;
463 double wp4 = 25./729.;
465 double SUM1, SUM2, SUM3, SUM4, SUM5, RGNCMP=0., RGNVAL, RGNERR,
F2,
F3, DIF, DIFMAX, IDVAXN =0.;
467 if (N < 2 || N > 15)
return 0;
468 if (MINPTS > MAXPTS)
return 0;
472 double TWONDM = pow(2.,(
double)(N));
474 int IRLCLS = (int)pow(2.,(N))+2*N*(N+1)+1;
479 if ( MAXPTS < IRLCLS )
return 0;
480 for (
int j = 0; j <
N; j++ ){
481 ctr[j]=(B[j] + A[j])*HF;
482 wth[j]=(B[j] - A[j])*HF;
485 double RGNVOL = TWONDM;
486 for (
int j = 0; j <
N; j++ ){
487 RGNVOL = RGNVOL*wth[j];
496 for (
int j = 0; j <
N; j++ ) {
497 z[j]=ctr[j]-xl2*wth[j];
500 z[j]=ctr[j]+xl2*wth[j];
511 DIF=fabs(7.*F2-F3-12.*SUM1);
512 DIFMAX=
max(DIF,DIFMAX);
514 if ( DIFMAX == DIF) IDVAXN = j+1;
520 for (
int j = 1; j <
N; j++){
523 for (
int k = j;
k <
N;
k++){
524 for (
int l = 0; l < 2; l++){
526 z[j1]=ctr[j1]+wthl[j1];
527 for (
int m = 0;
m < 2;
m++){
540 for (
int j = 0; j <
N; j++){
547 for (
int j = 0; j <
N; j++){
550 if ( wthl[j] > 0. )
goto L90;
553 RGNCMP = RGNVOL*(wpn1[N-2]*SUM1+wp2*SUM2+wpn3[N-2]*SUM3+wp4*SUM4);
554 RGNVAL = wn1[N-2]*SUM1+w2*SUM2+wn3[N-2]*SUM3+w4*SUM4+wn5[N-2]*SUM5;
556 RGNVAL = RGNVOL*RGNVAL;
557 RGNERR = fabs(RGNVAL-RGNCMP);
558 RESULT = RESULT+RGNVAL;
559 ABSERR = ABSERR+RGNERR;
560 IFNCLS = IFNCLS+IRLCLS;
568 if ( ISBTMP > ISBRGS )
goto L160;
569 if ( ISBTMP < ISBRGS ){
570 ISBTPP = ISBTMP + IRGNST;
572 if ( WK[ISBTMP-1] < WK[ISBTPP-1] ) ISBTMP = ISBTPP;
575 if ( RGNERR >= WK[ISBTMP-1] )
goto L160;
576 for (
int k = 0;
k < IRGNST;
k++){
577 WK[ISBRGN-
k-1] = WK[ISBTMP-
k-1];
584 ISBTMP = (ISBRGN/(2*IRGNST))*IRGNST;
586 if ( ISBTMP >= IRGNST && RGNERR > WK[ISBTMP-1] ){
587 for (
int k = 0;
k < IRGNST;
k++){
588 WK[ISBRGN-
k-1]=WK[ISBTMP-
k-1];
595 WK[ISBRGN-1] = RGNERR;
596 WK[ISBRGN-2] = RGNVAL;
597 WK[ISBRGN-3] = IDVAXN;
599 for (
int j = 0; j <
N; j++) {
601 ISBTMP = ISBRGN-2*j-4;
607 ctr[IDVAX0-1]=ctr[IDVAX0-1]+2*wth[IDVAX0-1];
608 ISBRGS = ISBRGS + IRGNST;
613 RELERR=ABSERR/fabs(RESULT);
616 if ( ISBRGS + IRGNST > IWK ) IFAIL = 2;
617 if ( IFNCLS + 2*IRLCLS > MAXPTS ) IFAIL = 1;
618 if ( RELERR < EPS && IFNCLS >= MINPTS ) IFAIL = 0;
623 ABSERR = ABSERR-WK[ISBRGN-1];
624 RESULT = RESULT-WK[ISBRGN-2];
625 IDVAX0 = (int)WK[ISBRGN-3];
627 for (
int j = 0; j <
N; j++) {
628 ISBTMP = ISBRGN-2*j-4;
630 wth[j] = WK[ISBTMP-1];
633 wth[IDVAX0-1] = HF*wth[IDVAX0-1];
634 ctr[IDVAX0-1] = ctr[IDVAX0-1]-wth[IDVAX0-1];
660 double WGamma = W/
gamma;
661 double WGR = 1.0*WGamma*Rho;