26 #define hbarc 0.197327053
28 #define MAGENTA "\033[35m"
30 using namespace Jetscape;
47 dGamma_qq =
new vector<double>;
48 dGamma_qg =
new vector<double>;
49 dGamma_qq_q =
new vector<double>;
50 dGamma_qg_q =
new vector<double>;
53 auto martini_mutex = make_shared<MartiniMutex>();
54 SetMutex(martini_mutex);
60 JSINFO <<
"Initialize Martini ...";
65 deltaT = GetXMLElementDouble({
"Eloss",
"deltaT"});
67 if (deltaT > Martini_deltaT_Max) {
68 JSWARN <<
"Timestep for Martini ( deltaT = " << deltaT
69 <<
" ) is too large. "
70 <<
"Please choose a detaT smaller than or equal to 0.03 in the XML "
72 throw std::runtime_error(
73 "Martini not properly initialized in XML file ...");
76 string s = GetXMLElementText({
"Eloss",
"Martini",
"name"});
77 JSDEBUG << s <<
" to be initialized ...";
79 tStart = GetXMLElementDouble({
"Eloss",
"tStart"});
80 Q0 = GetXMLElementDouble({
"Eloss",
"Martini",
"Q0"});
81 alpha_s0 = GetXMLElementDouble({
"Eloss",
"Martini",
"alpha_s"});
82 pcut = GetXMLElementDouble({
"Eloss",
"Martini",
"pcut"});
83 hydro_Tc = GetXMLElementDouble({
"Eloss",
"Martini",
"hydro_Tc"});
84 recoil_on = GetXMLElementInt({
"Eloss",
"Martini",
"recoil_on"});
85 run_alphas = GetXMLElementInt({
"Eloss",
"Martini",
"run_alphas"});
90 PathToTables = GetXMLElementText({
"Eloss",
"Martini",
"path"});
93 ZeroOneDistribution = uniform_real_distribution<double>{0.0, 1.0};
95 readRadiativeRate(&dat, &Gam);
96 readElasticRateOmega();
101 vector<Parton> &pIn, vector<Parton> &pOut) {
103 <<
" " << Q2 <<
" " << pIn.size();
111 double p0, px, py, pz;
113 double velx, vely, velz;
114 double pRest, pxRest;
115 double pyRest, pzRest;
121 double pThermal, pxThermal;
122 double pyThermal, pzThermal;
123 double pRecoil, pxRecoil;
124 double pyRecoil, pzRecoil;
126 double xx, yy, zz, tt;
138 double velocity_jet[4];
140 double SpatialRapidity;
159 for (
int i = 0;
i < pIn.size();
i++) {
162 pStat = pIn[
i].pstat();
172 pAbs = sqrt(px * px + py * py + pz * pz);
180 double velocityMod = std::sqrt(std::pow(velx, 2) + std::pow(vely, 2) +
183 xx = pIn[
i].x_in().x() + (Time - pIn[
i].x_in().t()) * velx / velocityMod;
184 yy = pIn[
i].x_in().y() + (Time - pIn[
i].x_in().t()) * vely / velocityMod;
185 zz = pIn[
i].x_in().z() + (Time - pIn[
i].x_in().t()) * velz / velocityMod;
188 SpatialRapidity = 0.5 * std::log((tt + zz) / (tt - zz));
189 double boostedTStart = tStart * cosh(SpatialRapidity);
192 std::unique_ptr<FluidCellInfo> check_fluid_info_ptr;
193 GetHydroCellSignal(Time, xx, yy, zz, check_fluid_info_ptr);
197 vx = check_fluid_info_ptr->
vx;
198 vy = check_fluid_info_ptr->
vy;
199 vz = check_fluid_info_ptr->
vz;
202 beta = sqrt(vx * vx + vy * vy + vz * vz);
208 TakeResponsibilityFor(
211 pLabel = pIn[
i].plabel();
214 pIn[
i].set_label(pLabelNew);
239 gamma = 1. / sqrt(1. - beta * beta);
240 cosPhi = (px * vx + py * vy + pz *
vz) / (pAbs * beta);
243 pRest = pAbs * gamma * (1. - beta * cosPhi);
245 pxRest = -vx * gamma * pAbs +
246 (1. + (gamma - 1.) * vx * vx / (beta * beta)) * px +
247 (gamma - 1.) * vx * vy / (beta * beta) * py +
248 (gamma - 1.) * vx * vz / (beta * beta) * pz;
249 pyRest = -vy * gamma * pAbs +
250 (1. + (gamma - 1.) * vy * vy / (beta * beta)) * py +
251 (gamma - 1.) * vx * vy / (beta * beta) * px +
252 (gamma - 1.) * vy * vz / (beta * beta) * pz;
253 pzRest = -vz * gamma * pAbs +
254 (1. + (gamma - 1.) * vz * vz / (beta * beta)) * pz +
255 (gamma - 1.) * vx * vz / (beta * beta) * px +
256 (gamma - 1.) * vy * vz / (beta * beta) * py;
258 pVecRest =
FourVector(pxRest, pyRest, pzRest, pRest);
260 cosPhiRest = (pxRest * vx + pyRest * vy + pzRest *
vz) / (pRest * beta);
261 boostBack = gamma * (1. + beta * cosPhiRest);
265 if (pRest < eLossCut)
continue;
267 xVec =
FourVector(xx + px / pAbs * deltaT, yy + py / pAbs * deltaT,
268 zz + pz / pAbs * deltaT, Time + deltaT);
270 velocity_jet[0] = 1.0;
271 velocity_jet[1] = pIn[
i].jet_v().x();
272 velocity_jet[2] = pIn[
i].jet_v().y();
273 velocity_jet[3] = pIn[
i].jet_v().z();
278 double mu = sqrt(2.*pAbs*T);
279 alpha_s = RunningAlphaS(mu);
281 g = sqrt(4. * M_PI * alpha_s);
283 double deltaTRest = deltaT / gamma;
285 int process = DetermineProcess(pRest, T, deltaTRest, Id);
290 <<
" process = " << process <<
" T = " << setprecision(3) << T
291 <<
" pAbs = " << pAbs <<
" " << px <<
" " << py <<
" " << pz
292 <<
" | pRest = " << pRest <<
"/" << pcut
293 <<
" | position = " << xx <<
" " << yy <<
" " << zz
294 <<
" | stat = " << pStat <<
" " << pLabel <<
" " << coherent
295 <<
" | " << pAtSplit.
x();
298 bool coherent_temp = coherent;
307 if (process == 0 || (coherent && (process < 5))) {
308 pOut.push_back(
Parton(pLabel, Id, pStat, pVec, xVec));
309 pOut[pOut.size() - 1].set_form_time(0.);
310 pOut[pOut.size() - 1].set_jet_v(velocity_jet);
313 pOut[pOut.size() - 1].set_user_info(
322 if (std::abs(Id) == 1 || std::abs(Id) == 2 || std::abs(Id) == 3) {
326 if (pRest / T < AMYpCut)
330 kRest = getNewMomentumRad(pRest, T, process);
335 pNewRest = pRest - kRest;
337 pNew = pNewRest * boostBack;
338 pVecNew.
Set((px / pAbs) * pNew, (py / pAbs) * pNew, (pz / pAbs) * pNew,
340 pOut.push_back(
Parton(pLabel, Id, pStat, pVecNew, xVec));
341 pOut[pOut.size() - 1].set_form_time(0.);
342 pOut[pOut.size() - 1].set_jet_v(
348 k = kRest * boostBack;
349 kVec.
Set((px / pAbs) * k, (py / pAbs) * k, (pz / pAbs) * k, k);
350 pOut.push_back(
Parton(pLabelNew, 21, pStat, kVec, xVec));
351 pOut[pOut.size() - 1].set_form_time(0.);
352 pOut[pOut.size() - 1].set_jet_v(
365 }
else if (process == 2) {
367 if (pRest / T < AMYpCut)
371 kRest = getNewMomentumRad(pRest, T, process);
376 pNewRest = pRest - kRest;
378 pNew = pNewRest * boostBack;
379 pVecNew.
Set((px / pAbs) * pNew, (py / pAbs) * pNew, (pz / pAbs) * pNew,
381 pOut.push_back(
Parton(pLabel, Id, pStat, pVecNew, xVec));
382 pOut[pOut.size() - 1].set_form_time(0.);
383 pOut[pOut.size() - 1].set_jet_v(
391 k = kRest * boostBack;
392 kVec.
Set((px / pAbs) * k, (py / pAbs) * k, (pz / pAbs) * k, k);
393 pOut.push_back(
Parton(pLabelNew, 21, pStat, kVec, xVec));
394 pOut[pOut.size() - 1].set_form_time(0.);
395 pOut[pOut.size() - 1].set_jet_v(
400 }
else if (process == 5 || process == 6) {
402 omega = getEnergyTransfer(pRest, T, process);
403 q = getMomentumTransfer(pRest, omega, T, process);
409 pVecNewRest = getNewMomentumElas(pVecRest, omega, q);
411 pNewRest = pVecNewRest.
t();
416 pVecNew = pVecNewRest;
420 vx * gamma * pVecNewRest.
t() +
421 (1. + (gamma - 1.) * vx * vx / (beta * beta)) * pVecNewRest.
x() +
422 (gamma - 1.) * vx * vy / (beta * beta) * pVecNewRest.
y() +
423 (gamma - 1.) * vx * vz / (beta * beta) * pVecNewRest.
z();
425 vy * gamma * pVecNewRest.
t() +
426 (1. + (gamma - 1.) * vy * vy / (beta * beta)) * pVecNewRest.
y() +
427 (gamma - 1.) * vx * vy / (beta * beta) * pVecNewRest.
x() +
428 (gamma - 1.) * vy * vz / (beta * beta) * pVecNewRest.
z();
430 vz * gamma * pVecNewRest.
t() +
431 (1. + (gamma - 1.) * vz * vz / (beta * beta)) * pVecNewRest.
z() +
432 (gamma - 1.) * vx * vz / (beta * beta) * pVecNewRest.
x() +
433 (gamma - 1.) * vy * vz / (beta * beta) * pVecNewRest.
y();
435 pNew = sqrt(pxNew * pxNew + pyNew * pyNew + pzNew * pzNew);
436 pVecNew.
Set(pxNew, pyNew, pzNew, pNew);
439 pOut.push_back(
Parton(pLabel, Id, pStat, pVecNew, xVec));
440 pOut[pOut.size() - 1].set_form_time(0.);
441 pOut[pOut.size() - 1].set_jet_v(
445 pOut[pOut.size() - 1].set_user_info(
456 pVecThermalRest = getThermalVec(qVec, T, Id);
457 pVecRecoilRest = qVec;
458 pVecRecoilRest += pVecThermalRest;
459 double pRecoilRest = pVecRecoilRest.
t();
461 if (pRecoilRest > pcut) {
466 pVecThermal = pVecThermalRest;
467 pVecRecoil = pVecRecoilRest;
471 vx * gamma * pVecThermalRest.
t() +
472 (1. + (gamma - 1.) * vx * vx / (beta * beta)) *
473 pVecThermalRest.
x() +
474 (gamma - 1.) * vx * vy / (beta * beta) * pVecThermalRest.
y() +
475 (gamma - 1.) * vx * vz / (beta * beta) * pVecThermalRest.
z();
477 vy * gamma * pVecThermalRest.
t() +
478 (1. + (gamma - 1.) * vy * vy / (beta * beta)) *
479 pVecThermalRest.
y() +
480 (gamma - 1.) * vx * vy / (beta * beta) * pVecThermalRest.
x() +
481 (gamma - 1.) * vy * vz / (beta * beta) * pVecThermalRest.
z();
483 vz * gamma * pVecThermalRest.
t() +
484 (1. + (gamma - 1.) * vz * vz / (beta * beta)) *
485 pVecThermalRest.
z() +
486 (gamma - 1.) * vx * vz / (beta * beta) * pVecThermalRest.
x() +
487 (gamma - 1.) * vy * vz / (beta * beta) * pVecThermalRest.
y();
489 pThermal = sqrt(pxThermal * pxThermal + pyThermal * pyThermal +
490 pzThermal * pzThermal);
491 pVecThermal.
Set(pxThermal, pyThermal, pzThermal, pThermal);
494 vx * gamma * pVecRecoilRest.
t() +
495 (1. + (gamma - 1.) * vx * vx / (beta * beta)) *
497 (gamma - 1.) * vx * vy / (beta * beta) * pVecRecoilRest.
y() +
498 (gamma - 1.) * vx * vz / (beta * beta) * pVecRecoilRest.
z();
500 vy * gamma * pVecRecoilRest.
t() +
501 (1. + (gamma - 1.) * vy * vy / (beta * beta)) *
503 (gamma - 1.) * vx * vy / (beta * beta) * pVecRecoilRest.
x() +
504 (gamma - 1.) * vy * vz / (beta * beta) * pVecRecoilRest.
z();
506 vz * gamma * pVecRecoilRest.
t() +
507 (1. + (gamma - 1.) * vz * vz / (beta * beta)) *
509 (gamma - 1.) * vx * vz / (beta * beta) * pVecRecoilRest.
x() +
510 (gamma - 1.) * vy * vz / (beta * beta) * pVecRecoilRest.
y();
512 pRecoil = sqrt(pxRecoil * pxRecoil + pyRecoil * pyRecoil +
513 pzRecoil * pzRecoil);
514 pVecRecoil.
Set(pxRecoil, pyRecoil, pzRecoil, pRecoil);
520 double r = ZeroOneDistribution(*GetMt19937Generator());
523 else if (r < 2. / 3.)
531 if (pVecThermal.
t() > 1
e-5) {
533 pOut.push_back(
Parton(pLabelNew, newId, -1, pVecThermal, xVec));
534 pOut[pOut.size() - 1].set_form_time(0.);
535 pOut[pOut.size() - 1].set_jet_v(
541 pOut.push_back(
Parton(pLabelNew, newId, 1, pVecRecoil, xVec));
542 pOut[pOut.size() - 1].set_form_time(0.);
543 pOut[pOut.size() - 1].set_jet_v(
549 }
else if (process == 9) {
551 pOut.push_back(
Parton(pLabel, 21, pStat, pVec, xVec));
552 pOut[pOut.size() - 1].set_form_time(0.);
553 pOut[pOut.size() - 1].set_jet_v(
557 pOut[pOut.size() - 1].set_user_info(
564 }
else if (process == 10) {
566 pOut.push_back(
Parton(pLabel, 22, pStat, pVec, xVec));
567 pOut[pOut.size() - 1].set_form_time(0.);
568 pOut[pOut.size() - 1].set_jet_v(
573 }
else if (Id == 21) {
577 if (pRest / T < AMYpCut)
581 kRest = getNewMomentumRad(pRest, T, process);
586 pNewRest = pRest - kRest;
588 pNew = pNewRest * boostBack;
589 pVecNew.
Set((px / pAbs) * pNew, (py / pAbs) * pNew, (pz / pAbs) * pNew,
591 pOut.push_back(
Parton(pLabel, Id, pStat, pVecNew, xVec));
592 pOut[pOut.size() - 1].set_form_time(0.);
593 pOut[pOut.size() - 1].set_jet_v(
599 k = kRest * boostBack;
600 kVec.
Set((px / pAbs) * k, (py / pAbs) * k, (pz / pAbs) * k, k);
601 pOut.push_back(
Parton(pLabelNew, Id, pStat, kVec, xVec));
602 pOut[pOut.size() - 1].set_form_time(0.);
603 pOut[pOut.size() - 1].set_jet_v(
616 }
else if (process == 4) {
618 if (pRest / T < AMYpCut)
622 kRest = getNewMomentumRad(pRest, T, process);
627 pNewRest = pRest - kRest;
630 double r = ZeroOneDistribution(*GetMt19937Generator());
633 else if (r < 2. / 3.)
639 pNew = pNewRest * boostBack;
640 pVecNew.
Set((px / pAbs) * pNew, (py / pAbs) * pNew, (pz / pAbs) * pNew,
642 pOut.push_back(
Parton(pLabel, newId, pStat, pVecNew, xVec));
643 pOut[pOut.size() - 1].set_form_time(0.);
644 pOut[pOut.size() - 1].set_jet_v(
650 k = kRest * boostBack;
651 kVec.
Set((px / pAbs) * k, (py / pAbs) * k, (pz / pAbs) * k, k);
652 pOut.push_back(
Parton(pLabelNew, -newId, pStat, kVec, xVec));
653 pOut[pOut.size() - 1].set_form_time(0.);
654 pOut[pOut.size() - 1].set_jet_v(
667 }
else if (process == 7 || process == 8) {
669 omega = getEnergyTransfer(pRest, T, process);
670 q = getMomentumTransfer(pRest, omega, T, process);
676 pVecNewRest = getNewMomentumElas(pVecRest, omega, q);
678 pNewRest = pVecNewRest.
t();
683 pVecNew = pVecNewRest;
687 vx * gamma * pVecNewRest.
t() +
688 (1. + (gamma - 1.) * vx * vx / (beta * beta)) * pVecNewRest.
x() +
689 (gamma - 1.) * vx * vy / (beta * beta) * pVecNewRest.
y() +
690 (gamma - 1.) * vx * vz / (beta * beta) * pVecNewRest.
z();
692 vy * gamma * pVecNewRest.
t() +
693 (1. + (gamma - 1.) * vy * vy / (beta * beta)) * pVecNewRest.
y() +
694 (gamma - 1.) * vx * vy / (beta * beta) * pVecNewRest.
x() +
695 (gamma - 1.) * vy * vz / (beta * beta) * pVecNewRest.
z();
697 vz * gamma * pVecNewRest.
t() +
698 (1. + (gamma - 1.) * vz * vz / (beta * beta)) * pVecNewRest.
z() +
699 (gamma - 1.) * vx * vz / (beta * beta) * pVecNewRest.
x() +
700 (gamma - 1.) * vy * vz / (beta * beta) * pVecNewRest.
y();
702 pNew = sqrt(pxNew * pxNew + pyNew * pyNew + pzNew * pzNew);
703 pVecNew.
Set(pxNew, pyNew, pzNew, pNew);
706 pOut.push_back(
Parton(pLabel, Id, pStat, pVecNew, xVec));
707 pOut[pOut.size() - 1].set_form_time(0.);
708 pOut[pOut.size() - 1].set_jet_v(
712 pOut[pOut.size() - 1].set_user_info(
723 pVecThermalRest = getThermalVec(qVec, T, Id);
724 pVecRecoilRest = qVec;
725 pVecRecoilRest += pVecThermalRest;
726 double pRecoilRest = pVecRecoilRest.
t();
728 if (pRecoilRest > pcut) {
733 pVecThermal = pVecThermalRest;
734 pVecRecoil = pVecRecoilRest;
738 vx * gamma * pVecThermalRest.
t() +
739 (1. + (gamma - 1.) * vx * vx / (beta * beta)) *
740 pVecThermalRest.
x() +
741 (gamma - 1.) * vx * vy / (beta * beta) * pVecThermalRest.
y() +
742 (gamma - 1.) * vx * vz / (beta * beta) * pVecThermalRest.
z();
744 vy * gamma * pVecThermalRest.
t() +
745 (1. + (gamma - 1.) * vy * vy / (beta * beta)) *
746 pVecThermalRest.
y() +
747 (gamma - 1.) * vx * vy / (beta * beta) * pVecThermalRest.
x() +
748 (gamma - 1.) * vy * vz / (beta * beta) * pVecThermalRest.
z();
750 vz * gamma * pVecThermalRest.
t() +
751 (1. + (gamma - 1.) * vz * vz / (beta * beta)) *
752 pVecThermalRest.
z() +
753 (gamma - 1.) * vx * vz / (beta * beta) * pVecThermalRest.
x() +
754 (gamma - 1.) * vy * vz / (beta * beta) * pVecThermalRest.
y();
756 pThermal = sqrt(pxThermal * pxThermal + pyThermal * pyThermal +
757 pzThermal * pzThermal);
758 pVecThermal.
Set(pxThermal, pyThermal, pzThermal, pThermal);
761 vx * gamma * pVecRecoilRest.
t() +
762 (1. + (gamma - 1.) * vx * vx / (beta * beta)) *
764 (gamma - 1.) * vx * vy / (beta * beta) * pVecRecoilRest.
y() +
765 (gamma - 1.) * vx * vz / (beta * beta) * pVecRecoilRest.
z();
767 vy * gamma * pVecRecoilRest.
t() +
768 (1. + (gamma - 1.) * vy * vy / (beta * beta)) *
770 (gamma - 1.) * vx * vy / (beta * beta) * pVecRecoilRest.
x() +
771 (gamma - 1.) * vy * vz / (beta * beta) * pVecRecoilRest.
z();
773 vz * gamma * pVecRecoilRest.
t() +
774 (1. + (gamma - 1.) * vz * vz / (beta * beta)) *
776 (gamma - 1.) * vx * vz / (beta * beta) * pVecRecoilRest.
x() +
777 (gamma - 1.) * vy * vz / (beta * beta) * pVecRecoilRest.
y();
779 pRecoil = sqrt(pxRecoil * pxRecoil + pyRecoil * pyRecoil +
780 pzRecoil * pzRecoil);
781 pVecRecoil.
Set(pxRecoil, pyRecoil, pzRecoil, pRecoil);
787 double r = ZeroOneDistribution(*GetMt19937Generator());
790 else if (r < 2. / 3.)
798 if (pVecThermal.
t() > 1
e-5) {
800 pOut.push_back(
Parton(pLabelNew, newId, -1, pVecThermal, xVec));
801 pOut[pOut.size() - 1].set_form_time(0.);
802 pOut[pOut.size() - 1].set_jet_v(
808 pOut.push_back(
Parton(pLabelNew, newId, 1, pVecRecoil, xVec));
809 pOut[pOut.size() - 1].set_form_time(0.);
810 pOut[pOut.size() - 1].set_jet_v(
817 }
else if (process == 11) {
820 double r = ZeroOneDistribution(*GetMt19937Generator());
823 else if (r < 2. / 3.)
828 double antiquark = ZeroOneDistribution(*GetMt19937Generator());
832 pOut.push_back(
Parton(pLabel, newId, pStat, pVec, xVec));
833 pOut[pOut.size() - 1].set_form_time(0.);
834 pOut[pOut.size() - 1].set_jet_v(
838 pOut[pOut.size() - 1].set_user_info(
852 if (mu < 1.0)
return alpha_s0;
854 double beta0 = 9./(4.*M_PI);
855 double LambdaQCD = exp( -1./(2.*beta0*alpha_s0) );
856 double running_alphas = 1./(beta0 * log( pow(mu/LambdaQCD, 2.) ));
857 return running_alphas;
863 double dT = deltaTRest /
hbarc;
868 rateRad = getRateRadTotal(pRest, T);
870 rateElas = getRateElasTotal(pRest, T);
872 rateConv = getRateConv(pRest, T);
875 if (std::abs(Id) == 1 || std::abs(Id) == 2 || std::abs(Id) == 3) {
879 rateConv.
qgamma *= 4. / 9.;
882 rateConv.
qgamma *= 1. / 9.;
885 double totalQuarkProb = 0.;
891 if (pRest / T > AMYpCut)
892 totalQuarkProb += rateRad.
qqg * dT;
893 totalQuarkProb += (rateElas.
qq + rateElas.
qg + rateConv.
qg) * dT;
896 if (totalQuarkProb > 1.) {
897 JSWARN <<
" : Total Probability for quark processes exceeds 1 ("
898 << totalQuarkProb <<
"). "
899 <<
" : Most likely this means you should choose a smaller deltaT "
902 <<
"pRest=" << pRest <<
" T=" << T <<
" pRest/T=" << pRest /
T;
906 double accumProb = 0.;
907 double nextProb = 0.;
910 if (ZeroOneDistribution(*GetMt19937Generator()) < totalQuarkProb) {
915 double randProb = ZeroOneDistribution(*GetMt19937Generator());
919 if (pRest / T > AMYpCut) {
920 Prob = rateRad.
qqg * dT / totalQuarkProb;
921 if (accumProb <= randProb && randProb < (accumProb + Prob))
925 Prob = rateRad.
qqgamma * dT / totalQuarkProb;
926 if (accumProb <= randProb && randProb < (accumProb + Prob))
931 Prob = rateElas.
qq * dT / totalQuarkProb;
932 if (accumProb <= randProb && randProb < (accumProb + Prob))
936 Prob = rateElas.
qg * dT / totalQuarkProb;
937 if (accumProb <= randProb && randProb < (accumProb + Prob))
941 Prob = rateConv.
qg * dT / totalQuarkProb;
942 if (accumProb <= randProb && randProb < (accumProb + Prob))
946 Prob = rateConv.
qgamma * dT / totalQuarkProb;
947 if (accumProb <= randProb && randProb < (accumProb + Prob))
953 }
else if (Id == 21) {
955 double totalGluonProb = 0.;
957 if (pRest / T > AMYpCut)
958 totalGluonProb += (rateRad.
ggg + rateRad.
gqq) * dT;
959 totalGluonProb += (rateElas.
gq + rateElas.
gg + rateConv.
gq) * dT;
962 if (totalGluonProb > 1.) {
963 JSWARN <<
" : Total Probability for gluon processes exceeds 1 ("
964 << totalGluonProb <<
"). "
965 <<
" : Most likely this means you should choose a smaller deltaT "
968 <<
"pRest=" << pRest <<
" T=" << T <<
" pRest/T=" << pRest /
T;
972 double accumProb = 0.;
973 double nextProb = 0.;
976 if (ZeroOneDistribution(*GetMt19937Generator()) < totalGluonProb) {
981 double randProb = ZeroOneDistribution(*GetMt19937Generator());
985 if (pRest / T > AMYpCut) {
986 Prob = rateRad.
ggg * dT / totalGluonProb;
987 if (accumProb <= randProb && randProb < (accumProb + Prob))
991 Prob = rateRad.
gqq * dT / totalGluonProb;
992 if (accumProb <= randProb && randProb < (accumProb + Prob))
997 Prob = rateElas.
gq * dT / totalGluonProb;
998 if (accumProb <= randProb && randProb < (accumProb + Prob))
1002 Prob = rateElas.
gg * dT / totalGluonProb;
1003 if (accumProb <= randProb && randProb < (accumProb + Prob))
1007 Prob = rateConv.
gq * dT / totalGluonProb;
1008 if (accumProb <= randProb && randProb < (accumProb + Prob))
1023 double u = pRest /
T;
1026 rate.
qqg = (0.8616 - 3.2913 / (u *
u) + 2.1102 / u - 0.9485 / sqrt(u)) *
1028 rate.
ggg = (1.9463 + 61.7856 / (u * u *
u) - 30.7877 / (u * u) +
1029 8.0409 / u - 2.6249 / sqrt(u)) *
1031 rate.
gqq = (2.5830 / (u * u *
u) - 1.7010 / (u * u) + 1.4977 / u -
1032 1.1961 / pow(u, 0.8) + 0.1807 / sqrt(u)) *
1033 pow(
g, 4.) * T *
nf;
1035 (0.0053056 + 2.3279 / pow(u, 3.) - 0.6676 / u + 0.3223 / sqrt(u)) *
1036 pow(
g, 4.) * alpha_em / alpha_s *
T;
1038 double runningFactor =
1039 log(
g * T * pow(10., 0.25) / .175) / log(
g * T * pow(u, 0.25) / .175);
1040 if (runningFactor < 1.) {
1041 rate.
qqg *= runningFactor;
1042 rate.
gqq *= runningFactor;
1043 rate.
ggg *= runningFactor;
1044 rate.
qqgamma *= runningFactor;
1059 rate.
qqg = (0.5322 - 3.1037 / (u *
u) + 2.0139 / u - 0.9417 / sqrt(u)) *
1061 rate.
ggg = (1.1923 - 11.5250 / (u * u *
u) + 3.3010 / u - 1.9049 / sqrt(u)) *
1064 (0.0004656 - 0.04621 / (u *
u) + 0.0999 / u - 0.08171 / pow(u, 0.8) +
1065 0.008090 / pow(u, 0.2) - 1.2525 * pow(10., -8.) *
u) *
1066 pow(
g, 4.) * T *
nf;
1075 rate.
qqg = (0.3292 - 0.6759 / (u *
u) + 0.4871 / pow(u, 1.5) - 0.05393 / u +
1076 0.007878 / sqrt(u)) *
1078 rate.
ggg = (0.7409 + 1.8608 / (u * u *
u) - 0.1353 / (u * u) + 0.1401 /
u) *
1080 rate.
gqq = (0.03215 / (u * u *
u) + 0.01419 / (u * u) + 0.004338 / u -
1081 0.00001246 / sqrt(u)) *
1082 pow(
g, 4.) * T *
nf;
1089 double u = pRest /
T;
1099 Pos = getRateRadPos(u, T);
1100 Neg = getRateRadNeg(u, T);
1104 int posNegSwitch = 1;
1114 if (ZeroOneDistribution(*GetMt19937Generator()) <
1118 if (posNegSwitch == 1)
1121 randA = ZeroOneDistribution(*GetMt19937Generator()) *
1122 area(u + 12., u, posNegSwitch, 1);
1123 y = 2.5 / (
LambertW(2.59235 * pow(10., 23.) * exp(-100. * randA)));
1125 fy = 0.025 / (y *
y) + 0.01 / y;
1128 x = ZeroOneDistribution(*GetMt19937Generator());
1130 }
while (x > fyAct / fy);
1136 randA = ZeroOneDistribution(*GetMt19937Generator()) *
1137 area(-0.05, u, posNegSwitch, 1);
1138 y = -12. / (1. + 480. * randA);
1140 fy = 0.025 / (y *
y);
1143 x = ZeroOneDistribution(*GetMt19937Generator());
1145 }
while (x > fyAct / fy);
1149 }
else if (process == 2) {
1151 randA = ZeroOneDistribution(*GetMt19937Generator()) *
1152 area(1.15 * u, u, posNegSwitch, 2);
1153 y = 83895.3 * pow(pow(u, 0.5) * randA, 10. / 3.);
1155 fy = (0.01 / (pow(y, 0.7))) / pow(u, 0.5);
1158 x = ZeroOneDistribution(*GetMt19937Generator());
1160 }
while (x > fyAct / fy);
1163 }
else if (process == 3) {
1166 if (ZeroOneDistribution(*GetMt19937Generator()) <
1170 if (posNegSwitch == 1)
1173 randA = ZeroOneDistribution(*GetMt19937Generator()) *
1174 area(u / 2., u, posNegSwitch, 3);
1175 y = 5. / (
LambertW(2.68812 * pow(10., 45.) * exp(-50. * randA)));
1177 fy = 0.1 / (y *
y) + 0.02 / y;
1180 x = ZeroOneDistribution(*GetMt19937Generator());
1182 }
while (x > fyAct / fy);
1188 randA = ZeroOneDistribution(*GetMt19937Generator()) *
1189 area(-0.05, u, posNegSwitch, 3);
1190 y = -12. / (1. + 120. * randA);
1195 x = ZeroOneDistribution(*GetMt19937Generator());
1197 }
while (x > fyAct / fy);
1201 }
else if (process == 4) {
1204 if (ZeroOneDistribution(*GetMt19937Generator()) <
1208 if (posNegSwitch == 1)
1211 randA = ZeroOneDistribution(*GetMt19937Generator()) *
1212 area(u / 2., u, posNegSwitch, 4);
1213 y = 0.83333 * (0.06 *
function(
u, 0.05,
process) + randA) /
1216 fy = 1.2 *
function(
u, 0.05,
process);
1219 x = ZeroOneDistribution(*GetMt19937Generator());
1221 }
while (x > fyAct / fy);
1227 randA = ZeroOneDistribution(*GetMt19937Generator()) *
1228 area(-0.05, u, posNegSwitch, 4);
1229 y = (2.5 - u * log(7.81082 * pow(10., -6.) * exp(14.5 / u) +
1230 (-115.883 + 113.566 * u) * randA)) /
1233 fy = 0.98 * exp((1. - 1. / u) * (-2.5 + y)) /
u;
1236 x = ZeroOneDistribution(*GetMt19937Generator());
1238 }
while (x > fyAct / fy);
1243 JSWARN <<
"Invalid process number (" << process <<
")";
1253 if (posNegSwitch == 1)
1254 return (0.5299 - 0.025 / y + 0.01 * log(y));
1256 return (-0.002083 - 0.025 / y);
1257 }
else if (process == 2) {
1258 return ((0.03333 * pow(y, 0.3)) / pow(u, 0.5));
1259 }
else if (process == 3) {
1260 if (posNegSwitch == 1)
1261 return (2.05991 - 0.1 / y + 0.02 * log(y));
1263 return (-0.008333 - 0.1 / y);
1264 }
else if (process == 4) {
1265 if (posNegSwitch == 1)
1266 return (1.2 *
function(u, 0.05, process) * (y - 0.05));
1268 return ((6.8778 * pow(10., -8.) * exp(14.5 / u) -
1269 0.008805 * exp((2.5 - y + 0.98 * u * y) / u)) /
1278 return getRate_qqg(u, y);
1279 else if (process == 2)
1280 return getRate_qqgamma(u, y);
1281 else if (process == 3)
1282 return getRate_ggg(u, y);
1283 else if (process == 4)
1284 return getRate_gqq(u, y);
1290 bool coherentNow =
false;
1291 const weak_ptr<PartonShower> pShower = pIn.
shower();
1292 auto shower = pShower.lock();
1297 if (eIt->target().outdeg() < 1) {
1299 auto p =
shower->GetParton(*eIt);
1300 if (
p->plabel() == sibling) {
1305 if (!coherentSibling)
1306 return coherentSibling;
1308 JSWARN <<
"MARTINIUserInfo not set!!"
1309 <<
" plabel:" <<
p->plabel()
1310 <<
" Make this parton in de-coherent state";
1315 bool activeCoherent = (fabs(
p->x_in().t() - pIn.
x_in().
t()) < 0.015);
1316 if (!activeCoherent)
1317 return activeCoherent;
1319 JSDEBUG <<
" [Sibling]" <<
p->plabel() <<
" " <<
p->pid() <<
" "
1320 <<
p->x_in().t() <<
" " <<
p->x_in().x();
1324 double pxInit = pInitVec.
x();
1325 double pyInit = pInitVec.
y();
1326 double pzInit = pInitVec.
z();
1327 double pInit = pInitVec.
t();
1333 double xDelta = pIn.
x_in().
x() -
p->x_in().x();
1334 double yDelta = pIn.
x_in().
x() -
p->x_in().x();
1335 double zDelta = pIn.
x_in().
x() -
p->x_in().x();
1338 double xCrox = yDelta * pzInit - zDelta * pyInit;
1339 double yCrox = zDelta * pxInit - xDelta * pzInit;
1340 double zCrox = xDelta * pyInit - yDelta * pxInit;
1344 sqrt(xCrox * xCrox + yCrox * yCrox + zCrox * zCrox) / pInit;
1347 double pxDelta = pIn.px() -
p->px();
1348 double pyDelta = pIn.py() -
p->py();
1349 double pzDelta = pIn.pz() -
p->pz();
1352 double pxCrox = pyDelta * pzInit - pzDelta * pyInit;
1353 double pyCrox = pzDelta * pxInit - pxDelta * pzInit;
1354 double pzCrox = pxDelta * pyInit - pyDelta * pxInit;
1358 sqrt(pxCrox * pxCrox + pyCrox * pyCrox + pzCrox * pzCrox) / pInit;
1360 double Crperp = 0.25 * pow(
p->e() /
T, 0.11);
1361 if (rPerp * pPerp < Crperp *
hbarc)
1380 double u = pRest /
T;
1382 double alpha0 = 0.15;
1383 double deltaAlpha = 0.03;
1384 double iAlpha = floor((alpha_s - alpha0) / deltaAlpha + 0.001);
1385 double alphaFrac = (alpha_s - alpha0) / deltaAlpha - iAlpha;
1386 double rateLower, rateUpper;
1387 double c[2][6], d[2][6];
1389 for (
int i = 0;
i < 2;
i++)
1390 for (
int j = 0;
j < 6;
j++) {
1395 if (alpha_s >= 0.15 && alpha_s < 0.18) {
1396 c[0][0] = 0.18172488396136807;
1397 c[1][0] = 0.224596478395945;
1398 c[0][1] = 0.6004740049060965;
1399 c[1][1] = 1.0874259848101948;
1400 c[0][2] = 0.36559627257898347;
1401 c[1][2] = 0.6436398538984057;
1402 c[0][3] = 0.10607576568373664;
1403 c[1][3] = 0.11585154613692052;
1404 c[0][4] = 0.004322466954618182;
1405 c[1][4] = -0.001719701730785056;
1406 c[0][5] = 0.04731599462749122;
1407 c[1][5] = 0.06734745496415469;
1408 }
else if (alpha_s >= 0.18 && alpha_s < 0.21) {
1409 c[0][0] = 0.224596478395945;
1410 c[1][0] = 0.2686436092048326;
1411 c[0][1] = 1.0874259848101948;
1412 c[1][1] = 1.7286136256785387;
1413 c[0][2] = 0.6436398538984057;
1414 c[1][2] = 0.9826325498183079;
1415 c[0][3] = 0.11585154613692052;
1416 c[1][3] = 0.13136670133029682;
1417 c[0][4] = -0.001719701730785056;
1418 c[1][4] = -0.004876376882437649;
1419 c[0][5] = 0.06734745496415469;
1420 c[1][5] = 0.09140316977554151;
1421 }
else if (alpha_s >= 0.21 && alpha_s < 0.24) {
1422 c[0][0] = 0.2686436092048326;
1423 c[1][0] = 0.3137234778163784;
1424 c[0][1] = 1.7286136256785387;
1425 c[1][1] = 2.445764079999846;
1426 c[0][2] = 0.9826325498183079;
1427 c[1][2] = 1.3083241146035964;
1428 c[0][3] = 0.13136670133029682;
1429 c[1][3] = 0.18341717903923757;
1430 c[0][4] = -0.004876376882437649;
1431 c[1][4] = 0.006098371807040589;
1432 c[0][5] = 0.09140316977554151;
1433 c[1][5] = 0.12054238276023879;
1434 }
else if (alpha_s >= 0.24 && alpha_s < 0.27) {
1435 c[0][0] = 0.3137234778163784;
1436 c[1][0] = 0.3597255453974444;
1437 c[0][1] = 2.445764079999846;
1438 c[1][1] = 3.140669321831845;
1439 c[0][2] = 1.3083241146035964;
1440 c[1][2] = 1.535549334026633;
1441 c[0][3] = 0.18341717903923757;
1442 c[1][3] = 0.30505450230754705;
1443 c[0][4] = 0.006098371807040589;
1444 c[1][4] = 0.04285103618362223;
1445 c[0][5] = 0.12054238276023879;
1446 c[1][5] = 0.1558288379712527;
1447 }
else if (alpha_s >= 0.27 && alpha_s < 0.3) {
1448 c[0][0] = 0.3597255453974444;
1449 c[1][0] = 0.40656130602563223;
1450 c[0][1] = 3.140669321831845;
1451 c[1][1] = 3.713430971987352;
1452 c[0][2] = 1.535549334026633;
1453 c[1][2] = 1.5818298058630476;
1454 c[0][3] = 0.30505450230754705;
1455 c[1][3] = 0.5269042544852683;
1456 c[0][4] = 0.04285103618362223;
1457 c[1][4] = 0.11594975218839362;
1458 c[0][5] = 0.1558288379712527;
1459 c[1][5] = 0.1982063104156748;
1460 }
else if (alpha_s >= 0.3 && alpha_s < 0.33) {
1461 c[0][0] = 0.40656130602563223;
1462 c[1][0] = 0.45415805200862863;
1463 c[0][1] = 3.713430971987352;
1464 c[1][1] = 4.0758813206143785;
1465 c[0][2] = 1.5818298058630476;
1466 c[1][2] = 1.3775134184861555;
1467 c[0][3] = 0.5269042544852683;
1468 c[1][3] = 0.873527536823307;
1469 c[0][4] = 0.11594975218839362;
1470 c[1][4] = 0.23371456949506658;
1471 c[0][5] = 0.1982063104156748;
1472 c[1][5] = 0.24840524848507203;
1473 }
else if (alpha_s >= 0.33 && alpha_s < 0.36) {
1474 c[0][0] = 0.45415805200862863;
1475 c[1][0] = 0.5024541413891354;
1476 c[0][1] = 4.0758813206143785;
1477 c[1][1] = 4.159425815179756;
1478 c[0][2] = 1.3775134184861555;
1479 c[1][2] = 0.8719749565879445;
1480 c[0][3] = 0.873527536823307;
1481 c[1][3] = 1.3606690530660879;
1482 c[0][4] = 0.23371456949506658;
1483 c[1][4] = 0.4010658149846402;
1484 c[0][5] = 0.24840524848507203;
1485 c[1][5] = 0.3067901992139913;
1486 }
else if (alpha_s >= 0.36 && alpha_s < 0.39) {
1487 c[0][0] = 0.5024541413891354;
1488 c[1][0] = 0.5513999693402064;
1489 c[0][1] = 4.159425815179756;
1490 c[1][1] = 3.893153859527746;
1491 c[0][2] = 0.8719749565879445;
1492 c[1][2] = 0.009578762778659829;
1493 c[0][3] = 1.3606690530660879;
1494 c[1][3] = 2.0095157488463244;
1495 c[0][4] = 0.4010658149846402;
1496 c[1][4] = 0.6260756501912864;
1497 c[0][5] = 0.3067901992139913;
1498 c[1][5] = 0.37424991045026396;
1499 }
else if (alpha_s >= 0.39 && alpha_s <= 0.42) {
1500 c[0][0] = 0.5513999693402064;
1501 c[1][0] = 0.600941593540798;
1502 c[0][1] = 3.893153859527746;
1503 c[1][1] = 3.293344337592684;
1504 c[0][2] = 0.009578762778659829;
1505 c[1][2] = -1.1764805445298645;
1506 c[0][3] = 2.0095157488463244;
1507 c[1][3] = 2.792180001243466;
1508 c[0][4] = 0.6260756501912864;
1509 c[1][4] = 0.8949534049225013;
1510 c[0][5] = 0.37424991045026396;
1511 c[1][5] = 0.44878529934031575;
1514 rateLower = T * (c[0][0] + c[0][1] / pow(u, 4.) - c[0][2] / pow(u, 3.) -
1515 c[0][3] / pow(u, 2.) + c[0][4] / pow(u, 1.5) - c[0][5] /
u);
1516 rateUpper = T * (c[1][0] + c[1][1] / pow(u, 4.) - c[1][2] / pow(u, 3.) -
1517 c[1][3] / pow(u, 2.) + c[1][4] / pow(u, 1.5) - c[1][5] /
u);
1519 rate.
qq = (1. - alphaFrac) * rateLower + alphaFrac * rateUpper;
1522 rate.
gq = rate.
qq * 9. / 4.;
1524 if (alpha_s >= 0.15 && alpha_s < 0.18) {
1525 d[0][0] = 0.9364689080337059;
1526 d[1][0] = 1.1485486950080581;
1527 d[0][1] = 2.626076478553979;
1528 d[1][1] = 4.993647646894147;
1529 d[0][2] = 2.1171556605834274;
1530 d[1][2] = 3.7295251994302876;
1531 d[0][3] = 0.13123339226210134;
1532 d[1][3] = -0.0017620287506503757;
1533 d[0][4] = 0.02875811664147147;
1534 d[1][4] = 0.010598257485913224;
1535 d[0][5] = 0.27736469898722244;
1536 d[1][5] = 0.3949856219367327;
1537 }
else if (alpha_s >= 0.18 && alpha_s < 0.21) {
1538 d[0][0] = 1.1485486950080581;
1539 d[1][0] = 1.3645568637616001;
1540 d[0][1] = 4.993647646894147;
1541 d[1][1] = 8.174225869366722;
1542 d[0][2] = 3.7295251994302876;
1543 d[1][2] = 5.732101892684938;
1544 d[0][3] = -0.001762028750650376;
1545 d[1][3] = -0.1416811579957863;
1546 d[0][4] = 0.010598257485913224;
1547 d[1][4] = 0.011703596451947428;
1548 d[0][5] = 0.3949856219367327;
1549 d[1][5] = 0.5354757997870718;
1550 }
else if (alpha_s >= 0.21 && alpha_s < 0.24) {
1551 d[0][0] = 1.3645568637616001;
1552 d[1][0] = 1.5839378568555678;
1553 d[0][1] = 8.174225869366722;
1554 d[1][1] = 11.785897000063443;
1555 d[0][2] = 5.732101892684938;
1556 d[1][2] = 7.758388282689373;
1557 d[0][3] = -0.1416811579957863;
1558 d[1][3] = -0.13163385415183002;
1559 d[0][4] = 0.011703596451947428;
1560 d[1][4] = 0.09016386041913003;
1561 d[0][5] = 0.5354757997870718;
1562 d[1][5] = 0.7042577279136836;
1563 }
else if (alpha_s >= 0.24 && alpha_s < 0.27) {
1564 d[0][0] = 1.5839378568555678;
1565 d[1][0] = 1.8062676019060235;
1566 d[0][1] = 11.785897000063443;
1567 d[1][1] = 15.344112642069764;
1568 d[0][2] = 7.758388282689373;
1569 d[1][2] = 9.384190917330093;
1570 d[0][3] = -0.13163385415183002;
1571 d[1][3] = 0.19709400976261568;
1572 d[0][4] = 0.09016386041913003;
1573 d[1][4] = 0.30577623140224813;
1574 d[0][5] = 0.7042577279136836;
1575 d[1][5] = 0.9066501895009754;
1576 }
else if (alpha_s >= 0.27 && alpha_s < 0.3) {
1577 d[0][0] = 1.8062676019060235;
1578 d[1][0] = 2.0312125903238236;
1579 d[0][1] = 15.344112642069764;
1580 d[1][1] = 18.36844006721506;
1581 d[0][2] = 9.384190917330093;
1582 d[1][2] = 10.209988454804193;
1583 d[0][3] = 0.19709400976261568;
1584 d[1][3] = 0.9957025988944573;
1585 d[0][4] = 0.30577623140224813;
1586 d[1][4] = 0.7109302867706849;
1587 d[0][5] = 0.9066501895009754;
1588 d[1][5] = 1.1472148515742653;
1589 }
else if (alpha_s >= 0.3 && alpha_s < 0.33) {
1590 d[0][0] = 2.0312125903238236;
1591 d[1][0] = 2.258502734110078;
1592 d[0][1] = 18.36844006721506;
1593 d[1][1] = 20.43444928479894;
1594 d[0][2] = 10.209988454804193;
1595 d[1][2] = 9.896928897847518;
1596 d[0][3] = 0.9957025988944573;
1597 d[1][3] = 2.3867073785159003;
1598 d[0][4] = 0.7109302867706849;
1599 d[1][4] = 1.3473328178504662;
1600 d[0][5] = 1.1472148515742653;
1601 d[1][5] = 1.429497460496924;
1602 }
else if (alpha_s >= 0.33 && alpha_s < 0.36) {
1603 d[0][0] = 2.258502734110078;
1604 d[1][0] = 2.4879110920956653;
1605 d[0][1] = 20.43444928479894;
1606 d[1][1] = 21.220550462966102;
1607 d[0][2] = 9.896928897847518;
1608 d[1][2] = 8.20639681844989;
1609 d[0][3] = 2.3867073785159003;
1610 d[1][3] = 4.445222616370339;
1611 d[0][4] = 1.3473328178504662;
1612 d[1][4] = 2.2381176005506016;
1613 d[0][5] = 1.429497460496924;
1614 d[1][5] = 1.7550164762706189;
1615 }
else if (alpha_s >= 0.36 && alpha_s < 0.39) {
1616 d[0][0] = 2.4879110920956653;
1617 d[1][0] = 2.7192501243929903;
1618 d[0][1] = 21.220550462966102;
1619 d[1][1] = 20.470583876561985;
1620 d[0][2] = 8.20639681844989;
1621 d[1][2] = 4.954737209403953;
1622 d[0][3] = 4.445222616370339;
1623 d[1][3] = 7.227667929705693;
1624 d[0][4] = 2.2381176005506016;
1625 d[1][4] = 3.401378906197122;
1626 d[0][5] = 1.7550164762706189;
1627 d[1][5] = 2.1251383942923474;
1628 }
else if (alpha_s >= 0.39 && alpha_s <= 0.42) {
1629 d[0][0] = 2.7192501243929903;
1630 d[1][0] = 2.9523522354248817;
1631 d[0][1] = 20.470583876561985;
1632 d[1][1] = 18.027772799078463;
1633 d[0][2] = 4.954737209403953;
1634 d[1][2] = 0.050298242947981846;
1635 d[0][3] = 7.227667929705693;
1636 d[1][3] = 10.747352232336384;
1637 d[0][4] = 3.401378906197122;
1638 d[1][4] = 4.8378133911595285;
1639 d[0][5] = 2.1251383942923474;
1640 d[1][5] = 2.5391647730624003;
1643 rateLower = T * (d[0][0] + d[0][1] / pow(u, 4.) - d[0][2] / pow(u, 3.) -
1644 d[0][3] / pow(u, 2.) + d[0][4] / pow(u, 1.5) - d[0][5] /
u);
1645 rateUpper = T * (d[1][0] + d[1][1] / pow(u, 4.) - d[1][2] / pow(u, 3.) -
1646 d[1][3] / pow(u, 2.) + d[1][4] / pow(u, 1.5) - d[1][5] /
u);
1648 rate.
qg = (1. - alphaFrac) * rateLower + alphaFrac * rateUpper;
1651 rate.
gg = rate.
qg * 9. / 4.;
1659 double alpha0 = 0.15;
1660 double deltaAlpha = 0.03;
1661 double iAlpha = floor((alpha_s - alpha0) / deltaAlpha + 0.001);
1662 double alphaFrac = (alpha_s - alpha0) / deltaAlpha - iAlpha;
1663 double rateLower, rateUpper;
1664 double c[2][6], d[2][6];
1666 for (
int i = 0;
i < 2;
i++)
1667 for (
int j = 0;
j < 6;
j++) {
1672 if (alpha_s >= 0.15 && alpha_s < 0.18) {
1673 c[0][0] = 0.12199410313320332;
1674 c[1][0] = 0.15243607717720586;
1675 c[0][1] = 0.23732051765097376;
1676 c[1][1] = 0.5403120875137825;
1677 c[0][2] = -0.03285419708803458;
1678 c[1][2] = 0.06440920730334501;
1679 c[0][3] = 0.2255419254079952;
1680 c[1][3] = 0.2881594349535524;
1681 c[0][4] = 0.03991522899907729;
1682 c[1][4] = 0.04948438583750772;
1683 c[0][5] = 0.05022641428394594;
1684 c[1][5] = 0.07152523367501308;
1685 }
else if (alpha_s >= 0.18 && alpha_s < 0.21) {
1686 c[0][0] = 0.15243607717720586;
1687 c[1][0] = 0.15243607717720586;
1688 c[0][1] = 0.5403120875137825;
1689 c[1][1] = 0.5403120875137825;
1690 c[0][2] = 0.06440920730334501;
1691 c[1][2] = 0.06440920730334501;
1692 c[0][3] = 0.2881594349535524;
1693 c[1][3] = 0.2881594349535524;
1694 c[0][4] = 0.04948438583750772;
1695 c[1][4] = 0.04948438583750772;
1696 c[0][5] = 0.07152523367501308;
1697 c[1][5] = 0.07152523367501308;
1698 }
else if (alpha_s >= 0.21 && alpha_s < 0.24) {
1699 c[0][0] = 0.15243607717720586;
1700 c[1][0] = 0.21661000995329158;
1701 c[0][1] = 0.5403120875137825;
1702 c[1][1] = 1.4087570376612657;
1703 c[0][2] = 0.06440920730334501;
1704 c[1][2] = 0.2713885880193171;
1705 c[0][3] = 0.2881594349535524;
1706 c[1][3] = 0.48681971936565244;
1707 c[0][4] = 0.04948438583750772;
1708 c[1][4] = 0.09567346780679847;
1709 c[0][5] = 0.07152523367501308;
1710 c[1][5] = 0.12780677622585393;
1711 }
else if (alpha_s >= 0.24 && alpha_s < 0.27) {
1712 c[0][0] = 0.21661000995329158;
1713 c[1][0] = 0.2501007467879627;
1714 c[0][1] = 1.4087570376612657;
1715 c[1][1] = 1.8034683081244214;
1716 c[0][2] = 0.2713885880193171;
1717 c[1][2] = 0.228092470920281;
1718 c[0][3] = 0.48681971936565244;
1719 c[1][3] = 0.6841577896561725;
1720 c[0][4] = 0.09567346780679847;
1721 c[1][4] = 0.15430793601338547;
1722 c[0][5] = 0.12780677622585393;
1723 c[1][5] = 0.1648297331159989;
1724 }
else if (alpha_s >= 0.27 && alpha_s < 0.3) {
1725 c[0][0] = 0.2501007467879627;
1726 c[1][0] = 0.28440720063047276;
1727 c[0][1] = 1.8034683081244214;
1728 c[1][1] = 2.0448244620634055;
1729 c[0][2] = 0.228092470920281;
1730 c[1][2] = -0.018574547528236382;
1731 c[0][3] = 0.6841577896561725;
1732 c[1][3] = 0.9863974758613413;
1733 c[0][4] = 0.15430793601338547;
1734 c[1][4] = 0.2503738253300167;
1735 c[0][5] = 0.1648297331159989;
1736 c[1][5] = 0.2090067594645225;
1737 }
else if (alpha_s >= 0.3 && alpha_s < 0.33) {
1738 c[0][0] = 0.28440720063047276;
1739 c[1][0] = 0.31945943548344036;
1740 c[0][1] = 2.0448244620634055;
1741 c[1][1] = 2.0482495934952256;
1742 c[0][2] = -0.018574547528236382;
1743 c[1][2] = -0.5350999123662686;
1744 c[0][3] = 0.9863974758613413;
1745 c[1][3] = 1.4169725257394696;
1746 c[0][4] = 0.2503738253300167;
1747 c[1][4] = 0.3918202096574105;
1748 c[0][5] = 0.2090067594645225;
1749 c[1][5] = 0.26103455441873036;
1750 }
else if (alpha_s >= 0.33 && alpha_s < 0.36) {
1751 c[0][0] = 0.31945943548344036;
1752 c[1][0] = 0.35519799231686516;
1753 c[0][1] = 2.0482495934952256;
1754 c[1][1] = 1.7485135425544152;
1755 c[0][2] = -0.5350999123662686;
1756 c[1][2] = -1.3692232011881413;
1757 c[0][3] = 1.4169725257394696;
1758 c[1][3] = 1.9906086576701993;
1759 c[0][4] = 0.3918202096574105;
1760 c[1][4] = 0.5832315715098879;
1761 c[0][5] = 0.26103455441873036;
1762 c[1][5] = 0.32124694953933486;
1763 }
else if (alpha_s >= 0.36 && alpha_s < 0.39) {
1764 c[0][0] = 0.35519799231686516;
1765 c[1][0] = 0.39157507493019383;
1766 c[0][1] = 1.7485135425544152;
1767 c[1][1] = 1.0778995684787331;
1768 c[0][2] = -1.3692232011881413;
1769 c[1][2] = -2.5738838613236457;
1770 c[0][3] = 1.9906086576701993;
1771 c[1][3] = 2.727543221296746;
1772 c[0][4] = 0.5832315715098879;
1773 c[1][4] = 0.8323699786704292;
1774 c[0][5] = 0.32124694953933486;
1775 c[1][5] = 0.3905055907877247;
1776 }
else if (alpha_s >= 0.39 && alpha_s <= 0.42) {
1777 c[0][0] = 0.39157507493019383;
1778 c[1][0] = 0.4285382777192131;
1779 c[0][1] = 1.0778995684787331;
1780 c[1][1] = 0.05505396151716547;
1781 c[0][2] = -2.5738838613236457;
1782 c[1][2] = -4.113979132685303;
1783 c[0][3] = 2.727543221296746;
1784 c[1][3] = 3.5992808060371506;
1785 c[0][4] = 0.8323699786704292;
1786 c[1][4] = 1.1252568207814462;
1787 c[0][5] = 0.3905055907877247;
1788 c[1][5] = 0.4667953957378259;
1791 rateLower = T * (c[0][0] + c[0][1] / pow(u, 4.) - c[0][2] / pow(u, 3.) -
1792 c[0][3] / pow(u, 2.) + c[0][4] / pow(u, 1.5) - c[0][5] /
u);
1793 rateUpper = T * (c[1][0] + c[1][1] / pow(u, 4.) - c[1][2] / pow(u, 3.) -
1794 c[1][3] / pow(u, 2.) + c[1][4] / pow(u, 1.5) - c[1][5] /
u);
1796 rate.
qq = (1. - alphaFrac) * rateLower + alphaFrac * rateUpper;
1799 rate.
gq = rate.
qq * 9. / 4.;
1801 if (alpha_s >= 0.15 && alpha_s < 0.18) {
1802 d[0][0] = 0.6197775378922895;
1803 d[1][0] = 0.7680959463632293;
1804 d[0][1] = 1.5268694134079064;
1805 d[1][1] = 3.282164035377037;
1806 d[0][2] = 0.6939337312845367;
1807 d[1][2] = 1.6359849897319092;
1808 d[0][3] = 0.5967602676773388;
1809 d[1][3] = 0.6770046238563808;
1810 d[0][4] = 0.17320784052297564;
1811 d[1][4] = 0.22074166337990309;
1812 d[0][5] = 0.28964614117694565;
1813 d[1][5] = 0.4128184793199476;
1814 }
else if (alpha_s >= 0.18 && alpha_s < 0.21) {
1815 d[0][0] = 0.7680959463632293;
1816 d[1][0] = 0.9206225398305536;
1817 d[0][1] = 3.282164035377037;
1818 d[1][1] = 5.690562370150853;
1819 d[0][2] = 1.6359849897319092;
1820 d[1][2] = 2.8341906487774318;
1821 d[0][3] = 0.6770046238563808;
1822 d[1][3] = 0.7900156706763937;
1823 d[0][4] = 0.22074166337990309;
1824 d[1][4] = 0.2995126102416747;
1825 d[0][5] = 0.4128184793199476;
1826 d[1][5] = 0.5598645426609049;
1827 }
else if (alpha_s >= 0.21 && alpha_s < 0.24) {
1828 d[0][0] = 0.9206225398305536;
1829 d[1][0] = 1.0767954081327265;
1830 d[0][1] = 5.690562370150853;
1831 d[1][1] = 8.378841394880034;
1832 d[0][2] = 2.8341906487774318;
1833 d[1][2] = 3.9338968631891396;
1834 d[0][3] = 0.7900156706763937;
1835 d[1][3] = 1.0874771229885156;
1836 d[0][4] = 0.2995126102416747;
1837 d[1][4] = 0.46570985770548107;
1838 d[0][5] = 0.5598645426609049;
1839 d[1][5] = 0.7360069767362173;
1840 }
else if (alpha_s >= 0.24 && alpha_s < 0.27) {
1841 d[0][0] = 1.0767954081327265;
1842 d[1][0] = 1.2361819653856791;
1843 d[0][1] = 8.378841394880034;
1844 d[1][1] = 10.877148035367144;
1845 d[0][2] = 3.9338968631891396;
1846 d[1][2] = 4.526191560392149;
1847 d[0][3] = 1.0874771229885156;
1848 d[1][3] = 1.731930015138816;
1849 d[0][4] = 0.46570985770548107;
1850 d[1][4] = 0.7769917594310469;
1851 d[0][5] = 0.7360069767362173;
1852 d[1][5] = 0.9463662091275489;
1853 }
else if (alpha_s >= 0.27 && alpha_s < 0.3) {
1854 d[0][0] = 1.2361819653856791;
1855 d[1][0] = 1.3984393292278847;
1856 d[0][1] = 10.877148035367144;
1857 d[1][1] = 12.72181515837248;
1858 d[0][2] = 4.526191560392149;
1859 d[1][2] = 4.227297031355039;
1860 d[0][3] = 1.731930015138816;
1861 d[1][3] = 2.868526983329731;
1862 d[0][4] = 0.7769917594310469;
1863 d[1][4] = 1.2836917844304823;
1864 d[0][5] = 0.9463662091275489;
1865 d[1][5] = 1.1953148369630755;
1866 }
else if (alpha_s >= 0.3 && alpha_s < 0.33) {
1867 d[0][0] = 1.3984393292278847;
1868 d[1][0] = 1.5632880021613935;
1869 d[0][1] = 12.72181515837248;
1870 d[1][1] = 13.502896915302873;
1871 d[0][2] = 4.227297031355039;
1872 d[1][2] = 2.7113406243010467;
1873 d[0][3] = 2.868526983329731;
1874 d[1][3] = 4.615035662049938;
1875 d[0][4] = 1.2836917844304823;
1876 d[1][4] = 2.0259357821768784;
1877 d[0][5] = 1.1953148369630755;
1878 d[1][5] = 1.486253368704046;
1879 }
else if (alpha_s >= 0.33 && alpha_s < 0.36) {
1880 d[0][0] = 1.5632880021613935;
1881 d[1][0] = 1.730492163581557;
1882 d[0][1] = 13.502896915302873;
1883 d[1][1] = 12.913294655478987;
1884 d[0][2] = 2.7113406243010467;
1885 d[1][2] = -0.2477159937428581;
1886 d[0][3] = 4.615035662049938;
1887 d[1][3] = 7.042004003229154;
1888 d[0][4] = 2.0259357821768784;
1889 d[1][4] = 3.0253452576771465;
1890 d[0][5] = 1.486253368704046;
1891 d[1][5] = 1.8205651561017433;
1892 }
else if (alpha_s >= 0.36 && alpha_s < 0.39) {
1893 d[0][0] = 1.730492163581557;
1894 d[1][0] = 1.8998560359992867;
1895 d[0][1] = 12.913294655478987;
1896 d[1][1] = 10.708892844334745;
1897 d[0][2] = -0.2477159937428581;
1898 d[1][2] = -4.823210983922782;
1899 d[0][3] = 7.042004003229154;
1900 d[1][3] = 10.202109059054063;
1901 d[0][4] = 3.0253452576771465;
1902 d[1][4] = 4.298747764427364;
1903 d[0][5] = 1.8205651561017433;
1904 d[1][5] = 2.199497022778097;
1905 }
else if (alpha_s >= 0.39 && alpha_s <= 0.42) {
1906 d[0][0] = 1.8998560359992867;
1907 d[1][0] = 2.071204284004704;
1908 d[0][1] = 10.708892844334745;
1909 d[1][1] = 6.741738604119316;
1910 d[0][2] = -4.823210983922782;
1911 d[1][2] = -11.099716230158746;
1912 d[0][3] = 10.202109059054063;
1913 d[1][3] = 14.106488110189458;
1914 d[0][4] = 4.298747764427364;
1915 d[1][4] = 5.846203546614067;
1916 d[0][5] = 2.199497022778097;
1917 d[1][5] = 2.62230136903594;
1920 rateLower = T * (d[0][0] + d[0][1] / pow(u, 4.) - d[0][2] / pow(u, 3.) -
1921 d[0][3] / pow(u, 2.) + d[0][4] / pow(u, 1.5) - d[0][5] /
u);
1922 rateUpper = T * (d[1][0] + d[1][1] / pow(u, 4.) - d[1][2] / pow(u, 3.) -
1923 d[1][3] / pow(u, 2.) + d[1][4] / pow(u, 1.5) - d[1][5] /
u);
1925 rate.
qg = (1. - alphaFrac) * rateLower + alphaFrac * rateUpper;
1928 rate.
gg = rate.
qg * 9. / 4.;
1936 double alpha0 = 0.15;
1937 double deltaAlpha = 0.03;
1938 double iAlpha = floor((alpha_s - alpha0) / deltaAlpha + 0.001);
1939 double alphaFrac = (alpha_s - alpha0) / deltaAlpha - iAlpha;
1940 double rateLower, rateUpper;
1941 double c[2][6], d[2][6];
1943 for (
int i = 0;
i < 2;
i++)
1944 for (
int j = 0;
j < 6;
j++) {
1949 if (alpha_s >= 0.15 && alpha_s < 0.18) {
1950 c[0][0] = 0.059730780828164666;
1951 c[1][0] = 0.07216040121873951;
1952 c[0][1] = 0.3631534872548789;
1953 c[1][1] = 0.5471138972952214;
1954 c[0][2] = 0.39845046966687;
1955 c[1][2] = 0.5792306465939813;
1956 c[0][3] = 0.11946615972422633;
1957 c[1][3] = 0.1723078888161528;
1958 c[0][4] = 0.03559276204445307;
1959 c[1][4] = 0.05120408756812135;
1960 c[0][5] = 0.00291041965645416;
1961 c[1][5] = 0.0041777787108426695;
1962 }
else if (alpha_s >= 0.18 && alpha_s < 0.21) {
1963 c[0][0] = 0.07216040121873951;
1964 c[1][0] = 0.0846236909779996;
1965 c[0][1] = 0.5471138972952214;
1966 c[1][1] = 0.7725791286875564;
1967 c[0][2] = 0.5792306465939813;
1968 c[1][2] = 0.7931123494736929;
1969 c[0][3] = 0.1723078888161528;
1970 c[1][3] = 0.23406373724706608;
1971 c[0][4] = 0.05120408756812135;
1972 c[1][4] = 0.06935459958589639;
1973 c[0][5] = 0.0041777787108426695;
1974 c[1][5] = 0.005644055718614478;
1975 }
else if (alpha_s >= 0.21 && alpha_s < 0.24) {
1976 c[0][0] = 0.0846236909779996;
1977 c[1][0] = 0.09711346786308672;
1978 c[0][1] = 0.7725791286875564;
1979 c[1][1] = 1.0370070423372528;
1980 c[0][2] = 0.7931123494736929;
1981 c[1][2] = 1.036935526583188;
1982 c[0][3] = 0.23406373724706608;
1983 c[1][3] = 0.3034025403259155;
1984 c[0][4] = 0.06935459958589639;
1985 c[1][4] = 0.08957509599955729;
1986 c[0][5] = 0.005644055718614478;
1987 c[1][5] = 0.007264393465593115;
1988 }
else if (alpha_s >= 0.24 && alpha_s < 0.27) {
1989 c[0][0] = 0.09711346786308672;
1990 c[1][0] = 0.10962479860948156;
1991 c[0][1] = 1.0370070423372528;
1992 c[1][1] = 1.3372010137066646;
1993 c[0][2] = 1.036935526583188;
1994 c[1][2] = 1.307456863105879;
1995 c[0][3] = 0.3034025403259155;
1996 c[1][3] = 0.37910328734850873;
1997 c[0][4] = 0.08957509599955729;
1998 c[1][4] = 0.111456899829735;
1999 c[0][5] = 0.007264393465593115;
2000 c[1][5] = 0.009000895144744121;
2001 }
else if (alpha_s >= 0.27 && alpha_s < 0.3) {
2002 c[0][0] = 0.10962479860948156;
2003 c[1][0] = 0.1221541053951596;
2004 c[0][1] = 1.3372010137066646;
2005 c[1][1] = 1.6686065099273535;
2006 c[0][2] = 1.307456863105879;
2007 c[1][2] = 1.600404353394210;
2008 c[0][3] = 0.37910328734850873;
2009 c[1][3] = 0.4594932213772782;
2010 c[0][4] = 0.111456899829735;
2011 c[1][4] = 0.13442407314203592;
2012 c[0][5] = 0.009000895144744121;
2013 c[1][5] = 0.010800449048880756;
2014 }
else if (alpha_s >= 0.3 && alpha_s < 0.33) {
2015 c[0][0] = 0.1221541053951596;
2016 c[1][0] = 0.13469861652518803;
2017 c[0][1] = 1.6686065099273535;
2018 c[1][1] = 2.0276317271182074;
2019 c[0][2] = 1.600404353394210;
2020 c[1][2] = 1.912613330851788;
2021 c[0][3] = 0.4594932213772782;
2022 c[1][3] = 0.5434449889160747;
2023 c[0][4] = 0.13442407314203592;
2024 c[1][4] = 0.15810564016236883;
2025 c[0][5] = 0.010800449048880756;
2026 c[1][5] = 0.012629305933671075;
2027 }
else if (alpha_s >= 0.33 && alpha_s < 0.36) {
2028 c[0][0] = 0.13469861652518803;
2029 c[1][0] = 0.14725614907227047;
2030 c[0][1] = 2.0276317271182074;
2031 c[1][1] = 2.4109122726272654;
2032 c[0][2] = 1.912613330851788;
2033 c[1][2] = 2.241198157777867;
2034 c[0][3] = 0.5434449889160747;
2035 c[1][3] = 0.6299396046048817;
2036 c[0][4] = 0.15810564016236883;
2037 c[1][4] = 0.18216575652552597;
2038 c[0][5] = 0.012629305933671075;
2039 c[1][5] = 0.014456750325370632;
2040 }
else if (alpha_s >= 0.36 && alpha_s < 0.39) {
2041 c[0][0] = 0.14725614907227047;
2042 c[1][0] = 0.15982489441001274;
2043 c[0][1] = 2.4109122726272654;
2044 c[1][1] = 2.815254291049982;
2045 c[0][2] = 2.241198157777867;
2046 c[1][2] = 2.583462624103292;
2047 c[0][3] = 0.6299396046048817;
2048 c[1][3] = 0.7180274724508857;
2049 c[0][4] = 0.18216575652552597;
2050 c[1][4] = 0.20629432847931367;
2051 c[0][5] = 0.014456750325370632;
2052 c[1][5] = 0.01625568033747704;
2053 }
else if (alpha_s >= 0.39 && alpha_s <= 0.42) {
2054 c[0][0] = 0.15982489441001274;
2055 c[1][0] = 0.17240331582158486;
2056 c[0][1] = 2.815254291049982;
2057 c[1][1] = 3.238290376079149;
2058 c[0][2] = 2.583462624103292;
2059 c[1][2] = 2.9374985881586273;
2060 c[0][3] = 0.7180274724508857;
2061 c[1][3] = 0.8071008047950518;
2062 c[0][4] = 0.20629432847931367;
2063 c[1][4] = 0.23030341585944009;
2064 c[0][5] = 0.01625568033747704;
2065 c[1][5] = 0.018010096397556033;
2068 rateLower = T * (c[0][0] + c[0][1] / pow(u, 4.) - c[0][2] / pow(u, 3.) -
2069 c[0][3] / pow(u, 2.) + c[0][4] / pow(u, 1.5) - c[0][5] /
u);
2070 rateUpper = T * (c[1][0] + c[1][1] / pow(u, 4.) - c[1][2] / pow(u, 3.) -
2071 c[1][3] / pow(u, 2.) + c[1][4] / pow(u, 1.5) - c[1][5] /
u);
2073 rate.
qq = (1. - alphaFrac) * rateLower + alphaFrac * rateUpper;
2076 rate.
gq = rate.
qq * 9. / 4.;
2078 if (alpha_s >= 0.15 && alpha_s < 0.18) {
2079 d[0][0] = 0.3166913701414167;
2080 d[1][0] = 0.3804527486448292;
2081 d[0][1] = 1.0992070651449564;
2082 d[1][1] = 1.7114836115114735;
2083 d[0][2] = 1.4232219292986843;
2084 d[1][2] = 2.093540209692791;
2085 d[0][3] = 0.4655268754156213;
2086 d[1][3] = 0.6787666526042345;
2087 d[0][4] = 0.1444497238817506;
2088 d[1][4] = 0.21014340589291994;
2089 d[0][5] = 0.012281442189758532;
2090 d[1][5] = 0.017832857383112792;
2091 }
else if (alpha_s >= 0.18 && alpha_s < 0.21) {
2092 d[0][0] = 0.3804527486448292;
2093 d[1][0] = 0.44393432393104637;
2094 d[0][1] = 1.7114836115114735;
2095 d[1][1] = 2.483663499207573;
2096 d[0][2] = 2.093540209692791;
2097 d[1][2] = 2.8979112438999044;
2098 d[0][3] = 0.6787666526042345;
2099 d[1][3] = 0.9316968286688833;
2100 d[0][4] = 0.21014340589291994;
2101 d[1][4] = 0.28780901378857465;
2102 d[0][5] = 0.017832857383112792;
2103 d[1][5] = 0.02438874287373154;
2104 }
else if (alpha_s >= 0.21 && alpha_s < 0.24) {
2105 d[0][0] = 0.44393432393104637;
2106 d[1][0] = 0.5071424487228405;
2107 d[0][1] = 2.483663499207573;
2108 d[1][1] = 3.4070556051784515;
2109 d[0][2] = 2.8979112438999044;
2110 d[1][2] = 3.824491419496227;
2111 d[0][3] = 0.9316968286688833;
2112 d[1][3] = 1.2191109771387096;
2113 d[0][4] = 0.28780901378857465;
2114 d[1][4] = 0.3755459972857442;
2115 d[0][5] = 0.02438874287373154;
2116 d[1][5] = 0.03174924882247299;
2117 }
else if (alpha_s >= 0.24 && alpha_s < 0.27) {
2118 d[0][0] = 0.5071424487228405;
2119 d[1][0] = 0.5700856365203443;
2120 d[0][1] = 3.4070556051784515;
2121 d[1][1] = 4.466964606692036;
2122 d[0][2] = 3.824491419496227;
2123 d[1][2] = 4.857999356928031;
2124 d[0][3] = 1.2191109771387096;
2125 d[1][3] = 1.5348360053714125;
2126 d[0][4] = 0.3755459972857442;
2127 d[1][4] = 0.471215528026891;
2128 d[0][5] = 0.03174924882247299;
2129 d[1][5] = 0.03971601962636114;
2130 }
else if (alpha_s >= 0.27 && alpha_s < 0.3) {
2131 d[0][0] = 0.5700856365203443;
2132 d[1][0] = 0.6327732610959403;
2133 d[0][1] = 4.466964606692036;
2134 d[1][1] = 5.646624908846933;
2135 d[0][2] = 4.857999356928031;
2136 d[1][2] = 5.982691423451806;
2137 d[0][3] = 1.5348360053714125;
2138 d[1][3] = 1.8728243844356356;
2139 d[0][4] = 0.471215528026891;
2140 d[1][4] = 0.572761497659723;
2141 d[0][5] = 0.03971601962636114;
2142 d[1][5] = 0.04809998538877525;
2143 }
else if (alpha_s >= 0.3 && alpha_s < 0.33) {
2144 d[0][0] = 0.6327732610959403;
2145 d[1][0] = 0.6952147319486842;
2146 d[0][1] = 5.646624908846933;
2147 d[1][1] = 6.931552369487635;
2148 d[0][2] = 5.982691423451806;
2149 d[1][2] = 7.185588273540373;
2150 d[0][3] = 1.8728243844356356;
2151 d[1][3] = 2.228328283532209;
2152 d[0][4] = 0.572761497659723;
2153 d[1][4] = 0.6786029643259804;
2154 d[0][5] = 0.04809998538877525;
2155 d[1][5] = 0.056755908207122875;
2156 }
else if (alpha_s >= 0.33 && alpha_s < 0.36) {
2157 d[0][0] = 0.6952147319486842;
2158 d[1][0] = 0.7574189285141091;
2159 d[0][1] = 6.931552369487635;
2160 d[1][1] = 8.307255807497631;
2161 d[0][2] = 7.185588273540373;
2162 d[1][2] = 8.454112812202247;
2163 d[0][3] = 2.228328283532209;
2164 d[1][3] = 2.596781386863294;
2165 d[0][4] = 0.6786029643259804;
2166 d[1][4] = 0.7872276571283385;
2167 d[0][5] = 0.056755908207122875;
2168 d[1][5] = 0.06554867983133447;
2169 }
else if (alpha_s >= 0.36 && alpha_s < 0.39) {
2170 d[0][0] = 0.7574189285141091;
2171 d[1][0] = 0.8193940883937045;
2172 d[0][1] = 8.307255807497631;
2173 d[1][1] = 9.761691032241623;
2174 d[0][2] = 8.454112812202247;
2175 d[1][2] = 9.777948193339808;
2176 d[0][3] = 2.596781386863294;
2177 d[1][3] = 2.9744411293541457;
2178 d[0][4] = 0.7872276571283385;
2179 d[1][4] = 0.8973688582323887;
2180 d[0][5] = 0.06554867983133447;
2181 d[1][5] = 0.07435862848596686;
2182 }
else if (alpha_s >= 0.39 && alpha_s <= 0.42) {
2183 d[0][0] = 0.8193940883937045;
2184 d[1][0] = 0.8811479514201789;
2185 d[0][1] = 9.761691032241623;
2186 d[1][1] = 11.286034194965852;
2187 d[0][2] = 9.777948193339808;
2188 d[1][2] = 11.15001447311135;
2189 d[0][3] = 2.9744411293541457;
2190 d[1][3] = 3.3591358778545803;
2191 d[0][4] = 0.8973688582323887;
2192 d[1][4] = 1.0083901554550654;
2193 d[0][5] = 0.07435862848596686;
2194 d[1][5] = 0.08313659597360733;
2197 rateLower = T * (d[0][0] + d[0][1] / pow(u, 4.) - d[0][2] / pow(u, 3.) -
2198 d[0][3] / pow(u, 2.) + d[0][4] / pow(u, 1.5) - d[0][5] /
u);
2199 rateUpper = T * (d[1][0] + d[1][1] / pow(u, 4.) - d[1][2] / pow(u, 3.) -
2200 d[1][3] / pow(u, 2.) + d[1][4] / pow(u, 1.5) - d[1][5] /
u);
2202 rate.
qg = (1. - alphaFrac) * rateLower + alphaFrac * rateUpper;
2205 rate.
gg = rate.
qg * 9. / 4.;
2213 rate.
qg = 4. / 3. * 2. * M_PI * alpha_s * alpha_s * T * T / (3. * pRest) *
2214 (0.5 * log(pRest * T / ((1. / 6.) * pow(
g * T, 2.))) - 0.36149);
2215 rate.
gq =
nf * 3. / 8. * 4. / 3. * 2. * M_PI * alpha_s * alpha_s * T * T /
2217 (0.5 * log(pRest * T / ((1. / 6.) * pow(
g * T, 2.))) - 0.36149);
2218 rate.
qgamma = 2. * M_PI * alpha_s * alpha_em * T * T / (3. * pRest) *
2219 (0.5 * log(pRest * T / ((1. / 6.) * pow(
g * T, 2.))) - 0.36149);
2225 double u = pRest /
T;
2235 Pos = getRateElasPos(u, T);
2236 Neg = getRateElasNeg(u, T);
2240 int posNegSwitch = 1;
2247 if (process == 5 || process == 7)
2252 if (ZeroOneDistribution(*GetMt19937Generator()) <
2253 Neg.
qq / (Neg.
qq + Pos.
qq))
2256 if (ZeroOneDistribution(*GetMt19937Generator()) <
2257 Neg.
gq / (Neg.
gq + Pos.
gq))
2261 if (posNegSwitch == 1)
2264 randA = ZeroOneDistribution(*GetMt19937Generator()) *
2265 areaOmega(u, posNegSwitch, process);
2266 y = exp((-1.41428 * pow(10., 9.) * alpha_s -
2267 8.08158 * pow(10., 8.) * alpha_s * alpha_s +
2268 2.02327 * pow(10., 9.) * randA) /
2270 (4.72097 * pow(10., 8.) + 2.6977 * pow(10., 8.) * alpha_s)));
2272 fy = alpha_s / 0.15 * (0.035 + alpha_s * 0.02) / sqrt(y * y);
2273 fyAct = functionOmega(u, y, process);
2275 x = ZeroOneDistribution(*GetMt19937Generator());
2277 }
while (x > fyAct / fy);
2283 randA = ZeroOneDistribution(*GetMt19937Generator()) *
2284 areaOmega(-0.05, posNegSwitch, process);
2285 y = -12. * exp(-30. * randA / (alpha_s * (7. + 4. * alpha_s)));
2287 fy = alpha_s / 0.15 * (0.035 + alpha_s * 0.02) / sqrt(y * y);
2288 fyAct = functionOmega(u, y, process);
2290 x = ZeroOneDistribution(*GetMt19937Generator());
2292 }
while (x > fyAct / fy);
2296 }
else if (process == 6 || process == 8)
2301 if (ZeroOneDistribution(*GetMt19937Generator()) <
2302 Neg.
qg / (Neg.
qg + Pos.
qg))
2305 if (ZeroOneDistribution(*GetMt19937Generator()) <
2306 Neg.
gg / (Neg.
gg + Pos.
gg))
2310 if (posNegSwitch == 1)
2313 randA = ZeroOneDistribution(*GetMt19937Generator()) *
2314 areaOmega(u, posNegSwitch, process);
2315 y = exp((-2.32591 * pow(10., 17.) * alpha_s -
2316 1.32909 * pow(10., 17.) * alpha_s * alpha_s +
2317 2.2183 * pow(10., 17.) * randA) /
2318 (alpha_s * (7.76406 * pow(10., 16.) +
2319 4.43661 * pow(10., 16.) * alpha_s)));
2321 fy = 1.5 * alpha_s / 0.15 * (0.035 + alpha_s * 0.02) / sqrt(y * y);
2322 fyAct = functionOmega(u, y, process);
2324 x = ZeroOneDistribution(*GetMt19937Generator());
2326 }
while (x > fyAct / fy);
2332 randA = ZeroOneDistribution(*GetMt19937Generator()) *
2333 areaOmega(-0.05, posNegSwitch, process);
2334 y = -12. * exp(-2.81475 * pow(10., 15.) * randA /
2335 (alpha_s * (9.85162 * pow(10., 14.) +
2336 5.6295 * pow(10., 14.) * alpha_s)));
2338 fy = 1.5 * alpha_s / 0.15 * (0.035 + alpha_s * 0.02) / sqrt(y * y);
2339 fyAct = functionOmega(u, y, process);
2341 x = ZeroOneDistribution(*GetMt19937Generator());
2343 }
while (x > fyAct / fy);
2348 JSWARN <<
"Invalid process number (" << process <<
")";
2358 double u = pRest /
T;
2376 if (omega < 10. && omega > -3.) {
2377 if (process == 5 || process == 7)
2379 A = (0.7 + alpha_s) * 0.0014 *
2380 (1000. + 40. / sqrt(omega * omega) + 10.5 * pow(omega, 4.)) * alpha_s;
2381 B = 2. * sqrt(omega * omega) + 0.01;
2382 }
else if (process == 6 || process == 8)
2384 A = (0.7 + alpha_s) * 0.0022 *
2385 (1000. + 40. / sqrt(omega * omega) + 10.5 * pow(omega, 4.)) * alpha_s;
2386 B = 2. * sqrt(omega * omega) + 0.002;
2388 JSWARN <<
"Invalid process number (" << process <<
")";
2395 randA = ZeroOneDistribution(*GetMt19937Generator()) *
2396 areaQ(u, omega, process);
2398 sqrt(tan((2. * sqrt(B) * randA + A * atan(omega * omega / sqrt(B))) /
2401 fy = A * y / (pow(y, 4.) + B);
2402 fyAct = functionQ(u, omega, y, process);
2404 x = ZeroOneDistribution(*GetMt19937Generator());
2406 }
while (x > fyAct / fy);
2411 else if (omega < 40.) {
2412 double g = 0, g_new = 0;
2417 const double y_min = sqrt(omega * omega);
2423 y = y_min + ZeroOneDistribution(*GetMt19937Generator()) * (y_max - y_min);
2424 g = functionQ(u, omega, y, process);
2433 const int n_steps = 500;
2435 for (
int i = 0;
i < n_steps;
i++) {
2438 ZeroOneDistribution(*GetMt19937Generator()) * (y_max - y_min);
2439 }
while (y_new < y_min || y_new > y_max);
2443 g_new = functionQ(u, omega, y_new, process);
2448 if (ZeroOneDistribution(*GetMt19937Generator()) < ratio) {
2466 if (process == 5 || process == 7) {
2467 if (posNegSwitch == 1)
2468 return (0.0333333 * alpha_s * (7. + 4. * alpha_s) * (2.99573 + log(u)));
2470 return (-0.133333 * alpha_s * (1.75 + alpha_s) * log(-0.0833333 * u));
2471 }
else if (process == 6 || process == 8) {
2472 if (posNegSwitch == 1)
2473 return (0.05 * alpha_s * (7. + 4. * alpha_s) * (2.99573 + log(u)));
2475 return (-0.2 * alpha_s * (1.75 + alpha_s) * log(-0.0833333 * u));
2477 JSWARN <<
"Invalid process number (" << process <<
")";
2487 if (process == 5 || process == 7) {
2488 A = (0.7 + alpha_s - 0.3) * 0.0014 * alpha_s *
2489 (1000. + 40. / sqrt(omega * omega) + 10.5 * pow(omega, 4.));
2490 B = 2. * sqrt(omega * omega) + 0.01;
2491 }
else if (process == 6 || process == 8) {
2492 A = (0.7 + alpha_s - 0.3) * 0.0022 * alpha_s *
2493 (1000. + 40. / sqrt(omega * omega) + 10.5 * pow(omega, 4.));
2494 B = 2. * sqrt(omega * omega) + 0.002;
2496 JSWARN <<
"Invalid process number (" << process <<
")";
2501 areaQ = (0.5 * A * (atan(u * u / sqrt(B)) - atan(omega * omega / sqrt(B)))) /
2514 double pAbs = pVec.
t();
2518 double xx, yy, zz, tt;
2521 xx = pVec.
x() * (pAbs - omega) / pAbs;
2522 yy = pVec.
y() * (pAbs - omega) / pAbs;
2523 zz = pVec.
z() * (pAbs - omega) / pAbs;
2524 tt = pVec.
t() * (pAbs - omega) / pAbs;
2526 pVecNew.
Set(xx, yy, zz, tt);
2530 cosTheta_pq = (-omega * omega + 2. * pAbs * omega + q * q) / (2. * pAbs * q);
2531 qt = q * sqrt(1. - cosTheta_pq * cosTheta_pq);
2532 ql = q * cosTheta_pq;
2534 if (pVec.
y() * pVec.
y() > pVec.
x() * pVec.
x()) {
2544 tt = sqrt(xx * xx + yy * yy + zz * zz);
2545 etVec.
Set(xx / tt, yy / tt, zz / tt, 1.);
2548 qtVec.
Set(etVec.
x() * qt, etVec.
y() * qt, etVec.
z() * qt, etVec.
t() * qt);
2550 qlVec.
Set(pVec.
x() / pAbs * ql, pVec.
y() / pAbs * ql, pVec.
z() / pAbs * ql,
2551 pVec.
t() / pAbs * ql);
2554 pVecNewTemp -= qtVec;
2555 pVecNewTemp -= qlVec;
2557 phi = 2. * M_PI * ZeroOneDistribution(*GetMt19937Generator());
2558 r.
Set(pVec.
x() / pVec.
t(), pVec.
y() / pVec.
t(), pVec.
z() / pVec.
t(), 1.);
2562 M[0][0] = r.
x() * r.
x() * u + cos(phi);
2563 M[1][0] = r.
x() * r.
y() * u - r.
z() * sin(phi);
2564 M[2][0] = r.
x() * r.
z() * u + r.
y() * sin(phi);
2566 M[0][1] = r.
y() * r.
x() * u + r.
z() * sin(phi);
2567 M[1][1] = r.
y() * r.
y() * u + cos(phi);
2568 M[2][1] = r.
y() * r.
z() * u - r.
x() * sin(phi);
2570 M[0][2] = r.
z() * r.
x() * u - r.
y() * sin(phi);
2571 M[1][2] = r.
z() * r.
y() * u + r.
x() * sin(phi);
2572 M[2][2] = r.
z() * r.
z() * u + cos(phi);
2574 xx = M[0][0] * pVecNewTemp.
x() + M[0][1] * pVecNewTemp.
y() +
2575 M[0][2] * pVecNewTemp.
z();
2576 yy = M[1][0] * pVecNewTemp.
x() + M[1][1] * pVecNewTemp.
y() +
2577 M[1][2] * pVecNewTemp.
z();
2578 zz = M[2][0] * pVecNewTemp.
x() + M[2][1] * pVecNewTemp.
y() +
2579 M[2][2] * pVecNewTemp.
z();
2580 tt = sqrt(xx * xx + yy * yy + zz * zz);
2582 pVecNew.
Set(xx, yy, zz, tt);
2595 double cosTh, sinTh;
2596 double u1[3], u2[3];
2597 double M1[3][3], M2[3][3];
2598 double xx, yy, zz, tt;
2601 sqrt(qVec.
x() * qVec.
x() + qVec.
y() * qVec.
y() + qVec.
z() * qVec.
z());
2602 double omega = qVec.
t();
2606 if (q - fabs(omega) < 1
e-5) {
2611 k_min = (q - omega) / 2.;
2614 k = getThermal(k_min, T, kind);
2616 cosTh = (2. * k * omega - q * q + omega * omega) / (2. * k * q);
2617 sinTh = sqrt(1. - cosTh * cosTh);
2621 double norm = sqrt(qVec.
x() * qVec.
x() + qVec.
y() * qVec.
y());
2623 u1[0] = qVec.
y() /
norm;
2624 u1[1] = -qVec.
x() /
norm;
2635 M1[0][0] = u1[0] * u1[0] * (1. - cosTh) + cosTh;
2636 M1[1][0] = u1[0] * u1[1] * (1. - cosTh) - u1[2] * sinTh;
2637 M1[2][0] = u1[0] * u1[2] * (1. - cosTh) + u1[1] * sinTh;
2639 M1[0][1] = u1[1] * u1[0] * (1. - cosTh) + u1[2] * sinTh;
2640 M1[1][1] = u1[1] * u1[1] * (1. - cosTh) + cosTh;
2641 M1[2][1] = u1[1] * u1[2] * (1. - cosTh) - u1[0] * sinTh;
2643 M1[0][2] = u1[2] * u1[0] * (1. - cosTh) - u1[1] * sinTh;
2644 M1[1][2] = u1[2] * u1[1] * (1. - cosTh) + u1[0] * sinTh;
2645 M1[2][2] = u1[2] * u1[2] * (1. - cosTh) + cosTh;
2648 xx = M1[0][0] * qVec.
x() + M1[0][1] * qVec.
y() + M1[0][2] * qVec.
z();
2649 yy = M1[1][0] * qVec.
x() + M1[1][1] * qVec.
y() + M1[1][2] * qVec.
z();
2650 zz = M1[2][0] * qVec.
x() + M1[2][1] * qVec.
y() + M1[2][2] * qVec.
z();
2653 tt = sqrt(xx * xx + yy * yy + zz * zz);
2658 kVec.
Set(xx, yy, zz, k);
2661 double phi = 2. * M_PI * ZeroOneDistribution(*GetMt19937Generator());
2666 tt = sqrt(xx * xx + yy * yy + zz * zz);
2672 M2[0][0] = u2[0] * u2[0] * (1. - cos(phi)) + cos(phi);
2673 M2[1][0] = u2[0] * u2[1] * (1. - cos(phi)) - u2[2] * sin(phi);
2674 M2[2][0] = u2[0] * u2[2] * (1. - cos(phi)) + u2[1] * sin(phi);
2676 M2[0][1] = u2[1] * u2[0] * (1. - cos(phi)) + u2[2] * sin(phi);
2677 M2[1][1] = u2[1] * u2[1] * (1. - cos(phi)) + cos(phi);
2678 M2[2][1] = u2[1] * u2[2] * (1. - cos(phi)) - u2[0] * sin(phi);
2680 M2[0][2] = u2[2] * u2[0] * (1. - cos(phi)) - u2[1] * sin(phi);
2681 M2[1][2] = u2[2] * u2[1] * (1. - cos(phi)) + u2[0] * sin(phi);
2682 M2[2][2] = u2[2] * u2[2] * (1. - cos(phi)) + cos(phi);
2684 xx = M2[0][0] * kVec.
x() + M2[0][1] * kVec.
y() + M2[0][2] * kVec.
z();
2685 yy = M2[1][0] * kVec.
x() + M2[1][1] * kVec.
y() + M2[1][2] * kVec.
z();
2686 zz = M2[2][0] * kVec.
x() + M2[2][1] * kVec.
y() + M2[2][2] * kVec.
z();
2687 tt = sqrt(xx * xx + yy * yy + zz * zz);
2689 kVec.
Set(xx, yy, zz, tt);
2710 tan(M_PI * ZeroOneDistribution(*GetMt19937Generator()) / 2.0);
2714 gx = px2 * (1.0 + px2) * exp(-ex);
2715 else if (kind == -1)
2716 gx = px2 * (1.0 + px2) * 1 / (exp(ex) - 1);
2717 else if (kind == +1)
2718 gx = px2 * (1.0 + px2) * 1 / (exp(ex) + 1);
2719 if (ZeroOneDistribution(*GetMt19937Generator()) < gx / gm) {
2732 filename = PathToTables +
"/radgamma";
2734 JSINFO <<
"Reading rates of inelastic collisions from file ";
2735 JSINFO << filename.c_str() <<
" ... ";
2738 rfile = fopen(filename.c_str(),
"rb");
2739 if (rfile == NULL) {
2740 JSWARN <<
"[readRadiativeRate]: ERROR: Unable to open file " <<
filename;
2741 throw std::runtime_error(
2742 "[readRadiativeRate]: ERROR: Unable to open Radiative rate file");
2745 bytes_read = fread((
char *)(&dat->
ddf),
sizeof(
double), 1, rfile);
2746 bytes_read = fread((
char *)(&dat->
dda),
sizeof(
double), 1, rfile);
2747 bytes_read = fread((
char *)(&dat->
dcf),
sizeof(
double), 1, rfile);
2748 bytes_read = fread((
char *)(&dat->
dca),
sizeof(
double), 1, rfile);
2749 bytes_read = fread((
char *)(&dat->
Nc),
sizeof(
int), 1, rfile);
2750 bytes_read = fread((
char *)(&dat->
Nf),
sizeof(
int), 1, rfile);
2751 bytes_read = fread((
char *)(&dat->
BetheHeitler),
sizeof(
int), 1, rfile);
2752 bytes_read = fread((
char *)(&dat->
BDMPS),
sizeof(
int), 1, rfile);
2753 bytes_read = fread((
char *)(&dat->
include_gluons),
sizeof(
int), 1, rfile);
2754 bytes_read = fread((
char *)Gam->
qqg,
sizeof(
double),
NP * NK, rfile);
2755 bytes_read = fread((
char *)Gam->
tau_qqg,
sizeof(
double),
NP * NK, rfile);
2756 bytes_read = fread((
char *)Gam->
gqq,
sizeof(
double),
NP * NK, rfile);
2757 bytes_read = fread((
char *)Gam->
tau_gqq,
sizeof(
double),
NP * NK, rfile);
2758 bytes_read = fread((
char *)Gam->
ggg,
sizeof(
double),
NP * NK, rfile);
2759 bytes_read = fread((
char *)Gam->
tau_ggg,
sizeof(
double),
NP * NK, rfile);
2760 bytes_read = fread((
char *)Gam->
qqgamma,
sizeof(
double),
NP * NK, rfile);
2761 bytes_read = fread((
char *)Gam->
tau_qqgamma,
sizeof(
double),
NP * NK, rfile);
2769 dat->
n_p =
static_cast<int>(
2770 1.001 + dat->
p_max / dat->
dp);
2772 dat->
n_pmin =
static_cast<int>(
2773 1.001 + dat->
p_min / dat->
dp);
2776 dat->
n_kmin = 1 + 2 * (
static_cast<int>(2. / dat->
dp));
2778 dat->
n_k =
static_cast<int>((8 + dat->
p_max) / (2 * dat->
dp));
2790 filename[0] = PathToTables +
"/logEnDtrqq";
2791 filename[1] = PathToTables +
"/logEnDtrqg";
2793 JSINFO <<
"Reading rates of elastic collisions from files";
2795 JSINFO << filename[1] <<
" ...";
2797 fin.open(filename[0].c_str(),
ios::in);
2799 JSWARN <<
"[readElasticRateOmega]: ERROR: Unable to open file "
2801 throw std::runtime_error(
2802 "[readElasticRateQ]: ERROR: Unable to open ElasticRateOmega file");
2806 while (!fin.eof()) {
2810 dGamma_qq->push_back(dGamma);
2816 fin.open(filename[1].c_str(),
ios::in);
2818 JSWARN <<
"[readElasticRateOmega]: ERROR: Unable to open file "
2820 throw std::runtime_error(
2821 "[readElasticRateQ]: ERROR: Unable to open ElasticRateOmega file");
2825 while (!fin.eof()) {
2829 dGamma_qg->push_back(dGamma);
2840 double as, omega, q;
2844 filename[0] = PathToTables +
"/logEnDqtrqq";
2845 filename[1] = PathToTables +
"/logEnDqtrqg";
2847 JSINFO <<
"Reading rates of elastic collisions from files";
2849 JSINFO << filename[1] <<
" ...";
2851 fin.open(filename[0].c_str(),
ios::in);
2853 JSWARN <<
"[readElasticRateQ]: ERROR: Unable to open file " << filename[0];
2854 throw std::runtime_error(
2855 "[readElasticRateQ]: ERROR: Unable to open ElasticRateQ file");
2859 while (!fin.eof()) {
2864 dGamma_qq_q->push_back(dGamma);
2870 fin.open(filename[1].c_str(),
ios::in);
2872 JSWARN <<
"[readElasticRateQ]: ERROR: Unable to open file " << filename[1];
2873 throw std::runtime_error(
2874 "[readElasticRateQ]: ERROR: Unable to open ElasticRateQ file");
2878 while (!fin.eof()) {
2883 dGamma_qg_q->push_back(dGamma);
2891 return use_table(p, k, Gam.qqg, 0);
2896 return use_table(p, k, Gam.gqq, 1);
2903 return use_table(p, k, Gam.ggg, 2);
2909 return use_table(p, k, Gam.qqgamma, 3);
2920 double a,
b, result;
2924 if ((p < 4.01) || (p > 46000.) || (k < -12.) || (k > p + 12.))
2927 if ((which_kind % 3) && (k > p / 2))
2930 a = 24.7743737154026 * log(p * 0.2493765586034912718l);
2945 }
else if (k < p - 2.) {
2946 b = 190. - 10. * log(1.000670700260932956l /
2947 (0.0003353501304664781l + (k - 2.) / (p - 4.)) -
2952 b = 290. + 10. * (k -
p);
2954 b = 300. + 20. * (k -
p);
2957 b = 310. + 10. * (k -
p);
2959 b = 320. + 5. * (k -
p);
2965 result = (1. -
a) * ((1. - b) * dGamma[n_p][n_k] + b * dGamma[n_p][n_k + 1]) +
2966 a * ((1. - b) * dGamma[n_p + 1][n_k] + b * dGamma[n_p + 1][n_k + 1]);
2968 if (std::abs(k) > 0.001)
2970 switch (which_kind) {
2974 result /= 1. - exp(-k);
2976 result /= 1. + exp(k - p);
2981 result /= 1 + exp(-k);
2983 result /= 1. + exp(k - p);
2986 result /= k * (p -
k) / p;
2988 result /= 1. - exp(-k);
2990 result /= 1. - exp(k - p);
2997 result /= 1. + exp(k - p);
3006 if ((omega > 0. && omega < u) || (omega < 0. && omega > -u))
3007 return use_elastic_table_omega(omega, process);
3013 if (q > std::abs(omega) &&
3014 ((omega > 0 && omega < u) || (omega < 0 && omega > -u)))
3015 return use_elastic_table_q(omega, q, process);
3025 double alphaFrac, omegaFrac;
3026 int iOmega, iAlphas;
3027 int position, positionAlphaUp, positionOmegaUp, positionAlphaUpOmegaUp;
3028 double rate, rateAlphaUp, rateOmegaUp, rateAlphaUpOmegaUp;
3029 double rateOmegaAv, rateAlphaUpOmegaAv;
3032 iOmega = Nomega / 2 + floor((log(omega) + 5) / omegaStep);
3034 iOmega = Nomega / 2 - ceil((log(-omega) + 5) / omegaStep) - 1;
3035 iAlphas = floor((alpha_s - 0.15) / alphaStep);
3037 position = iOmega + Nomega * (iAlphas);
3038 positionAlphaUp = iOmega + Nomega * (iAlphas + 1);
3039 positionOmegaUp = iOmega + 1 + Nomega * (iAlphas);
3040 positionAlphaUpOmegaUp = iOmega + 1 + Nomega * (iAlphas + 1);
3042 alphaFrac = (alpha_s - (floor((alpha_s - alphaMin) / alphaStep) * alphaStep +
3046 if (exp(ceil((log(omega) + 5) / omegaStep) * omegaStep - 5) !=
3047 exp(floor((log(omega) + 5) / omegaStep) * omegaStep - 5))
3049 (omega - (exp(floor((log(omega) + 5) / omegaStep) * omegaStep - 5))) /
3050 ((exp(ceil((log(omega) + 5) / omegaStep) * omegaStep - 5)) -
3051 exp(floor((log(omega) + 5) / omegaStep) * omegaStep - 5));
3055 if (exp(ceil((log(-omega) + 5) / omegaStep) * omegaStep - 5) !=
3056 exp(floor((log(-omega) + 5) / omegaStep) * omegaStep - 5))
3059 (exp(floor((log(-omega) + 5) / omegaStep) * omegaStep - 5))) /
3060 ((exp(ceil((log(-omega) + 5) / omegaStep) * omegaStep - 5)) -
3061 exp(floor((log(-omega) + 5) / omegaStep) * omegaStep - 5));
3066 if (which_kind == 5 || which_kind == 7) {
3067 if (position > 0 && iAlphas < Nalphas && iOmega < Nomega)
3068 rate = dGamma_qq->at(position);
3072 if (iAlphas + 1 < Nalphas)
3073 rateAlphaUp = dGamma_qq->at(positionAlphaUp);
3077 if (iOmega + 1 < Nomega)
3078 rateOmegaUp = dGamma_qq->at(positionOmegaUp);
3082 if (iAlphas < Nalphas && iOmega < Nomega)
3083 rateAlphaUpOmegaUp = dGamma_qq->at(positionAlphaUpOmegaUp);
3085 rateAlphaUpOmegaUp =
rate;
3087 if (position > 0 && iAlphas < Nalphas && iOmega < Nomega)
3088 rate = dGamma_qg->at(position);
3092 if (iAlphas + 1 < Nalphas)
3093 rateAlphaUp = dGamma_qg->at(positionAlphaUp);
3097 if (iOmega + 1 < Nomega)
3098 rateOmegaUp = dGamma_qg->at(positionOmegaUp);
3102 if (iAlphas < Nalphas && iOmega < Nomega)
3103 rateAlphaUpOmegaUp = dGamma_qg->at(positionAlphaUpOmegaUp);
3105 rateAlphaUpOmegaUp =
rate;
3109 rateOmegaAv = (1. - omegaFrac) * rate + omegaFrac * rateOmegaUp;
3110 rateAlphaUpOmegaAv =
3111 (1. - omegaFrac) * rateAlphaUp + omegaFrac * rateAlphaUpOmegaUp;
3113 rateOmegaAv = (omegaFrac)*rate + (1. - omegaFrac) * rateOmegaUp;
3114 rateAlphaUpOmegaAv =
3115 (omegaFrac)*rateAlphaUp + (1. - omegaFrac) * rateAlphaUpOmegaUp;
3117 result = (1. - alphaFrac) * rateOmegaAv + alphaFrac * rateAlphaUpOmegaAv;
3128 double alphaFrac, omegaFrac, qFrac;
3129 int iOmega, iAlphas, iQ;
3130 int position, positionAlphaUp, positionOmegaUp, positionAlphaUpOmegaUp;
3131 int positionQUp, positionAlphaUpQUp, positionOmegaUpQUp,
3132 positionAlphaUpOmegaUpQUp;
3134 double rate, rateAlphaUp, rateOmegaUp, rateAlphaUpOmegaUp;
3135 double rateQUp, rateAlphaUpQUp, rateOmegaUpQUp, rateAlphaUpOmegaUpQUp;
3136 double rate2QUp, rateAlphaUp2QUp, rateOmegaUp2QUp, rateAlphaUpOmegaUp2QUp;
3137 double rateOmegaAv, rateAlphaUpOmegaAv, rateQUpOmegaAv, rateAlphaUpQUpOmegaAv;
3138 double rate2QUpOmegaAv, rateAlphaUp2QUpOmegaAv;
3139 double rateQAv, rateAlphaUpQAv;
3140 double slope, slopeAlphaUp;
3143 rateAlphaUp2QUp = 0.;
3144 rateOmegaUp2QUp = 0.;
3145 rateAlphaUpOmegaUp2QUp = 0.;
3147 rateAlphaUpOmegaAv = 0.;
3148 rateQUpOmegaAv = 0.;
3149 rateAlphaUpQUpOmegaAv = 0.;
3150 rate2QUpOmegaAv = 0.;
3151 rateAlphaUp2QUpOmegaAv = 0.;
3154 iOmega = Nomega / 2 + floor((log(omega) + 5) / omegaStep);
3156 iOmega = Nomega / 2 - ceil((log(-omega) + 5) / omegaStep) - 1;
3157 iQ = floor((log(q) + 5) / qStep + 0.0001);
3158 iAlphas = floor((alpha_s - 0.15) / alphaStep + 0.0001);
3160 position = iQ + Nq * (iOmega + Nomega * (iAlphas));
3161 positionAlphaUp = iQ + Nq * (iOmega + Nomega * (iAlphas + 1));
3162 positionOmegaUp = iQ + Nq * (iOmega + 1 + Nomega * (iAlphas));
3163 positionQUp = iQ + 1 + Nq * (iOmega + Nomega * (iAlphas));
3164 position2QUp = iQ + 2 + Nq * (iOmega + Nomega * (iAlphas));
3165 positionAlphaUpOmegaUp = iQ + Nq * (iOmega + 1 + Nomega * (iAlphas + 1));
3166 positionAlphaUpQUp = iQ + 1 + Nq * (iOmega + Nomega * (iAlphas + 1));
3167 positionOmegaUpQUp = iQ + 1 + Nq * (iOmega + 1 + Nomega * (iAlphas));
3168 positionAlphaUpOmegaUpQUp =
3169 iQ + 1 + Nq * (iOmega + 1 + Nomega * (iAlphas + 1));
3171 alphaFrac = (alpha_s - (floor((alpha_s - alphaMin) / alphaStep) * alphaStep +
3175 if (exp(ceil((log(omega) + 5) / omegaStep) * omegaStep - 5) !=
3176 exp(floor((log(omega) + 5) / omegaStep) * omegaStep - 5))
3178 (omega - (exp(floor((log(omega) + 5) / omegaStep) * omegaStep - 5))) /
3179 ((exp(ceil((log(omega) + 5) / omegaStep) * omegaStep - 5)) -
3180 exp(floor((log(omega) + 5) / omegaStep) * omegaStep - 5));
3184 if (exp(ceil((log(-omega) + 5) / omegaStep) * omegaStep - 5) !=
3185 exp(floor((log(-omega) + 5) / omegaStep) * omegaStep - 5))
3188 (exp(floor((log(-omega) + 5) / omegaStep) * omegaStep - 5))) /
3189 ((exp(ceil((log(-omega) + 5) / omegaStep) * omegaStep - 5)) -
3190 exp(floor((log(-omega) + 5) / omegaStep) * omegaStep - 5));
3198 qFrac = (log(q) - (floor((log(q) + 5.) / qStep) * qStep - 5.)) / qStep;
3202 if (exp(ceil((log(q) + 5.) / qStep) * qStep - 5.) !=
3203 exp(floor((log(q) + 5.) / qStep) * qStep - 5.))
3204 qFrac = (q - (exp(floor((log(q) + 5.) / qStep) * qStep - 5.))) /
3205 ((exp(ceil((log(q) + 5.) / qStep) * qStep - 5.)) -
3206 exp(floor((log(q) + 5.) / qStep) * qStep - 5.));
3211 if (which_kind == 5 || which_kind == 7) {
3212 if (position >= 0 && iAlphas < Nalphas && iOmega < Nomega && iQ < Nq)
3213 rate = dGamma_qq_q->at(position);
3217 if (iAlphas + 1 < Nalphas)
3218 rateAlphaUp = dGamma_qq_q->at(positionAlphaUp);
3222 if (iOmega + 1 < Nomega)
3223 rateOmegaUp = dGamma_qq_q->at(positionOmegaUp);
3228 rateQUp = dGamma_qq_q->at(positionQUp);
3232 if (iAlphas < Nalphas && iOmega < Nomega)
3233 rateAlphaUpOmegaUp = dGamma_qq_q->at(positionAlphaUpOmegaUp);
3235 rateAlphaUpOmegaUp =
rate;
3237 if (iAlphas < Nalphas && iQ < Nq)
3238 rateAlphaUpQUp = dGamma_qq_q->at(positionAlphaUpQUp);
3240 rateAlphaUpQUp =
rate;
3242 if (iOmega + 1 < Nomega && iQ + 1 < Nq)
3243 rateOmegaUpQUp = dGamma_qq_q->at(positionOmegaUpQUp);
3245 rateOmegaUpQUp =
rate;
3247 if (iAlphas < Nalphas && iOmega < Nomega && iQ < Nq)
3248 rateAlphaUpOmegaUpQUp = dGamma_qq_q->at(positionAlphaUpOmegaUpQUp);
3250 rateAlphaUpOmegaUpQUp =
rate;
3255 rate2QUp = dGamma_qq_q->at(position2QUp);
3259 if (iAlphas < Nalphas && iQ + 2 < Nq)
3260 rateAlphaUp2QUp = dGamma_qq_q->at(positionAlphaUpQUp + 1);
3262 rateAlphaUp2QUp = rateAlphaUpQUp;
3264 if (iOmega < Nomega && iQ + 2 < Nq)
3265 rateOmegaUp2QUp = dGamma_qq_q->at(positionOmegaUpQUp + 1);
3267 rateOmegaUp2QUp = rateOmegaUpQUp;
3269 if (iAlphas < Nalphas && iOmega < Nomega && iQ + 2 < Nq)
3270 rateAlphaUpOmegaUp2QUp = dGamma_qq_q->at(positionAlphaUpOmegaUpQUp + 1);
3272 rateAlphaUpOmegaUp2QUp = rateAlphaUpOmegaUpQUp;
3275 if (position > 0 && iAlphas < Nalphas && iOmega < Nomega && iQ < Nq)
3276 rate = dGamma_qg_q->at(position);
3280 if (iAlphas + 1 < Nalphas)
3281 rateAlphaUp = dGamma_qg_q->at(positionAlphaUp);
3285 if (iOmega + 1 < Nomega)
3286 rateOmegaUp = dGamma_qg_q->at(positionOmegaUp);
3291 rateQUp = dGamma_qg_q->at(positionQUp);
3295 if (iAlphas < Nalphas && iOmega < Nomega)
3296 rateAlphaUpOmegaUp = dGamma_qg_q->at(positionAlphaUpOmegaUp);
3298 rateAlphaUpOmegaUp =
rate;
3300 if (iAlphas < Nalphas && iQ < Nq)
3301 rateAlphaUpQUp = dGamma_qg_q->at(positionAlphaUpQUp);
3303 rateAlphaUpQUp =
rate;
3305 if (iOmega + 1 < Nomega && iQ + 1 < Nq)
3306 rateOmegaUpQUp = dGamma_qg_q->at(positionOmegaUpQUp);
3308 rateOmegaUpQUp =
rate;
3310 if (iAlphas < Nalphas && iOmega < Nomega && iQ < Nq)
3311 rateAlphaUpOmegaUpQUp = dGamma_qg_q->at(positionAlphaUpOmegaUpQUp);
3313 rateAlphaUpOmegaUpQUp =
rate;
3318 rate2QUp = dGamma_qg_q->at(position2QUp);
3322 if (iAlphas < Nalphas && iQ + 2 < Nq)
3323 rateAlphaUp2QUp = dGamma_qg_q->at(positionAlphaUpQUp + 1);
3325 rateAlphaUp2QUp = rateAlphaUpQUp;
3327 if (iOmega < Nomega && iQ + 2 < Nq)
3328 rateOmegaUp2QUp = dGamma_qg_q->at(positionOmegaUpQUp + 1);
3330 rateOmegaUp2QUp = rateOmegaUpQUp;
3332 if (iAlphas < Nalphas && iOmega < Nomega && iQ + 2 < Nq)
3333 rateAlphaUpOmegaUp2QUp = dGamma_qg_q->at(positionAlphaUpOmegaUpQUp + 1);
3335 rateAlphaUpOmegaUp2QUp = rateAlphaUpOmegaUpQUp;
3339 if (omega > 0. && omega <= 20.) {
3340 rateOmegaAv = (1. - omegaFrac) * rate + omegaFrac * rateOmegaUp;
3341 rateAlphaUpOmegaAv =
3342 (1. - omegaFrac) * rateAlphaUp + omegaFrac * rateAlphaUpOmegaUp;
3343 rateQUpOmegaAv = (1. - omegaFrac) * rateQUp + omegaFrac * rateOmegaUpQUp;
3344 rateAlphaUpQUpOmegaAv =
3345 (1. - omegaFrac) * rateAlphaUpQUp + omegaFrac * rateAlphaUpOmegaUpQUp;
3346 }
else if (omega > 20.) {
3347 if (rate != 0. && rateOmegaUp != 0.)
3349 exp((1. - omegaFrac) * log(rate) + omegaFrac * log(rateOmegaUp));
3350 else if (rate == 0.)
3351 rateOmegaAv = rateOmegaUp;
3352 else if (rateOmegaUp == 0.)
3357 if (rateAlphaUpOmegaUp != 0. && rateAlphaUp != 0.)
3358 rateAlphaUpOmegaAv = exp((1. - omegaFrac) * log(rateAlphaUp) +
3359 omegaFrac * log(rateAlphaUpOmegaUp));
3360 else if (rateAlphaUp == 0.)
3361 rateAlphaUpOmegaAv = rateAlphaUpOmegaUp;
3362 else if (rateAlphaUpOmegaUp == 0.)
3363 rateAlphaUpOmegaAv = rateAlphaUp;
3365 rateAlphaUpOmegaAv = 0.;
3367 if (rateOmegaUpQUp != 0. && rateQUp != 0.)
3368 rateQUpOmegaAv = exp((1. - omegaFrac) * log(rateQUp) +
3369 omegaFrac * log(rateOmegaUpQUp));
3370 else if (rateOmegaUpQUp == 0.)
3371 rateQUpOmegaAv = rateQUp;
3372 else if (rateQUp == 0.)
3373 rateQUpOmegaAv = rateOmegaUpQUp;
3375 rateQUpOmegaAv = 0.;
3377 if (rateAlphaUpOmegaUpQUp != 0. && rateAlphaUpQUp != 0.)
3378 rateAlphaUpQUpOmegaAv = exp((1. - omegaFrac) * log(rateAlphaUpQUp) +
3379 omegaFrac * log(rateAlphaUpOmegaUpQUp));
3380 else if (rateAlphaUpQUp == 0.)
3381 rateAlphaUpQUpOmegaAv = rateAlphaUpOmegaUpQUp;
3382 else if (rateAlphaUpOmegaUpQUp == 0.)
3383 rateAlphaUpQUpOmegaAv = rateAlphaUpQUp;
3385 rateAlphaUpQUpOmegaAv = 0.;
3387 rate2QUpOmegaAv = exp((1. - omegaFrac) * log(rate2QUp) +
3388 omegaFrac * log(rateOmegaUp2QUp));
3389 rateAlphaUp2QUpOmegaAv = exp((1. - omegaFrac) * log(rateAlphaUp2QUp) +
3390 omegaFrac * log(rateAlphaUpOmegaUp2QUp));
3391 }
else if (omega < 0.) {
3392 rateOmegaAv = (omegaFrac)*rate + (1. - omegaFrac) * rateOmegaUp;
3393 rateQUpOmegaAv = (omegaFrac)*rateQUp + (1. - omegaFrac) * rateOmegaUpQUp;
3394 rateAlphaUpOmegaAv =
3395 (omegaFrac)*rateAlphaUp + (1. - omegaFrac) * rateAlphaUpOmegaUp;
3396 rateAlphaUpQUpOmegaAv =
3397 (omegaFrac)*rateAlphaUpQUp + (1. - omegaFrac) * rateAlphaUpOmegaUpQUp;
3402 if (rateOmegaAv > 0.) {
3404 exp((1. - qFrac) * log(rateOmegaAv) + qFrac * log(rateQUpOmegaAv));
3405 }
else if (rateOmegaAv < 0.)
3407 slope = (log(rate2QUpOmegaAv) - log(rateQUpOmegaAv)) / qStep;
3408 rateQAv = exp(log(rateQUpOmegaAv) - slope * ((1. - qFrac) * qStep));
3413 if (rateAlphaUpOmegaAv > 0.) {
3414 rateAlphaUpQAv = exp((1. - qFrac) * log(rateAlphaUpOmegaAv) +
3415 qFrac * log(rateAlphaUpQUpOmegaAv));
3416 }
else if (rateAlphaUpOmegaAv < 0.)
3419 (log(rateAlphaUp2QUpOmegaAv) - log(rateAlphaUpQUpOmegaAv)) / qStep;
3420 rateAlphaUpQAv = exp(log(rateAlphaUpQUpOmegaAv) -
3421 slopeAlphaUp * ((1. - qFrac) * qStep));
3423 rateAlphaUpQAv = 0.;
3428 rateQAv = (1. - qFrac) * rateOmegaAv + qFrac * rateQUpOmegaAv;
3430 (1. - qFrac) * rateAlphaUpOmegaAv + qFrac * rateAlphaUpQUpOmegaAv;
3433 result = (1. - alphaFrac) * rateQAv + alphaFrac * rateAlphaUpQAv;
3441 double w_new, w_old, ratio, e_old, tol;
3446 if (z <= -exp(-1.0)) {
3447 JSWARN <<
"LambertW is not defined for z = " <<
z;
3448 JSWARN <<
"z needs to be bigger than " << -exp(-1.0);
3449 throw std::runtime_error(
"LambertW small z problem");
3453 w_old = log(z) - log(log(z));
3461 while (std::abs(ratio) > tol) {
3463 ratio = w_old * e_old -
z;
3464 ratio /= (e_old * (w_old + 1.0) -
3465 (w_old + 2.0) * (w_old * e_old -
z) / (2.0 * w_old + 2.0));
3466 w_new = w_old - ratio;
3470 JSWARN <<
"LambertW is not converging after 100 iterations.";
3471 JSWARN <<
"LambertW: z = " <<
z;
3472 JSWARN <<
"LambertW: w_old = " << w_old;
3473 JSWARN <<
"LambertW: w_new = " << w_new;
3474 JSWARN <<
"LambertW: ratio = " << ratio;
3475 throw std::runtime_error(
"LambertW not conversing");