]>
Commit | Line | Data |
---|---|---|
da32329d AM |
1 | /////////////////////////////////////////////////////////////////////////// |
2 | // | |
3 | // Copyright 2010 | |
4 | // | |
5 | // This file is part of starlight. | |
6 | // | |
7 | // starlight is free software: you can redistribute it and/or modify | |
8 | // it under the terms of the GNU General Public License as published by | |
9 | // the Free Software Foundation, either version 3 of the License, or | |
10 | // (at your option) any later version. | |
11 | // | |
12 | // starlight is distributed in the hope that it will be useful, | |
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | // GNU General Public License for more details. | |
16 | // | |
17 | // You should have received a copy of the GNU General Public License | |
18 | // along with starlight. If not, see <http://www.gnu.org/licenses/>. | |
19 | // | |
20 | /////////////////////////////////////////////////////////////////////////// | |
21 | // | |
22 | // File and Version Information: | |
45d54d9a | 23 | // $Rev:: 176 $: revision of last commit |
24 | // $Author:: jseger $: author of last commit | |
25 | // $Date:: 2014-06-20 22:15:20 +0200 #$: date of last commit | |
da32329d AM |
26 | // |
27 | // Description: | |
28 | // Added incoherent factor to luminosity table output--Joey | |
29 | // | |
30 | // | |
31 | /////////////////////////////////////////////////////////////////////////// | |
32 | ||
33 | ||
34 | #include <iostream> | |
35 | #include <fstream> | |
36 | #include <cmath> | |
37 | ||
38 | #include "inputParameters.h" | |
39 | #include "beambeamsystem.h" | |
40 | #include "beam.h" | |
41 | #include "starlightconstants.h" | |
42 | #include "nucleus.h" | |
43 | #include "bessel.h" | |
44 | #include "twophotonluminosity.h" | |
45 | #include <pthread.h> | |
46 | ||
47 | using namespace std; | |
48 | using namespace starlightConstants; | |
49 | ||
50 | ||
51 | ||
52 | //______________________________________________________________________________ | |
53 | twoPhotonLuminosity::twoPhotonLuminosity(beam beam_1,beam beam_2): | |
54 | beamBeamSystem(beam_1,beam_2) | |
55 | ,_gamma(inputParametersInstance.beamLorentzGamma()) | |
56 | ,_nWbins(inputParametersInstance.nmbWBins()) | |
57 | ,_nYbins(inputParametersInstance.nmbRapidityBins()) | |
58 | ,_wMin(inputParametersInstance.minW()) | |
59 | ,_yMin(-inputParametersInstance.maxRapidity()) | |
60 | ,_wMax(inputParametersInstance.maxW()) | |
61 | ,_yMax(inputParametersInstance.maxRapidity()) | |
62 | { | |
63 | //Lets check to see if we need to recalculate the luminosity tables | |
64 | twoPhotonDifferentialLuminosity(); | |
65 | } | |
66 | ||
67 | ||
68 | //______________________________________________________________________________ | |
69 | twoPhotonLuminosity::~twoPhotonLuminosity() | |
70 | { } | |
71 | ||
72 | ||
73 | //______________________________________________________________________________ | |
74 | void twoPhotonLuminosity::twoPhotonDifferentialLuminosity() | |
75 | { | |
76 | ofstream wylumfile; | |
77 | wylumfile.precision(15); | |
78 | wylumfile.open("slight.txt"); | |
79 | std::vector<double> w(_nWbins); | |
80 | std::vector<double> y(_nYbins); | |
81 | double xlum = 0.; | |
82 | double Normalize = 0.,OldNorm; | |
83 | double wmev = 0; | |
84 | ||
85 | Normalize = 1./sqrt(1*(double)_nWbins*_nYbins); //if your grid is very fine, you'll want high accuracy-->small Normalize | |
86 | OldNorm = Normalize; | |
87 | ||
88 | //Writing out our input parameters+(w,y)grid+diff._lum. | |
45d54d9a | 89 | // wylumfile << inputParametersInstance.parameterValueKey() << endl; |
da32329d AM |
90 | wylumfile << beam1().Z() <<endl; |
91 | wylumfile << beam1().A() <<endl; | |
92 | wylumfile << beam2().Z() <<endl; | |
93 | wylumfile << beam2().A() <<endl; | |
94 | wylumfile << inputParametersInstance.beamLorentzGamma() <<endl; | |
95 | wylumfile << inputParametersInstance.maxW() <<endl; | |
96 | wylumfile << inputParametersInstance.minW() <<endl; | |
97 | wylumfile << inputParametersInstance.nmbWBins() <<endl; | |
98 | wylumfile << inputParametersInstance.maxRapidity() <<endl; | |
99 | wylumfile << inputParametersInstance.nmbRapidityBins() <<endl; | |
100 | wylumfile << inputParametersInstance.productionMode() <<endl; | |
101 | wylumfile << inputParametersInstance.beamBreakupMode() <<endl; | |
102 | wylumfile << inputParametersInstance.interferenceEnabled() <<endl; | |
103 | wylumfile << inputParametersInstance.interferenceStrength() <<endl; | |
104 | wylumfile << inputParametersInstance.coherentProduction() <<endl; | |
105 | wylumfile << inputParametersInstance.incoherentFactor() <<endl; | |
45d54d9a | 106 | wylumfile << starlightConstants::deuteronSlopePar <<endl; |
da32329d AM |
107 | wylumfile << inputParametersInstance.maxPtInterference() <<endl; |
108 | wylumfile << inputParametersInstance.nmbPtBinsInterference() <<endl; | |
109 | for (unsigned int i = 0; i < _nWbins; ++i) { | |
110 | w[i] = _wMin + (_wMax-_wMin)/_nWbins*i; | |
111 | wylumfile << w[i] <<endl; | |
112 | } | |
113 | for (unsigned int i = 0; i < _nYbins; ++i) { | |
114 | y[i] = -_yMax + 2.*_yMax*i/(_nYbins); | |
115 | wylumfile << y[i] <<endl; | |
116 | } | |
117 | ||
118 | if(inputParametersInstance.xsecCalcMethod() == 0) { | |
119 | ||
120 | for (unsigned int i = 0; i < _nWbins; ++i) { //For each (w,y) pair, calculate the diff. _lum | |
121 | for (unsigned int j = 0; j < _nYbins; ++j) { | |
122 | wmev = w[i]*1000.; | |
123 | xlum = wmev * D2LDMDY(wmev,y[j],Normalize); //Convert photon flux dN/dW to Lorentz invariant photon number WdN/dW | |
124 | if (j==0) OldNorm = Normalize; //Save value of integral for each new W(i) and Y(i) | |
125 | wylumfile << xlum <<endl; | |
126 | } | |
127 | Normalize = OldNorm; | |
45d54d9a | 128 | } |
da32329d AM |
129 | |
130 | } | |
131 | else if(inputParametersInstance.xsecCalcMethod() == 1) { | |
132 | ||
45d54d9a | 133 | /* |
da32329d AM |
134 | const int nthreads = inputParametersInstance.nThreads(); |
135 | pthread_t threads[nthreads]; | |
136 | difflumiargs args[nthreads]; | |
137 | ||
138 | for(int t = 0; t < nthreads; t++) | |
139 | { | |
140 | args[t].self = this; | |
141 | } | |
142 | for (unsigned int i = 1; i <= _nWbins; ++i) { //For each (w,y) pair, calculate the diff. _lum | |
143 | printf("Calculating cross section: %2.0f %% \r", float(i)/float(_nWbins)*100); | |
144 | fflush(stdout); | |
145 | unsigned int r = 1; | |
146 | for(unsigned int j = 0; j < _nYbins/nthreads; ++j) | |
147 | { | |
148 | ||
149 | for(int t = 0; t < nthreads; t++) | |
150 | { | |
151 | args[t].m = w[i]; | |
152 | args[t].y = y[r]; | |
153 | ||
154 | pthread_create(&threads[t], NULL, &twoPhotonLuminosity::D2LDMDY_Threaded, &args[t]); | |
155 | r++; | |
156 | } | |
157 | for(int t = 0; t < nthreads; t++) | |
158 | { | |
159 | pthread_join(threads[t], NULL); | |
160 | xlum = w[i] * args[t].res; | |
161 | wylumfile << xlum <<endl; | |
162 | } | |
163 | } | |
164 | for(unsigned int t = 0; t < _nYbins%nthreads; t++) | |
165 | { | |
166 | args[t].m = w[i]; | |
167 | args[t].y = y[r]; | |
168 | ||
169 | pthread_create(&threads[t], NULL, &twoPhotonLuminosity::D2LDMDY_Threaded, &args[t]); | |
170 | r++; | |
171 | } | |
172 | for(unsigned int t = 0; t < _nYbins%nthreads; t++) | |
173 | { | |
174 | pthread_join(threads[t], NULL); | |
175 | xlum = w[i] * args[t].res; | |
176 | wylumfile << xlum <<endl; | |
177 | } | |
178 | } | |
179 | } | |
180 | ||
181 | wylumfile << inputParametersInstance.parameterValueKey() << endl; | |
182 | wylumfile.close(); | |
45d54d9a | 183 | */ |
184 | ||
185 | for (unsigned int i = 0; i < _nWbins; i++) { //For each (w,y) pair, calculate the diff. _lum | |
186 | printf("Calculating cross section: %2.0f %% \r", float(i)/float(_nWbins)*100); | |
187 | fflush(stdout); | |
188 | for (unsigned int j = 0; j < _nYbins; j++) { | |
189 | xlum = w[i] * D2LDMDY(w[i],y[j]); //Convert photon flux dN/dW to Lorentz invariant photon number WdN/dW | |
190 | wylumfile << xlum <<endl; | |
191 | // cout<<" i: "<<i<<" j: "<<j<<" W*dN/dW: "<<xlum<<endl; | |
192 | } | |
193 | } | |
194 | } | |
da32329d AM |
195 | return; |
196 | } | |
197 | ||
198 | //______________________________________________________________________________ | |
199 | double twoPhotonLuminosity::D2LDMDY(double M,double Y,double &Normalize) | |
200 | { | |
201 | // double differential luminosity | |
202 | ||
203 | double D2LDMDYx = 0.; | |
204 | ||
205 | _W1 = M/2.0*exp(Y); | |
206 | _W2 = M/2.0*exp(-Y); | |
207 | int Zin=beam1().Z(); | |
208 | D2LDMDYx = 2.0/M*Zin*Zin*Zin*Zin*(starlightConstants::alpha*starlightConstants::alpha)*integral(Normalize); //treats it as a symmetric collision | |
209 | Normalize = D2LDMDYx*M/(2.0*beam1().Z()*beam1().Z()* | |
210 | beam1().Z()*beam1().Z()* | |
211 | starlightConstants::alpha*starlightConstants::alpha); | |
212 | //Normalization also treats it as symmetric | |
213 | return D2LDMDYx; | |
214 | } | |
215 | ||
216 | ||
217 | ||
218 | //______________________________________________________________________________ | |
219 | double twoPhotonLuminosity::D2LDMDY(double M, double Y) const | |
220 | { | |
221 | // double differential luminosity | |
222 | ||
223 | double D2LDMDYx = 0.; | |
224 | double w1 = M/2.0*exp(Y); | |
225 | double w2 = M/2.0*exp(-Y); | |
226 | ||
227 | //int Z1=beam1().Z(); | |
228 | //int Z2=beam2().Z(); | |
229 | ||
230 | double r_nuc1 = beam1().nuclearRadius(); | |
231 | double r_nuc2 = beam2().nuclearRadius(); | |
232 | ||
233 | double b1min = r_nuc1; | |
234 | double b2min = r_nuc2; | |
235 | ||
236 | double b1max = max(5.*_gamma*hbarc/w1,5*r_nuc1); | |
237 | double b2max = max(5.*_gamma*hbarc/w2,5*r_nuc2); | |
238 | ||
239 | const int nbins_b1 = 120; | |
240 | const int nbins_b2 = 120; | |
241 | ||
242 | double log_delta_b1 = (log(b1max)-log(b1min))/nbins_b1; | |
243 | double log_delta_b2 = (log(b2max)-log(b2min))/nbins_b2; | |
244 | double sum = 0; | |
245 | for(int i = 0; i < nbins_b1; ++i) | |
246 | { | |
247 | // Sum from nested integral | |
248 | double sum_b2 = 0; | |
249 | double b1_low = b1min*exp(i*log_delta_b1); | |
250 | double b1_high = b1min*exp((i+1)*log_delta_b1); | |
251 | double b1_cent = (b1_high+b1_low)/2.; | |
252 | for(int j = 0; j < nbins_b2; ++j) | |
253 | { | |
254 | // Sum from nested | |
255 | double sum_phi = 0; | |
256 | double b2_low = b2min*exp(j*log_delta_b2); | |
257 | double b2_high = b2min*exp((j+1)*log_delta_b2); | |
258 | double b2_cent = (b2_high+b2_low)/2.; | |
259 | ||
260 | // Gaussian integration n = 10 | |
261 | // Since cos is symmetric around 0 we only need 5 of the | |
262 | // points in the gaussian integration. | |
263 | const int ngi = 5; | |
264 | double weights[ngi] = | |
265 | { | |
266 | 0.2955242247147529, | |
267 | 0.2692667193099963, | |
268 | 0.2190863625159820, | |
269 | 0.1494513491505806, | |
270 | 0.0666713443086881, | |
271 | }; | |
272 | ||
273 | double abscissas[ngi] = | |
274 | { | |
275 | -0.1488743389816312, | |
276 | -0.4333953941292472, | |
277 | -0.6794095682990244, | |
278 | -0.8650633666889845, | |
279 | -0.9739065285171717, | |
280 | }; | |
281 | ||
282 | for(int k = 0; k < ngi; ++k) | |
283 | { | |
284 | double b_rel = sqrt(b1_cent*b1_cent+b2_cent*b2_cent + 2.*b1_cent*b2_cent*cos(pi*(abscissas[k]+1))); | |
285 | ||
286 | sum_phi += weights[k] * probabilityOfBreakup(b_rel)*2; | |
287 | } | |
288 | sum_b2 += beam2().photonFlux(b2_cent,w2)*pi*sum_phi*b2_cent*(b2_high-b2_low); | |
289 | } | |
290 | ||
291 | sum += beam1().photonFlux(b1_cent, w1)*sum_b2*b1_cent*(b1_high-b1_low); | |
292 | ||
293 | } | |
294 | D2LDMDYx = 2.*pi*M/2.*sum; | |
295 | return D2LDMDYx; | |
296 | } | |
297 | ||
298 | ||
299 | void * twoPhotonLuminosity::D2LDMDY_Threaded(void * a) | |
300 | { | |
301 | difflumiargs *args = (difflumiargs*)a; | |
302 | double M = args->m; | |
303 | double Y = args->y; | |
304 | args->res = args->self->D2LDMDY(M, Y); | |
305 | ||
306 | return NULL; | |
307 | } | |
308 | ||
309 | /* | |
310 | D2LDMDYx = 2.0/M*Zin*Zin*Zin*Zin*(starlightConstants::alpha*starlightConstants::alpha)*integral(Normalize); //treats it as a symmetric collision | |
311 | Normalize = D2LDMDYx*M/(2.0*beam1().Z()*beam1().Z()* | |
312 | beam1().Z()*beam1().Z()* | |
313 | starlightConstants::alpha*starlightConstants::alpha); | |
314 | //Normalization also treats it as symmetric | |
315 | return D2LDMDYx; | |
316 | ||
317 | */ | |
318 | ||
319 | ||
320 | //______________________________________________________________________________ | |
321 | double twoPhotonLuminosity::integral(double Normalize) | |
322 | { | |
323 | int NIter = 0; | |
324 | int NIterMin = 0; | |
325 | double EPS = 0.; | |
326 | double RM = 0.; | |
327 | double u1 = 0.; | |
328 | double u2 = 0.; | |
329 | double B1 = 0.; | |
330 | double B2 = 0.; | |
331 | double Integrala = 0.; | |
332 | double totsummary = 0.; | |
333 | double NEval = 0.; | |
334 | double Lower[3]; | |
335 | double Upper[3]; | |
336 | double WK[500000]; //used to be [1000000] | |
337 | double Result, Summary, ResErr, NFNEVL; | |
338 | ||
339 | EPS = .01*Normalize; //This is EPS for integration, 1% of previous integral value. | |
340 | // Change this to the Woods-Saxon radius to be consistent with the older calculations (JN 230710) | |
341 | RM = beam1().nuclearRadius()/starlightConstants::hbarcmev; //Assumes symmetry? | |
342 | // RM = beam1().woodSaxonRadius()/starlightConstants::hbarcmev; | |
343 | ||
344 | NIter = 10000 + (int)1000000*(int)Normalize; //if integral value is very small, we don't do too many intertions to get precision down to 1% | |
345 | NIterMin = 600; | |
346 | u1 = 9.*_gamma/_W1; //upper boundary in B1 | |
347 | u2 = 9.*_gamma/_W2; //upper boundary in B2 | |
348 | B1 = .4*_gamma/_W1; //intermediate boundary in B1 | |
349 | B2 = .4*_gamma/_W2; //intermediate boundary in B2 | |
350 | //The trick is that u1,2 and b1,2 could be less than RM-the lower integration boundary, thus integration area splits into 4,2 or 1 pieces | |
351 | ||
352 | if (u1 < RM){ | |
353 | Integrala = 0; | |
354 | totsummary = 0; | |
355 | NEval = 0; | |
356 | } | |
357 | else if (B1 > RM){ | |
358 | if (u2 < RM){ | |
359 | Integrala = 0; | |
360 | totsummary = 0; | |
361 | NEval = 0; | |
362 | } | |
363 | else if (B2 > RM){ //integral has 4 parts | |
364 | Integrala = 0; | |
365 | totsummary = 40000; | |
366 | NEval = 0; | |
367 | Lower[0] = RM; //1 | |
368 | Lower[1] = RM; //2 | |
369 | Lower[2] = 0.; //3 | |
370 | Upper[2] = 2.*starlightConstants::pi; //3 | |
371 | Upper[0] = B1; //1 | |
372 | Upper[1] = B2; //2 | |
373 | radmul(3,Lower,Upper,NIterMin,NIter,EPS,WK,NIter,Result,ResErr,NFNEVL,Summary); | |
374 | Integrala = Integrala + Result; | |
375 | totsummary = totsummary + 1000*Summary; | |
376 | NEval = NEval + NFNEVL; | |
377 | Upper[0] = u1; //1 | |
378 | Upper[1] = B2; //2 | |
379 | Lower[0] = B1; //1 | |
380 | Lower[1] = RM; //2 | |
381 | radmul(3,Lower,Upper,NIterMin,NIter,EPS,WK,NIter,Result,ResErr,NFNEVL,Summary); | |
382 | Integrala = Integrala + Result; | |
383 | totsummary = totsummary + 100*Summary; | |
384 | NEval = NEval + NFNEVL; | |
385 | Upper[0] = B1; //1 | |
386 | Upper[1] = u2; //2 | |
387 | Lower[0] = RM; //1 | |
388 | Lower[1] = B2; //2 | |
389 | radmul(3,Lower,Upper,NIterMin,NIter,EPS,WK,NIter,Result,ResErr,NFNEVL,Summary); | |
390 | Integrala = Integrala + Result; | |
391 | totsummary = totsummary + 100*Summary; | |
392 | NEval = NEval + NFNEVL; | |
393 | Upper[0] = u1; //1 | |
394 | Upper[1] = u2; //2 | |
395 | Lower[0] = B1; //1 | |
396 | Lower[1] = B2; //2 | |
397 | radmul(3,Lower,Upper,NIterMin,NIter,EPS,WK,NIter,Result,ResErr,NFNEVL,Summary); | |
398 | Integrala = Integrala + Result; | |
399 | totsummary = totsummary + Summary; | |
400 | NEval = NEval + NFNEVL; | |
401 | } | |
402 | else { | |
403 | //integral has 2 parts, b2 integral has only 1 component | |
404 | Integrala = 0; | |
405 | totsummary = 20000; | |
406 | NEval = 0; | |
407 | Lower[0] = RM; //1 | |
408 | Lower[1] = RM; //2 | |
409 | Lower[2] = 0.; //3 | |
410 | Upper[2] = 2.*starlightConstants::pi; //3 | |
411 | Upper[0] = B1; //1 | |
412 | Upper[1] = u2; //2 | |
413 | radmul(3,Lower,Upper,NIterMin,NIter,EPS,WK,NIter,Result,ResErr,NFNEVL,Summary); | |
414 | Integrala = Integrala + Result; | |
415 | totsummary = totsummary + 100*Summary; | |
416 | NEval = NEval + NFNEVL; | |
417 | Upper[0] = u1; //1 | |
418 | Lower[0] = B1; //1 | |
419 | radmul(3,Lower,Upper,NIterMin,NIter,EPS,WK,NIter,Result,ResErr,NFNEVL,Summary); | |
420 | Integrala = Integrala + Result; | |
421 | totsummary = totsummary + Summary; | |
422 | NEval = NEval + NFNEVL; | |
423 | } | |
424 | } | |
425 | else{ | |
426 | if (u2 < RM ){ | |
427 | Integrala = 0; | |
428 | totsummary = 0; | |
429 | NEval = 0; | |
430 | } | |
431 | else if (B2 > RM){ | |
432 | //integral has 2 parts, b1 integral has only 1 component | |
433 | Integrala = 0; | |
434 | totsummary = 20000; | |
435 | NEval = 0; | |
436 | Lower[0] = RM; //1 | |
437 | Lower[1] = RM; //2 | |
438 | Lower[2] = 0.; //2 | |
439 | Upper[2] = 2.*starlightConstants::pi; //3 | |
440 | Upper[0] = u1; //1 | |
441 | Upper[1] = B2; //2 | |
442 | radmul(3,Lower,Upper,NIterMin,NIter,EPS,WK,NIter,Result,ResErr,NFNEVL,Summary); | |
443 | Integrala = Integrala + Result; | |
444 | totsummary = totsummary + 100*Summary; | |
445 | NEval = NEval + NFNEVL; | |
446 | Upper[1] = u2; //2 | |
447 | Lower[1] = B2; //2 | |
448 | radmul(3,Lower,Upper,NIterMin,NIter,EPS,WK,NIter,Result,ResErr,NFNEVL,Summary); | |
449 | Integrala = Integrala + Result; | |
450 | totsummary = totsummary + Summary; | |
451 | NEval = NEval + NFNEVL; | |
452 | } | |
453 | else{ //integral has 1 part | |
454 | Integrala = 0; | |
455 | totsummary = 10000; | |
456 | NEval = 0; | |
457 | Lower[0] = RM; //1 | |
458 | Lower[1] = RM; //2 | |
459 | Lower[2] = 0.; //3 | |
460 | Upper[2] = 2.*starlightConstants::pi; //3 | |
461 | Upper[0] = u1; //1 | |
462 | Upper[1] = u2; //2 | |
463 | radmul(3,Lower,Upper,NIterMin,NIter,EPS,WK,NIter,Result,ResErr,NFNEVL,Summary); | |
464 | Integrala = Integrala + Result; | |
465 | totsummary = totsummary + Summary; | |
466 | NEval = NEval + NFNEVL; | |
467 | } | |
468 | } | |
469 | Integrala = 2*starlightConstants::pi*Integrala; | |
470 | return Integrala; | |
471 | } | |
472 | ||
473 | //______________________________________________________________________________ | |
474 | 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) | |
475 | { | |
476 | double wn1[14] = { -0.193872885230909911, -0.555606360818980835, | |
477 | -0.876695625666819078, -1.15714067977442459, -1.39694152314179743, | |
478 | -1.59609815576893754, -1.75461057765584494, -1.87247878880251983, | |
479 | -1.94970278920896201, -1.98628257887517146, -1.98221815780114818, | |
480 | -1.93750952598689219, -1.85215668343240347, -1.72615963013768225}; | |
481 | ||
482 | double wn3[14] = { 0.0518213686937966768, 0.0314992633236803330, | |
483 | 0.0111771579535639891, -0.00914494741655235473, -0.0294670527866686986, | |
484 | -0.0497891581567850424, -0.0701112635269013768, -0.0904333688970177241, | |
485 | -0.110755474267134071, -0.131077579637250419, -0.151399685007366752, | |
486 | -0.171721790377483099, -0.192043895747599447, -0.212366001117715794}; | |
487 | ||
488 | double wn5[14] = { 0.871183254585174982e-01, 0.435591627292587508e-01, | |
489 | 0.217795813646293754e-01, 0.108897906823146873e-01, 0.544489534115734364e-02, | |
490 | 0.272244767057867193e-02, 0.136122383528933596e-02, 0.680611917644667955e-03, | |
491 | 0.340305958822333977e-03, 0.170152979411166995e-03, 0.850764897055834977e-04, | |
492 | 0.425382448527917472e-04, 0.212691224263958736e-04, 0.106345612131979372e-04}; | |
493 | ||
494 | double wpn1[14] = { -1.33196159122085045, -2.29218106995884763, | |
495 | -3.11522633744855959, -3.80109739368998611, -4.34979423868312742, | |
496 | -4.76131687242798352, -5.03566529492455417, -5.17283950617283939, | |
497 | -5.17283950617283939, -5.03566529492455417, -4.76131687242798352, | |
498 | -4.34979423868312742, -3.80109739368998611, -3.11522633744855959}; | |
499 | ||
500 | double wpn3[14] = { 0.0445816186556927292, -0.0240054869684499309, | |
501 | -0.0925925925925925875, -0.161179698216735251, -0.229766803840877915, | |
502 | -0.298353909465020564, -0.366941015089163228, -0.435528120713305891, | |
503 | -0.504115226337448555, -0.572702331961591218, -0.641289437585733882, | |
504 | -0.709876543209876532, -0.778463648834019195, -0.847050754458161859}; | |
505 | ||
506 | RESULT = 0; | |
507 | ||
508 | double ABSERR = 0.; | |
509 | double ctr[15], wth[15], wthl[15], z[15]; | |
510 | double R1 = 1.; | |
511 | double HF = R1/2.; | |
512 | double xl2 = 0.358568582800318073; | |
513 | double xl4 = 0.948683298050513796; | |
514 | double xl5 = 0.688247201611685289; | |
515 | double w2 = 980./6561.; | |
516 | double w4 = 200./19683.; | |
517 | double wp2 = 245./486.; | |
518 | double wp4 = 25./729.; | |
519 | int j1 =0; | |
520 | double SUM1, SUM2, SUM3, SUM4, SUM5, RGNCMP=0., RGNVAL, RGNERR, F2, F3, DIF, DIFMAX, IDVAXN =0.; | |
521 | IFAIL = 3; | |
522 | if (N < 2 || N > 15) return 0; | |
523 | if (MINPTS > MAXPTS) return 0; | |
524 | int IFNCLS = 0; | |
525 | int IDVAX0 = 0; | |
526 | bool LDV = false; | |
527 | double TWONDM = pow(2.,(double)(N)); | |
528 | int IRGNST = 2*N+3; | |
529 | int IRLCLS = (int)pow(2.,(N))+2*N*(N+1)+1; | |
530 | int ISBRGN = IRGNST; | |
531 | int ISBTMP, ISBTPP; | |
532 | int ISBRGS = IRGNST; | |
533 | ||
534 | if ( MAXPTS < IRLCLS ) return 0; | |
535 | for ( int j = 0; j < N; j++ ){ //10 | |
536 | ctr[j]=(B[j] + A[j])*HF; | |
537 | wth[j]=(B[j] - A[j])*HF; | |
538 | } | |
539 | L20: | |
540 | double RGNVOL = TWONDM; //20 | |
541 | for ( int j = 0; j < N; j++ ){ //30 | |
542 | RGNVOL = RGNVOL*wth[j]; | |
543 | z[j] = ctr[j]; | |
544 | } | |
545 | ||
546 | SUM1 = integrand(N,z); | |
547 | ||
548 | DIFMAX = 0; | |
549 | SUM2 = 0; | |
550 | SUM3 = 0; | |
551 | for ( int j = 0; j < N; j++ ) { //40 | |
552 | z[j]=ctr[j]-xl2*wth[j]; | |
553 | F2=integrand(N,z); | |
554 | ||
555 | z[j]=ctr[j]+xl2*wth[j]; | |
556 | F2=F2+integrand(N,z); | |
557 | wthl[j]=xl4*wth[j]; | |
558 | ||
559 | z[j]=ctr[j]-wthl[j]; | |
560 | F3=integrand(N,z); | |
561 | ||
562 | z[j]=ctr[j]+wthl[j]; | |
563 | F3=F3+integrand(N,z); | |
564 | SUM2=SUM2+F2; | |
565 | SUM3=SUM3+F3; | |
566 | DIF=fabs(7.*F2-F3-12.*SUM1); | |
567 | DIFMAX=max(DIF,DIFMAX); | |
568 | ||
569 | if ( DIFMAX == DIF) IDVAXN = j+1; | |
570 | z[j]=ctr[j]; | |
571 | ||
572 | } | |
573 | ||
574 | SUM4 = 0; | |
575 | for ( int j = 1; j < N; j++){ //70 | |
576 | ||
577 | j1=j-1; | |
578 | for ( int k = j; k < N; k++){ //60 | |
579 | for ( int l = 0; l < 2; l++){ //50 | |
580 | wthl[j1]=-wthl[j1]; | |
581 | z[j1]=ctr[j1]+wthl[j1]; | |
582 | for ( int m = 0; m < 2; m++){ //50 | |
583 | wthl[k]=-wthl[k]; | |
584 | z[k]=ctr[k]+wthl[k]; | |
585 | SUM4=SUM4+integrand(N,z); | |
586 | } | |
587 | } | |
588 | z[k]=ctr[k]; | |
589 | } | |
590 | z[j1]=ctr[j1]; | |
591 | } | |
592 | ||
593 | SUM5 = 0; | |
594 | ||
595 | for ( int j = 0; j < N; j++){ //80 | |
596 | wthl[j]=-xl5*wth[j]; | |
597 | z[j]=ctr[j]+wthl[j]; | |
598 | } | |
599 | L90: | |
600 | SUM5=SUM5+integrand(N,z); //line 90 | |
601 | ||
602 | for (int j = 0; j < N; j++){ //100 | |
603 | wthl[j]=-wthl[j]; | |
604 | z[j]=ctr[j]+wthl[j]; | |
605 | if ( wthl[j] > 0. ) goto L90; | |
606 | } | |
607 | ||
608 | RGNCMP = RGNVOL*(wpn1[N-2]*SUM1+wp2*SUM2+wpn3[N-2]*SUM3+wp4*SUM4); | |
609 | RGNVAL = wn1[N-2]*SUM1+w2*SUM2+wn3[N-2]*SUM3+w4*SUM4+wn5[N-2]*SUM5; | |
610 | ||
611 | RGNVAL = RGNVOL*RGNVAL; | |
612 | RGNERR = fabs(RGNVAL-RGNCMP); | |
613 | RESULT = RESULT+RGNVAL; | |
614 | ABSERR = ABSERR+RGNERR; | |
615 | IFNCLS = IFNCLS+IRLCLS; | |
616 | ||
617 | ||
618 | if (LDV){ | |
619 | L110: | |
620 | ||
621 | ISBTMP = 2*ISBRGN; | |
622 | ||
623 | if ( ISBTMP > ISBRGS ) goto L160; | |
624 | if ( ISBTMP < ISBRGS ){ | |
625 | ISBTPP = ISBTMP + IRGNST; | |
626 | ||
627 | if ( WK[ISBTMP-1] < WK[ISBTPP-1] ) ISBTMP = ISBTPP; | |
628 | } | |
629 | ||
630 | if ( RGNERR >= WK[ISBTMP-1] ) goto L160; | |
631 | for ( int k = 0; k < IRGNST; k++){ | |
632 | WK[ISBRGN-k-1] = WK[ISBTMP-k-1]; | |
633 | } | |
634 | ISBRGN = ISBTMP; | |
635 | goto L110; | |
636 | } | |
637 | L140: | |
638 | ||
639 | ISBTMP = (ISBRGN/(2*IRGNST))*IRGNST; | |
640 | ||
641 | if ( ISBTMP >= IRGNST && RGNERR > WK[ISBTMP-1] ){ | |
642 | for ( int k = 0; k < IRGNST; k++){ | |
643 | WK[ISBRGN-k-1]=WK[ISBTMP-k-1]; | |
644 | } | |
645 | ISBRGN = ISBTMP; | |
646 | goto L140; | |
647 | } | |
648 | L160: | |
649 | ||
650 | WK[ISBRGN-1] = RGNERR; | |
651 | WK[ISBRGN-2] = RGNVAL; | |
652 | WK[ISBRGN-3] = IDVAXN; | |
653 | ||
654 | for ( int j = 0; j < N; j++) { | |
655 | ||
656 | ISBTMP = ISBRGN-2*j-4; | |
657 | WK[ISBTMP]=ctr[j]; | |
658 | WK[ISBTMP-1]=wth[j]; | |
659 | } | |
660 | if (LDV) { | |
661 | LDV = false; | |
662 | ctr[IDVAX0-1]=ctr[IDVAX0-1]+2*wth[IDVAX0-1]; | |
663 | ISBRGS = ISBRGS + IRGNST; | |
664 | ISBRGN = ISBRGS; | |
665 | goto L20; | |
666 | } | |
667 | ||
668 | RELERR=ABSERR/fabs(RESULT); | |
669 | ||
670 | ||
671 | if ( ISBRGS + IRGNST > IWK ) IFAIL = 2; | |
672 | if ( IFNCLS + 2*IRLCLS > MAXPTS ) IFAIL = 1; | |
673 | if ( RELERR < EPS && IFNCLS >= MINPTS ) IFAIL = 0; | |
674 | ||
675 | if ( IFAIL == 3 ) { | |
676 | LDV = true; | |
677 | ISBRGN = IRGNST; | |
678 | ABSERR = ABSERR-WK[ISBRGN-1]; | |
679 | RESULT = RESULT-WK[ISBRGN-2]; | |
680 | IDVAX0 = (int)WK[ISBRGN-3]; | |
681 | ||
682 | for ( int j = 0; j < N; j++) { | |
683 | ISBTMP = ISBRGN-2*j-4; | |
684 | ctr[j] = WK[ISBTMP]; | |
685 | wth[j] = WK[ISBTMP-1]; | |
686 | } | |
687 | ||
688 | wth[IDVAX0-1] = HF*wth[IDVAX0-1]; | |
689 | ctr[IDVAX0-1] = ctr[IDVAX0-1]-wth[IDVAX0-1]; | |
690 | goto L20; | |
691 | } | |
692 | NFNEVL=IFNCLS; | |
693 | return 1; | |
694 | } | |
695 | ||
696 | ||
697 | //______________________________________________________________________________ | |
698 | double twoPhotonLuminosity::integrand(double , // N (unused) | |
699 | double X[]) | |
700 | { | |
701 | double b1 = X[0]; //1 | |
702 | double b2 = X[1]; //2 | |
703 | double theta = X[2]; //3 | |
704 | //breakup effects distances in fermis, so convert to fermis(factor of hbarcmev) | |
705 | double D = sqrt(b1*b1+b2*b2-2*b1*b2*cos(theta))*starlightConstants::hbarcmev; | |
706 | double integrandx = Nphoton(_W1,_gamma,b1)*Nphoton(_W2,_gamma,b2)*b1*b2*probabilityOfBreakup(D); | |
707 | //why not just use gamma? | |
708 | //switching _input2photon.beamLorentzGamma()to gamma | |
709 | return integrandx; | |
710 | } | |
711 | ||
712 | ||
713 | //______________________________________________________________________________ | |
714 | double twoPhotonLuminosity::Nphoton(double W,double gamma,double Rho) | |
715 | { | |
716 | double Nphoton1 =0.; | |
717 | double WGamma = W/gamma; | |
718 | double WGR = 1.0*WGamma*Rho; | |
719 | //factor of Z^2*alpha is omitted | |
720 | double Wphib = WGamma*bessel::dbesk1(WGR); | |
721 | ||
722 | Nphoton1 = 1.0/(starlightConstants::pi*starlightConstants::pi)*(Wphib*Wphib); | |
723 | return Nphoton1; | |
724 | } |