31 ,_probOfBreakup(_nBbins)
36 ,_fnSingleCumulative(_nK+1)
37 ,_fnDoubleCumulative(_nK+1)
39 ,_fnDoubleIntCumulative(_nK+1)
45 ,_hadBreakProbCalculated(
false)
61 for (
int i = 0; i < _nK+1; i++)
64 egamma = egamma * eg_inc;
77 for (
int i = 0; i <
_nK; i++)
86 for (
int j = 0; j < _nBbins - 1; j++)
100 bint = bint + 0.5*(f1+
f2)*(b-bold);
109 egamma = egamma*eg_inc;
113 for (
int i = 0; i <
_nK; i++)
119 for (
int i = 0; i <
_nK; i++)
137 for (
int i = 0; i <
_nK; i++)
148 for (
int i = 0; i < _nK+1; i++)
151 egamma1 = egamma1 * eg_inc;
166 for (
int i = 0; i <
_nK; i++)
171 for (
int j = 0; j <
_nK; j++)
178 for (
int k = 0;
k < nbbins - 1;
k++)
193 bint = bint + 0.5*(f1+
f2)*(b-bold);
197 egamma2 = egamma2 * eg_inc;
199 egamma1 = egamma1 * eg_inc;
202 for (
int i = 0; i <
_nK; i++)
205 for (
int j = 0; j <
_nK; j++)
212 for (
int i = 1; i < _nK+1; i++)
218 for (
int i = 0; i < _nK+1; i++)
239 if (itest >=
_nK || itest < 0)
241 std::cerr <<
"ERROR: itest: " << itest << std::endl;
248 std::cout <<
"WARNING: delta_f: " << delta_f << std::endl;
252 double dF = _fnSingleCumulative[itest+1] - _fnSingleCumulative[itest];
254 double delta_e = delta_f*dE/dF;
256 if (delta_e > (_eGamma[itest+1] - _eGamma[itest]))
258 std::cerr <<
"ERROR: delta_E: " << delta_e << std::endl;
261 egamma = _eGamma[itest] + delta_e;
280 if (itest1 >=
_nK || itest1 < 0)
282 std::cerr <<
"ERROR: itest1: " << itest1 << std::endl;
288 std::cout <<
"WARNING: delta_f: " << delta_f << std::endl;
292 double dF = _fnDoubleIntCumulative[itest1+1] - _fnDoubleIntCumulative[itest1];
294 double delta_e = delta_f*dE/dF;
296 if (delta_e > (_eGamma[itest1+1] - _eGamma[itest1]))
298 std::cerr <<
"ERROR: delta_E: " << delta_e << std::endl;
301 egamma1 = _eGamma[itest1] + delta_e;
305 std::vector<double> fn_second_cumulative(
_nK+1);
307 fn_second_cumulative[0] = 0.0;
308 for(
int i = 1; i <
_nK+1; i++)
310 fn_second_cumulative[i] = fn_second_cumulative[i-1] +
_fnDouble[itest1][i-1];
313 double norm_factor = 1.0/fn_second_cumulative[
_nK];
314 for(
int i = 0; i < _nK+1; i++)
316 fn_second_cumulative[i] = norm_factor*fn_second_cumulative[i];
321 while (xtest2 > fn_second_cumulative[itest2])
327 if (itest2 >= _nK || itest2 < 0)
329 std::cerr <<
"ERROR: itest2: " << itest2 << std::endl;
331 delta_f = xtest2 - fn_second_cumulative[itest2];
335 std::cout <<
"WARNING: delta_f: " << delta_f << std::endl;
338 dE = _eGamma[itest2+1] - _eGamma[itest2];
339 dF = fn_second_cumulative[itest2+1] - fn_second_cumulative[itest2];
341 delta_e = delta_f*dE/dF;
343 if (delta_e > (_eGamma[itest2+1] - _eGamma[itest2]))
345 std::cerr <<
"ERROR: delta_E: " << delta_e << std::endl;
348 egamma2 = _eGamma[itest2] + delta_e;
359 double b_min =
_bMin;
366 for (
int i = 0; i < nbbins; i++)
382 double fnSingle = 0.0;
384 if (i1 < 0 || i2 >
_nK)
386 std::cout <<
"I1, I2 out of bounds. Egamma = " << egamma << std::endl;
387 std::cout <<
"I1, I2 = " << i1 <<
", " << i2 << std::endl;
393 double eFrac = (egamma - _eGamma[i1])/dE;
395 if (eFrac < 0.0 || eFrac > 1.0)
397 std::cout <<
"WARNING: Efrac = " << eFrac << std::endl;
409 double fnDouble = 0.0;
411 if (i1 < 0 || i2 >
_nK)
413 std::cout <<
"I1, I2 out of bounds. Egamma1 = " << egamma1 << std::endl;
414 std::cout <<
"I1, I2 = " << i1 <<
", " << i2 << std::endl;
422 if (j1 < 0 || j2 > _nK)
424 std::cout <<
"J1, J2 out of bounds. Egamma2 = " << egamma2 << std::endl;
425 std::cout <<
"J1, J2 = " << j1 <<
", " << j2 << std::endl;
431 double eFrac1 = (egamma1 - _eGamma[i1])/dE1;
433 if (eFrac1 < 0.0 || eFrac1 > 1.0)
435 std::cout <<
"WARNING: Efrac1 = " << eFrac1 << std::endl;
441 double dE2 = _eGamma[j2] - _eGamma[j1];
442 double eFrac2 = (egamma2 - _eGamma[j1])/dE2;
444 if (eFrac2 < 0.0 || eFrac2 > 1.0)
446 std::cout <<
"WARNING: Efrac2 = " << eFrac2 << std::endl;
449 fnDouble = (1.0 - eFrac2)*ptemp1 + eFrac2*ptemp2;
458 double res = factor *
_beamBeamSystem->beam1().photonDensity(b, egamma*factor);