19 #include "Pythia8/Pythia.h"
28 #define MAGENTA "\033[35m"
30 using namespace Jetscape;
33 const double QS = 0.9;
38 static Pythia8::Pythia
PythiaFunction(
"IntentionallyEmpty",
false);
66 broadening_on =
false;
71 QhatParametrizationType=-1;
98 JSINFO <<
"Initialize Matter ...";
109 QhatParametrizationType=-1;
118 double m_qhat = GetXMLElementDouble({
"Eloss",
"Matter",
"qhat0"});
125 double inputDouble = -99.99;
127 matter_on = GetXMLElementInt({
"Eloss",
"Matter",
"matter_on"});
128 in_vac = GetXMLElementInt({
"Eloss",
"Matter",
"in_vac"});
129 recoil_on = GetXMLElementInt({
"Eloss",
"Matter",
"recoil_on"});
130 broadening_on = GetXMLElementInt({
"Eloss",
"Matter",
"broadening_on"});
131 brick_med = GetXMLElementInt({
"Eloss",
"Matter",
"brick_med"});
132 Q00 = GetXMLElementDouble({
"Eloss",
"Matter",
"Q0"});
133 T0 = GetXMLElementDouble({
"Eloss",
"Matter",
"T0"});
134 alphas = GetXMLElementDouble({
"Eloss",
"Matter",
"alphas"});
135 qhatA = GetXMLElementDouble({
"Eloss",
"Matter",
"qhatA"});
136 qhatB = GetXMLElementDouble({
"Eloss",
"Matter",
"qhatB"});
137 qhatC = GetXMLElementDouble({
"Eloss",
"Matter",
"qhatC"});
138 qhatD = GetXMLElementDouble({
"Eloss",
"Matter",
"qhatD"});
139 tStart = GetXMLElementDouble({
"Eloss",
"tStart"});
141 QhatParametrizationType=GetXMLElementInt({
"Eloss",
"Matter",
"QhatParametrizationType"});
142 hydro_Tc = GetXMLElementDouble({
"Eloss",
"Matter",
"hydro_Tc"});
143 brick_length = GetXMLElementDouble({
"Eloss",
"Matter",
"brick_length"});
144 vir_factor = GetXMLElementDouble({
"Eloss",
"Matter",
"vir_factor"});
146 if (vir_factor < 0.0) {
147 cout <<
"Reminder: negative vir_factor is set, initial energy will be used "
155 JSINFO << MAGENTA <<
"matter shower on: " << matter_on;
156 JSINFO << MAGENTA <<
"in_vac: " << in_vac <<
" brick_med: " << brick_med
157 <<
" recoil_on: " << recoil_on<<
", tStart ="<<tStart;
158 JSINFO << MAGENTA <<
"Q0: " << Q00 <<
" vir_factor: " << vir_factor
159 <<
" qhat0: " << qhat0 <<
" alphas: " << alphas <<
", QhatParametrizationType="<<QhatParametrizationType
160 <<
" qhatA: " << qhatA <<
" qhatB: " <<qhatB <<
" qhatC: " << qhatC <<
" qhatD: " <<qhatD
161 <<
" hydro_Tc: " << hydro_Tc <<
" brick_length: " << brick_length;
162 if(QhatParametrizationType ==1){
JSINFO <<
"Running alphas will be used as 4*pi/(9.0*log(2*enerLoc*tempLoc/LambdaQCDS))"; }
164 if (recoil_on && !flag_init) {
166 <<
"Reminder: download LBT tables first and cmake .. if recoil is "
167 "switched on in MATTER.";
173 ZeroOneDistribution = uniform_real_distribution<double>{0.0, 1.0};
176 srand((
unsigned)
time(NULL));
187 f->WriteComment(
"ElossModule Parton List: " + GetId());
188 f->WriteComment(
"Energy loss to be implemented accordingly ...");
192 JSWARN <<
"i=" << i <<
" MATTER -- status: " << pIn[
i].pstat()
193 <<
" color: " << pIn[
i].color() <<
" " << pIn[
i].anti_color();
194 JSWARN <<
"pid = " << pIn[
i].pid() <<
" E = " << pIn[
i].e()
195 <<
" px = " << pIn[
i].p(1) <<
" py = " << pIn[
i].p(2)
196 <<
" pz = " << pIn[
i].p(3) <<
" virtuality = " << pIn[
i].t()
197 <<
" form_time in fm = " << pIn[
i].form_time()
198 <<
" split time = " << pIn[
i].form_time() + pIn[
i].x_in().t();
202 vector<Parton> &pIn, vector<Parton> &pOut) {
204 if (std::isnan(pIn[0].
e()) || std::isnan(pIn[0].px()) ||
205 std::isnan(pIn[0].py()) || std::isnan(pIn[0].pz()) ||
206 std::isnan(pIn[0].
t()) || std::isnan(pIn[0].form_time())) {
208 Dump_pIn_info(0, pIn);
212 double blurb, zeta, tQ2;
213 int iSplit, pid_a, pid_b;
214 unsigned int max_color, min_color, min_anti_color;
215 double velocity[4], xStart[4], velocity_jet[4];
216 bool photon_brem =
false;
218 VERBOSE(8) <<
MAGENTA <<
"SentInPartons Signal received : " << deltaT <<
" "
219 << Q2 <<
" " << pIn.size();
222 <<
" ********************************************************** ";
226 double delT = deltaT;
230 double ehat_over_T2 = 10.0;
232 std::unique_ptr<FluidCellInfo> check_fluid_info_ptr;
235 <<
" The time in GeV-1 is " << Time;
236 VERBOSE(8) <<
MAGENTA <<
"pid = " << pIn[0].pid() <<
" E = " << pIn[0].e()
237 <<
" px = " << pIn[0].p(1) <<
" py = " << pIn[0].p(2)
238 <<
" pz = " << pIn[0].p(3) <<
" virtuality = " << pIn[0].t()
239 <<
" form_time in fm = " << pIn[0].form_time()
240 <<
" split time = " << pIn[0].form_time() + pIn[0].x_in().t();
241 VERBOSE(8) <<
" color = " << pIn[0].color()
242 <<
" anti-color = " << pIn[0].anti_color();
244 unsigned int ShowerMaxColor = pIn[0].max_color();
245 unsigned int CurrentMaxColor;
247 if (pIn[0].max_color() < MaxColor) {
248 pIn[0].set_max_color(MaxColor);
251 MaxColor = pIn[0].max_color();
259 qhatbrick = qhat0 / 3.0;
262 VERBOSE(8) <<
" qhat0 = " << qhat0 <<
" qhat = " << qhat;
264 for (
int i = 0;
i < pIn.size();
i++) {
268 if(pIn[
i].pstat() != 22) {
271 <<
" A photon was RECEIVED with px = " << pIn[
i].px()
272 <<
" from framework and sent back ";
274 pOut.push_back(pIn[
i]);
281 if (std::abs(pIn[
i].pstat()) == 1) {
293 <<
" * parton formation spacetime point= " << pIn[
i].x_in().t()
294 <<
" " << pIn[
i].x_in().x() <<
" " << pIn[
i].x_in().y() <<
" "
295 << pIn[
i].x_in().z();
299 int jet_stat = pIn[
i].pstat();
302 <<
" energy: " << pIn[
i].e() <<
" color: " << pIn[
i].color()
303 <<
" " << pIn[
i].anti_color() <<
" clock: " <<
time;
307 for (
int j = 1;
j <= 3;
j++) {
308 velocity[
j] = pIn[
i].p(
j) / pIn[
i].e();
313 std::sqrt(std::pow(velocity[1], 2) + std::pow(velocity[2], 2) +
314 std::pow(velocity[3], 2));
318 <<
" tachyonic propagation detected for parton passed from hard "
319 "scattering, velocity mod = "
321 JSWARN <<
"velocityMod=" << std::setprecision(20) << velocityMod;
322 Dump_pIn_info(
i, pIn);
327 if (pIn[
i].form_time() < 0.0)
328 pIn[
i].set_jet_v(velocity);
335 velocity_jet[0] = 1.0;
336 velocity_jet[1] = pIn[
i].jet_v().x();
337 velocity_jet[2] = pIn[
i].jet_v().y();
338 velocity_jet[3] = pIn[
i].jet_v().z();
342 std::sqrt(pow(pIn[
i].jet_v().
x(), 2) + pow(pIn[
i].jet_v().
y(), 2) +
343 pow(pIn[
i].jet_v().
z(), 2));
345 for (
int j = 0;
j <= 3;
j++) {
346 xStart[
j] = pIn[
i].x_in().comp(
j);
354 initVx = velocity[1] / velocityMod;
355 initVy = velocity[2] / velocityMod;
356 initVz = velocity[3] / velocityMod;
358 if (std::abs(pIn[
i].
pid()) == 4 || std::abs(pIn[
i].
pid()) == 5) {
359 double OnShellEnergy = std::sqrt(
360 pIn[
i].px() * pIn[
i].px() + pIn[
i].py() * pIn[
i].py() +
361 pIn[
i].pz() * pIn[
i].pz() + pIn[
i].restmass() * pIn[
i].restmass());
363 initVx = pIn[
i].px() / OnShellEnergy;
364 initVy = pIn[
i].py() / OnShellEnergy;
365 initVz = pIn[
i].pz() / OnShellEnergy;
368 std::sqrt(initVx * initVx + initVy * initVy + initVz * initVz);
371 initRdotV = (initRx * pIn[
i].jet_v().x() + initRy * pIn[
i].jet_v().y() +
372 initRz * pIn[
i].jet_v().z()) /
374 initVdotV = (initVx * pIn[
i].jet_v().x() + initVy * pIn[
i].jet_v().y() +
375 initVz * pIn[
i].jet_v().z()) /
379 double now_R0 =
time;
380 double now_Rx = initRx + (time - initR0) * initVx;
381 double now_Ry = initRy + (time - initR0) * initVy;
382 double now_Rz = initRz + (time - initR0) * initVz;
385 double SpatialRapidity =
386 0.5 * std::log((now_R0 + now_Rz) / (now_R0 - now_Rz));
390 if (std::isnan(velocityMod) || std::isnan(velocity[1]) ||
391 std::isnan(velocity[2]) || std::isnan(velocity[3]) ||
392 std::isinf(velocityMod) || std::isinf(velocity[1]) ||
393 std::isinf(velocity[2]) || std::isinf(velocity[3])) {
395 JSINFO << BOLDYELLOW <<
"time, initR0, initRx, initRy, initRz=" << time
396 <<
", " << initR0 <<
", " << initRx <<
", " << initRy <<
", "
398 JSINFO << BOLDYELLOW <<
"Vx, Vy, Vz =" << velocity[1] <<
", "
399 << velocity[2] <<
", " << velocity[3];
400 JSINFO << BOLDYELLOW <<
"initVx, initVy, initVz =" << initVx <<
", "
401 << initVy <<
", " << initVz;
402 Dump_pIn_info(
i, pIn);
405 initEner = pIn[
i].e();
407 if (GetJetSignalConnected())
408 length = fillQhatTab(SpatialRapidity);
410 JSWARN <<
"Couldn't find a hydro module attached!";
411 throw std::runtime_error(
412 "Please attach a hydro module or set in_vac to 1 in the XML file");
421 zeta = ((xStart[0] + initRdotV) / std::sqrt(2)) * fmToGeVinv;
427 if (std::isinf(now_R0) || std::isnan(now_R0) || std::isinf(now_Rz) ||
428 std::isnan(now_Rz) || std::abs(now_Rz) > now_R0) {
430 JSINFO << BOLDYELLOW <<
"now_R for vector is:" << now_R0 <<
", " << now_Rx
431 <<
", " << now_Ry <<
", " << now_Rz;
432 JSINFO << BOLDYELLOW <<
"time, initR0, initRx, initRy, initRz=" << time
433 <<
", " << initR0 <<
", " << initRx <<
", " << initRy <<
", "
435 JSINFO << BOLDYELLOW <<
"initVx, initVy, initVz =" << initVx <<
", "
436 << initVy <<
", " << initVz;
437 JSINFO << BOLDYELLOW <<
"velocityMod=" << velocityMod;
438 JSINFO << BOLDYELLOW <<
"initVMod="
439 << std::sqrt(initVx * initVx + initVy * initVy + initVz * initVz);
440 Dump_pIn_info(
i, pIn);
443 double boostedTStart = tStart * cosh(SpatialRapidity);
444 if (!in_vac && now_R0 >= boostedTStart) {
445 if (now_R0 * now_R0 < now_Rz * now_Rz)
446 cout <<
"Warning 1: " << now_R0 <<
" " << now_Rz << endl;
447 GetHydroCellSignal(now_R0, now_Rx, now_Ry, now_Rz, check_fluid_info_ptr);
457 int pid = pIn[
i].pid();
459 if (pIn[
i].form_time() <
464 <<
" E = " << pIn[
i].e();
466 if ((pIn[
i].
t() < 0.0) &&
469 JSWARN <<
" parton with a negative virtuality was sent to MATTER and "
470 "will now have its virtuality reset!, press 1 and return to "
477 JSDEBUG <<
" parton is a gluon ";
480 JSDEBUG <<
" parton is a quark ";
486 double pT2 = pIn[
i].p(1) * pIn[
i].p(1) + pIn[
i].p(2) * pIn[
i].p(2);
488 if (vir_factor < 0.0)
490 std::abs(vir_factor) * (pIn[
i].e() * pIn[
i].e() - pIn[
i].restmass() * pIn[
i].restmass());
492 max_vir = pT2 * vir_factor;
494 if (max_vir <=
QS *
QS) {
498 << pIn[
i].x_in().y() <<
" " << pIn[
i].x_in().z() <<
" "
499 << pIn[
i].x_in().t();
500 if (abs(pIn[
i].
pid()) == 4 || abs(pIn[
i].
pid()) == 5) {
504 (1.0 + std::sqrt(1.0 + 4.0 * pIn[
i].restmass() *
505 pIn[
i].restmass() / QS / QS));
506 if (max_vir > min_vir) {
508 generate_vac_t_w_M(pIn[
i].
pid(), pIn[
i].restmass(), pIn[
i].nu(),
509 QS * QS / 2.0, max_vir, zeta, iSplit);
519 }
else if (pIn[
i].
pid() ==
gid) {
520 tQ2 = generate_vac_t_w_M(pIn[
i].
pid(), pIn[
i].restmass(), pIn[
i].nu(),
521 QS * QS / 2.0, max_vir, zeta, iSplit);
523 tQ2 = generate_vac_t(pIn[
i].
pid(), pIn[
i].nu(), QS * QS / 2.0,
524 max_vir, zeta, iSplit);
532 <<
" max virtuality allowed = " << max_vir;
534 <<
" Color = " << pIn[
i].color()
535 <<
" Anti-Color = " << pIn[
i].anti_color();
537 <<
" px = " << pIn[
i].px() <<
" py = " << pIn[
i].py()
538 <<
" pz = " << pIn[
i].pz();
544 pIn[
i].set_mean_form_time();
545 double ft = generate_L(pIn[
i].mean_form_time());
546 pIn[
i].set_form_time(ft);
549 pIn[
i].set_min_color(pIn[
i].
color());
550 pIn[
i].set_min_anti_color(pIn[
i].anti_color());
551 MaxColor = pIn[
i].max_color();
556 VERBOSE(8) <<
" *********************************************************"
557 "******************** ";
559 <<
" Color = " << pIn[
i].color()
560 <<
" Anti-Color = " << pIn[
i].anti_color();
562 <<
" px = " << pIn[
i].px() <<
" py = " << pIn[
i].py()
563 <<
" pz = " << pIn[
i].pz();
565 <<
" Mean formation time = " << pIn[
i].mean_form_time();
567 << pIn[
i].form_time();
569 << pIn[
i].e() * pIn[
i].e() -
570 pIn[
i].restmass() * pIn[
i].restmass()
571 <<
" Minimum Virtuality = " << QS *
QS;
572 VERBOSE(8) <<
" * Qhat = " << qhat <<
" Length in fm = " <<
length / 5.0;
573 VERBOSE(8) <<
" * Jet velocity = " << pIn[
i].jet_v().comp(0) <<
" "
574 << pIn[
i].jet_v().comp(1) <<
" " << pIn[
i].jet_v().comp(2)
575 <<
" " << pIn[
i].jet_v().comp(3);
576 VERBOSE(8) <<
" * reset location of parton formation = "
577 << pIn[
i].x_in().t() <<
" " << pIn[
i].x_in().x() <<
" "
578 << pIn[
i].x_in().y() <<
" " << pIn[
i].x_in().z();
579 VERBOSE(8) <<
" *********************************************************"
580 "******************** ";
593 double tempEner = initEner;
594 qhat = fncQhat(zeta);
598 ehat = 0.0 * qhat / 4.0 / now_temp;
600 <<
" ehat = " << ehat;
605 Q0 = sqrt(sqrt(2.0 * tempEner * qhat * sqrt(2.0)));
607 Q0 = sqrt(sqrt(2.0 * tempEner * qhat * sqrt(2.0) /
Ca *
Cf));
623 ((!in_vac) && now_temp <= T0 &&
626 TakeResponsibilityFor(
628 double decayTime = pIn[
i].mean_form_time();
631 VERBOSE(8) <<
" parton origin time = " << pIn[
i].x_in().t()
632 <<
" parton formation time = " << pIn[
i].form_time();
633 VERBOSE(8) <<
" parton id " << pIn[
i].pid()
634 <<
" parton virtuality = " << pIn[
i].t();
637 double splitTime = pIn[
i].form_time() + pIn[
i].x_in().t();
639 VERBOSE(8) <<
" splitTime = " << splitTime;
640 VERBOSE(8) <<
" qhat before splitime loop = " << qhat;
646 VERBOSE(8) <<
"SPLIT in MATTER";
660 for (
int j = 1;
j <= 3;
j++)
661 el_p0[
j] = pIn[i].
p(
j);
662 el_p0[0] = pIn[
i].e();
663 el_p0[4] = pIn[
i].t();
664 HQ_mass = pIn[
i].restmass();
667 el_time = el_time + el_dt) {
674 double boostedTStart = tStart * std::cosh(SpatialRapidity);
675 if (el_time < boostedTStart)
681 double el_rx = initRx + (el_time - initR0) * initVx;
682 double el_ry = initRy + (el_time - initR0) * initVy;
683 double el_rz = initRz + (el_time - initR0) * initVz;
685 double tempLoc, sdLoc, vxLoc, vyLoc, vzLoc, qhatLoc, enerLoc;
686 double betaLoc, gammaLoc, flowFactor;
690 double pc0[4] = {0.0};
691 double vc0[4] = {0.0};
692 double soln_alphas, prob_el;
700 if (abs(pid) == 4 || abs(pid) == 5)
701 pc0[0] = sqrt(pc0[1] * pc0[1] + pc0[2] * pc0[2] + pc0[3] * pc0[3] +
704 pc0[0] = sqrt(pc0[1] * pc0[1] + pc0[2] * pc0[2] + pc0[3] * pc0[3]);
708 if (std::isinf(el_time) || std::isnan(el_time) || std::isinf(el_rz) ||
709 std::isnan(el_rz) || std::abs(el_rz) > el_time) {
710 JSWARN <<
"Second instance";
711 JSWARN <<
"el_vector for vector is:" << el_time <<
", " << el_rx
712 <<
", " << el_ry <<
", " << el_rz;
713 JSWARN <<
"initR0, initRx, initRy, init Rz=" << initR0 <<
", "
714 << initRx <<
", " << initRy <<
", " << initRz;
715 JSWARN <<
"initVx, initVy, initVz =" << initVx <<
", " << initVy
717 JSWARN <<
"velocityMod=" << std::setprecision(20) << velocityMod;
718 JSWARN <<
"initVMod=" << std::setprecision(20)
719 << std::sqrt(initVx * initVx + initVy * initVy +
721 Dump_pIn_info(i, pIn);
724 GetHydroCellSignal(el_time, el_rx, el_ry, el_rz,
725 check_fluid_info_ptr);
731 vxLoc = check_fluid_info_ptr->
vx;
732 vyLoc = check_fluid_info_ptr->
vy;
733 vzLoc = check_fluid_info_ptr->
vz;
741 if (hydro_ctl == 0 && tempLoc >= hydro_Tc) {
747 betaLoc = sqrt(vxLoc * vxLoc + vyLoc * vyLoc + vzLoc * vzLoc);
748 gammaLoc = 1.0 / sqrt(1.0 - betaLoc * betaLoc);
751 (1.0 - (initVx * vxLoc + initVy * vyLoc + initVz * vzLoc));
773 double muSquare= pIn[
i].t();
774 qhatLoc= GeneralQhatFunction(QhatParametrizationType, tempLoc, sdLoc,
alphas, qhat0, enerLoc, muSquare);
781 if (el_time + el_dt <= time)
782 dt_lrf = el_dt * flowFactor;
784 dt_lrf = (time - el_time) * flowFactor;
789 if (qhat0 < 0.0 || QhatParametrizationType==0 || QhatParametrizationType==1 || QhatParametrizationType==5 ||
790 QhatParametrizationType==6 || QhatParametrizationType==7 )
793 soln_alphas = solve_alphas(qhatLoc, enerLoc, tempLoc);
796 muD2 = 6.0 *
pi * soln_alphas * tempLoc * tempLoc;
797 prob_el = 42.0 *
zeta3 * el_CR * tempLoc / 6.0 /
pi /
798 pi * dt_lrf / 0.1973;
800 prob_el=prob_el*ModifiedProbability(QhatParametrizationType, tempLoc, sdLoc, enerLoc, pIn[i].
t());
802 el_rand = ZeroOneDistribution(*GetMt19937Generator());
806 if (el_rand < prob_el) {
813 double pc2[4] = {0.0};
814 double pc3[4] = {0.0};
815 double pc4[4] = {0.0};
817 unsigned int el_max_color, el_color0, el_anti_color0, el_color2,
818 el_anti_color2, el_color3, el_anti_color3;
820 el_max_color = pIn[
i].max_color();
821 el_color0 = pIn[
i].color();
822 el_anti_color0 = pIn[
i].anti_color();
828 flavor(CT, pid0, pid2, pid3, el_max_color, el_color0,
829 el_anti_color0, el_color2, el_anti_color2, el_color3,
835 if (CT == 11 || CT == 12) {
836 collHQ22(CT, tempLoc, muD2, vc0, pc0, pc2, pc3, pc4, qt);
838 colljet22(CT, tempLoc, muD2, vc0, pc0, pc2, pc3, pc4, qt);
841 if (pc0[0] < pc2[0] && abs(pid0) != 4 &&
844 double p0temp[4] = {0.0};
845 for (
int k = 0;
k <= 3;
k++) {
853 if (pc2[0] < rounding_error || pc3[0] < rounding_error)
859 el_vertex[0] = el_time;
860 el_vertex[1] = el_rx;
861 el_vertex[2] = el_ry;
862 el_vertex[3] = el_rz;
867 pc2[0] = sqrt(pc2[1] * pc2[1] + pc2[2] * pc2[2] + pc2[3] * pc2[3] +
870 if (std::isnan(pc2[1]) || std::isnan(pc2[2]) ||
871 std::isnan(pc2[3]) || std::isinf(pc2[1]) ||
872 std::isinf(pc2[2]) || std::isinf(pc2[3])) {
873 JSWARN <<
"recoil in MATTER instance 1: pc[0]=" << pc2[0]
874 <<
", pc2[1]=" << pc2[1] <<
", pc2[2]=" << pc2[2]
875 <<
", pc2[3]=" << pc2[3];
878 pOut.push_back(
Parton(0, pid2, 1, pc2, el_vertex));
879 iout = pOut.size() - 1;
880 pOut[iout].set_jet_v(velocity_jet);
881 pOut[iout].set_mean_form_time();
883 pOut[iout].set_form_time(ft);
891 pOut[iout].set_color(0);
892 pOut[iout].set_anti_color(0);
893 pOut[iout].set_max_color(pIn[i].max_color());
894 pOut[iout].set_min_color(pIn[i].min_color());
895 pOut[iout].set_min_anti_color(pIn[i].min_anti_color());
898 Parton(0, pid3, -1, pc3, el_vertex));
899 iout = pOut.size() - 1;
900 pOut[iout].set_jet_v(velocity_jet);
901 pOut[iout].set_mean_form_time();
903 pOut[iout].set_form_time(ft);
909 pOut[iout].set_color(0);
910 pOut[iout].set_anti_color(0);
911 pOut[iout].set_max_color(pIn[i].max_color());
912 pOut[iout].set_min_color(pIn[i].min_color());
913 pOut[iout].set_min_anti_color(pIn[i].min_anti_color());
926 for (
int j = 1;
j <= 3;
j++)
929 el_p0[0] = el_p0[0] - recordE0 + pc0[0];
930 el_p0[4] = el_p0[0] * el_p0[0] - pc0[0] * pc0[0];
932 cout <<
"complain negative virt" << endl;
937 double t_used = pIn[
i].t();
939 double tau_form = 2.0 * pIn[
i].nu() / t_used;
940 double z_low =
QS *
QS / t_used / 2.0;
941 double z_hi = 1.0 - z_low;
943 VERBOSE(8) <<
" zeta = " << zeta;
947 P_z_gg_int(z_low, z_hi, zeta, t_used, tau_form, pIn[i].nu());
949 nf * P_z_qq_int(z_low, z_hi, zeta, t_used, tau_form, pIn[i].nu());
951 z_low = (
QS *
QS + 2.0 * M * M) / t_used / 2.0;
955 val3 = P_z_qq_int_w_M_vac_only(M, z_low, z_hi, zeta, t_used,
956 tau_form, pIn[i].nu());
957 if (t_used < (
QS *
QS + 2.0 * M * M))
961 z_low = (
QS *
QS + 2.0 * M * M) / t_used / 2.0;
965 val4 = P_z_qq_int_w_M_vac_only(M, z_low, z_hi, zeta, t_used,
966 tau_form, pIn[i].nu());
967 if (t_used < (
QS *
QS + 2.0 * M * M))
971 <<
" val3 = " << val3 <<
" val4 = " << val4;
973 if (val1 < 0.0 || val2 < 0.0 || val3 < 0.0 || val4 < 0.0) {
974 cerr <<
" minus log of sudakov negative val1 , val2 , val3, val4 = "
975 << val1 <<
" " << val2 <<
" " << val3 <<
" " << val4
977 throw std::runtime_error(
"minus log of sudakov negative");
981 double ratio1 = val1 / (val1 + val2 + val3 + val4);
982 double ratio2 = (val1 + val2) / (val1 + val2 + val3 + val4);
983 double ratio3 = (val1 + val2 + val3) / (val1 + val2 + val3 + val4);
984 double r = ZeroOneDistribution(*GetMt19937Generator());
985 if (r >= ratio1 && r < ratio2) {
987 double r2 = ZeroOneDistribution(*GetMt19937Generator());
993 }
else if (r2 > 0.3333) {
1002 }
else if (r >= ratio2 && r < ratio3) {
1009 }
else if (r >= ratio3) {
1020 }
else if (std::abs(pIn[i].
pid()) < 4) {
1022 double relative_charge = 0.0;
1023 if ((std::abs(pIn[i].
pid()) > 0) && (std::abs(pIn[i].
pid()) < 4))
1024 relative_charge = 1.0 / 9.0;
1025 if (std::abs(pIn[i].
pid()) == 2)
1026 relative_charge = relative_charge * 4.0;
1027 if (std::abs(pIn[i].
pid()) == 4)
1028 relative_charge = 4.0 / 9.0;
1029 if (std::abs(pIn[i].
pid()) == 5)
1030 relative_charge = 1.0 / 9.0;
1033 1.0 - sudakov_Pqg(
QS *
QS / 2, pIn[i].
t(), zeta, pIn[i].nu());
1036 std::pow(sudakov_Pqp(
QS *
QS / 2, pIn[i].
t(), zeta, pIn[i].nu()),
1039 double val = ProbGluon / (ProbGluon + ProbPhoton);
1042 <<
" probability of gluon radiation from quark = " << val;
1044 double r2 = ZeroOneDistribution(*GetMt19937Generator());
1065 double tQd1 =
QS *
QS;
1066 double tQd2 = QS *
QS;
1068 double new_parent_p0 = el_p0[0];
1069 double new_parent_px = el_p0[1];
1070 double new_parent_py = el_p0[2];
1071 double new_parent_pz = el_p0[3];
1072 double new_parent_t = el_p0[4];
1073 double new_parent_pl = (new_parent_px * pIn[
i].jet_v().x() +
1074 new_parent_py * pIn[
i].jet_v().y() +
1075 new_parent_pz * pIn[
i].jet_v().z()) /
1077 if (new_parent_pl < 0.0) {
1079 <<
" parton traversing opposite to jet direction ... Just "
1080 "letting you know ! ";
1088 double new_parent_nu = (new_parent_p0 + new_parent_pl) / sqrt(2.0);
1091 unsigned int d1_col, d1_acol, d2_col, d2_acol,
color, anti_color;
1097 max_color = pIn[
i].max_color();
1099 JSDEBUG <<
" old max color = " << max_color;
1100 max_color = ++MaxColor;
1102 anti_color = max_color;
1103 pIn[
i].set_max_color(max_color);
1109 d1_col = pIn[
i].color();
1111 d1_acol = anti_color;
1112 d2_acol = pIn[
i].anti_color();
1117 if (pIn[i].
pid() > 0)
1121 d2_col = pIn[
i].color();
1122 d2_acol = anti_color;
1125 d1_acol = anti_color;
1127 d2_acol = pIn[
i].anti_color();
1130 iSplit == 2 || iSplit == 4 ||
1134 d1_col = pIn[
i].color();
1136 d2_acol = pIn[
i].anti_color();
1142 d1_col = pIn[
i].color();
1143 d1_acol = pIn[
i].anti_color();
1147 throw std::runtime_error(
"error in iSplit");
1150 double l_perp2 = -1.0;
1157 z = generate_vac_z_w_M(pid, pIn[i].restmass(), QS * QS / 2.0,
1158 pIn[i].
t(), zeta, pIn[i].nu(), iSplit);
1172 if (std::abs(pid_a) == 4 || std::abs(pid_a) == 5) {
1174 if (QS * QS * (1.0 + std::sqrt(1.0 + 4.0 * M * M / QS / QS)) / 2.0 <
1175 z * z * new_parent_t) {
1176 tQd1 = generate_vac_t_w_M(
1177 pid_a, pIn[i].restmass(), z * new_parent_nu, QS * QS / 2.0,
1178 z * z * new_parent_t,
1179 zeta + std::sqrt(2) * pIn[i].form_time() * fmToGeVinv,
1183 tQd1 = z * z * new_parent_t;
1185 }
else if (pid_a == 21) {
1187 if ((QS * QS) < z * z * new_parent_t) {
1188 tQd1 = generate_vac_t_w_M(
1189 pid_a, M, z * new_parent_nu, QS * QS / 2.0,
1190 z * z * new_parent_t,
1191 zeta + std::sqrt(2) * pIn[i].form_time() * fmToGeVinv,
1194 tQd1 = z * z * new_parent_t;
1200 if (z * z * new_parent_t > QS * QS) {
1201 tQd1 = generate_vac_t(
1202 pid_a, z * new_parent_nu, QS * QS / 2.0, z * z * new_parent_t,
1203 zeta + std::sqrt(2) * pIn[i].form_time() * fmToGeVinv,
1206 tQd1 = z * z * new_parent_t;
1214 if (std::abs(pid_b) == 4 || std::abs(pid_b) == 5) {
1217 if (QS * QS * (1.0 + std::sqrt(1.0 + 4.0 * M * M / QS / QS)) / 2.0 <
1218 (1.0 - z) * (1.0 - z) * new_parent_t) {
1219 tQd2 = generate_vac_t_w_M(
1220 pid_b, pIn[i].restmass(), (1.0 - z) * new_parent_nu,
1221 QS * QS / 2.0, (1.0 - z) * (1.0 - z) * new_parent_t,
1222 zeta + std::sqrt(2) * pIn[i].form_time() * fmToGeVinv,
1226 tQd2 = (1.0 -
z) * (1.0 - z) * new_parent_t;
1229 }
else if (pid_b == 21) {
1231 if (QS * QS < (1.0 - z) * (1.0 -
z) * new_parent_t) {
1232 tQd2 = generate_vac_t_w_M(
1233 pid_b, M, (1.0 - z) * new_parent_nu, QS * QS / 2.0,
1234 (1.0 - z) * (1.0 - z) * new_parent_t,
1235 zeta + std::sqrt(2) * pIn[i].form_time() * fmToGeVinv,
1239 tQd2 = (1.0 -
z) * (1.0 - z) * new_parent_t;
1244 if (((1.0 - z) * (1.0 - z) * new_parent_t > QS * QS) &&
1246 tQd2 = generate_vac_t(
1247 pid_b, (1.0 - z) * new_parent_nu, QS * QS / 2.0,
1248 (1.0 - z) * (1.0 - z) * new_parent_t,
1249 zeta + std::sqrt(2) * pIn[i].form_time() * fmToGeVinv,
1252 tQd2 = (1.0 -
z) * (1.0 - z) * new_parent_t;
1260 l_perp2 = new_parent_t * z * (1.0 -
z) - tQd2 * z -
1263 if (abs(pid) == 4 || abs(pid) == 5) {
1264 l_perp2 = new_parent_t * z * (1.0 -
z) - tQd2 * z -
1266 std::pow((1.0 - z) * pIn[i].restmass(),
1268 }
else if ((pid == 21) &&
1274 l_perp2 = new_parent_t * z * (1.0 -
z) - tQd2 * z -
1275 tQd1 * (1.0 - z) - M * M;
1277 l_perp2 = new_parent_t * z * (1.0 -
z) - tQd2 * z -
1301 if (l_perp2 <= Lambda_QCD * Lambda_QCD)
1303 double l_perp = std::sqrt(
1306 <<
" l_perp2 = " << l_perp2;
1308 <<
" tQd2 = " << tQd2;
1310 <<
" pid_b = " << pid_b;
1313 double angle = generate_angle();
1319 pIn[
i].jet_v().z() /
1321 double s_t = std::sqrt(1.0 - c_t * c_t);
1323 double s_p = pIn[
i].jet_v().y() / std::sqrt(pow(pIn[i].jet_v().
x(), 2) +
1324 pow(pIn[i].jet_v().
y(), 2));
1325 double c_p = pIn[
i].jet_v().x() / std::sqrt(pow(pIn[i].jet_v().
x(), 2) +
1326 pow(pIn[i].jet_v().
y(), 2));
1329 <<
" Jet direction w.r.t. beam: theta = " << std::acos(c_t)
1330 <<
" phi = " << std::acos(c_p);
1341 k_perp1[1] = z * (new_parent_px - new_parent_pl * s_t * c_p) +
1342 l_perp * std::cos(angle) * c_t * c_p -
1343 l_perp * std::sin(angle) * s_p;
1344 k_perp1[2] = z * (new_parent_py - new_parent_pl * s_t * s_p) +
1345 l_perp * std::cos(angle) * c_t * s_p +
1346 l_perp * std::sin(angle) * c_p;
1347 k_perp1[3] = z * (new_parent_pz - new_parent_pl * c_t) -
1348 l_perp * std::cos(angle) * s_t;
1350 pow(k_perp1[1], 2) + pow(k_perp1[2], 2) + pow(k_perp1[3], 2);
1354 if ((std::abs(pid_a) == 4) || (std::abs(pid_a) == 5))
1357 double energy = (z * new_parent_nu + (tQd1 + k_perp1_2 + M * M) /
1358 (2.0 * z * new_parent_nu)) /
1360 double plong = (z * new_parent_nu - (tQd1 + k_perp1_2 + M * M) /
1361 (2.0 * z * new_parent_nu)) /
1364 JSWARN <<
" Energy negative after rotation, press 1 and return to "
1371 newp[1] = plong * s_t * c_p + k_perp1[1];
1372 newp[2] = plong * s_t * s_p + k_perp1[2];
1373 newp[3] = plong * c_t + k_perp1[3];
1375 VERBOSE(8) <<
MAGENTA <<
" D1 px = " << newp[1] <<
" py = " << newp[2]
1376 <<
" pz = " << newp[3] <<
" E = " << newp[0];
1380 for (
int j = 1;
j <= 3;
j++) {
1382 newx[
j] = pIn[
i].x_in().comp(
j) +
1383 (time - pIn[
i].x_in().comp(0)) * velocity[
j];
1388 pOut.push_back(
Parton(0, pid_a, jet_stat, newp, newx));
1389 int iout = pOut.size() - 1;
1391 if (std::isnan(newp[1]) || std::isnan(newp[2]) || std::isnan(newp[3])) {
1392 JSINFO <<
MAGENTA << plong <<
" " << s_t <<
" " << c_p <<
" "
1395 JSINFO <<
MAGENTA << newp[0] <<
" " << newp[1] <<
" " << newp[2]
1399 pOut[iout].set_jet_v(velocity_jet);
1400 pOut[iout].set_mean_form_time();
1401 double ft = generate_L(pOut[iout].mean_form_time());
1402 pOut[iout].set_form_time(ft);
1403 pOut[iout].set_color(d1_col);
1404 pOut[iout].set_anti_color(d1_acol);
1405 pOut[iout].set_max_color(max_color);
1406 pOut[iout].set_min_color(pIn[i].min_color());
1407 pOut[iout].set_min_anti_color(pIn[i].min_anti_color());
1409 VERBOSE(8) <<
BOLDRED <<
" virtuality of D 1 = " << pOut[iout].t();
1410 VERBOSE(8) <<
BOLDRED <<
" mass of parton = " << pOut[iout].restmass();
1415 k_perp2[1] = (1.0 -
z) * (new_parent_px - new_parent_pl * s_t * c_p) -
1416 l_perp * std::cos(angle) * c_t * c_p +
1417 l_perp * std::sin(angle) * s_p;
1418 k_perp2[2] = (1.0 -
z) * (new_parent_py - new_parent_pl * s_t * s_p) -
1419 l_perp * std::cos(angle) * c_t * s_p -
1420 l_perp * std::sin(angle) * c_p;
1421 k_perp2[3] = (1.0 -
z) * (new_parent_pz - new_parent_pl * c_t) +
1422 l_perp * std::cos(angle) * s_t;
1424 pow(k_perp2[1], 2) + pow(k_perp2[2], 2) + pow(k_perp2[3], 2);
1427 if ((std::abs(pid_b) == 4) || (std::abs(pid_b) == 5))
1432 ((1.0 -
z) * new_parent_nu +
1433 (tQd2 + k_perp2_2 + M * M) / (2.0 * (1.0 -
z) * new_parent_nu)) /
1436 ((1.0 -
z) * new_parent_nu -
1437 (tQd2 + k_perp2_2 + M * M) / (2.0 * (1.0 -
z) * new_parent_nu)) /
1444 JSWARN <<
" Energy of 2nd daughter negative after rotation, press 1 "
1445 "and return to continue ";
1450 newp[1] = plong * s_t * c_p + k_perp2[1];
1451 newp[2] = plong * s_t * s_p + k_perp2[2];
1452 newp[3] = plong * c_t + k_perp2[3];
1454 if (std::isnan(newp[1]) || std::isnan(newp[2]) || std::isnan(newp[3])) {
1456 JSINFO << MAGENTA << plong <<
" " << s_t <<
" " << c_p <<
" "
1458 JSINFO << MAGENTA << newp[0] <<
" " << newp[1] <<
" " << newp[2]
1463 VERBOSE(8) <<
MAGENTA <<
" D1 px = " << newp[1] <<
" py = " << newp[2]
1464 <<
" pz = " << newp[3] <<
" E = " << newp[0];
1468 for (
int j = 1;
j <= 3;
j++) {
1470 newx[
j] = pIn[
i].x_in().comp(
j) +
1471 (time - pIn[
i].x_in().comp(0)) * velocity[
j];
1478 pOut.push_back(
Parton(0, pid_b, jet_stat, newp, newx));
1479 iout = pOut.size() - 1;
1480 pOut[iout].set_jet_v(velocity_jet);
1481 pOut[iout].set_mean_form_time();
1482 ft = generate_L(pOut[iout].mean_form_time());
1483 pOut[iout].set_form_time(ft);
1484 pOut[iout].set_color(d2_col);
1485 pOut[iout].set_anti_color(d2_acol);
1486 pOut[iout].set_max_color(max_color);
1487 pOut[iout].set_min_color(pIn[i].min_color());
1488 pOut[iout].set_min_anti_color(pIn[i].min_anti_color());
1493 pOut.push_back(
Photon(0, pid_b, jet_stat, newp, newx));
1494 iout = pOut.size() - 1;
1495 pOut[iout].set_jet_v(velocity_jet);
1496 pOut[iout].set_mean_form_time();
1497 ft = generate_L(pOut[iout].mean_form_time());
1498 pOut[iout].set_form_time(1.0 / rounding_error);
1499 pOut[iout].set_color(0);
1500 pOut[iout].set_anti_color(0);
1501 pOut[iout].set_max_color(max_color);
1502 pOut[iout].set_min_color(pIn[i].min_color());
1503 pOut[iout].set_min_anti_color(pIn[i].min_anti_color());
1508 VERBOSE(8) <<
BOLDRED <<
" virtuality of D 2 = " << pOut[iout].t();
1512 if (broadening_on) {
1515 ((time + initRdotV + (time - initR0)) / std::sqrt(2)) *
1517 qhat = fncQhat(now_zeta);
1518 if (now_temp > 0.1) {
1519 ehat = 0.0 * qhat / 4.0 / now_temp;
1521 ehat = 0.0 * qhat / 4.0 / 0.3;
1524 VERBOSE(8) <<
BOLDRED <<
" between splits broadening qhat = " << qhat
1525 <<
" ehat = " << ehat <<
" and delT = " << delT;
1527 <<
" zeta now = " << now_zeta;
1529 if ((!recoil_on) && (qhat > 0.0)) {
1531 if (pIn[i].
pid() == 21)
1533 kt = generate_kt(qhat * 1.414 / 0.197, delT);
1534 }
else if ((pIn[i].
pid() < 6) &&
1535 (pIn[i].
pid() > -6))
1537 kt = generate_kt(qhat * 1.414 / 0.197 *
Cf /
Ca,
1544 JSDEBUG <<
" kt generated = " << kt
1545 <<
" for qhat = " << qhat * 1.414 / 0.197
1546 <<
" and delT = " << delT;
1548 double ktx, kty, ktz;
1549 ktx = kty = ktz = 0.0;
1554 bool solved =
false;
1556 while ((!solved) && (trials < 1000)) {
1560 kt * (1 - 2 * ZeroOneDistribution(*GetMt19937Generator()));
1562 JSDEBUG <<
" vx = " << vx <<
" vy = " << vy <<
" vz = " <<
vz;
1565 4 * ktx * ktx * vx * vx * vy * vy -
1566 4 * (vy * vy + vz * vz) *
1567 (ktx * ktx * (vx * vx + vz * vz) - kt * kt * vz * vz));
1570 (-2 * ktx * vx * vy +
rad) / 2 / (vy * vy + vz * vz);
1572 (-2 * ktx * vx * vy -
rad) / 2 / (vy * vy + vz * vz);
1576 if ((ktx * ktx + sol1 * sol1) > kt * kt)
1579 if ((ktx * ktx + kty * kty) < kt * kt) {
1580 ktz = sqrt(kt * kt - ktx * ktx - kty * kty);
1582 double sign = ZeroOneDistribution(*GetMt19937Generator());
1588 ktz = (-1 * ktx * vx - kty *
vy) / vz;
1596 kt * (1 - 2 * ZeroOneDistribution(*GetMt19937Generator()));
1597 double sign = ZeroOneDistribution(*GetMt19937Generator());
1600 ktz = sqrt(kt * kt - kty * kty);
1601 sign = ZeroOneDistribution(*GetMt19937Generator());
1609 <<
" ktz = " << ktz;
1611 double px = pIn[
i].px();
1612 double py = pIn[
i].py();
1613 double pz = pIn[
i].pz();
1616 double p = sqrt(px * px + py * py + pz * pz);
1619 <<
" pz = " << pz <<
" px = " << px <<
" py = " << py;
1625 double np = sqrt(px * px + py * py + pz * pz);
1626 JSDEBUG <<
" p = " << p <<
" np = " << np;
1628 double correction = 0.0;
1630 if (np * np > p * p)
1631 correction = sqrt(np * np - p * p);
1633 px -= correction *
vx;
1634 py -= correction *
vy;
1635 pz -= correction *
vz;
1649 np = sqrt(px * px + py * py + pz * pz);
1650 JSDEBUG <<
"FINAL p = " << p <<
" np = " << np;
1652 pOut.push_back(pIn[i]);
1653 int iout = pOut.size() - 1;
1655 pOut[iout].reset_p(px, py, pz);
1657 double drag = ehat * delT;
1660 <<
" temperature = " << now_temp;
1662 if ((np > drag) && (energy > drag) &&
1663 (energy > sqrt(px * px + py * py + pz * pz))) {
1668 pOut[iout].reset_momentum(px, py, pz, energy);
1672 <<
" pz = " << pz <<
" px = " << px <<
" py = " << py;
1676 pOut.push_back(pIn[i]);
1680 if (broadening_on) {
1683 ((time + initRdotV + (time - initR0)) / std::sqrt(2)) * fmToGeVinv;
1685 qhat = fncQhat(now_zeta);
1686 if (now_temp > 0.1) {
1687 ehat = 0.0 * qhat / 4.0 / now_temp;
1689 ehat = 0.0 * qhat / 4.0 / 0.3;
1692 VERBOSE(8) <<
BOLDRED <<
" after splits broadening qhat = " << qhat
1693 <<
" ehat = " << ehat <<
" and delT = " << delT;
1695 <<
" zeta now = " << now_zeta;
1699 if ((!recoil_on) && (qhat > 0.0)) {
1702 if (pIn[
i].
pid() == 21) {
1703 kt = generate_kt(qhat * 1.414 / 0.197, delT);
1705 kt = generate_kt(qhat * 1.414 / 0.197 *
Cf /
Ca, delT);
1708 JSDEBUG <<
" kt generated = " << kt
1709 <<
" for qhat = " << qhat * 1.414 / 0.197
1710 <<
" and delT = " << delT;
1712 double ktx, kty, ktz;
1713 ktx = kty = ktz = 0;
1718 bool solved =
false;
1721 while ((!solved) && (trials < 1000)) {
1724 ktx = kt * (1 - 2 * ZeroOneDistribution(*GetMt19937Generator()));
1726 JSDEBUG <<
" vx = " << vx <<
" vy = " << vy <<
" vz = " <<
vz;
1729 4 * ktx * ktx * vx * vx * vy * vy -
1730 4 * (vy * vy + vz * vz) *
1731 (ktx * ktx * (vx * vx + vz * vz) - kt * kt * vz * vz));
1734 (-2 * ktx * vx * vy +
rad) / 2 / (vy * vy + vz * vz);
1736 (-2 * ktx * vx * vy -
rad) / 2 / (vy * vy + vz * vz);
1740 if ((ktx * ktx + sol1 * sol1) > kt * kt)
1743 if ((ktx * ktx + kty * kty) < kt * kt) {
1744 ktz = sqrt(kt * kt - ktx * ktx - kty * kty);
1746 double sign = ZeroOneDistribution(*GetMt19937Generator());
1751 ktz = (-1 * ktx * vx - kty *
vy) / vz;
1757 kty = kt * (1 - 2 * ZeroOneDistribution(*GetMt19937Generator()));
1758 double sign = ZeroOneDistribution(*GetMt19937Generator());
1761 ktz = sqrt(kt * kt - kty * kty);
1762 sign = ZeroOneDistribution(*GetMt19937Generator());
1770 <<
" ktz = " << ktz;
1772 double px = pIn[
i].px();
1773 double py = pIn[
i].py();
1774 double pz = pIn[
i].pz();
1777 double p = sqrt(px * px + py * py + pz * pz);
1780 <<
" pz = " << pz <<
" px = " << px <<
" py = " << py;
1786 double np = sqrt(px * px + py * py + pz * pz);
1787 JSDEBUG <<
" p = " << p <<
" np = " << np;
1788 double correction = 0.0;
1789 if (np * np > p * p)
1790 correction = sqrt(np * np - p * p);
1792 px -= correction *
vx;
1793 py -= correction *
vy;
1794 pz -= correction *
vz;
1805 np = sqrt(px * px + py * py + pz * pz);
1806 JSDEBUG <<
"FINAL p = " << p <<
" nnnp = " << np;
1808 pOut.push_back(pIn[
i]);
1809 int iout = pOut.size() - 1;
1811 pOut[iout].reset_p(px, py, pz);
1812 np = sqrt(px * px + py * py + pz * pz);
1813 double drag = ehat * delT;
1816 <<
" temperature = " << now_temp;
1818 if ((np > drag) && (energy > drag) &&
1819 (energy > sqrt(px * px + py * py + pz * pz))) {
1824 pOut[iout].reset_momentum(px, py, pz, energy);
1828 <<
" pz = " << pz <<
" px = " << px <<
" py = " << py;
1839 double width = local_qhat * dzeta;
1843 r = ZeroOneDistribution(*GetMt19937Generator());
1846 throw std::runtime_error(
" k_t^2 < 0.0 ");
1847 double kt = sqrt(x * local_qhat * dzeta);
1853 double ang,
r, blurb;
1856 r = ZeroOneDistribution(*GetMt19937Generator());
1868 double loc_a,
int is) {
1869 double r,
z, ratio, diff, scale, t_low, t_hi, t_mid, numer, denom,
test;
1872 r = ZeroOneDistribution(*GetMt19937Generator());
1875 if ((r >= 1.0) || (r <= 0.0)) {
1876 throw std::runtime_error(
1877 "error in random number in t *GetMt19937Generator()");
1882 diff = (ratio -
r) / r;
1893 numer = sudakov_Pgg(t0, t, loc_a, nu) *
1894 std::pow(sudakov_Pqq(t0, t, loc_a, nu),
nf);
1900 throw std::runtime_error(
" error in isp ");
1907 throw std::runtime_error(
"error in isp in quark split");
1909 double relative_charge = 0.0;
1910 if ((std::abs(p_id) > 0) && (std::abs(p_id) < 4))
1911 relative_charge = 1.0 / 9.0;
1912 if (std::abs(p_id) == 2)
1913 relative_charge = relative_charge * 4.0;
1915 numer = sudakov_Pqg(t0, t, loc_a, nu) *
1916 std::pow(sudakov_Pqp(t0, t, loc_a, nu), relative_charge);
1934 t_mid = (t_low + t_hi) / 2.0;
1937 denom = sudakov_Pgg(t0, t_mid, loc_a, nu) *
1938 std::pow(sudakov_Pqq(t0, t_mid, loc_a, nu),
nf);
1939 if ((is != 1) && (is != 2)) {
1940 throw std::runtime_error(
" error in isp numerator");
1944 if ((is != 0) && (is != 3)) {
1945 throw std::runtime_error(
" error in isp in quark split numerator ");
1947 double relative_charge = 0.0;
1948 if ((std::abs(p_id) > 0) && (std::abs(p_id) < 4))
1949 relative_charge = 1.0 / 9.0;
1950 if (std::abs(p_id) == 2)
1951 relative_charge = relative_charge * 4.0;
1953 denom = sudakov_Pqg(t0, t_mid, loc_a, nu) *
1954 std::pow(sudakov_Pqp(t0, t_mid, loc_a, nu), relative_charge);
1957 ratio = numer / denom;
1959 diff = (ratio -
r) / r;
1974 }
while ((abs(diff) >
s_approx) && (abs(t_hi - t_low) / t_hi >
s_error));
1980 double t,
double loc_a,
int is) {
1981 double r,
z, ratio, diff, scale, t_low_M0, t_low_MM, t_low_00, t_hi_M0,
1982 t_hi_MM, t_hi_00, t_mid_M0, t_mid_MM, t_mid_00, numer, denom,
test;
1988 r = ZeroOneDistribution(*GetMt19937Generator());
1991 if ((r >= 1.0) || (r <= 0.0)) {
1992 throw std::runtime_error(
1993 "error in random number in t *GetMt19937Generator()");
1998 diff = (ratio -
r) / r;
2002 t_low_M0 = t0 * (1.0 + std::sqrt(1.0 + 2.0 * M * M / t0));
2003 t_low_MM = 2.0 * (M * M + t0);
2004 t_low_00 = 2.0 * t0;
2012 VERBOSE(1) <<
MAGENTA <<
" in gen_vac_t_w_M : t_low , t_hi = " << t_low_M0 <<
" " <<
t ;
2016 if (t < 2.0 * (M_charm * M_charm + t0)) {
2017 numer = sudakov_Pgg(t0, t, loc_a, nu) *
2018 std::pow(sudakov_Pqq(t0, t, loc_a, nu), 3.0);
2019 }
else if (t < 2.0 * (M_bottom * M_bottom + t0)) {
2020 numer = sudakov_Pgg(t0, t, loc_a, nu) *
2021 std::pow(sudakov_Pqq(t0, t, loc_a, nu), 3.0) *
2022 sudakov_Pqq_w_M_vac_only(M_charm, t0, t, loc_a, nu);
2024 numer = sudakov_Pgg(t0, t, loc_a, nu) *
2025 std::pow(sudakov_Pqq(t0, t, loc_a, nu), 3.0) *
2026 sudakov_Pqq_w_M_vac_only(M_charm, t0, t, loc_a, nu) *
2027 sudakov_Pqq_w_M_vac_only(M_bottom, t0, t, loc_a, nu);
2034 if ((is != 1) && (is != 2) && (is != 4) && (is != 5)) {
2035 throw std::runtime_error(
" error in isp ");
2039 throw std::runtime_error(
"error in isp in quark split");
2041 if (((
int)std::abs((
double)p_id)) == 4 ||
2042 ((
int)std::abs((
double)p_id)) == 5) {
2043 numer = sudakov_Pqg_w_M(M, t0, t, loc_a, nu);
2050 numer = sudakov_Pqg(t0, t, loc_a, nu);
2054 t_mid_M0 = t_low_M0;
2055 t_mid_MM = t_low_MM;
2056 t_mid_00 = t_low_00;
2060 if (std::fabs(p_id) ==
cid || std::fabs(p_id) ==
bid)
2072 bool exit_condition =
true;
2075 t_mid_M0 = (t_low_M0 + t_hi_M0) / 2.0;
2076 t_mid_MM = (t_low_MM + t_hi_MM) / 2.0;
2077 t_mid_00 = (t_low_00 + t_hi_00) / 2.0;
2080 if (t_mid_00 < 2.0 * (M_charm * M_charm + t0)) {
2081 denom = sudakov_Pgg(t0, t_mid_00, loc_a, nu) *
2082 std::pow(sudakov_Pqq(t0, t_mid_00, loc_a, nu), 3.0);
2083 }
else if (t_mid_00 < 2.0 * (M_bottom * M_bottom + t0)) {
2084 denom = sudakov_Pgg(t0, t_mid_00, loc_a, nu) *
2085 std::pow(sudakov_Pqq(t0, t_mid_00, loc_a, nu), 3.0) *
2086 sudakov_Pqq_w_M_vac_only(M_charm, t0, t_mid_00, loc_a, nu);
2088 denom = sudakov_Pgg(t0, t_mid_00, loc_a, nu) *
2089 std::pow(sudakov_Pqq(t0, t_mid_00, loc_a, nu), 3.0) *
2090 sudakov_Pqq_w_M_vac_only(M_charm, t0, t_mid_00, loc_a, nu) *
2091 sudakov_Pqq_w_M_vac_only(M_bottom, t0, t_mid_00, loc_a, nu);
2093 if ((is != 1) && (is != 2) && (is != 4) && (is != 5)) {
2094 throw std::runtime_error(
" error in isp numerator");
2098 throw std::runtime_error(
" error in isp in quark split numerator ");
2100 if (((
int)std::abs((
double)p_id)) == 4 ||
2101 ((
int)std::abs((
double)p_id)) == 5) {
2103 <<
" t_mid_M0 = " << t_mid_M0;
2104 denom = sudakov_Pqg_w_M(M, t0, t_mid_M0, loc_a, nu);
2106 denom = sudakov_Pqg(t0, t_mid_00, loc_a, nu);
2110 ratio = numer / denom;
2112 diff = (ratio -
r) / r;
2115 t_low_M0 = t_mid_M0;
2116 t_low_MM = t_mid_MM;
2117 t_low_00 = t_mid_00;
2128 if (std::abs(p_id) ==
cid || std::abs(p_id) ==
bid)
2129 exit_condition = (std::abs(diff) <
s_approx) ||
2130 (std::abs(t_hi_M0 - t_low_M0) / t_hi_M0 <
s_error);
2132 exit_condition = (std::abs(diff) <
s_approx) ||
2133 (std::abs(t_hi_00 - t_low_00) / t_hi_00 <
s_error);
2136 }
while (!exit_condition);
2138 if (std::fabs(p_id) ==
cid || std::fabs(p_id) ==
bid)
2155 double nu,
int is) {
2156 double r,
z, ratio, diff,
e, numer1, numer2, numer, denom, z_low, z_hi, z_mid,
2159 r = ZeroOneDistribution(*GetMt19937Generator());
2161 if ((r > 1) || (r < 0)) {
2162 throw std::runtime_error(
2163 " error in random number in z *GetMt19937Generator()");
2168 diff = (ratio -
r) / r;
2173 throw std::runtime_error(
" error in epsilon");
2182 denom = P_z_gg_int(z_low, z_hi, loc_b, t, 2.0 * nu / t, nu);
2184 denom = P_z_qq_int(z_low, z_hi, loc_b, t, 2.0 * nu / t, nu);
2187 }
else if ((p_id !=
gid) && (is == 0)) {
2188 denom = P_z_qg_int(z_low, z_hi, loc_b, t, 2.0 * nu / t, nu);
2189 }
else if ((p_id !=
gid) && (is == 3)) {
2190 denom = P_z_qp_int(z_low, z_hi, loc_b, t, 2.0 * nu / t, nu);
2192 throw std::runtime_error(
2193 " I do not understand your combination of particle id and split id in "
2194 "denominator of generate_z ");
2203 if (itcounter++ > 10000) {
2205 <<
" abs(diff) = " << abs(diff) <<
" approx = " <<
approx
2206 <<
" r = " << r <<
" zmid = " << z_mid <<
" denom = " << denom
2207 <<
" numer = " << numer <<
" e = " << e <<
" " << numer / denom
2209 throw std::runtime_error(
"Stuck in endless loop");
2212 z_mid = (z_low + z_hi) / 2.0;
2216 numer = P_z_gg_int(e, z_mid, loc_b, t, 2.0 * nu / t, nu);
2218 numer = P_z_qq_int(e, z_mid, loc_b, t, 2.0 * nu / t, nu);
2220 }
else if ((p_id !=
gid) && (is == 0)) {
2221 numer = P_z_qg_int(e, z_mid, loc_b, t, 2.0 * nu / t, nu);
2222 }
else if ((p_id !=
gid) && (is == 3)) {
2223 numer = P_z_qp_int(e, z_mid, loc_b, t, 2.0 * nu / t, nu);
2225 throw std::runtime_error(
2226 " I do not understand your combination of particle id and split id "
2227 "in numerator of generate_z ");
2229 ratio = numer / denom;
2230 diff = (ratio -
r) / r;
2240 }
while ((abs(diff) >
approx) && (abs(z_hi - z_low) / z_hi >
s_error));
2246 double loc_b,
double nu,
int is) {
2247 double r,
z, ratio, diff,
e, numer1, numer2, numer, denom, z_low_00, z_low_M0,
2248 z_low_MM, z_hi_00, z_hi_M0, z_hi_MM, z_mid_00, z_mid_M0, z_mid_MM,
test,
2249 z_min_00, z_min_M0, z_min_MM;
2251 r = ZeroOneDistribution(*GetMt19937Generator());
2255 if ((r > 1) || (r < 0)) {
2256 throw std::runtime_error(
2257 " error in random number in z *GetMt19937Generator()");
2262 diff = (ratio -
r) / r;
2269 throw std::runtime_error(
" error in epsilon");
2272 z_low_M0 = e + M2 / (t + M2);
2274 z_low_MM = e + M2 /
t;
2278 z_hi_MM =
double(1.0) - e - M2 /
t;
2280 z_min_00 = z_low_00;
2281 z_min_M0 = z_low_M0;
2282 z_min_MM = z_low_MM;
2289 denom = P_z_gg_int(z_min_00, z_hi_00, loc_b, t, 2.0 * nu / t, nu);
2294 denom = P_z_qq_int_w_M_vac_only(M, z_min_MM, z_hi_MM, loc_b, t,
2298 denom = P_z_qq_int(z_min_00, z_hi_00, loc_b, t, 2.0 * nu / t, nu);
2302 if ((std::abs(p_id) == 4) || (std::abs(p_id) == 5)) {
2303 denom = P_z_qg_int_w_M(M, z_min_M0, z_hi_M0, loc_b, t, 2.0 * nu / t, nu);
2305 denom = P_z_qg_int(z_min_00, z_hi_00, loc_b, t, 2.0 * nu / t, nu);
2318 if (itcounter++ > 10000) {
2320 <<
" abs(diff) = " << abs(diff) <<
" approx = " <<
approx
2321 <<
" r = " << r <<
" zmid = " << z_mid_M0 <<
" denom = " << denom
2322 <<
" numer = " << numer <<
" e = " << e <<
" " << numer / denom
2324 throw std::runtime_error(
"Stuck in endless loop");
2327 z_mid_00 = (z_low_00 + z_hi_00) / 2.0;
2328 z_mid_M0 = (z_low_M0 + z_hi_M0) / 2.0;
2329 z_mid_MM = (z_low_MM + z_hi_MM) / 2.0;
2333 numer = P_z_gg_int(z_min_00, z_mid_00, loc_b, t, 2.0 * nu / t, nu);
2339 numer = P_z_qq_int_w_M_vac_only(M, z_min_MM, z_mid_MM, loc_b, t,
2343 numer = P_z_qq_int(z_min_00, z_mid_00, loc_b, t, 2.0 * nu / t, nu);
2348 if ((std::abs(p_id) == 4) || (std::abs(p_id) == 5)) {
2350 P_z_qg_int_w_M(M, z_min_M0, z_mid_M0, loc_b, t, 2.0 * nu / t, nu);
2352 numer = P_z_qg_int(z_min_00, z_mid_00, loc_b, t, 2.0 * nu / t, nu);
2355 ratio = numer / denom;
2356 diff = (ratio -
r) / r;
2361 if ((diff == 0.0) && ((p_id ==
gid) || (std::abs(p_id) < 4)))
2363 if ((diff == 0.0) && ((std::abs(p_id) == 4) || (std::abs(p_id) == 5)))
2372 z_low_M0 = z_mid_M0;
2373 z_low_00 = z_mid_00;
2374 z_low_MM = z_mid_MM;
2379 ((std::abs(p_id) ==
cid || std::abs(p_id) ==
bid) &&
2380 (abs(diff) >
approx) && (abs(z_hi_M0 - z_low_M0) / z_hi_M0 >
s_error)) ||
2381 ((std::abs(p_id) ==
uid || std::abs(p_id) ==
did ||
2382 std::abs(p_id) ==
sid) &&
2383 (abs(diff) >
approx) && (abs(z_hi_00 - z_low_00) / z_hi_00 >
s_error)) ||
2384 ((std::abs(p_id) ==
gid && is >= 1 && is < 3) && (abs(diff) >
approx) &&
2385 (abs(z_hi_00 - z_low_00) / z_hi_00 >
s_error)) ||
2386 ((std::abs(p_id) ==
gid && is > 3) && (abs(diff) >
approx) &&
2387 (abs(z_hi_MM - z_low_MM) / z_hi_MM >
s_error)));
2391 if (p_id ==
gid && (is == 1 || is == 2))
2393 else if (p_id ==
gid && (is == 4 || is == 5))
2395 else if (std::abs(p_id) ==
uid || std::abs(p_id) ==
did ||
2396 std::abs(p_id) ==
sid)
2403 double r, x_low, x_high,
x, diff, span, val, arg,
norm;
2406 r = ZeroOneDistribution(*GetMt19937Generator());
2409 if ((r > 1) || (r < 0)) {
2410 throw std::runtime_error(
2411 " error in random number in z *GetMt19937Generator()");
2416 x_high = 8.0 * form_time;
2420 x = (x_low + x_high) / 2.0;
2422 span = (x_high - x_low) / x_high;
2424 arg = x / form_time / std::sqrt(
pi);
2426 val = std::erf(arg);
2428 diff = std::abs(val - r);
2431 if ((val - r) > 0.0) {
2437 x = (x_low + x_high) / 2.0;
2439 arg = x / form_time / std::sqrt(
pi);
2441 val = std::erf(arg);
2443 diff = std::abs(val - r);
2445 span = (x_high - x_low) / x_high;
2459 if (g1 < 2.0 * g0) {
2460 cerr <<
" warning: the lower limit of the sudakov > 1/2 upper limit, "
2463 cerr <<
" in sudakov_P glue glue, g0, g1 = " << g0 <<
" " << g1 << endl;
2464 throw std::runtime_error(
" warning: the lower limit of the sudakov > 1/2 "
2465 "upper limit, returning 1");
2473 sud = exp(-1.0 * (
Ca / 2.0 /
pi) * sud_val_GG(g0, g, g1, loc_c, E));
2480 double val,
h, intg, hL, hR, diff, intg_L, intg_R, t_form, span;
2484 h = (h1 +
h2) / 2.0;
2486 span = (h2 -
h1) / h2;
2488 t_form = 2.0 * E1 /
h;
2490 val = alpha_s(h) * sud_z_GG(h0, h, loc_d, t_form, E1);
2492 intg = val * (h2 -
h1);
2494 hL = (h1 +
h) / 2.0;
2496 t_form = 2.0 * E1 / hL;
2498 intg_L = alpha_s(hL) * sud_z_GG(h0, hL, loc_d, t_form, E1) * (h -
h1);
2500 hR = (h +
h2) / 2.0;
2502 t_form = 2.0 * E1 / hR;
2504 intg_R = alpha_s(hR) * sud_z_GG(h0, hR, loc_d, t_form, E1) * (h2 -
h);
2506 diff = std::abs((intg_L + intg_R - intg) / intg);
2512 intg = sud_val_GG(h0, h1, h, loc_d, E1) + sud_val_GG(h0, h, h2, loc_d, E1);
2523 double t2,
t3, t7, t11, t12, t15, t21, t25, q2, q3, q8, q12, qL,
tau, res,
2524 z_min, limit_factor, lz, uz, mz, m_fac;
2525 double t_q1, t_q3, t_q4, t_q6, t_q8, t_q9, t_q12, q_q1, q_q4, q_q6, q_q9,
2530 if (cg1 < 2.0 * cg) {
2536 t2 = std::pow(cg1, 2);
2539 t11 = std::abs(cg - cg1);
2540 t12 = std::log(t11);
2541 t15 = std::pow(cg, 2);
2543 t25 = -(5.0 * t3 - 12.0 * cg * t2 + 6.0 * t7 * t3 - 6.0 * t12 * t3 -
2544 4.0 * t15 * cg + 6.0 * t15 * cg1) /
2549 limit_factor = 2.0 * std::sqrt(2.0) * cg1 / E2 / 0.1;
2551 if (limit_factor < 0.0) {
2552 cerr <<
" error in z limit factor for medium calculation in sud-z-gg = "
2553 << limit_factor << endl;
2554 throw std::runtime_error(
2555 "error in z limit factor for medium calculation in sud-z-gg");
2561 q12 = (2.0 - 4.0 * q3 + 2.0 / cg * cg1 - 2.0 / q8) * q2;
2564 cerr <<
"ERROR: medium contribution negative in sud_z_GG: q12 = " << q12
2566 cerr <<
"cg, cg1 = " << cg <<
" " << cg1 << endl;
2567 cerr <<
" t25 = " << t25 << endl;
2568 throw std::runtime_error(
"ERROR: medium contribution negative in sud_z_GG");
2573 if ((
length - loc_e) < tau)
2586 qhat = fncAvrQhat(loc_e, tau);
2590 res = t25 + 2.0 * qL * q12 / cg1;
2601 double l_fac,
double E2) {
2603 double t3,
t4, t5, t10, t11, t12, t15, t9, qL,
tau, res, limit_factor, lz, uz,
2608 t3 = std::log((1.0 - cg1));
2610 t5 = std::pow(cg1, 2);
2611 t10 = std::log((1.0 - cg));
2613 t12 = std::pow(cg, 2);
2614 t15 = -(2.0 * cg1) - t3 + t4 - (2.0 / 3.0) * t5 * cg1 + t5 + (2.0 * cg) +
2615 t10 - t11 + (2.0 / 3.0) * t12 * cg - t12;
2619 limit_factor = 2.0 * std::sqrt(2.0) * cg3 / E2 / 0.1;
2621 if (limit_factor < 0.0) {
2622 cerr <<
" error in z limit factor for medium calculation = " << limit_factor
2624 throw std::runtime_error(
" error in z limit factor for medium calculation");
2629 if ((
length - loc_e) < tau)
2646 qhat = fncAvrQhat(loc_e, tau);
2650 t9 = 2.0 * cg1 - 1.0 / (-1.0 + cg1) - 1.0 / cg1 - 2.0 * cg +
2651 1.0 / (-1.0 + cg) + 1.0 / cg;
2654 cerr <<
"ERROR: medium contribution negative in P_z_gg_int : t9 = " << t9
2657 cerr <<
" cg, cg1 = " << cg <<
" " << cg1 << endl;
2658 throw std::runtime_error(
2659 "ERROR: medium contribution negative in P_z_gg_int");
2662 res = t15 + 2.0 * t9 * qL / cg3;
2675 JSWARN <<
" warning: the lower limit of the sudakov > 1/2 upper limit, "
2677 JSWARN <<
" in sudakov_Pquark quark, q0, q1 = " << q0 <<
" " << q1;
2684 sud = exp(-1.0 * (
Tf / 2.0 /
pi) * sud_val_QQ(q0, q, q1, loc_c, E));
2690 double loc_c,
double E) {
2695 if (q1 < 2.0 * (q0 + M * M)) {
2696 JSWARN <<
" warning: the upper limit of the sudakov q1<2.0*(q0+M*M), "
2698 JSWARN <<
" in sudakov_Pquark quark, q0, q1 = " << q0 <<
" " << q1;
2701 q = 2.0 * (q0 + M * M);
2702 sud = exp(-1.0 * (
Tf / 2.0 /
pi) *
2703 sud_val_QQ_w_M_vac_only(M, q0, q, q1, loc_c, E));
2710 double val,
h, intg, hL, hR, diff, intg_L, intg_R, t_form, span;
2712 h = (h1 +
h2) / 2.0;
2714 span = (h2 -
h1) / h2;
2716 t_form = 2.0 * E1 /
h;
2718 val = alpha_s(h) * sud_z_QQ(h0, h, loc_d, t_form, E1);
2720 intg = val * (h2 -
h1);
2722 hL = (h1 +
h) / 2.0;
2724 t_form = 2.0 * E1 / hL;
2726 intg_L = alpha_s(hL) * sud_z_QQ(h0, hL, loc_d, t_form, E1) * (h -
h1);
2728 hR = (h +
h2) / 2.0;
2730 t_form = 2.0 * E1 / hR;
2732 intg_R = alpha_s(hR) * sud_z_QQ(h0, hR, loc_d, t_form, E1) * (h2 -
h);
2734 diff = std::abs((intg_L + intg_R - intg) / intg);
2740 intg = sud_val_QQ(h0, h1, h, loc_d, E1) + sud_val_QQ(h0, h, h2, loc_d, E1);
2749 double h2,
double loc_d,
double E1) {
2750 double val,
h, intg, hL, hR, diff, intg_L, intg_R, t_form, span;
2752 h = (h1 +
h2) / 2.0;
2754 span = (h2 -
h1) / h2;
2756 t_form = 2.0 * E1 /
h;
2758 val = alpha_s(h) * sud_z_QQ_w_M_vac_only(M, h0, h, loc_d, t_form, E1);
2760 intg = val * (h2 -
h1);
2762 hL = (h1 +
h) / 2.0;
2764 t_form = 2.0 * E1 / hL;
2766 intg_L = alpha_s(hL) * sud_z_QQ_w_M_vac_only(M, h0, hL, loc_d, t_form, E1) *
2769 hR = (h +
h2) / 2.0;
2771 t_form = 2.0 * E1 / hR;
2773 intg_R = alpha_s(hR) * sud_z_QQ_w_M_vac_only(M, h0, hR, loc_d, t_form, E1) *
2776 diff = std::abs((intg_L + intg_R - intg) / intg);
2782 intg = sud_val_QQ_w_M_vac_only(M, h0, h1, h, loc_d, E1) +
2783 sud_val_QQ_w_M_vac_only(M, h0, h, h2, loc_d, E1);
2794 double t2,
t4, t5, t7, t9, t14, q2, q3, q5, q6, q8, q15, qL,
tau, res, z_min;
2802 if (cg1 < 2.0 * cg) {
2811 t7 = std::pow(cg, 2.0);
2812 t9 = std::pow(cg1, 2.0);
2813 t14 = ((t5 *
t4) - t7 * cg / t9 / cg1) * t2 / 3.0;
2820 q6 = std::log(std::abs(q5));
2824 q15 = (-1.0 + (2.0 * q3) + q6 - q8) * q2;
2827 cerr <<
"ERROR: medium contribution negative in sud_z_QQ: q15 = " << q15
2829 cerr <<
"cg, cg1 = " << cg <<
" " << cg1 << endl;
2830 cerr <<
" t14 = " << t14 << endl;
2831 throw std::runtime_error(
"ERROR: medium contribution negative in sud_z_QQ");
2836 if ((
length - loc_e) < tau)
2847 qhat = fncAvrQhat(loc_e, tau);
2851 res = t14 + 2.0 * qL * q15 / cg1;
2857 double loc_e,
double l_fac,
double E2) {
2859 double q2, q3, q5, q6, q8, q15, qL,
tau, res, z_min;
2867 if (cg1 < 2.0 * (cg + M * M)) {
2874 double t2 = t1 + cg;
2875 double t3 = 1.0 / cg1;
2876 double t5 = -t2 * t3 + 1.0;
2877 double t6 = t5 * t5;
2878 double t8 = t2 *
t2;
2879 double t10 = pow(cg1, 2.0);
2880 double t15 = 2.0 / 3.0 * (t6 * t5 - t8 * t2 / t10 / cg1) * t3;
2885 q6 = std::log(std::abs(q5));
2889 q15 = (-1.0 + (2.0 * q3) + q6 - q8) * q2;
2892 cerr <<
"ERROR: medium contribution negative in sud_z_QQ: q15 = " << q15
2894 cerr <<
"cg, cg1 = " << cg <<
" " << cg1 << endl;
2895 cerr <<
" t15 = " << t15 << endl;
2896 throw std::runtime_error(
"ERROR: medium contribution negative in sud_z_QQ");
2901 if ((
length - loc_e) < tau)
2912 qhat = fncAvrQhat(loc_e, tau);
2916 res = t15 + 2.0 * qL * q15 / cg1;
2922 double l_fac,
double E2) {
2923 double t_q1, t_q3, t_q4, t_q6, t_q8, t_q9, t_q12, q_q1, q_q4, q_q6, q_q9,
2924 q_q11, qL,
tau, res;
2926 if ((cg < cg1 / (2.0 * E2 * E2 / cg1 + 1.0)))
2927 cg = cg1 / (2.0 * E2 * E2 / cg1 + 1.0);
2929 t_q1 = std::pow(cg1, 2);
2932 t_q6 = std::pow(cg, 2);
2935 t_q12 = t_q1 * cg1 / 6.0 - t_q4 * t_q3 / 6.0 - t_q6 * cg / 6.0 +
2940 if ((
length - loc_e) < tau)
2951 qhat = fncAvrQhat(loc_e, tau);
2955 q_q1 = std::log(cg1);
2956 q_q4 = std::log(1.0 - cg1);
2957 q_q6 = std::log(cg);
2958 q_q9 = std::log(1.0 - cg);
2959 q_q11 = -cg1 + q_q1 / 2.0 - q_q4 / 2.0 + cg - q_q6 / 2.0 + q_q9 / 2.0;
2962 cerr <<
"ERROR: medium contribution negative in P_z_gg_int : q_q11 = "
2964 throw std::runtime_error(
2965 "ERROR: medium contribution negative in P_z_gg_int");
2968 res = t_q12 *
Tf /
Ca + 2.0 * qL * q_q11 / cg3 * (
Tf *
Cf /
Ca /
Ca);
2982 if (g1 < 2.0 * g0) {
2983 JSWARN <<
" warning: the lower limit of the sudakov > 1/2 upper limit, "
2985 JSWARN <<
" in sudakov_Pquark Photon, g0, g1 = " << g0 <<
" " << g1;
2990 double logsud = sud_val_QP(g0, g, g1, loc_c, E);
2992 sud = exp((-1.0 / 2.0 /
pi) * logsud);
2999 double val,
h, intg, hL, hR, diff, intg_L, intg_R, t_form, span;
3002 double alphaEM = 1.0 / 137.0;
3006 h = (h1 +
h2) / 2.0;
3008 span = (h2 -
h1) / h2;
3010 t_form = 2.0 * E1 /
h;
3012 val = alphaEM * sud_z_QP(h0, h, loc_d, t_form, E1);
3014 intg = val * (h2 -
h1);
3016 hL = (h1 +
h) / 2.0;
3018 t_form = 2.0 * E1 / hL;
3020 intg_L = alphaEM * sud_z_QP(h0, hL, loc_d, t_form, E1) * (h -
h1);
3022 hR = (h +
h2) / 2.0;
3024 t_form = 2.0 * E1 / hR;
3026 intg_R = alphaEM * sud_z_QP(h0, hR, loc_d, t_form, E1) * (h2 -
h);
3028 diff = std::abs((intg_L + intg_R - intg) / intg);
3031 intg = sud_val_QP(h0, h1, h, loc_d, E1) + sud_val_QP(h0, h, h2, loc_d, E1);
3038 double loc_e,
double cg3,
double l_fac,
3040 double t_q1, t_q3, t_q4, t_q6, t_q8, t_q9, t_q12, q_q1, q_q4, q_q6, q_q9,
3041 q_q11, qL,
tau, res;
3043 if ((cg < cg1 / (2.0 * E2 * E2 / cg1 + 1.0)))
3044 cg = cg1 / (2.0 * E2 * E2 / cg1 + 1.0);
3046 t_q1 = std::pow(cg1, 2);
3049 t_q6 = std::pow(cg, 2);
3052 t_q12 = t_q1 * cg1 / 6.0 - t_q4 * t_q3 / 6.0 - t_q6 * cg / 6.0 +
3057 if ((
length - loc_e) < tau)
3068 qhat = fncAvrQhat(loc_e, tau);
3072 q_q1 = std::log(cg1);
3073 q_q4 = std::log(1.0 - cg1);
3074 q_q6 = std::log(cg);
3075 q_q9 = std::log(1.0 - cg);
3076 q_q11 = -cg1 + q_q1 / 2.0 - q_q4 / 2.0 + cg - q_q6 / 2.0 + q_q9 / 2.0;
3079 cerr <<
"ERROR: medium contribution negative in P_z_gg_int_w_M : q_q11 = "
3081 cout <<
" z_low = " << cg <<
" z_hi = " << cg1 << endl;
3082 throw std::runtime_error(
3083 "ERROR: medium contribution negative in P_z_gg_int");
3086 res = t_q12 *
Tf /
Ca + 2.0 * qL * q_q11 / cg3 * (
Tf *
Cf /
Ca /
Ca);
3094 double t2, t6, t10, t11, t17, q2, q3, q4, q5, q6, q10, q14, qL,
tau, res,
3100 if (cg1 < 2.0 * cg) {
3104 t2 = std::pow(cg1, 2);
3106 t10 = std::abs(cg - cg1);
3107 t11 = std::log(t10);
3108 t17 = -1.0 / t2 * (3.0 * cg1 - 6.0 * cg + 4.0 * t6 * cg1 - 4.0 * t11 * cg1) /
3128 qhat = fncAvrQhat(loc_e, tau) *
Cf /
3135 res = t17 + 2.0 * qL * q14 / cg1;
3140 cerr <<
"ERROR: medium contribution negative in sud_z_QG : q14 = " << q14
3142 throw std::runtime_error(
"ERROR: medium contribution negative in sud_z_QG");
3148 double l_fac,
double E2) {
3150 double t2, t5, t7, t10, t12, q2, q6, q10,
tau, qL, res;
3152 if ((cg < cg1 / (2.0 * E2 * E2 / cg1 + 1.0)))
3153 cg = cg1 / (2.0 * E2 * E2 / cg1 + 1.0);
3155 t2 = std::pow(cg1, 2);
3156 t5 = std::log(1.0 - cg1);
3157 t7 = std::pow(cg, 2);
3158 t10 = std::log(1.0 - cg);
3159 t12 = -cg1 - t2 / 2.0 - 2.0 * t5 + cg + t7 / 2.0 + 2.0 * t10;
3166 if ((
length - loc_e) < tau)
3177 qhat = fncAvrQhat(loc_e, tau);
3181 res = t12 + 2.0 * qL * q10 / cg3;
3195 if (g1 < 2.0 * g0) {
3196 JSWARN <<
" warning: the lower limit of the sudakov > 1/2 upper limit, "
3198 JSWARN <<
" in sudakov_Pquark gluon, g0, g1 = " << g0 <<
" " << g1;
3203 sud = exp(-1.0 * (
Cf / 2.0 /
pi) * sud_val_QG(g0, g, g1, loc_c, E));
3215 if (g1 < g0 * (1.0 + std::sqrt(1.0 + 2.0 * M * M / g0))) {
3216 JSWARN <<
" warning: Not enough separation between upper and lower limits "
3217 "of Sudakov to have resolvable radiation ";
3218 JSWARN <<
" in sudakov_Pquark gluon, g0*( 1.0 + std::sqrt( 1.0 + "
3220 << g0 * (1.0 + std::sqrt(1.0 + 2.0 * M * M / g0)) <<
" g1 = " << g1;
3225 g = g0 * (1.0 + std::sqrt(1.0 + 2.0 * M * M / g0));
3227 sud = exp(-1.0 * (
Cf / 2.0 /
pi) * sud_val_QG_w_M(M, g0, g, g1, loc_c, E));
3234 double val,
h, intg, hL, hR, diff, intg_L, intg_R, t_form, span;
3239 h = (h1 +
h2) / 2.0;
3241 span = (h2 -
h1) / h2;
3243 t_form = 2.0 * E1 /
h;
3245 val = alpha_s(h) * sud_z_QG(h0, h, loc_d, t_form, E1);
3247 intg = val * (h2 -
h1);
3249 hL = (h1 +
h) / 2.0;
3251 t_form = 2.0 * E1 / hL;
3253 intg_L = alpha_s(hL) * sud_z_QG(h0, hL, loc_d, t_form, E1) * (h -
h1);
3255 hR = (h +
h2) / 2.0;
3257 t_form = 2.0 * E1 / hR;
3259 intg_R = alpha_s(hR) * sud_z_QG(h0, hR, loc_d, t_form, E1) * (h2 -
h);
3261 diff = std::abs((intg_L + intg_R - intg) / intg);
3264 intg = sud_val_QG(h0, h1, h, loc_d, E1) + sud_val_QG(h0, h, h2, loc_d, E1);
3271 double loc_d,
double E1) {
3272 double val,
h, intg, hL, hR, diff, intg_L, intg_R, t_form, span;
3277 h = (h1 +
h2) / 2.0;
3279 span = (h2 -
h1) / h2;
3281 t_form = 2.0 * E1 /
h;
3283 val = alpha_s(h) * sud_z_QG_w_M(M, h0, h, loc_d, t_form, E1);
3285 intg = val * (h2 -
h1);
3287 hL = (h1 +
h) / 2.0;
3289 t_form = 2.0 * E1 / hL;
3291 intg_L = alpha_s(hL) * sud_z_QG_w_M(M, h0, hL, loc_d, t_form, E1) * (h -
h1);
3293 hR = (h +
h2) / 2.0;
3295 t_form = 2.0 * E1 / hR;
3297 intg_R = alpha_s(hR) * sud_z_QG_w_M(M, h0, hR, loc_d, t_form, E1) * (h2 -
h);
3299 diff = std::abs((intg_L + intg_R - intg) / intg);
3305 intg = sud_val_QG_w_M(M, h0, h1, h, loc_d, E1) +
3306 sud_val_QG_w_M(M, h0, h, h2, loc_d, E1);
3317 double t2, t6, t10, t11, t17, q2, q3, q4, q5, q6, q10, q14, qL,
tau, res,
3323 if (cg1 < 2.0 * cg) {
3327 t2 = std::pow(cg1, 2);
3329 t10 = std::abs(cg - cg1);
3330 t11 = std::log(t10);
3331 t17 = -1.0 / t2 * (3.0 * cg1 - 6.0 * cg + 4.0 * t6 * cg1 - 4.0 * t11 * cg1) /
3342 q14 = (q6 + 2.0 / cg * cg1 - q10 + 2.0 / q4) * q2;
3357 qhat = fncAvrQhat(loc_e, tau);
3358 if (qhat * sqrt(2) > 0.6) {
3368 res = t17 + 2.0 * qL * q14 / cg1;
3373 cerr <<
"ERROR: medium contribution negative in sud_z_QG : q14 = " << q14
3375 throw std::runtime_error(
"ERROR: medium contribution negative in sud_z_QG");
3382 double l_fac,
double E2)
3385 double qL,
tau, res, z_min;
3390 if (cg1 < 2.0 * cg + M * M / (1.0 + M * M / cg1)) {
3392 JSINFO <<
MAGENTA <<
" returning with cg, cg1 = " << cg <<
" " << cg1
3397 double t1 = 1.0 / cg1;
3398 double t2 = t1 * cg;
3399 double t4 = std::pow(1.0 - t2, 2.0);
3400 double t7 = std::log(t2);
3402 double t10 = t1 * t9;
3403 double t13 = 1.0 / (t10 + 1.0) * t10;
3404 double t15 = std::pow(t2 + t13, 2.0);
3405 double t18 = std::log(1.0 - t2 - t13);
3406 double t21 = t1 * (-t4 / 2.0 - 1.0 + 2.0 * t2 - 2.0 * t7 + t15 / 2.0 + t13 +
3410 double q2 = 1.0 / cg1;
3411 double q3 = q2 * q1;
3412 double q5 = 4.0 * q3 + 1.0;
3413 double q6 = q2 * cg;
3414 double q7 = std::log(q6);
3415 double q9 = q1 * q1;
3416 double q10 = std::pow(cg1, 2.0);
3417 double q12 = 1.0 / q10 * q9;
3418 double q14 = q12 - 2.0 * q3 + 1.0 / 2.0;
3419 double q15 = 1.0 - q6;
3420 double q16 = std::log(q15);
3421 double q18 = q3 + 1.0;
3422 double q28 = q15 * q15;
3423 double q33 = 1.0 / q18 * q3;
3424 double q34 = 1.0 - q6 - q33;
3425 double q35 = std::log(q34);
3426 double q37 = q6 + q33;
3427 double q38 = std::log(q37);
3428 double q48 = q37 * q37;
3429 double q52 = q7 * q5 + q16 * q14 + q15 * q18 / 2.0 + 2.0 / cg * cg1 +
3430 3.0 / 2.0 * q2 / q15 * q1 - 1.0 / q28 * q12 / 2.0 - q35 * q5 -
3431 q38 * q14 - q37 * q18 / 2.0 - 2.0 / q34 -
3432 3.0 / 2.0 * q2 / q37 * q1 + 1.0 / q48 * q12 / 2.0;
3433 double q53 = q2 * q52;
3437 if ((
length - loc_e) < tau)
3448 qhat = fncAvrQhat(loc_e, tau);
3456 qL = qhat * 2.0 *
tau;
3460 double e2 = 1.0 / cg1;
3461 double e3 = e2 * e1;
3462 double e4 = e2 * cg;
3463 double e5 = std::log(e4);
3464 double e8 = std::log(1.0 - e4);
3465 double e13 = 1.0 / (e3 + 1.0) * e3;
3466 double e15 = std::log(1.0 - e4 - e13);
3467 double e18 = std::log(e4 + e13);
3468 double e22 = e2 * (-(2.0 * e5 - e8 + 1.0 - e4) * e3 +
3469 (2.0 * e15 - e18 + e4 + e13) * e3);
3477 if (ehat * sqrt(2) > 0.6) {
3486 double f2 = 1.0 / cg1;
3487 double f3 = f2 *
f1;
3488 double f4 = f2 * cg;
3489 double f5 = std::log(f4);
3490 double f8 = f1 *
f1;
3491 double f9 = std::pow(cg1, 2.0);
3492 double f11 = 1.0 / f9 *
f8;
3493 double f14 = 13.0 / 4.0 * f11 - 15.0 / 4.0 * f3 + 1.0 / 2.0;
3494 double f15 = 1.0 -
f4;
3495 double f16 = std::log(f15);
3496 double f24 = f15 * f15;
3497 double f32 = 1.0 / (f3 + 1.0) *
f3;
3498 double f33 = 1.0 - f4 - f32;
3499 double f34 = std::log(f33);
3500 double f37 = f4 + f32;
3501 double f38 = std::log(f37);
3502 double f45 = f37 * f37;
3503 double f52 = f2 * ((15.0 / 2.0 * f5 * f3 + f16 * f14 + 1.0 / cg * cg1 +
3504 15.0 / 4.0 * f2 / f15 * f1 - 13.0 / 8.0 / f24 * f11) *
3506 (15.0 / 2.0 * f34 * f3 + f38 * f14 + 1.0 / f33 +
3507 15.0 / 4.0 * f2 / f37 * f1 - 13.0 / 8.0 / f45 * f11) *
3515 if (e2hat * sqrt(2) > 0.6) {
3520 e2L = e2hat * 8.0 / (tau * cg1);
3525 res = t21 + qL * q53 / cg1;
3532 cerr <<
"ERROR: medium contribution negative in sud_z_QG : res = " << res
3535 throw std::runtime_error(
"ERROR: medium contribution negative in sud_z_QG");
3542 double l_fac,
double E2) {
3544 double t2, t5, t7, t10, t12, q2, q6, q10,
tau, qL, res;
3546 if ((cg < cg1 / (2.0 * E2 * E2 / cg1 + 1.0)))
3547 cg = cg1 / (2.0 * E2 * E2 / cg1 + 1.0);
3549 t2 = std::pow(cg1, 2);
3550 t5 = std::log(1.0 - cg1);
3551 t7 = std::pow(cg, 2);
3552 t10 = std::log(1.0 - cg);
3553 t12 = -cg1 - t2 / 2.0 - 2.0 * t5 + cg + t7 / 2.0 + 2.0 * t10;
3559 q10 = q2 - 2.0 / (cg1 - 1.0) - q6 + 2.0 / (cg - 1.0);
3574 qhat = fncAvrQhat(loc_e, tau);
3578 res = t12 + 2.0 * qL * q10 / cg3;
3584 double cg3,
double l_fac,
double E2) {
3586 double t2, t5, t7, t10, t12,
tau, qL, res;
3592 t2 = std::pow(cg1, 2);
3593 t5 = std::log(1.0 - cg1);
3594 t7 = std::pow(cg, 2);
3595 t10 = std::log(1.0 - cg);
3596 t12 = -cg1 - t2 / 2.0 - 2.0 * t5 + cg + t7 / 2.0 + 2.0 * t10;
3601 double q2 = 1.0 / cg3;
3602 double q3 = q2 * q1;
3603 double q5 = 4.0 * q3 + 1.0;
3604 double q6 = 1.0 - cg1;
3605 double q7 = std::log(q6);
3606 double q9 = q1 * q1;
3607 double q10 = cg3 * cg3;
3608 double q12 = 1.0 / q10 * q9;
3609 double q14 = q12 - 2.0 * q3 + 1.0 / 2.0;
3610 double q15 = std::log(cg1);
3611 double q17 = q3 + 1.0;
3612 double q26 = std::pow(cg1, 2.0);
3613 double q30 = 1.0 - cg;
3614 double q31 = std::log(q30);
3615 double q33 = std::log(cg);
3616 double q43 = std::pow(cg, 2.0);
3617 double q47 = q7 * q5 + q15 * q14 + cg1 * q17 / 2.0 + 2.0 / q6 +
3618 3.0 / 2.0 * q2 / cg1 * q1 - 1.0 / q26 * q12 / 2.0 - q31 * q5 -
3619 q33 * q14 - cg * q17 / 2.0 - 2.0 / q30 -
3620 3.0 / 2.0 * q2 / cg * q1 + 1.0 / q43 * q12 / 2.0;
3624 if ((
length - loc_e) < tau)
3635 qhat = fncAvrQhat(loc_e, tau);
3636 qL = qhat * 2.0 *
tau;
3640 double e3 = 1.0 / cg3 * e1;
3641 double e4 = 1.0 - cg1;
3642 double e5 = std::log(e4);
3643 double e10 = 1.0 - cg;
3644 double e11 = std::log(e10);
3645 double e17 = 2.0 * (e5 + 1.0 / e4 + cg1 / 2.0) * e3 -
3646 2.0 * (e11 + 1.0 / e10 + cg / 2.0) * e3;
3658 double f2 = 1.0 / cg3;
3659 double f3 = f2 *
f1;
3660 double f4 = 13.0 *
f3;
3661 double f6 = f1 *
f1;
3662 double f7 = f6 * (f4 + 15.0);
3663 double f8 = 1.0 - cg1;
3664 double f9 = std::log(f8);
3665 double f10 = cg3 * cg3;
3666 double f11 = 1.0 / f10;
3667 double f15 = std::log(cg1);
3668 double f23 = f1 * (39.0 / 4.0 * f11 * f6 + 15.0 / 2.0 * f3 + 1.0);
3669 double f28 = f6 * (f4 + 15.0 / 2.0);
3670 double f29 = f8 *
f8;
3671 double f37 = 1.0 / f10 / cg3 * f6 *
f1;
3672 double f42 = 1.0 - cg;
3673 double f43 = std::log(f42);
3674 double f47 = std::log(cg);
3675 double f54 = f42 * f42;
3676 double f63 = f11 * f9 * f7 / 4.0 + f2 * f1 * f15 / 2.0 + 1.0 / f8 * f2 * f23 -
3677 1.0 / f29 * f11 * f28 / 2.0 + 13.0 / 6.0 / f29 / f8 * f37 -
3678 f11 * f43 * f7 / 4.0 - f2 * f1 * f47 / 2.0 -
3679 1.0 / f42 * f2 * f23 + 1.0 / f54 * f11 * f28 / 2.0 -
3680 13.0 / 6.0 / f54 / f42 * f37;
3688 e2L = e2hat * 8.0 / (tau * cg3);
3691 res = t12 + qL * q47 / cg3;
3700 double a, L2, q24, c_nf;
3717 a = 12.0 *
pi / (11.0 *
Nc - 2.0 * c_nf) / std::log(q24 / L2);
3719 JSWARN <<
" alpha too large ";
3740 double xLoc, yLoc, zLoc, tLoc;
3741 double vxLoc, vyLoc, vzLoc, gammaLoc, betaLoc;
3742 double edLoc, sdLoc;
3744 double flowFactor, qhatLoc;
3746 double lastLength = initR0;
3750 std::unique_ptr<FluidCellInfo> check_fluid_info_ptr;
3752 for (
int i = 0;
i < dimQhatTab;
i++) {
3757 double boostedTStart = tStart * std::cosh(y);
3758 if (tLoc < initR0 || tLoc < boostedTStart) {
3763 xLoc = initRx + (tLoc - initR0) * initVx;
3764 yLoc = initRy + (tLoc - initR0) * initVy;
3765 zLoc = initRz + (tLoc - initR0) * initVz;
3779 if (std::isinf(tLoc) || std::isnan(tLoc) || std::isinf(zLoc) ||
3780 std::isnan(zLoc) || std::abs(zLoc) > tLoc) {
3781 JSWARN <<
"Third instance";
3782 JSWARN <<
"Loc for vector is:" << tLoc <<
", " << xLoc <<
", " << yLoc
3784 JSWARN <<
"initR0, initRx, initRy, initRz="
3785 <<
", " << initR0 <<
", " << initRx <<
", " << initRy <<
", "
3787 JSWARN <<
"initVx, initVy, initVz =" << initVx <<
", " << initVy <<
", "
3789 JSWARN <<
"initVMod=" << std::setprecision(20)
3790 << std::sqrt(initVx * initVx + initVy * initVy + initVz * initVz);
3791 JSWARN <<
"Can't dump pIn_info as we are in fillQhatTab. But it should "
3792 "be dumped right before this.";
3796 GetHydroCellSignal(tLoc, xLoc, yLoc, zLoc, check_fluid_info_ptr);
3802 vxLoc = check_fluid_info_ptr->
vx;
3803 vyLoc = check_fluid_info_ptr->
vy;
3804 vzLoc = check_fluid_info_ptr->
vz;
3808 if (hydro_ctl == 0 && tempLoc >= hydro_Tc) {
3810 betaLoc = sqrt(vxLoc * vxLoc + vyLoc * vyLoc + vzLoc * vzLoc);
3811 gammaLoc = 1.0 / sqrt(1.0 - betaLoc * betaLoc);
3813 gammaLoc * (1.0 - (initVx * vxLoc + initVy * vyLoc + initVz * vzLoc));
3844 qhatLoc= GeneralQhatFunction(QhatParametrizationType, tempLoc, sdLoc,
alphas, qhat0, initEner, muSquare);
3845 qhatLoc = qhatLoc * flowFactor;
3853 qhatLoc / sqrt(2.0);
3856 for (
int i = 0;
i < dimQhatTab;
i++) {
3858 double totValue = 0.0;
3860 for (
int j = 0;
i +
j < dimQhatTab;
j++) {
3862 totValue = totValue + qhatTab1D[
i +
j];
3863 qhatTab2D[
i][
j] = totValue / (
j + 1);
3868 return ((2.0 * lastLength + initRdotV - initR0) / sqrt(2.0) *
3874 double Matter::GeneralQhatFunction(
int QhatParametrization,
double Temperature,
double EntropyDensity,
double FixAlphas,
double Qhat0,
double E,
double muSquare)
3876 int ActiveFlavor=3; qhat=0.0;
3877 double DebyeMassSquare = FixAlphas*4*
pi*pow(Temperature,2.0)*(6.0 + ActiveFlavor)/6.0;
3878 double ScaleNet=2*E*Temperature;
3879 if(ScaleNet < 1.0){ ScaleNet=1.0; }
3880 switch(QhatParametrization)
3884 qhat = (
Ca*50.4864/
pi)*pow(FixAlphas,2)*pow(Temperature,3)*log(ScaleNet/DebyeMassSquare);
3889 qhat = (
Ca*50.4864/
pi)*RunningAlphaS(ScaleNet)*FixAlphas*pow(Temperature,3)*log(ScaleNet/DebyeMassSquare);
3894 qhat = Qhat0*0.1973;
3899 qhat = Qhat0*pow(Temperature/0.3,3)*0.1973;
3904 qhat = Qhat0*(EntropyDensity/96.0)*0.1973;
3910 qhat = (
Ca*50.4864/
pi)*RunningAlphaS(ScaleNet)*FixAlphas*pow(Temperature,3)*log(ScaleNet/DebyeMassSquare);
3911 qhat = qhat*VirtualityQhatFunction(5, E, muSquare);
3917 qhat = (
Ca*50.4864/
pi)*RunningAlphaS(ScaleNet)*FixAlphas*pow(Temperature,3)*log(ScaleNet/DebyeMassSquare);
3918 qhat = qhat*VirtualityQhatFunction(6, E, muSquare);
3924 qhat = (
Ca*50.4864/
pi)*RunningAlphaS(ScaleNet)*FixAlphas*pow(Temperature,3)*log(ScaleNet/DebyeMassSquare);
3925 qhat = qhat*VirtualityQhatFunction(7, E, muSquare);
3929 JSINFO<<
"q-hat Parametrization "<<QhatParametrization<<
" is not used, qhat will be set to zero";
3938 double Square_Lambda_QCD_HTL = exp( -12.0*
pi/( (33 - 2*ActiveFlavor)*
alphas) );
3939 double ans = 12.0*
pi/( (33.0- 2.0*ActiveFlavor)*log(muSquare/Square_Lambda_QCD_HTL) );
3940 if(muSquare < 1.0) {ans=
alphas; }
3942 VERBOSE(8)<<
"Fixed-alphaS="<<alphas<<
", Lambda_QCD_HTL="<<sqrt(Square_Lambda_QCD_HTL)<<
", mu2="<<muSquare<<
", Running alpha_s"<<ans;
3949 double ans=0;
double xB=0, xB0=0, IntegralNorm=0;
3951 if( muSquare <= Q00*Q00) {ans=1;}
3954 switch(QhatParametrization)
3977 ans = 1.0 + qhatA*log(Q00*Q00)*log(Q00*Q00) + qhatB*pow(log(Q00*Q00),4);
3978 ans = ans/( 1.0 + qhatA*log(muSquare)*log(muSquare) + qhatB*pow(log(muSquare),4) );
3982 xB = muSquare/(2.0*enerLoc);
3983 xB0 = Q00*Q00/(2.0*enerLoc);
if(xB<=xB0){ans=1.0;
break; }
3984 if ( qhatC > 0.0 && xB < 0.99)
3986 ans = ( exp(qhatC*(1.0-xB)) - 1.0 )/(1.0 + qhatA*log(muSquare/0.04) + qhatB*log(muSquare/0.04)*log(muSquare/0.04) );
3987 ans = ans*(1.0 + qhatA*log(Q00*Q00/0.04) + qhatB*log(Q00*Q00/0.04)*log(Q00*Q00/0.04) )/( exp(qhatC*(1.0-xB0)) - 1.0 );
3990 else if( qhatC == 0.0 && xB < 0.99)
3992 ans = (1.0-xB)/(1.0 + qhatA*log(muSquare/0.04) + qhatB*log(muSquare/0.04)*log(muSquare/0.04) );
3993 ans = ans*(1.0 + qhatA*log(Q00*Q00/0.04) + qhatB*log(Q00*Q00/0.04)*log(Q00*Q00/0.04) )/(1-xB0);
4000 xB = muSquare/(2.0*enerLoc);
4001 xB0 = Q00*Q00/(2.0*enerLoc);
if(xB<=xB0){ans=1.0;
break; }
4002 ans = IntegralPDF(xB, qhatC, qhatD)/(1.0 + qhatA*log(muSquare/0.04) + qhatB*log(muSquare/0.04)*log(muSquare/0.04) );
4003 IntegralNorm = IntegralPDF(xB0, qhatC, qhatD);
4004 if( IntegralNorm > 0.0 )
4006 ans=ans*(1.0 + qhatA*log(muSquare/0.04) + qhatB*log(muSquare/0.04)*log(muSquare/0.04) )/IntegralNorm;
4013 JSINFO<<
"q-hat Parametrization "<<QhatParametrization<<
" is not used, VirtualityQhatFunction is set to zero or one";
4023 double ModifiedAlphas=0;
double qhatLoc=0;
4024 double ScaleNet=2*enerLoc*tempLoc;
4025 if(ScaleNet <1.0) { ScaleNet=1.0; }
4027 switch(QhatParametrization)
4036 ModifiedAlphas = RunningAlphaS(ScaleNet);
4041 qhatLoc = qhat0*0.1973;
4042 ModifiedAlphas = solve_alphas(qhatLoc, enerLoc, tempLoc);
4047 qhatLoc = qhat0*pow(tempLoc/0.3,3)*0.1973;
4048 ModifiedAlphas = solve_alphas(qhatLoc, enerLoc, tempLoc);
4053 qhatLoc = qhat0*(sdLoc/96.0)*0.1973;
4054 ModifiedAlphas = solve_alphas(qhatLoc, enerLoc, tempLoc);
4060 ModifiedAlphas = RunningAlphaS(ScaleNet)*VirtualityQhatFunction(5, enerLoc, muSquare) ;
4065 ModifiedAlphas = RunningAlphaS(ScaleNet)*VirtualityQhatFunction(6, enerLoc, muSquare) ;
4071 ModifiedAlphas = RunningAlphaS(ScaleNet)*VirtualityQhatFunction(7, enerLoc, muSquare) ;
4075 JSINFO<<
"q-hat Parametrization "<<QhatParametrization<<
" is not used,Elastic scattering alphas will be set to zero";
4078 return ModifiedAlphas;
4084 double Xmin=0.01, Xmax=0.99,
X=0, dX=0, ans=0;
int N=100, ix=0;
4086 if(xB > Xmax) {ans=0;}
4090 for(
int i=ix;
i<
N;
i++)
4093 if (
X<Xmin){
X=Xmin;}
4094 ans = ans + pow(
X,a)*pow(1-
X,b)*dX;
4109 (int)((sqrt(2.0) * zeta / 5.0 - initRdotV + initR0) / 2.0 / tStep +
4113 if (indexZeta >= dimQhatTab)
4116 double avrQhat = qhatTab1D[indexZeta]*VirtualityQhatFunction(QhatParametrizationType, initEner, tscale);
4130 (int)((sqrt(2.0) * zeta / 5.0 - initRdotV + initR0) / 2.0 / tStep +
4132 int indexTau = (int)(tau / sqrt(2.0) / 5.0 / tStep +
4136 if (indexZeta >= dimQhatTab)
4138 if (indexTau >= dimQhatTab)
4139 indexTau = dimQhatTab - 1;
4141 double avrQhat = qhatTab2D[indexZeta][indexTau]*VirtualityQhatFunction(QhatParametrizationType, initEner, tscale);
4148 unsigned int &max_color,
unsigned int &color0,
4149 unsigned int &anti_color0,
unsigned int &color2,
4150 unsigned int &anti_color2,
unsigned int &color3,
4151 unsigned int &anti_color3) {
4156 unsigned int backup_color0 = color0;
4157 unsigned int backup_anti_color0 = anti_color0;
4169 double R3 = 6.0 * 6 * 4 / 9;
4170 double R0 = R1 +
R3;
4172 double a = ran0(&NUM1);
4180 color0 = backup_color0;
4181 anti_color0 = max_color;
4183 color2 = anti_color0;
4184 anti_color2 = max_color;
4185 color3 = backup_anti_color0;
4186 anti_color3 = max_color;
4189 b = floor(ran0(&NUM1) * 6 + 1);
4197 color0 = backup_color0;
4198 anti_color0 = max_color;
4201 color3 = backup_anti_color0;
4206 anti_color0 = backup_anti_color0;
4208 anti_color2 = max_color;
4210 anti_color3 = backup_color0;
4213 }
else if (abs(KATT00) == 4) {
4214 double R1 = 6.0 * 6 * 4 / 9;
4216 double R00 = R1 +
R2;
4218 double a = ran0(&NUM1);
4220 if (a <= R2 / R00) {
4230 anti_color2 = color0;
4232 anti_color3 = backup_color0;
4236 anti_color0 = max_color;
4238 color2 = anti_color0;
4239 anti_color2 = max_color;
4240 color3 = backup_anti_color0;
4241 anti_color3 = max_color;
4245 b = floor(ran0(&NUM1) * 6 + 1);
4250 if (KATT00 > 0 && KATT2 > 0) {
4254 color2 = backup_color0;
4258 }
else if (KATT00 > 0 && KATT2 < 0) {
4263 anti_color2 = max_color;
4265 anti_color3 = backup_color0;
4266 }
else if (KATT00 < 0 && KATT2 > 0) {
4269 anti_color0 = max_color;
4272 color3 = backup_anti_color0;
4277 anti_color0 = max_color;
4279 anti_color2 = backup_anti_color0;
4281 anti_color3 = max_color;
4287 double R4 = 4.0 * 6 * 4 / 9;
4288 double R5 = 1.0 * 6 * 4 / 9;
4291 double R7 = 1.0 * 6 * 4 / 9;
4293 double R00 = R3 + R4 + R5 + R7;
4295 double a = ran0(&NUM1);
4296 if (a <= R3 / R00) {
4307 anti_color2 = color0;
4309 anti_color3 = backup_color0;
4313 anti_color0 = max_color;
4315 color2 = anti_color0;
4316 anti_color2 = max_color;
4317 color3 = backup_anti_color0;
4318 anti_color3 = max_color;
4320 }
else if (a <= (R3 + R4) / R00) {
4323 b = floor(ran0(&NUM1) * 6 + 1);
4327 }
while (KATT3 == KATT0 || KATT3 == -KATT0);
4330 if (KATT00 > 0 && KATT2 > 0) {
4334 color2 = backup_color0;
4338 }
else if (KATT00 > 0 && KATT2 < 0) {
4343 anti_color2 = max_color;
4345 anti_color3 = backup_color0;
4346 }
else if (KATT00 < 0 && KATT2 > 0) {
4349 anti_color0 = max_color;
4352 color3 = backup_anti_color0;
4357 anti_color0 = max_color;
4359 anti_color2 = backup_anti_color0;
4361 anti_color3 = max_color;
4363 }
else if (a <= (R3 + R4 + R5) / R00) {
4372 color2 = backup_color0;
4379 anti_color0 = max_color;
4381 anti_color2 = backup_anti_color0;
4383 anti_color3 = max_color;
4395 anti_color2 = max_color;
4397 anti_color3 = backup_color0;
4401 anti_color0 = max_color;
4404 color3 = backup_anti_color0;
4412 double p0[4],
double p2[4],
double p3[4],
double p4[4],
4465 double p0ex[4] = {0.0};
4466 double vc[4] = {0.0};
4468 int ct1_loop, ct2_loop, flag1, flag2;
4487 if(flag2 == 1 || ct1_loop > 1e6){
4498 xw = 15.0 * ran0(&NUM1);
4499 razim = 2.0 *
pi * ran0(&NUM1);
4500 rcos = 1.0 - 2.0 * ran0(&NUM1);
4501 rsin = sqrt(1.0 - rcos * rcos);
4504 p2[3] = p2[0] * rcos;
4505 p2[1] = p2[0] * rsin * cos(razim);
4506 p2[2] = p2[0] * rsin * sin(razim);
4512 2.0 * (p0[0] * p2[0] - p0[1] * p2[1] - p0[2] * p2[2] - p0[3] * p2[3]);
4518 tmax = ss - qhat0ud;
4530 }
while ((tt < qhat0ud) || (tt > (ss - qhat0ud)));
4532 f1 = pow(xw, 3) / (exp(xw) - 1) / 1.4215;
4533 f2 = pow(xw, 3) / (exp(xw) + 1) / 1.2845;
4541 (3.0 - tmin * (ss - tmin) / pow(ss, 2) +
4542 (ss - tmin) * ss / pow(tmin, 2) + tmin * ss / pow((ss - tmin), 2));
4543 msq = pow((1.0 / p0[0] / p2[0] / 2.0), 2) *
4544 (3.0 - tt * uu / pow(ss, 2) + uu * ss / pow(tt, 2) +
4545 tt * ss / pow(uu, 2)) /
4551 mmax = 4.0 / pow(ss, 2) *
4552 (4.0 / 9.0 * (pow(tmin, 2) + pow((ss - tmin), 2)) / tmin /
4554 (pow(tmin, 2) + pow((ss - tmin), 2)) / pow(ss, 2));
4555 msq = pow((1.0 / p0[0] / p2[0] / 2.0), 2) *
4556 (4.0 / 9.0 * (pow(tt, 2) + pow(uu, 2)) / tt / uu -
4557 (pow(tt, 2) + pow(uu, 2)) / pow(ss, 2)) /
4563 if (((pow(ss, 2) + pow((ss - tmin), 2)) / pow(tmin, 2) +
4564 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmin), 2)) / ss / (ss - tmin)) >
4565 ((pow(ss, 2) + pow((ss - tmax), 2) / pow(tmax, 2) +
4566 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmax), 2)) / ss /
4570 ((pow(ss, 2) + pow((ss - tmin), 2)) / pow(tmin, 2) +
4571 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmin), 2)) / ss / (ss - tmin));
4575 ((pow(ss, 2) + pow((ss - tmax), 2)) / pow(tmax, 2) +
4576 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmax), 2)) / ss / (ss - tmax));
4579 msq = pow((1.0 / p0[0] / p2[0] / 2.0), 2) *
4580 ((pow(ss, 2) + pow(uu, 2)) / pow(tt, 2) +
4581 4.0 / 9.0 * (pow(ss, 2) + pow(uu, 2)) / ss / uu) /
4588 if (((pow(ss, 2) + pow((ss - tmin), 2)) / pow(tmin, 2) +
4589 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmin), 2)) / ss / (ss - tmin)) >
4590 ((pow(ss, 2) + pow((ss - tmax), 2) / pow(tmax, 2) +
4591 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmax), 2)) / ss /
4595 ((pow(ss, 2) + pow((ss - tmin), 2)) / pow(tmin, 2) +
4596 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmin), 2)) / ss / (ss - tmin));
4600 ((pow(ss, 2) + pow((ss - tmax), 2)) / pow(tmax, 2) +
4601 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmax), 2)) / ss / (ss - tmax));
4604 msq = pow((1.0 / p0[0] / p2[0] / 2.0), 2) *
4605 ((pow(ss, 2) + pow(uu, 2)) / pow(tt, 2) +
4606 4.0 / 9.0 * (pow(ss, 2) + pow(uu, 2)) / ss / uu) /
4612 mmax = 4.0 / pow(ss, 2) *
4613 (4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmin), 2)) / pow(tmin, 2));
4614 msq = pow((1.0 / p0[0] / p2[0] / 2.0), 2) *
4615 (4.0 / 9.0 * (pow(ss, 2) + pow(uu, 2)) / pow(tt, 2)) / mmax;
4620 mmax = 4.0 / pow(ss, 2) *
4621 (4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmin), 2)) / pow(tmin, 2) +
4622 (pow(ss, 2) + pow(tmin, 2)) / pow((ss - tmin), 2) -
4623 2.0 / 3.0 * pow(ss, 2) / tmin / (ss - tmin));
4624 msq = pow((1.0 / p0[0] / p2[0] / 2.0), 2) *
4626 ((pow(ss, 2) + pow(uu, 2)) / pow(tt, 2) +
4627 (pow(ss, 2) + pow(tt, 2)) / pow(uu, 2) -
4628 2.0 / 3.0 * pow(ss, 2) / tt / uu)) /
4634 mmax = 4.0 / pow(ss, 2) *
4635 (4.0 / 9.0 * (pow(tmin, 2) + pow((ss - tmin), 2)) / pow(ss, 2));
4636 msq = pow((1.0 / p0[0] / p2[0] / 2.0), 2) *
4637 (4.0 / 9.0 * (pow(tt, 2) + pow(uu, 2)) / pow(ss, 2)) / (mmax + 0.5);
4642 mmax = 4.0 / pow(ss, 2) *
4643 (4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmin), 2)) / pow(tmin, 2) +
4644 (pow(tmin, 2) + pow((ss - tmin), 2)) / pow(ss, 2) +
4645 2.0 / 3.0 * pow((ss - tmin), 2) / ss / tmin);
4646 msq = (pow((1.0 / p0[0] / p2[0] / 2.0), 2) *
4648 (((pow(ss, 2) + pow(uu, 2)) / pow(tt, 2)) +
4649 (pow(tt, 2) + pow(uu, 2)) / pow(ss, 2) +
4650 2.0 / 3.0 * pow(uu, 2) / ss / tt))) /
4656 mmax = 4.0 / pow(ss, 2) *
4657 (4.0 / 9.0 * (pow(tmin, 2) + pow((ss - tmin), 2)) / tmin /
4659 (pow(tmin, 2) + pow((ss - tmin), 2)) / pow(ss, 2));
4660 msq = pow((1.0 / p0[0] / p2[0] / 2.0), 2) *
4661 (4.0 / 9.0 * (pow(tt, 2) + pow(uu, 2)) / tt / uu -
4662 (pow(tt, 2) + pow(uu, 2)) / pow(ss, 2)) /
4667 }
while (rank > (msq * ff));
4669 if(flag1 == 1 || flag2 == 1){
4692 vc[1] = (p0[1] + p2[1]) / (p0[0] + p2[0]);
4693 vc[2] = (p0[2] + p2[2]) / (p0[0] + p2[0]);
4694 vc[3] = (p0[3] + p2[3]) / (p0[0] + p2[0]);
4708 double ranp = 2.0 *
pi * ran0(&NUM1);
4712 qt = sqrt(pow(pcm, 2) - pow((tt / 2.0 / pcm - pcm), 2));
4713 double qx = qt * cos(ranp);
4714 double qy = qt * sin(ranp);
4719 double qpar = tt / 2.0 / pcm;
4723 double upt = sqrt(p2[1] * p2[1] + p2[2] * p2[2]) / p2[0];
4724 double upx = p2[1] / p2[0];
4725 double upy = p2[2] / p2[0];
4726 double upz = p2[3] / p2[0];
4730 p2[1] = p2[1] - qpar * upx;
4731 p2[2] = p2[2] - qpar * upy;
4733 p2[1] = p2[1] + (upz * upx * qy + upy * qx) / upt;
4734 p2[2] = p2[2] + (upz * upy * qy - upx * qx) / upt;
4736 p2[3] = p2[3] - qpar * upz - upt * qy;
4753 rotate(p4[1], p4[2], p4[3], p0, 1);
4754 qt = sqrt(pow(p0[1], 2) + pow(p0[2], 2));
4755 rotate(p4[1], p4[2], p4[3], p0, -1);
4779 double p0[4],
double p2[4],
double p3[4],
double p4[4],
4813 double e2, theta2, theta4, phi24;
4814 double e1, e4, p1, cosTheta24, downFactor,
4816 double HQmass, fBmax, fFmax, fB, fF, maxValue;
4817 int index_p1, index_T, index_e2;
4818 int ct1_loop, ct2_loop, flag1, flag2;
4825 HQmass = p0[0] * p0[0] - p0[1] * p0[1] - p0[2] * p0[2] - p0[3] * p0[3];
4826 if (HQmass > 1
e-12) {
4827 HQmass = sqrt(HQmass);
4841 p1 = sqrt(p0[1] * p0[1] + p0[2] * p0[2] + p0[3] * p0[3]);
4842 index_p1 = (int)((p1 - min_p1) / bin_p1);
4843 index_T = (int)((temp - min_T) / bin_T);
4844 if (index_p1 >= N_p1) {
4845 index_p1 = N_p1 - 1;
4846 cout <<
"warning: p1 is over p_max: " << p1 << endl;
4848 if (index_T >= N_T) {
4850 cout <<
"warning: T is over T_max: " << temp << endl;
4854 cout <<
"warning: T is below T_min: " << temp << endl;
4857 fBmax = distFncBM[index_T][index_p1];
4858 fFmax = distFncFM[index_T][index_p1];
4865 if (ct1_loop > 1e6) {
4870 xw = max_e2 * ran0(&NUM1);
4871 index_e2 = (int)((xw - min_e2) / bin_e2);
4872 if (index_e2 >= N_e2)
4873 index_e2 = N_e2 - 1;
4875 ff = distFncF[index_T][index_p1][index_e2] / fFmax;
4876 maxValue = distMaxF[index_T][index_p1][index_e2];
4877 }
else if (CT == 12) {
4878 ff = distFncB[index_T][index_p1][index_e2] / fBmax;
4879 maxValue = distMaxB[index_T][index_p1][index_e2];
4881 cout <<
"Wrong HQ channel ID" << endl;
4884 }
while (ran0(&NUM1) > ff);
4893 if (ct2_loop > 1e6) {
4894 cout <<
"cannot sample final states for HQ scattering ..." << endl;
4899 theta2 =
pi * ran0(&NUM1);
4900 theta4 =
pi * ran0(&NUM1);
4901 phi24 = 2.0 *
pi * ran0(&NUM1);
4904 sin(theta2) * sin(theta4) * cos(phi24) + cos(theta2) * cos(theta4);
4905 downFactor = e1 - p1 * cos(theta4) + e2 - e2 * cosTheta24;
4906 e4 = (e1 * e2 - p1 * e2 * cos(theta2)) / downFactor;
4907 sigFactor = sin(theta2) * sin(theta4) * e2 * e4 / downFactor;
4910 ss = 2.0 * e1 * e2 + HQmass * HQmass - 2.0 * p1 * e2 * cos(theta2);
4911 tt = -2.0 * e2 * e4 * (1.0 - cosTheta24);
4912 uu = 2.0 * HQmass * HQmass - ss - tt;
4915 if (ss <= 2.0 * qhat0ud || tt >= -qhat0ud || uu >= -qhat0ud) {
4924 (1.0 / (exp(e2 / temp) + 1.0)) * (1.0 - 1.0 / (exp(e4 / temp) + 1.0));
4925 sigFactor = sigFactor *
ff;
4926 msq = Mqc2qc(ss, tt, HQmass) / maxValue;
4931 (1.0 / (exp(e2 / temp) - 1.0)) * (1.0 + 1.0 / (exp(e4 / temp) - 1.0));
4932 sigFactor = sigFactor *
ff;
4933 msq = Mgc2gc(ss, tt, HQmass) / maxValue;
4938 }
while (rank > (msq * sigFactor));
4940 if (flag1 == 0 && flag2 == 0) {
4943 p3[1] = e2 * sin(theta2);
4945 p3[3] = e2 * cos(theta2);
4951 p2[1] = e4 * sin(theta4) * cos(phi24);
4952 p2[2] = e4 * sin(theta4) * sin(phi24);
4953 p2[3] = e4 * cos(theta4);
4957 double th_rotate = 2.0 *
pi * ran0(&NUM1);
4958 double p3x_rotate = p3[1] * cos(th_rotate) - p3[2] * sin(th_rotate);
4959 double p3y_rotate = p3[1] * sin(th_rotate) + p3[2] * cos(th_rotate);
4960 double p2x_rotate = p2[1] * cos(th_rotate) - p2[2] * sin(th_rotate);
4961 double p2y_rotate = p2[1] * sin(th_rotate) + p2[2] * cos(th_rotate);
4968 rotate(p4[1], p4[2], p4[3], p2, -1);
4969 rotate(p4[1], p4[2], p4[3], p3, -1);
4971 p0[1] = p4[1] + p3[1] - p2[1];
4972 p0[2] = p4[2] + p3[2] - p2[2];
4973 p0[3] = p4[3] + p3[3] - p2[3];
4975 sqrt(p0[1] * p0[1] + p0[2] * p0[2] + p0[3] * p0[3] + HQmass * HQmass);
4978 if (fabs(p0[0] + p2[0] - p3[0] - p4[0]) > 0.00001) {
4979 cout <<
"Violation of energy conservation in HQ 2->2 scattering: "
4980 << fabs(p0[0] + p2[0] - p3[0] - p4[0]) << endl;
4984 rotate(p4[1], p4[2], p4[3], p0, 1);
4985 qt = sqrt(pow(p0[1], 2) + pow(p0[2], 2));
4986 rotate(p4[1], p4[2], p4[3], p0, -1);
5012 double u = 2.0 * m2m - s -
t;
5015 MM = 64.0 / 9.0 * (pow((m2m - u), 2) + pow((s - m2m), 2) + 2.0 * m2m *
t) /
5024 double u = 2.0 * m2m - s -
t;
5027 MM = 32.0 * (s - m2m) * (m2m - u) / t /
t;
5028 MM = MM + 64.0 / 9.0 * ((s - m2m) * (m2m - u) + 2.0 * m2m * (s + m2m)) /
5030 MM = MM + 64.0 / 9.0 * ((s - m2m) * (m2m - u) + 2.0 * m2m * (u + m2m)) /
5032 MM = MM + 16.0 / 9.0 * m2m * (4.0 * m2m -
t) / ((s - m2m) * (m2m -
u));
5033 MM = MM + 16.0 * ((s - m2m) * (m2m - u) + m2m * (s -
u)) / (t * (s - m2m));
5034 MM = MM + 16.0 * ((s - m2m) * (m2m - u) - m2m * (s -
u)) / (t * (u - m2m));
5040 double vv = sqrt(v[1] * v[1] + v[2] * v[2] + v[3] * v[3]);
5041 double ga = 1.0 / sqrt(1.0 - vv * vv);
5042 double ppar = p[1] * v[1] + p[2] * v[2] + p[3] * v[3];
5043 double gavv = (ppar * ga / (1.0 + ga) - p[0]) * ga;
5044 p[0] = ga * (p[0] - ppar);
5045 p[1] = p[1] + v[1] * gavv;
5046 p[2] = p[2] + v[2] * gavv;
5047 p[3] = p[3] + v[3] * gavv;
5051 double vv = sqrt(v[1] * v[1] + v[2] * v[2] + v[3] * v[3]);
5052 double ga = 1.0 / sqrt(1.0 - vv * vv);
5053 double ppar = p[1] * v[1] + p[2] * v[2] + p[3] * v[3];
5054 double gavv = (-ppar * ga / (1.0 + ga) - p[0]) * ga;
5055 p[0] = ga * (p[0] + ppar);
5056 p[1] = p[1] - v[1] * gavv;
5057 p[2] = p[2] - v[2] * gavv;
5058 p[3] = p[3] - v[3] * gavv;
5067 double wx, wy, wz,
E,
pt, w, cosa, sina, cosb, sinb;
5068 double wx1, wy1, wz1;
5074 E = sqrt(px * px + py * py + pz * pz);
5075 pt = sqrt(px * px + py * py);
5077 w = sqrt(wx * wx + wy * wy + wz * wz);
5091 wx1 = wx * cosb * cosa + wy * cosb * sina - wz * sinb;
5092 wy1 = -wx * sina + wy * cosa;
5093 wz1 = wx * sinb * cosa + wy * sinb * sina + wz * cosb;
5097 wx1 = wx * cosa * cosb - wy * sina + wz * cosa * sinb;
5098 wy1 = wx * sina * cosb + wy * cosa + wz * sina * sinb;
5099 wz1 = -wx * sinb + wz * cosb;
5116 const int IM1 = 2147483563;
5117 const int IM2 = 2147483399;
5118 const double AM = (1.0 / IM1);
5119 const int IMM1 = (IM1 - 1);
5120 const int IA1 = 40014;
5121 const int IA2 = 40692;
5122 const int IQ1 = 53668;
5123 const int IQ2 = 52774;
5124 const int IR1 = 12211;
5125 const int IR2 = 3791;
5126 const int NTAB = 32;
5127 const int NDIV = (1 + IMM1 / NTAB);
5128 const double EPS = 1.2e-7;
5129 const double RNMX = (1.0 - EPS);
5133 static long idum2 = 123456789;
5135 static long iv[NTAB];
5143 for (j = NTAB + 7; j >= 0; j--) {
5145 *idum = IA1 * (*idum - k * IQ1) - k * IR1;
5154 *idum = IA1 * (*idum - k * IQ1) - k * IR1;
5158 idum2 = IA2 * (idum2 - k * IQ2) - k * IR2;
5166 if ((temp = AM * iy) > RNMX)
5176 double preFactor = 42.0 *
Ca *
zeta3 /
pi;
5180 preFactor * pow(0.5, 2) * pow(var_temp, 3) *
5181 log(5.7 * max(var_ener, 2.0 *
pi * var_temp) / 24 /
pi / 0.5 / var_temp);
5183 if (max_qhat < var_qhat) {
5184 JSINFO <<
"qhat exceeds HTL calculation, use alpha_s = 0.5";
5188 double solution = sqrt(
5189 var_qhat / preFactor / pow(var_temp, 3) /
5190 log(5.7 * max(var_ener, 2.0 *
pi * var_temp) / 24 /
pi / 0.2 / var_temp));
5191 double fnc_value, fnc_derivative;
5192 fnc_value = fnc0_alphas(solution, var_qhat, var_ener, var_temp);
5194 fnc0_derivative_alphas(solution, var_qhat, var_ener, var_temp);
5198 while (fabs(fnc_value / var_qhat) > 0.001) {
5200 solution = solution - fnc_value / fnc_derivative;
5201 fnc_value = fnc0_alphas(solution, var_qhat, var_ener, var_temp);
5203 fnc0_derivative_alphas(solution, var_qhat, var_ener, var_temp);
5206 if (solution < 0.0 || solution > 0.5) {
5207 JSINFO <<
"unreasonable alpha_s: " << solution <<
" use alpha_s = 0.5";
5217 double preFactor = 42.0 *
Ca *
zeta3 /
pi;
5218 return (preFactor * var_alphas * var_alphas * pow(var_temp, 3) *
5219 log(5.7 * max(var_ener, 2.0 *
pi * var_temp) / 24 /
pi /
5220 var_alphas / var_temp) -
5225 double var_ener,
double var_temp) {
5227 double preFactor = 42.0 *
Ca *
zeta3 /
pi;
5228 return (preFactor * pow(var_temp, 3) *
5230 log(5.7 * max(var_ener, 2.0 *
pi * var_temp) / 24 /
pi /
5231 var_alphas / var_temp) -
5256 ifstream f11(
"LBT-tables/ratedata-HQ");
5257 if (!f11.is_open()) {
5258 cout <<
"Erro openning HQ data file!\n";
5260 for (
int i = 1;
i <=
n;
i++) {
5262 f11 >> RHQ[
it][ie] >> RHQ11[
it][ie] >> RHQ12[
it][ie] >> qhatHQ[
it][ie];
5268 ifstream fileB(
"LBT-tables/distB.dat");
5269 if (!fileB.is_open()) {
5270 cout <<
"Erro openning data file distB.dat!" << endl;
5272 for (
int i = 0;
i < N_T;
i++) {
5273 for (
int j = 0;
j < N_p1;
j++) {
5274 double dummy_T, dummy_p1;
5275 fileB >> dummy_T >> dummy_p1;
5276 if (fabs(min_T + (0.5 +
i) * bin_T - dummy_T) > 1.0e-5 ||
5277 fabs(min_p1 + (0.5 +
j) * bin_p1 - dummy_p1) > 1.0e-5) {
5278 cout <<
"Erro in reading data file distB.dat!" << endl;
5281 fileB >> distFncBM[
i][
j];
5282 for (
int k = 0;
k < N_e2;
k++)
5283 fileB >> distFncB[
i][
j][
k];
5284 for (
int k = 0;
k < N_e2;
k++)
5285 fileB >> distMaxB[
i][
j][
k];
5291 ifstream fileF(
"LBT-tables/distF.dat");
5292 if (!fileF.is_open()) {
5293 cout <<
"Erro openning data file distF.dat!" << endl;
5295 for (
int i = 0;
i < N_T;
i++) {
5296 for (
int j = 0;
j < N_p1;
j++) {
5297 double dummy_T, dummy_p1;
5298 fileF >> dummy_T >> dummy_p1;
5299 if (fabs(min_T + (0.5 +
i) * bin_T - dummy_T) > 1.0e-5 ||
5300 fabs(min_p1 + (0.5 +
j) * bin_p1 - dummy_p1) > 1.0e-5) {
5301 cout <<
"Erro in reading data file distF.dat!" << endl;
5304 fileF >> distFncFM[
i][
j];
5305 for (
int k = 0;
k < N_e2;
k++)
5306 fileF >> distFncF[
i][
j][
k];
5307 for (
int k = 0;
k < N_e2;
k++)
5308 fileF >> distMaxF[
i][
j][
k];