29 #define MAGENTA "\033[35m"
31 using namespace Jetscape;
81 auto lbt_mutex = make_shared<LBTMutex>();
88 JSINFO <<
"Initialize LBT ...";
94 "LBT-tables/LBT.input");
103 std::string s = GetXMLElementText({
"Eloss",
"Lbt",
"name"});
104 JSDEBUG << s <<
" to be initialized ...";
112 int in_vac = GetXMLElementInt({
"Eloss",
"Lbt",
"in_vac"});
120 Kprimary = GetXMLElementInt({
"Eloss",
"Lbt",
"only_leading"});
121 run_alphas = GetXMLElementInt({
"Eloss",
"Lbt",
"run_alphas"});
122 Q00 = GetXMLElementDouble({
"Eloss",
"Lbt",
"Q0"});
123 fixAlphas = GetXMLElementDouble({
"Eloss",
"Lbt",
"alphas"});
124 hydro_Tc = GetXMLElementDouble({
"Eloss",
"Lbt",
"hydro_Tc"});
125 tStart = GetXMLElementDouble({
"Eloss",
"tStart"});
126 JSINFO <<
MAGENTA <<
"LBT parameters -- in_med: " << vacORmed
127 <<
" Q0: " << Q00 <<
" only_leading: " << Kprimary
128 <<
" alpha_s: " << fixAlphas <<
" hydro_Tc: " << hydro_Tc<<
", tStart="<<tStart;
141 alphas = alphas0(Kalphas, temp0);
143 qhat0 = DebyeMass2(Kqhat0,
alphas, temp0);
145 ZeroOneDistribution = uniform_real_distribution<double>{0.0, 1.0};
153 f->WriteComment(
"ElossModule Parton List: " + GetId());
154 f->WriteComment(
"Energy loss to be implemented accordingly ...");
158 vector<Parton> &pIn, vector<Parton> &pOut) {
165 <<
" " << Q2 <<
" " << &pIn;
179 for (
int i = 0;
i < pIn.size();
i++) {
184 if(pIn[
i].pstat() != 22) {
186 pOut.push_back(pIn[
i]);
205 par_status = pIn[
i].pstat();
207 if (par_status != -1) {
209 KATT1[
j] = pIn[
i].pid();
210 P[1][
j] = pIn[
i].p(1);
211 P[2][
j] = pIn[
i].p(2);
212 P[3][
j] = pIn[
i].p(3);
214 if (std::abs(pIn[
i].
pid()) == 4 || std::abs(pIn[
i].
pid()) == 5)
215 P[4][
j] = pIn[
i].restmass();
216 P[0][
j] = sqrt(
P[1][j] *
P[1][j] +
P[2][j] *
P[2][j] +
P[3][j] *
P[3][j] +
218 P[5][
j] = sqrt(
P[1][j] *
P[1][j] +
P[2][j] *
P[2][j]);
219 P[6][
j] = pIn[
i].e() * pIn[
i].e() -
P[0][
j] *
P[0][
j];
227 Vfrozen[1][
j] = pIn[
i].x_in().x();
228 Vfrozen[2][
j] = pIn[
i].x_in().y();
229 Vfrozen[3][
j] = pIn[
i].x_in().z();
230 Vfrozen[0][
j] = pIn[
i].x_in().t();
231 V[1][
j] = Vfrozen[1][
j];
232 V[2][
j] = Vfrozen[2][
j];
233 V[3][
j] = Vfrozen[3][
j];
234 V[0][
j] = -log(1.0 - ZeroOneDistribution(*GetMt19937Generator()));
236 for (
int k = 0;
k <= 3;
k++)
237 Prad[
k][j] = P[
k][j];
240 vcfrozen[1][
j] = 0.0;
241 vcfrozen[2][
j] = 0.0;
242 vcfrozen[3][
j] = 0.0;
246 if (pIn[
i].has_user_info<LBTUserInfo>()) {
259 KATT10[
j] = pIn[
i].pid();
260 P0[1][
j] = pIn[
i].p(1);
261 P0[2][
j] = pIn[
i].p(2);
262 P0[3][
j] = pIn[
i].p(3);
264 P0[0][
j] = sqrt(P0[1][j] * P0[1][j] + P0[2][j] * P0[2][j] +
265 P0[3][j] * P0[3][j] + P0[4][j] * P0[4][j]);
266 P0[5][
j] = sqrt(P0[1][j] * P0[1][j] + P0[2][j] * P0[2][j]);
267 P0[6][
j] = pIn[
i].e() * pIn[
i].e() - P0[0][
j] * P0[0][
j];
272 Vfrozen0[1][
j] = pIn[
i].x_in().x();
273 Vfrozen0[2][
j] = pIn[
i].x_in().y();
274 Vfrozen0[3][
j] = pIn[
i].x_in().z();
275 Vfrozen0[0][
j] = pIn[
i].x_in().t();
276 V0[1][
j] = Vfrozen0[1][
j];
277 V0[2][
j] = Vfrozen0[2][
j];
278 V0[3][
j] = Vfrozen0[3][
j];
279 V0[0][
j] = -log(1.0 - ZeroOneDistribution(*GetMt19937Generator()));
284 vcfrozen0[1][
j] = 0.0;
285 vcfrozen0[2][
j] = 0.0;
286 vcfrozen0[3][
j] = 0.0;
290 if (pIn[
i].has_user_info<LBTUserInfo>()) {
316 double systemTime =
time;
352 double velocity_jet[4];
353 velocity_jet[0] = 1.0;
354 velocity_jet[1] = pIn[
i].jet_v().x();
355 velocity_jet[2] = pIn[
i].jet_v().y();
356 velocity_jet[3] = pIn[
i].jet_v().z();
361 if (flag_update == 0)
364 TakeResponsibilityFor(
375 for (
int j = 1; j <= np; j++) {
377 if (
P[0][j] < cutOut)
382 double tempP[4], tempX[4];
383 tempP[0] = sqrt(
P[0][j] *
P[0][j] +
P[6][j]);
387 tempX[0] = Vfrozen[0][
j];
388 tempX[1] = Vfrozen[1][
j];
389 tempX[2] = Vfrozen[2][
j];
390 tempX[3] = Vfrozen[3][
j];
393 if (std::isnan(tempP[1])) {
394 JSWARN <<
"second instance: j=" << j <<
", P[0][j]=" <<
P[0][
j]
395 <<
", P[1][j]=" <<
P[1][
j] <<
", P[2][j]=" <<
P[2][
j]
396 <<
", P[3][j]=" <<
P[3][
j] <<
", P[4][j]=" <<
P[4][
j]
397 <<
", P[6][j]=" <<
P[6][
j];
400 pOut.push_back(
Parton(0, KATT1[j], out_stat, tempP, tempX));
402 pOut.back().set_user_info(
new LBTUserInfo(Tint_lrf[j]));
404 int iout = pOut.size() - 1;
405 pOut[iout].set_jet_v(velocity_jet);
406 pOut[iout].set_mean_form_time();
407 double ft = pOut[iout].mean_form_time();
408 pOut[iout].set_form_time(ft);
412 for (
int j = 2; j <= np; j++) {
413 if (P0[0][j] < cutOut)
415 double tempP[4], tempX[4];
416 tempP[0] = sqrt(P0[0][j] * P0[0][j] + P0[6][j]);
420 tempX[0] = Vfrozen0[0][
j];
421 tempX[1] = Vfrozen0[1][
j];
422 tempX[2] = Vfrozen0[2][
j];
423 tempX[3] = Vfrozen0[3][
j];
425 pOut.push_back(
Parton(0, KATT10[j], -1, tempP, tempX));
428 int iout = pOut.size() - 1;
429 pOut[iout].set_jet_v(velocity_jet);
430 pOut[iout].set_mean_form_time();
431 double ft = pOut[iout].mean_form_time();
432 pOut[iout].set_form_time(ft);
437 if (flag_update0 == 0)
440 TakeResponsibilityFor(
444 JSDEBUG <<
"Wrong number of negative partons!";
447 for (
int j = 1; j <= np; j++) {
448 if (P0[0][j] < cutOut)
450 double tempP[4], tempX[4];
455 tempX[0] = Vfrozen0[0][
j];
456 tempX[1] = Vfrozen0[1][
j];
457 tempX[2] = Vfrozen0[2][
j];
458 tempX[3] = Vfrozen0[3][
j];
460 pOut.push_back(
Parton(0, KATT10[j], -1, tempP, tempX));
463 int iout = pOut.size() - 1;
464 pOut[iout].set_jet_v(velocity_jet);
465 pOut[iout].set_mean_form_time();
466 double ft = pOut[iout].mean_form_time();
467 pOut[iout].set_form_time(ft);
550 double fraction = 0.0;
551 double fraction0 = 0.0;
552 double vc0b[4] = {0.0};
553 double pMag, vMag, flowFactor;
557 double vp0[4] = {0.0};
558 double p0temp[4] = {0.0};
560 double p0temp1 = 0.0;
561 double p0temp2 = 0.0;
563 double pcx[4] = {0.0};
564 double pcy[4] = {0.0};
566 double pcx1[4] = {0.0};
567 double pcy1[4] = {0.0};
570 double dt_lrf, maxFncHQ, Tdiff, lim_low, lim_high, lim_int;
571 double probCol, probRad, probTot;
573 double lrf_rStart[4] = {0.0};
574 double SpatialRapidity = 0.0;
591 for (
int i = 1;
i <= np;
i++) {
602 if (
P[0][
i] < epsilon) {
609 if (P0[0][
i] < epsilon) {
618 if (tauswitch == 0) {
624 V0[1][
i] = V0[1][
i] + (ti - Vfrozen0[0][
i]) * P0[1][
i] / P0[0][
i];
625 V0[2][
i] = V0[2][
i] + (ti - Vfrozen0[0][
i]) * P0[2][
i] / P0[0][
i];
626 V0[3][
i] = V0[3][
i] + (ti - Vfrozen0[0][
i]) * P0[3][
i] / P0[0][
i];
633 double ed00, sd00, VX00, VY00, VZ00;
645 std::unique_ptr<FluidCellInfo> check_fluid_info_ptr;
647 SpatialRapidity = 0.5 * std::log((tcar0 + zcar0) / (tcar0 - zcar0));
649 GetHydroCellSignal(tcar0, xcar0, ycar0, zcar0, check_fluid_info_ptr);
654 VX00 = check_fluid_info_ptr->
vx;
655 VY00 = check_fluid_info_ptr->
vy;
656 VZ00 = check_fluid_info_ptr->
vz;
658 if (tcar0 < tStart * cosh(SpatialRapidity)) {
675 if (hydro_ctl0 == 0 && temp00 >= hydro_Tc) {
677 qhat00 = DebyeMass2(Kqhat0,
alphas, temp00);
681 Vfrozen0[1][
i] = V0[1][
i];
682 Vfrozen0[2][
i] = V0[2][
i];
683 Vfrozen0[3][
i] = V0[3][
i];
684 Tfrozen0[
i] = temp00;
685 vcfrozen0[1][
i] = VX00;
686 vcfrozen0[2][
i] = VY00;
687 vcfrozen0[3][
i] = VZ00;
702 if (tauswitch == 0) {
708 V[1][
i] = V[1][
i] + (ti - Vfrozen[0][
i]) *
P[1][
i] /
P[0][
i];
709 V[2][
i] = V[2][
i] + (ti - Vfrozen[0][
i]) *
P[2][
i] /
P[0][
i];
710 V[3][
i] = V[3][
i] + (ti - Vfrozen[0][
i]) *
P[3][
i] /
P[0][
i];
717 for (
int lrf_i = 0; lrf_i <= 3; lrf_i++)
718 lrf_rStart[lrf_i] = Vfrozen[lrf_i][
i];
722 double ed, sd, VX, VY, VZ;
738 std::unique_ptr<FluidCellInfo> check_fluid_info_ptr;
740 SpatialRapidity = 0.5 * std::log((tcar + zcar) / (tcar - zcar));
742 GetHydroCellSignal(tcar, xcar, ycar, zcar, check_fluid_info_ptr);
745 if (!GetJetSignalConnected()) {
746 JSWARN <<
"Couldn't find a hydro module attached!";
747 throw std::runtime_error(
"Please attach a hydro module or set "
748 "in_vac to 1 in the XML file");
753 VX = check_fluid_info_ptr->
vx;
754 VY = check_fluid_info_ptr->
vy;
755 VZ = check_fluid_info_ptr->
vz;
757 if (tcar < tStart * cosh(SpatialRapidity)) {
772 if (hydro_ctl == 0 && temp0 >= hydro_Tc) {
787 alphas = alphas0(Kalphas, temp0);
789 qhat0 = DebyeMass2(Kqhat0,
alphas, temp0);
793 Vfrozen[1][
i] = V[1][
i];
794 Vfrozen[2][
i] = V[2][
i];
795 Vfrozen[3][
i] = V[3][
i];
812 sqrt(vc0b[1] * vc0b[1] + vc0b[2] * vc0b[2] + vc0b[3] * vc0b[3]);
814 (1.0 - (pc0[1] * vc0b[1] + pc0[2] * vc0b[2] + pc0[3] * vc0b[3]) /
816 sqrt(1.0 - vMag * vMag);
834 double qhatTP, RTE1, RTE2;
844 PLen = sqrt(pc0[1] * pc0[1] + pc0[2] * pc0[2] + pc0[3] * pc0[3]);
855 fixedLog = log(5.7*E/4.0/6.0/
pi/0.3/T);
861 double lambdaQCD2 = exp(-4.0*
pi/9.0/
alphas);
862 runAlphas = 4.0*
pi/9.0/log(scaleMu2/lambdaQCD2);
864 runKT = runAlphas/0.3;
865 runLog = log(scaleMu2/6.0/
pi/T/T/
alphas)/fixedLog;
868 lam(KATTC0, RTE, PLen, T, T1, T2, E1, E2, iT1, iT2, iE1,
874 KPfactor = 1.0 + KPamp * exp(-PLen * PLen / 2.0 / KPsig / KPsig);
875 KTfactor = 1.0 + KTamp * exp(-pow((temp0 - hydro_Tc), 2) / 2.0 / KTsig /
879 Kfactor = KPfactor * KTfactor * KTfactor * runKT * preKT * runLog;
881 Kfactor = KPfactor * KTfactor * KTfactor * preKT * preKT;
887 RTE1 = (qhatG[iT2][iE1] - qhatG[iT1][iE1]) * (T - T1) / (T2 -
T1) +
889 RTE2 = (qhatG[iT2][iE2] - qhatG[iT1][iE2]) * (T - T1) / (T2 -
T1) +
891 }
else if (KATTC0 == 4 || KATTC0 == -4 || KATTC0 == 5 || KATTC0 == -5) {
892 RTE1 = (qhatHQ[iT2][iE1] - qhatHQ[iT1][iE1]) * (T - T1) / (T2 -
T1) +
894 RTE2 = (qhatHQ[iT2][iE2] - qhatHQ[iT1][iE2]) * (T - T1) / (T2 -
T1) +
897 RTE1 = (qhatLQ[iT2][iE1] - qhatLQ[iT1][iE1]) * (T - T1) / (T2 -
T1) +
899 RTE2 = (qhatLQ[iT2][iE2] - qhatLQ[iT1][iE2]) * (T - T1) / (T2 -
T1) +
903 qhatTP = (RTE2 - RTE1) * (PLen - E1) / (E2 - E1) + RTE1;
905 qhatTP = qhatTP * Kfactor;
914 qhat_over_T3 = qhatTP;
918 D2piT = 8.0 *
pi / (qhat_over_T3 / CA * CF);
920 D2piT = 8.0 *
pi / qhat_over_T3;
928 Q0 = sqrt(sqrt(2.0 * E * qhat));
942 if (
i > nj && E < Ecmcut)
956 lrf_rStart[1] + (tLoc - lrf_rStart[0]) *
P[1][
i] /
P[0][
i];
958 lrf_rStart[2] + (tLoc - lrf_rStart[0]) *
P[2][
i] /
P[0][
i];
960 lrf_rStart[3] + (tLoc - lrf_rStart[0]) *
P[3][
i] /
P[0][
i];
961 double dtLoc, tempLoc, vxLoc, vyLoc, vzLoc;
968 std::unique_ptr<FluidCellInfo> check_fluid_info_ptr;
970 SpatialRapidity = 0.5 * std::log((tLoc + zLoc) / (tLoc - zLoc));
972 GetHydroCellSignal(tLoc, xLoc, yLoc, zLoc, check_fluid_info_ptr);
974 vxLoc = check_fluid_info_ptr->
vx;
975 vyLoc = check_fluid_info_ptr->
vy;
976 vzLoc = check_fluid_info_ptr->
vz;
978 if (tLoc < tStart * cosh(SpatialRapidity)) {
985 if (tempLoc >= hydro_Tc) {
986 vMag = sqrt(vxLoc * vxLoc + vyLoc * vyLoc + vzLoc * vzLoc);
989 (pc0[1] * vxLoc + pc0[2] * vyLoc + pc0[3] * vzLoc) / pc0[0]) /
990 sqrt(1.0 - vMag * vMag);
991 Tint_lrf[
i] = Tint_lrf[
i] + dtLoc * flowFactor;
1000 radng[
i] += nHQgluon(KATT1[
i], dt_lrf, Tdiff, temp0, E, maxFncHQ) / 2.0 * KTfactor * runKT;
1002 radng[
i] += nHQgluon(KATT1[
i], dt_lrf, Tdiff, temp0, E, maxFncHQ) / 2.0 * KTfactor * preKT;
1005 if (run_alphas==1) {
1006 radng[
i] += nHQgluon(KATT1[
i], dt_lrf, Tdiff, temp0, E, maxFncHQ) * KTfactor * runKT;
1008 radng[
i] += nHQgluon(KATT1[
i], dt_lrf, Tdiff, temp0, E, maxFncHQ) * KTfactor * preKT;
1011 lim_low = sqrt(6.0 *
pi *
alphas) * temp0 /
E;
1012 if (abs(KATT1[
i]) == 4 || abs(KATT1[i]) == 5)
1015 lim_high = 1.0 - lim_low;
1016 lim_int = lim_high - lim_low;
1018 probRad = 1.0 - exp(-radng[i]);
1023 if (tauswitch == 0) {
1035 V[0][
i] = V[0][
i] - fraction * dt * RTE / 0.1970 *
1036 sqrt(pow(
P[1][i], 2) + pow(
P[2][i], 2) +
1039 probCol = fraction * dt_lrf * RTE / 0.1970;
1053 if (run_alphas==1) {
1054 probCol = probCol * KPfactor * KTfactor * runKT;
1056 probCol = probCol * KPfactor * KTfactor * preKT;
1058 probCol = (1.0 - exp(-probCol)) *
1062 probTot = probCol + probRad;
1064 if (ZeroOneDistribution(*GetMt19937Generator()) <
1072 for (
int nsca = 1; nsca <= Nscatter; nsca++) {
1080 flavor(CT, KATTC0, KATT2, KATT3, RTE, PLen, T, T1, T2, E1, E2, iT1,
1085 if (CT == 11 || CT == 12) {
1086 collHQ22(CT, temp0, qhat0, vc0, pc0, pc2, pc3, pc4, qt);
1088 colljet22(CT, temp0, qhat0, vc0, pc0, pc2, pc3, pc4, qt);
1096 KATT10[np0] = KATT3;
1099 if (pc0[0] < pc2[0] && abs(KATTC0) != 4 && abs(KATTC0) != 5 &&
1102 for (
int k = 0;
k <= 3;
k++) {
1108 KATT1[np0] = KATTC0;
1111 for (
int j = 0;
j <= 3;
j++) {
1115 V[
j][np0] = V[
j][
i];
1117 P0[
j][np0] = pc3[
j];
1118 V0[
j][np0] = V[
j][
i];
1120 Vfrozen[
j][np0] = Vfrozen[
j][
i];
1121 Vfrozen0[
j][np0] = Vfrozen[
j][
i];
1122 Tfrozen[np0] = temp0;
1123 Tfrozen0[np0] = temp0;
1126 vcfrozen[
j][np0] = vc0b[
j];
1127 vcfrozen0[
j][np0] = vc0b[
j];
1132 P[5][np0] =
P[5][
i];
1133 P0[5][np0] =
P[5][
i];
1152 if (KINT0 != 0 && KINT != 0) {
1153 for (
int j = 0;
j <= 3;
j++) {
1154 p0temp[
j] =
P[
j][
i];
1166 transback(vc0, pc4);
1168 if (Ejp > 2 * sqrt(qhat0)) {
1174 if (KATT1[i] != 21) {
1182 if (ZeroOneDistribution(*GetMt19937Generator()) <
1186 for (
int j = 0;
j <= 3;
j++) {
1191 collHQ23(KATT1[i], temp0, qhat0, vc0, pc01, pc2, pc3, pc4, qt,
1192 icl23, Tdiff, Ejp, maxFncHQ, lim_low, lim_int);
1200 nrad = KPoisson(radng[i]);
1209 for (
int j = 0;
j <= 3;
j++) {
1211 P[
j][np0 - 1] = pc2[
j];
1212 V[
j][np0 - 1] = V[
j][
i];
1213 P0[
j][np0 - 1] = pc3[
j];
1214 V0[
j][np0 - 1] = V[
j][
i];
1216 V[
j][np0] = V[
j][
i];
1220 Vfrozen[
j][np0] = Vfrozen[
j][
i];
1221 Vfrozen0[
j][np0] = 0.0;
1223 vcfrozen[
j][np0] = vc0b[
j];
1224 vcfrozen0[
j][np0] = 0.0;
1228 Tfrozen[np0] = temp0;
1229 Tfrozen0[np0] = 0.0;
1232 P[5][np0] =
P[5][
i];
1240 P[6][
i] = pow(
P[0][i] / Elab, 2) * Qinit;
1241 P[6][np0] = pow(
P[0][np0] / Elab, 2) * Qinit;
1253 eGluon = eGluon + pc4[0];
1254 nGluon = nGluon + 1.0;
1256 V[0][np0] = -log(1.0 - ZeroOneDistribution(*GetMt19937Generator()));
1261 for (
int j = 0;
j <= 3;
j++)
1264 radiationHQ(KATT1[i], qhat0, vc0, pc2, pc01, pc4, pb,
1265 iclrad, Tdiff, Ejp, maxFncHQ, temp0, lim_low,
1276 for (
int j = 0;
j <= 3;
j++) {
1278 P[
j][np0 - 1] = pc2[
j];
1280 V[
j][np0] = V[
j][
i];
1284 Vfrozen[
j][np0] = Vfrozen[
j][
i];
1285 Vfrozen0[
j][np0] = 0.0;
1287 vcfrozen[
j][np0] = vc0b[
j];
1288 vcfrozen0[
j][np0] = 0.0;
1292 Tfrozen[np0] = temp0;
1293 Tfrozen0[np0] = 0.0;
1296 P[5][np0] =
P[5][
i];
1303 P[6][
i] = pow(
P[0][i] / Elab, 2) * Qinit;
1304 P[6][np0 - 1] = pow(
P[0][np0 - 1] / Elab, 2) * Qinit;
1305 P[6][np0] = pow(
P[0][np0] / Elab, 2) * Qinit;
1310 eGluon = eGluon + pc4[0];
1311 nGluon = nGluon + 1.0;
1313 V[0][np0] = -log(1.0 - ZeroOneDistribution(*GetMt19937Generator()));
1335 if (abs(KATT1[i]) == 4 || abs(KATT1[i]) == 5)
1337 tiscatter[
i] = tcar;
1338 V[0][
i] = -log(1.0 - ZeroOneDistribution(*GetMt19937Generator()));
1340 for (
unsigned ip = nnpp + 1; ip <= np0; ++ip) {
1341 tiscatter[ip] = tcar;
1342 V[0][ip] = -log(1.0 - ZeroOneDistribution(*GetMt19937Generator()));
1343 V0[0][ip] = -log(1.0 - ZeroOneDistribution(*GetMt19937Generator()));
1350 if (KATT1[i] == 21 && np0 - nnpp >= 2) {
1352 p0temp1 =
P[0][idlead];
1353 for (
unsigned ip = nnpp + 2; ip <= np0 - 1; ++ip) {
1354 if (p0temp1 <
P[0][ip + 1]) {
1355 p0temp1 =
P[0][ip + 1];
1359 if (
P[0][idlead] >
P[0][i]) {
1361 KATTy = KATT1[idlead];
1363 KATT1[idlead] = KATTx;
1364 for (
int j = 0;
j <= 3;
j++) {
1366 pcy[
j] =
P[
j][idlead];
1368 P[
j][idlead] = pcx[
j];
1386 if (
P[0][nnpp + 1] < Ecut) {
1389 for (
int j = 0;
j <= 3;
j++) {
1390 P[
j][nnpp + 1] = 0.0;
1391 P0[
j][nnpp + 1] = 0.0;
1395 if (
P[0][i] < Ecut) {
1397 for (
int j = 0;
j <= 3;
j++)
1401 for (
int m = nnpp + 2;
m <= np0;
m++) {
1402 if (
P[0][
m] < Ecut) {
1404 for (
int j = 0;
j <= 3;
j++)
1412 tiscatter[
i] = tcar;
1425 if (np >= dimParList) {
1426 cout <<
"np exceeds the grid size ... terminate " << endl;
1430 if (Kprimary == 1) {
1458 if (fixPosition != 1)
1459 read_xyMC(numInitXY);
1464 ifstream
f1(
"LBT-tables/ratedata");
1465 if (!f1.is_open()) {
1466 cout <<
"Erro openning date file1!\n";
1468 for (
int i = 1;
i <=
n;
i++) {
1470 f1 >> qhatG[
it][ie] >> Rg[
it][ie] >> Rg1[
it][ie] >> Rg2[
it][ie] >>
1471 Rg3[
it][ie] >> qhatLQ[
it][ie] >> Rq[
it][ie] >> Rq3[
it][ie] >>
1472 Rq4[
it][ie] >> Rq5[
it][ie] >> Rq6[
it][ie] >> Rq7[
it][ie] >>
1479 ifstream f11(
"LBT-tables/ratedata-HQ");
1480 if (!f11.is_open()) {
1481 cout <<
"Erro openning HQ data file!\n";
1483 for (
int i = 1;
i <=
n;
i++) {
1485 f11 >> RHQ[
it][ie] >> RHQ11[
it][ie] >> RHQ12[
it][ie] >> qhatHQ[
it][ie];
1492 ifstream f12(
"LBT-tables/dNg_over_dt_cD6.dat");
1493 ifstream f13(
"LBT-tables/dNg_over_dt_qD6.dat");
1494 ifstream f14(
"LBT-tables/dNg_over_dt_gD6.dat");
1495 if (!f12.is_open() || !f13.is_open() || !f14.is_open()) {
1496 cout <<
"Erro openning HQ radiation table file!\n";
1498 for (
int k = 1;
k <= t_gn;
k++) {
1499 char dummyChar[100];
1501 f12 >> dummyChar >> dummyChar >> dummyChar >> dummyChar;
1502 f13 >> dummyChar >> dummyChar >> dummyChar >> dummyChar;
1503 f14 >> dummyChar >> dummyChar >> dummyChar >> dummyChar;
1504 for (
int i = 1;
i <= temp_gn;
i++) {
1505 dNg_over_dt_c[
k + 1][
i][0] = 0.0;
1506 dNg_over_dt_q[
k + 1][
i][0] = 0.0;
1507 dNg_over_dt_g[
k + 1][
i][0] = 0.0;
1508 max_dNgfnc_c[
k + 1][
i][0] = 0.0;
1509 max_dNgfnc_q[
k + 1][
i][0] = 0.0;
1510 max_dNgfnc_g[
k + 1][
i][0] = 0.0;
1511 for (
int j = 1;
j <= HQener_gn;
j++) {
1512 f12 >> dNg_over_dt_c[
k + 1][
i][
j] >> max_dNgfnc_c[
k + 1][
i][
j];
1513 f13 >> dNg_over_dt_q[
k + 1][
i][
j] >> max_dNgfnc_q[
k + 1][
i][
j];
1514 f14 >> dNg_over_dt_g[
k + 1][
i][
j] >> max_dNgfnc_g[
k + 1][
i][
j];
1526 for (
int i = 1;
i <= temp_gn;
i++) {
1527 for (
int j = 1;
j <= HQener_gn;
j++) {
1528 dNg_over_dt_c[1][
i][
j] = 0.0;
1529 dNg_over_dt_q[1][
i][
j] = 0.0;
1530 dNg_over_dt_g[1][
i][
j] = 0.0;
1531 max_dNgfnc_c[1][
i][
j] = 0.0;
1532 max_dNgfnc_q[1][
i][
j] = 0.0;
1533 max_dNgfnc_g[1][
i][
j] = 0.0;
1539 ifstream fileB(
"LBT-tables/distB.dat");
1540 if (!fileB.is_open()) {
1541 cout <<
"Erro openning data file distB.dat!" << endl;
1543 for (
int i = 0;
i < N_T;
i++) {
1544 for (
int j = 0;
j < N_p1;
j++) {
1545 double dummy_T, dummy_p1;
1546 fileB >> dummy_T >> dummy_p1;
1547 if (fabs(min_T + (0.5 +
i) * bin_T - dummy_T) > 1.0e-5 ||
1548 fabs(min_p1 + (0.5 +
j) * bin_p1 - dummy_p1) > 1.0e-5) {
1549 cout <<
"Erro in reading data file distB.dat!" << endl;
1552 fileB >> distFncBM[
i][
j];
1553 for (
int k = 0;
k < N_e2;
k++)
1554 fileB >> distFncB[
i][
j][
k];
1555 for (
int k = 0;
k < N_e2;
k++)
1556 fileB >> distMaxB[
i][
j][
k];
1562 ifstream fileF(
"LBT-tables/distF.dat");
1563 if (!fileF.is_open()) {
1564 cout <<
"Erro openning data file distF.dat!" << endl;
1566 for (
int i = 0;
i < N_T;
i++) {
1567 for (
int j = 0;
j < N_p1;
j++) {
1568 double dummy_T, dummy_p1;
1569 fileF >> dummy_T >> dummy_p1;
1570 if (fabs(min_T + (0.5 +
i) * bin_T - dummy_T) > 1.0e-5 ||
1571 fabs(min_p1 + (0.5 +
j) * bin_p1 - dummy_p1) > 1.0e-5) {
1572 cout <<
"Erro in reading data file distF.dat!" << endl;
1575 fileF >> distFncFM[
i][
j];
1576 for (
int k = 0;
k < N_e2;
k++)
1577 fileF >> distFncF[
i][
j][
k];
1578 for (
int k = 0;
k < N_e2;
k++)
1579 fileF >> distMaxF[
i][
j][
k];
1585 cout <<
"Initialization completed for LBT." << endl;
1594 const int IM1 = 2147483563;
1595 const int IM2 = 2147483399;
1596 const double AM = (1.0 / IM1);
1597 const int IMM1 = (IM1 - 1);
1598 const int IA1 = 40014;
1599 const int IA2 = 40692;
1600 const int IQ1 = 53668;
1601 const int IQ2 = 52774;
1602 const int IR1 = 12211;
1603 const int IR2 = 3791;
1604 const int NTAB = 32;
1605 const int NDIV = (1 + IMM1 / NTAB);
1606 const double EPS = 1.2e-7;
1607 const double RNMX = (1.0 - EPS);
1611 static long idum2 = 123456789;
1613 static long iv[NTAB];
1621 for (j = NTAB + 7; j >= 0; j--) {
1623 *idum = IA1 * (*idum - k * IQ1) - k * IR1;
1632 *idum = IA1 * (*idum - k * IQ1) - k * IR1;
1636 idum2 = IA2 * (idum2 - k * IQ2) - k * IR2;
1644 if ((temp = AM * iy) > RNMX)
1657 cout <<
"un-recoganized Kalphas" << endl;
1667 return 4.0 *
pi * alphas * pow(temp0, 2);
1670 return (3.0 / 2.0) * 4.0 *
pi * alphas * pow(temp0, 2);
1675 JSWARN <<
"Kqhat0 = " << Kqhat0;
1676 throw std::runtime_error(
"Unexpected value for Kqhat0");
1698 void LBT::titau(
double ti,
double vf[4],
double vp[4],
double p0[4],
double &Vx,
1699 double &Vy,
double &Veta,
double &Xtau) {
1708 double gamma = 1.0 / sqrt(1 - (vf[1] * vf[1] + vf[2] * vf[2]));
1709 double mt = sqrt(p0[1] * p0[1] + p0[2] * p0[2]);
1710 double Yp = 1.0 / 2.0 * log((p0[0] + p0[3]) / (p0[0] - p0[3]));
1711 double etas = vp[3];
1712 double etaf = atanh(vf[3]) +
etas;
1713 double pper = sqrt(p0[1] * p0[1] + p0[2] * p0[2]);
1714 double vper = sqrt(vf[1] * vf[1] + vf[2] * vf[2]);
1715 double pvper = p0[1] * vf[1] + p0[2] * vf[2];
1717 Vx = p0[1] / pper / cosh(Yp - etas);
1718 Vy = p0[2] / pper / cosh(Yp - etas);
1719 Veta = (1.0 / ti) * tanh(Yp - etas);
1721 Xtau = (gamma * mt * cosh(Yp - etaf) - pvper * vper) / (mt * cosh(Yp - etas));
1736 double &
T2,
double &E1,
double &E2,
int &iT1,
int &iT2,
int &iE1,
1739 double dtemp = 0.02;
1740 iT1 = (int)((T - 0.1) / dtemp);
1742 iE1 = (int)(log(E) + 2);
1747 T1 = 0.12 + (iT1 - 1) * 0.02;
1749 E1 = exp(iE1 - 2.0);
1750 E2 = exp(iE2 - 2.0);
1754 (Rg[iT2][iE1] - Rg[iT1][iE1]) * (T - T1) / (T2 -
T1) + Rg[iT1][iE1];
1756 (Rg[iT2][iE2] - Rg[iT1][iE2]) * (T - T1) / (T2 -
T1) + Rg[iT1][iE2];
1757 RTE = (RTE2 - RTE1) * (E - E1) / (E2 - E1) + RTE1;
1758 }
else if (KATT0 == 4 || KATT0 == -4 || KATT0 == 5 ||
1761 (RHQ[iT2][iE1] - RHQ[iT1][iE1]) * (T - T1) / (T2 -
T1) + RHQ[iT1][iE1];
1763 (RHQ[iT2][iE2] - RHQ[iT1][iE2]) * (T - T1) / (T2 -
T1) + RHQ[iT1][iE2];
1764 RTE = (RTE2 - RTE1) * (E - E1) / (E2 - E1) + RTE1;
1767 (Rq[iT2][iE1] - Rq[iT1][iE1]) * (T - T1) / (T2 -
T1) + Rq[iT1][iE1];
1769 (Rq[iT2][iE2] - Rq[iT1][iE2]) * (T - T1) / (T2 -
T1) + Rq[iT1][iE2];
1770 RTE = (RTE2 - RTE1) * (E - E1) / (E2 - E1) + RTE1;
1777 void LBT::flavor(
int &CT,
int &KATT0,
int &KATT2,
int &KATT3,
double RTE,
1778 double E,
double T,
double &
T1,
double &
T2,
double &E1,
1779 double &E2,
int &iT1,
int &iT2,
int &iE1,
int &iE2) {
1809 linear(KATT0, E, T, T1, T2, E1, E2, iT1, iT2, iE1, iE2, RTEg, RTEg1, RTEg2,
1810 RTEg3, RTEq, RTEq3, RTEq4, RTEq5, RTEq6, RTEq7, RTEq8, RTEHQ, RTEHQ11,
1819 double a = ZeroOneDistribution(*GetMt19937Generator());
1828 if (a > R1 / R0 && a <= (R1 + R2) / R0) {
1830 b = floor(ZeroOneDistribution(*GetMt19937Generator()) * 6 + 1);
1839 if (a > (R1 + R2) / R0 && a <= 1.0) {
1841 b = floor(ZeroOneDistribution(*GetMt19937Generator()) * 6 + 1);
1849 }
else if (KATT00 == 4 || KATT00 == -4 || KATT00 == 5 ||
1852 double R1 = RTEHQ11;
1853 double R2 = RTEHQ12;
1855 double a = ZeroOneDistribution(*GetMt19937Generator());
1862 b = floor(ZeroOneDistribution(*GetMt19937Generator()) * 6 + 1);
1883 double a = ZeroOneDistribution(*GetMt19937Generator());
1884 if (a <= R3 / R00) {
1891 if (a > R3 / R00 && a <= (R3 + R4) / R00) {
1894 b = floor(ZeroOneDistribution(*GetMt19937Generator()) * 6 + 1);
1899 if (KATT3 == KATT0) {
1906 if (a > (R3 + R4) / R00 && a <= (R3 + R4 + R5) / R00) {
1913 if (a > (R3 + R4 + R5) / R00 && a <= (R3 + R4 + R5 + R6) / R00) {
1917 b = floor(ZeroOneDistribution(*GetMt19937Generator()) * 3 + 1);
1921 KATT2 = -KATT0 / abs(KATT0) * vb[
b];
1922 if (abs(KATT2) == abs(KATT3)) {
1928 if (a > (R3 + R4 + R5 + R6) / R00 && a <= (R3 + R4 + R5 + R6 + R7) / R00) {
1936 if (a > (R3 + R4 + R5 + R6 + R7) / R00 && a <= 1.0) {
1948 double &E1,
double &E2,
int &iT1,
int &iT2,
int &iE1,
int &iE2,
1949 double &RTEg,
double &RTEg1,
double &RTEg2,
double &RTEg3,
1950 double &RTEq,
double &RTEq3,
double &RTEq4,
double &RTEq5,
1951 double &RTEq6,
double &RTEq7,
double &RTEq8,
double &RTEHQ,
1952 double &RTEHQ11,
double &RTEHQ12,
double &qhatTP) {
1955 (Rg1[iT2][iE1] - Rg1[iT1][iE1]) * (T - T1) / (T2 -
T1) + Rg1[iT1][iE1];
1957 (Rg1[iT2][iE2] - Rg1[iT1][iE2]) * (T - T1) / (T2 -
T1) + Rg1[iT1][iE2];
1958 RTEg1 = (RTE2 - RTE1) * (E - E1) / (E2 - E1) + RTE1;
1961 (Rg2[iT2][iE1] - Rg2[iT1][iE1]) * (T - T1) / (T2 -
T1) + Rg2[iT1][iE1];
1963 (Rg2[iT2][iE2] - Rg2[iT1][iE2]) * (T - T1) / (T2 -
T1) + Rg2[iT1][iE2];
1964 RTEg2 = (RTE2 - RTE1) * (E - E1) / (E2 - E1) + RTE1;
1967 (Rg3[iT2][iE1] - Rg3[iT1][iE1]) * (T - T1) / (T2 -
T1) + Rg3[iT1][iE1];
1969 (Rg3[iT2][iE2] - Rg3[iT1][iE2]) * (T - T1) / (T2 -
T1) + Rg3[iT1][iE2];
1970 RTEg3 = (RTE2 - RTE1) * (E - E1) / (E2 - E1) + RTE1;
1976 }
else if (KATT == 4 || KATT == -4 || KATT == 5 ||
1978 double RTE1 = (RHQ11[iT2][iE1] - RHQ11[iT1][iE1]) * (T - T1) / (T2 -
T1) +
1980 double RTE2 = (RHQ11[iT2][iE2] - RHQ11[iT1][iE2]) * (T - T1) / (T2 -
T1) +
1982 RTEHQ11 = (RTE2 - RTE1) * (E - E1) / (E2 - E1) + RTE1;
1984 RTE1 = (RHQ12[iT2][iE1] - RHQ12[iT1][iE1]) * (T - T1) / (T2 -
T1) +
1986 RTE2 = (RHQ12[iT2][iE2] - RHQ12[iT1][iE2]) * (T - T1) / (T2 -
T1) +
1988 RTEHQ12 = (RTE2 - RTE1) * (E - E1) / (E2 - E1) + RTE1;
1996 (Rq3[iT2][iE1] - Rq3[iT1][iE1]) * (T - T1) / (T2 -
T1) + Rq3[iT1][iE1];
1998 (Rq3[iT2][iE2] - Rq3[iT1][iE2]) * (T - T1) / (T2 -
T1) + Rq3[iT1][iE2];
1999 RTEq3 = (RTE2 - RTE1) * (E - E1) / (E2 - E1) + RTE1;
2002 (Rq4[iT2][iE1] - Rq4[iT1][iE1]) * (T - T1) / (T2 -
T1) + Rq4[iT1][iE1];
2004 (Rq4[iT2][iE2] - Rq4[iT1][iE2]) * (T - T1) / (T2 -
T1) + Rq4[iT1][iE2];
2005 RTEq4 = (RTE2 - RTE1) * (E - E1) / (E2 - E1) + RTE1;
2008 (Rq5[iT2][iE1] - Rq5[iT1][iE1]) * (T - T1) / (T2 -
T1) + Rq5[iT1][iE1];
2010 (Rq5[iT2][iE2] - Rq5[iT1][iE2]) * (T - T1) / (T2 -
T1) + Rq5[iT1][iE2];
2011 RTEq5 = (RTE2 - RTE1) * (E - E1) / (E2 - E1) + RTE1;
2014 (Rq6[iT2][iE1] - Rq6[iT1][iE1]) * (T - T1) / (T2 -
T1) + Rq6[iT1][iE1];
2016 (Rq6[iT2][iE2] - Rq6[iT1][iE2]) * (T - T1) / (T2 -
T1) + Rq6[iT1][iE2];
2017 RTEq6 = (RTE2 - RTE1) * (E - E1) / (E2 - E1) + RTE1;
2020 (Rq7[iT2][iE1] - Rq7[iT1][iE1]) * (T - T1) / (T2 -
T1) + Rq7[iT1][iE1];
2022 (Rq7[iT2][iE2] - Rq7[iT1][iE2]) * (T - T1) / (T2 -
T1) + Rq7[iT1][iE2];
2023 RTEq7 = (RTE2 - RTE1) * (E - E1) / (E2 - E1) + RTE1;
2026 (Rq8[iT2][iE1] - Rq8[iT1][iE1]) * (T - T1) / (T2 -
T1) + Rq8[iT1][iE1];
2028 (Rq8[iT2][iE2] - Rq8[iT1][iE2]) * (T - T1) / (T2 -
T1) + Rq8[iT1][iE2];
2029 RTEq8 = (RTE2 - RTE1) * (E - E1) / (E2 - E1) + RTE1;
2065 twlinear(KATT0, E, T, RTEg1, RTEg2, RTEq6, RTEq7, RTEq8);
2075 double a = ZeroOneDistribution(*GetMt19937Generator());
2076 if (a <= R1 / (R1 + R2)) {
2083 if (a > R1 / (R1 + R2)) {
2086 b = floor(ZeroOneDistribution(*GetMt19937Generator()) * 6 + 1);
2113 double R00 = R6 + R7 + R8;
2124 if (abs(KATT20) != abs(KATT00)) {
2131 if (KATT20 == KATT00) {
2137 if (KATT20 == -KATT00) {
2138 double a = ZeroOneDistribution(*GetMt19937Generator());
2139 if (a <= (R6) / R00) {
2143 b = floor(ZeroOneDistribution(*GetMt19937Generator()) * 3 + 1);
2147 KATT2 = -KATT0 / abs(KATT0) * vb[
b];
2148 if (abs(KATT2) == abs(KATT0)) {
2154 if (a > (R6) / R00 && a <= (R6 + R7) / R00) {
2161 if (a > (R6 + R7) / R00 && a <= 1.0) {
2175 double &RTEq6,
double &RTEq7,
double &RTEq8) {
2178 double dtemp = 0.02;
2179 int iT1 = floor((T - 0.1) / dtemp);
2181 int iE1 = floor(log(E) + 2);
2184 double T1 = 0.12 + (iT1 - 1) * 0.02;
2185 double T2 = T1 + dtemp;
2186 double E1 = exp(iE1 - 2.0);
2187 double E2 = exp(iE2 - 2.0);
2191 (Rg1[iT2][iE1] - Rg1[iT1][iE1]) * (T - T1) / (T2 -
T1) + Rg1[iT1][iE1];
2193 (Rg1[iT2][iE2] - Rg1[iT1][iE2]) * (T - T1) / (T2 -
T1) + Rg1[iT1][iE2];
2194 RTEg1 = (RTE2 - RTE1) * (E - E1) / (E2 - E1) + RTE1;
2197 (Rg2[iT2][iE1] - Rg2[iT1][iE1]) * (T - T1) / (T2 -
T1) + Rg2[iT1][iE1];
2199 (Rg2[iT2][iE2] - Rg2[iT1][iE2]) * (T - T1) / (T2 -
T1) + Rg2[iT1][iE2];
2200 RTEg2 = (RTE2 - RTE1) * (E - E1) / (E2 - E1) + RTE1;
2221 (Rq6[iT2][iE1] - Rq6[iT1][iE1]) * (T - T1) / (T2 -
T1) + Rq6[iT1][iE1];
2223 (Rq6[iT2][iE2] - Rq6[iT1][iE2]) * (T - T1) / (T2 -
T1) + Rq6[iT1][iE2];
2224 RTEq6 = (RTE2 - RTE1) * (E - E1) / (E2 - E1) + RTE1;
2227 (Rq7[iT2][iE1] - Rq7[iT1][iE1]) * (T - T1) / (T2 -
T1) + Rq7[iT1][iE1];
2229 (Rq7[iT2][iE2] - Rq7[iT1][iE2]) * (T - T1) / (T2 -
T1) + Rq7[iT1][iE2];
2230 RTEq7 = (RTE2 - RTE1) * (E - E1) / (E2 - E1) + RTE1;
2233 (Rq8[iT2][iE1] - Rq8[iT1][iE1]) * (T - T1) / (T2 -
T1) + Rq8[iT1][iE1];
2235 (Rq8[iT2][iE2] - Rq8[iT1][iE2]) * (T - T1) / (T2 -
T1) + Rq8[iT1][iE2];
2236 RTEq8 = (RTE2 - RTE1) * (E - E1) / (E2 - E1) + RTE1;
2243 double vv = sqrt(v[1] * v[1] + v[2] * v[2] + v[3] * v[3]);
2244 double ga = 1.0 / sqrt(1.0 - vv * vv);
2245 double ppar = p[1] * v[1] + p[2] * v[2] + p[3] * v[3];
2246 double gavv = (ppar * ga / (1.0 + ga) - p[0]) * ga;
2247 p[0] = ga * (p[0] - ppar);
2248 p[1] = p[1] + v[1] * gavv;
2249 p[2] = p[2] + v[2] * gavv;
2250 p[3] = p[3] + v[3] * gavv;
2254 double vv = sqrt(v[1] * v[1] + v[2] * v[2] + v[3] * v[3]);
2255 double ga = 1.0 / sqrt(1.0 - vv * vv);
2256 double ppar = p[1] * v[1] + p[2] * v[2] + p[3] * v[3];
2257 double gavv = (-ppar * ga / (1.0 + ga) - p[0]) * ga;
2258 p[0] = ga * (p[0] + ppar);
2259 p[1] = p[1] - v[1] * gavv;
2260 p[2] = p[2] - v[2] * gavv;
2261 p[3] = p[3] - v[3] * gavv;
2266 double p0[4],
double p2[4],
double p3[4],
double p4[4],
2319 double p0ex[4] = {0.0};
2321 int ct1_loop, ct2_loop, flag1, flag2;
2342 if(flag2 == 1 || ct1_loop > 1e6){
2353 xw = 15.0 * ZeroOneDistribution(*GetMt19937Generator());
2354 razim = 2.0 *
pi * ZeroOneDistribution(*GetMt19937Generator());
2355 rcos = 1.0 - 2.0 * ZeroOneDistribution(*GetMt19937Generator());
2356 rsin = sqrt(1.0 - rcos * rcos);
2359 p2[3] = p2[0] * rcos;
2360 p2[1] = p2[0] * rsin * cos(razim);
2361 p2[2] = p2[0] * rsin * sin(razim);
2367 2.0 * (p0[0] * p2[0] - p0[1] * p2[1] - p0[2] * p2[2] - p0[3] * p2[3]);
2373 tmax = ss - qhat0ud;
2377 rant = ZeroOneDistribution(*GetMt19937Generator());
2385 }
while ((tt < qhat0ud) || (tt > (ss - qhat0ud)));
2387 f1 = pow(xw, 3) / (exp(xw) - 1) / 1.4215;
2388 f2 = pow(xw, 3) / (exp(xw) + 1) / 1.2845;
2396 (3.0 - tmin * (ss - tmin) / pow(ss, 2) +
2397 (ss - tmin) * ss / pow(tmin, 2) + tmin * ss / pow((ss - tmin), 2));
2398 msq = pow((1.0 / p0[0] / p2[0] / 2.0), 2) *
2399 (3.0 - tt * uu / pow(ss, 2) + uu * ss / pow(tt, 2) +
2400 tt * ss / pow(uu, 2)) /
2406 mmax = 4.0 / pow(ss, 2) *
2407 (4.0 / 9.0 * (pow(tmin, 2) + pow((ss - tmin), 2)) / tmin /
2409 (pow(tmin, 2) + pow((ss - tmin), 2)) / pow(ss, 2));
2410 msq = pow((1.0 / p0[0] / p2[0] / 2.0), 2) *
2411 (4.0 / 9.0 * (pow(tt, 2) + pow(uu, 2)) / tt / uu -
2412 (pow(tt, 2) + pow(uu, 2)) / pow(ss, 2)) /
2418 if (((pow(ss, 2) + pow((ss - tmin), 2)) / pow(tmin, 2) +
2419 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmin), 2)) / ss / (ss - tmin)) >
2420 ((pow(ss, 2) + pow((ss - tmax), 2) / pow(tmax, 2) +
2421 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmax), 2)) / ss /
2425 ((pow(ss, 2) + pow((ss - tmin), 2)) / pow(tmin, 2) +
2426 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmin), 2)) / ss / (ss - tmin));
2430 ((pow(ss, 2) + pow((ss - tmax), 2)) / pow(tmax, 2) +
2431 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmax), 2)) / ss / (ss - tmax));
2434 msq = pow((1.0 / p0[0] / p2[0] / 2.0), 2) *
2435 ((pow(ss, 2) + pow(uu, 2)) / pow(tt, 2) +
2436 4.0 / 9.0 * (pow(ss, 2) + pow(uu, 2)) / ss / uu) /
2443 if (((pow(ss, 2) + pow((ss - tmin), 2)) / pow(tmin, 2) +
2444 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmin), 2)) / ss / (ss - tmin)) >
2445 ((pow(ss, 2) + pow((ss - tmax), 2) / pow(tmax, 2) +
2446 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmax), 2)) / ss /
2450 ((pow(ss, 2) + pow((ss - tmin), 2)) / pow(tmin, 2) +
2451 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmin), 2)) / ss / (ss - tmin));
2455 ((pow(ss, 2) + pow((ss - tmax), 2)) / pow(tmax, 2) +
2456 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmax), 2)) / ss / (ss - tmax));
2459 msq = pow((1.0 / p0[0] / p2[0] / 2.0), 2) *
2460 ((pow(ss, 2) + pow(uu, 2)) / pow(tt, 2) +
2461 4.0 / 9.0 * (pow(ss, 2) + pow(uu, 2)) / ss / uu) /
2467 mmax = 4.0 / pow(ss, 2) *
2468 (4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmin), 2)) / pow(tmin, 2));
2469 msq = pow((1.0 / p0[0] / p2[0] / 2.0), 2) *
2470 (4.0 / 9.0 * (pow(ss, 2) + pow(uu, 2)) / pow(tt, 2)) / mmax;
2475 mmax = 4.0 / pow(ss, 2) *
2476 (4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmin), 2)) / pow(tmin, 2) +
2477 (pow(ss, 2) + pow(tmin, 2)) / pow((ss - tmin), 2) -
2478 2.0 / 3.0 * pow(ss, 2) / tmin / (ss - tmin));
2479 msq = pow((1.0 / p0[0] / p2[0] / 2.0), 2) *
2481 ((pow(ss, 2) + pow(uu, 2)) / pow(tt, 2) +
2482 (pow(ss, 2) + pow(tt, 2)) / pow(uu, 2) -
2483 2.0 / 3.0 * pow(ss, 2) / tt / uu)) /
2489 mmax = 4.0 / pow(ss, 2) *
2490 (4.0 / 9.0 * (pow(tmin, 2) + pow((ss - tmin), 2)) / pow(ss, 2));
2491 msq = pow((1.0 / p0[0] / p2[0] / 2.0), 2) *
2492 (4.0 / 9.0 * (pow(tt, 2) + pow(uu, 2)) / pow(ss, 2)) / (mmax + 0.5);
2497 mmax = 4.0 / pow(ss, 2) *
2498 (4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmin), 2)) / pow(tmin, 2) +
2499 (pow(tmin, 2) + pow((ss - tmin), 2)) / pow(ss, 2) +
2500 2.0 / 3.0 * pow((ss - tmin), 2) / ss / tmin);
2501 msq = (pow((1.0 / p0[0] / p2[0] / 2.0), 2) *
2503 (((pow(ss, 2) + pow(uu, 2)) / pow(tt, 2)) +
2504 (pow(tt, 2) + pow(uu, 2)) / pow(ss, 2) +
2505 2.0 / 3.0 * pow(uu, 2) / ss / tt))) /
2511 mmax = 4.0 / pow(ss, 2) *
2512 (4.0 / 9.0 * (pow(tmin, 2) + pow((ss - tmin), 2)) / tmin /
2514 (pow(tmin, 2) + pow((ss - tmin), 2)) / pow(ss, 2));
2515 msq = pow((1.0 / p0[0] / p2[0] / 2.0), 2) *
2516 (4.0 / 9.0 * (pow(tt, 2) + pow(uu, 2)) / tt / uu -
2517 (pow(tt, 2) + pow(uu, 2)) / pow(ss, 2)) /
2521 rank = ZeroOneDistribution(*GetMt19937Generator());
2522 }
while (rank > (msq * ff));
2524 if(flag1 == 1 || flag2 == 1){
2547 vc[1] = (p0[1] + p2[1]) / (p0[0] + p2[0]);
2548 vc[2] = (p0[2] + p2[2]) / (p0[0] + p2[0]);
2549 vc[3] = (p0[3] + p2[3]) / (p0[0] + p2[0]);
2563 double ranp = 2.0 *
pi * ZeroOneDistribution(*GetMt19937Generator());
2567 qt = sqrt(pow(pcm, 2) - pow((tt / 2.0 / pcm - pcm), 2));
2568 double qx = qt * cos(ranp);
2569 double qy = qt * sin(ranp);
2574 double qpar = tt / 2.0 / pcm;
2578 double upt = sqrt(p2[1] * p2[1] + p2[2] * p2[2]) / p2[0];
2579 double upx = p2[1] / p2[0];
2580 double upy = p2[2] / p2[0];
2581 double upz = p2[3] / p2[0];
2585 p2[1] = p2[1] - qpar * upx;
2586 p2[2] = p2[2] - qpar * upy;
2588 p2[1] = p2[1] + (upz * upx * qy + upy * qx) / upt;
2589 p2[2] = p2[2] + (upz * upy * qy - upx * qx) / upt;
2591 p2[3] = p2[3] - qpar * upz - upt * qy;
2608 rotate(p4[1], p4[2], p4[3], p0, 1);
2609 qt = sqrt(pow(p0[1], 2) + pow(p0[2], 2));
2610 rotate(p4[1], p4[2], p4[3], p0, -1);
2634 double p0[4],
double p2[4],
double p3[4],
double p4[4],
2668 double e2, theta2, theta4, phi24;
2669 double e1, e4, p1, cosTheta24, downFactor,
2671 double HQmass, fBmax, fFmax, fB, fF, maxValue;
2672 int index_p1, index_T, index_e2;
2673 int ct1_loop, ct2_loop, flag1, flag2;
2680 HQmass = p0[0] * p0[0] - p0[1] * p0[1] - p0[2] * p0[2] - p0[3] * p0[3];
2681 if (HQmass > 1
e-12) {
2682 HQmass = sqrt(HQmass);
2696 p1 = sqrt(p0[1] * p0[1] + p0[2] * p0[2] + p0[3] * p0[3]);
2697 index_p1 = (int)((p1 - min_p1) / bin_p1);
2698 index_T = (int)((temp - min_T) / bin_T);
2699 if (index_p1 >= N_p1) {
2700 index_p1 = N_p1 - 1;
2701 cout <<
"warning: p1 is over p_max: " << p1 << endl;
2703 if (index_T >= N_T) {
2705 cout <<
"warning: T is over T_max: " << temp << endl;
2709 cout <<
"warning: T is below T_min: " << temp << endl;
2712 fBmax = distFncBM[index_T][index_p1];
2713 fFmax = distFncFM[index_T][index_p1];
2720 if (ct1_loop > 1e6) {
2725 xw = max_e2 * ZeroOneDistribution(*GetMt19937Generator());
2726 index_e2 = (int)((xw - min_e2) / bin_e2);
2727 if (index_e2 >= N_e2)
2728 index_e2 = N_e2 - 1;
2730 ff = distFncF[index_T][index_p1][index_e2] / fFmax;
2731 maxValue = distMaxF[index_T][index_p1][index_e2];
2732 }
else if (CT == 12) {
2733 ff = distFncB[index_T][index_p1][index_e2] / fBmax;
2734 maxValue = distMaxB[index_T][index_p1][index_e2];
2736 cout <<
"Wrong HQ channel ID" << endl;
2739 }
while (ZeroOneDistribution(*GetMt19937Generator()) > ff);
2748 if (ct2_loop > 1e6) {
2749 cout <<
"cannot sample final states for HQ scattering ..." << endl;
2754 theta2 =
pi * ZeroOneDistribution(*GetMt19937Generator());
2755 theta4 =
pi * ZeroOneDistribution(*GetMt19937Generator());
2756 phi24 = 2.0 *
pi * ZeroOneDistribution(*GetMt19937Generator());
2759 sin(theta2) * sin(theta4) * cos(phi24) + cos(theta2) * cos(theta4);
2760 downFactor = e1 - p1 * cos(theta4) + e2 - e2 * cosTheta24;
2761 e4 = (e1 * e2 - p1 * e2 * cos(theta2)) / downFactor;
2762 sigFactor = sin(theta2) * sin(theta4) * e2 * e4 / downFactor;
2765 ss = 2.0 * e1 * e2 + HQmass * HQmass - 2.0 * p1 * e2 * cos(theta2);
2766 tt = -2.0 * e2 * e4 * (1.0 - cosTheta24);
2767 uu = 2.0 * HQmass * HQmass - ss - tt;
2770 if (ss <= 2.0 * qhat0ud || tt >= -qhat0ud || uu >= -qhat0ud) {
2771 rank = ZeroOneDistribution(*GetMt19937Generator());
2779 (1.0 / (exp(e2 / temp) + 1.0)) * (1.0 - 1.0 / (exp(e4 / temp) + 1.0));
2780 sigFactor = sigFactor *
ff;
2781 msq = Mqc2qc(ss, tt, HQmass) / maxValue;
2786 (1.0 / (exp(e2 / temp) - 1.0)) * (1.0 + 1.0 / (exp(e4 / temp) - 1.0));
2787 sigFactor = sigFactor *
ff;
2788 msq = Mgc2gc(ss, tt, HQmass) / maxValue;
2791 rank = ZeroOneDistribution(*GetMt19937Generator());
2793 }
while (rank > (msq * sigFactor));
2795 if (flag1 == 0 && flag2 == 0) {
2798 p3[1] = e2 * sin(theta2);
2800 p3[3] = e2 * cos(theta2);
2806 p2[1] = e4 * sin(theta4) * cos(phi24);
2807 p2[2] = e4 * sin(theta4) * sin(phi24);
2808 p2[3] = e4 * cos(theta4);
2812 double th_rotate = 2.0 *
pi * ZeroOneDistribution(*GetMt19937Generator());
2813 double p3x_rotate = p3[1] * cos(th_rotate) - p3[2] * sin(th_rotate);
2814 double p3y_rotate = p3[1] * sin(th_rotate) + p3[2] * cos(th_rotate);
2815 double p2x_rotate = p2[1] * cos(th_rotate) - p2[2] * sin(th_rotate);
2816 double p2y_rotate = p2[1] * sin(th_rotate) + p2[2] * cos(th_rotate);
2823 rotate(p4[1], p4[2], p4[3], p2, -1);
2824 rotate(p4[1], p4[2], p4[3], p3, -1);
2826 p0[1] = p4[1] + p3[1] - p2[1];
2827 p0[2] = p4[2] + p3[2] - p2[2];
2828 p0[3] = p4[3] + p3[3] - p2[3];
2830 sqrt(p0[1] * p0[1] + p0[2] * p0[2] + p0[3] * p0[3] + HQmass * HQmass);
2833 if (fabs(p0[0] + p2[0] - p3[0] - p4[0]) > 0.00001) {
2834 cout <<
"Violation of energy conservation in HQ 2->2 scattering: "
2835 << fabs(p0[0] + p2[0] - p3[0] - p4[0]) << endl;
2839 rotate(p4[1], p4[2], p4[3], p0, 1);
2840 qt = sqrt(pow(p0[1], 2) + pow(p0[2], 2));
2841 rotate(p4[1], p4[2], p4[3], p0, -1);
2879 vc[1] = (p0[1] + p2[1]) / (p0[0] + p2[0]);
2880 vc[2] = (p0[2] + p2[2]) / (p0[0] + p2[0]);
2881 vc[3] = (p0[3] + p2[3]) / (p0[0] + p2[0]);
2904 double ss = 4.0 * pow(pcm, 2);
2906 double tmin = qhat0ud;
2907 double tmid = ss / 2.0;
2908 double tmax = ss - qhat0ud;
2934 rant = ZeroOneDistribution(*GetMt19937Generator());
2937 if ((tt < qhat0ud) || (tt > (ss - qhat0ud)))
2948 mmax = 3.0 - tmin * (ss - tmin) / pow(ss, 2) +
2949 (ss - tmin) * ss / pow(tmin, 2) + tmin * ss / pow((ss - tmin), 2);
2950 msq = (3.0 - tt * uu / pow(ss, 2) + uu * ss / pow(tt, 2) +
2951 tt * ss / pow(uu, 2)) /
2959 mmax = 4.0 / 9.0 * (pow(tmin, 2) + pow((ss - tmin), 2)) / tmin /
2961 (pow(tmin, 2) + pow((ss - tmin), 2)) / pow(ss, 2);
2962 msq = (4.0 / 9.0 * (pow(tt, 2) + pow(uu, 2)) / tt / uu -
2963 (pow(tt, 2) + pow(uu, 2)) / pow(ss, 2)) /
2971 if (((pow(ss, 2) + pow((ss - tmin), 2)) / pow(tmin, 2) +
2972 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmin), 2)) / ss / (ss - tmin)) >
2973 ((pow(ss, 2) + pow((ss - tmax), 2) / pow(tmax, 2) +
2974 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmax), 2)) / ss /
2977 (pow(ss, 2) + pow((ss - tmin), 2)) / pow(tmin, 2) +
2978 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmin), 2)) / ss / (ss - tmin);
2982 ((pow(ss, 2) + pow((ss - tmax), 2)) / pow(tmax, 2) +
2983 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmax), 2)) / ss / (ss - tmax));
2986 msq = ((pow(ss, 2) + pow(uu, 2)) / pow(tt, 2) +
2987 4.0 / 9.0 * (pow(ss, 2) + pow(uu, 2)) / ss / uu) /
2995 if (((pow(ss, 2) + pow((ss - tmin), 2)) / pow(tmin, 2) +
2996 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmin), 2)) / ss / (ss - tmin)) >
2997 ((pow(ss, 2) + pow((ss - tmax), 2) / pow(tmax, 2) +
2998 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmax), 2)) / ss /
3001 (pow(ss, 2) + pow((ss - tmin), 2)) / pow(tmin, 2) +
3002 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmin), 2)) / ss / (ss - tmin);
3006 ((pow(ss, 2) + pow((ss - tmax), 2)) / pow(tmax, 2) +
3007 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmax), 2)) / ss / (ss - tmax));
3010 msq = ((pow(ss, 2) + pow(uu, 2)) / pow(tt, 2) +
3011 4.0 / 9.0 * (pow(ss, 2) + pow(uu, 2)) / ss / uu) /
3020 mmax = 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmin), 2)) / pow(tmin, 2);
3021 msq = (4.0 / 9.0 * (pow(ss, 2) + pow(uu, 2)) / pow(tt, 2)) / mmax;
3028 mmax = 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmin), 2)) / pow(tmin, 2) +
3029 (pow(ss, 2) + pow(tmin, 2)) / pow((ss - tmin), 2) -
3030 2.0 / 3.0 * pow(ss, 2) / tmin / (ss - tmin);
3032 ((pow(ss, 2) + pow(uu, 2)) / pow(tt, 2) +
3033 (pow(ss, 2) + pow(tt, 2)) / pow(uu, 2) -
3034 2.0 / 3.0 * pow(ss, 2) / tt / uu)) /
3042 mmax = 4.0 / 9.0 * (pow(tmin, 2) + pow((ss - tmin), 2)) / pow(ss, 2);
3043 msq = (4.0 / 9.0 * (pow(tt, 2) + pow(uu, 2)) / pow(ss, 2)) / (mmax + 0.5);
3050 mmax = 4.0 / 9.0 * (pow(ss, 2) + pow((ss - tmin), 2)) / pow(tmin, 2) +
3051 (pow(tmin, 2) + pow((ss - tmin), 2)) / pow(ss, 2) +
3052 2.0 / 3.0 * pow((ss - tmin), 2) / ss / tmin;
3054 (((pow(ss, 2) + pow(uu, 2)) / pow(tt, 2)) +
3055 (pow(tt, 2) + pow(uu, 2)) / pow(ss, 2) +
3056 2.0 / 3.0 * pow(uu, 2) / ss / tt)) /
3064 mmax = 4.0 / 9.0 * (pow(tmin, 2) + pow((ss - tmin), 2)) / tmin /
3066 (pow(tmin, 2) + pow((ss - tmin), 2)) / pow(ss, 2);
3067 msq = (4.0 / 9.0 * (pow(tt, 2) + pow(uu, 2)) / tt / uu -
3068 (pow(tt, 2) + pow(uu, 2)) / pow(ss, 2)) /
3073 rank = ZeroOneDistribution(*GetMt19937Generator());
3075 }
while (rank > msq);
3080 if ((tt > qhat0ud) && (tt < (ss - qhat0ud))) {
3082 ranp = 2.0 *
pi * ZeroOneDistribution(*GetMt19937Generator());
3086 qt = sqrt(pow(pcm, 2) - pow((tt / 2.0 / pcm - pcm), 2));
3087 qx = qt * cos(ranp);
3088 qy = qt * sin(ranp);
3093 qpar = tt / 2.0 / pcm;
3097 upt = sqrt(p2[1] * p2[1] + p2[2] * p2[2]) / p2[0];
3098 upx = p2[1] / p2[0];
3099 upy = p2[2] / p2[0];
3100 upz = p2[3] / p2[0];
3105 p2[1] = p2[1] - qpar * upx;
3106 p2[2] = p2[2] - qpar * upy;
3108 p2[1] = p2[1] + (upz * upx * qy + upy * qx) / upt;
3109 p2[2] = p2[2] + (upz * upy * qy - upx * qx) / upt;
3111 p2[3] = p2[3] - qpar * upz - upt * qy;
3132 double p0[4],
double p2[4],
double p3[4],
double p4[4],
3133 double qt,
int &ic,
double Tdiff,
double HQenergy,
3134 double max_Ng,
double xLow,
double xInt) {
3146 double randomX, randomY;
3147 int count_sample, nloopOut, flagOut;
3148 double theta_gluon, kperp_gluon;
3150 double zDirection[4];
3152 sqrt(p0[0] * p0[0] - p0[1] * p0[1] - p0[2] * p0[2] - p0[3] * p0[3]);
3160 if (abs(parID) != 4 && abs(parID) != 5) {
3163 sqrt(p0[1] * p0[1] + p0[2] * p0[2] + p0[3] * p0[3] + HQmass * HQmass);
3180 if (p0[0] < 2.0 * sqrt(qhat0ud)) {
3186 zDirection[1] = p0[1];
3187 zDirection[2] = p0[2];
3188 zDirection[3] = p0[3];
3189 zDirection[0] = p0[0];
3191 rotate(zDirection[1], zDirection[2], zDirection[3], p2,
3198 randomX = xLow + xInt * ZeroOneDistribution(*GetMt19937Generator());
3199 randomY = ZeroOneDistribution(*GetMt19937Generator());
3200 }
while (tau_f(randomX, randomY, HQenergy, HQmass) < 1.0 /
pi / temp_med);
3203 while (max_Ng * ZeroOneDistribution(*GetMt19937Generator()) > dNg_over_dxdydt(parID, randomX, randomY,
3204 HQenergy, HQmass, temp_med,
3206 count_sample = count_sample + 1;
3207 if (count_sample > 1
e+5) {
3219 randomX = xLow + xInt * ZeroOneDistribution(*GetMt19937Generator());
3220 randomY = ZeroOneDistribution(*GetMt19937Generator());
3221 }
while (tau_f(randomX, randomY, HQenergy, HQmass) < 1.0 /
pi / temp_med);
3224 if (parID == 21 && randomX > 0.5)
3225 randomX = 1.0 - randomX;
3226 theta_gluon = 2.0 *
pi * ZeroOneDistribution(*GetMt19937Generator());
3227 kperp_gluon = randomX * randomY * HQenergy;
3228 kpGluon[1] = kperp_gluon * cos(theta_gluon);
3229 kpGluon[2] = kperp_gluon * sin(theta_gluon);
3230 kpGluon[3] = randomX * HQenergy * sqrt(1.0 - randomY * randomY);
3231 kpGluon[0] = sqrt(kpGluon[1] * kpGluon[1] + kpGluon[2] * kpGluon[2] +
3232 kpGluon[3] * kpGluon[3]);
3235 if (kpGluon[0] > (HQenergy - HQmass)) {
3256 double sp1z = sqrt(p0[1] * p0[1] + p0[2] * p0[2] + p0[3] * p0[3]);
3258 double sp2x = p2[1];
3259 double sp2y = p2[2];
3260 double sp2z = p2[3];
3265 double sqx, sqy, sqzA, sq0A, sqzB, sq0B, sqz, sq0, sqtheta;
3266 double sAA, sBB, sCC, aaa, bbb, ccc, abc, abc2;
3273 sqtheta = 2.0 *
pi * ZeroOneDistribution(*GetMt19937Generator());
3274 sqx = qt * cos(sqtheta);
3275 sqy = qt * sin(sqtheta);
3276 sAA = (sE1 + sE2 - sk0) / (sp1z + sp2z - skz);
3278 (pow(sE2, 2) - pow((sE1 - sk0), 2) + pow((sp1x - sqx - skx), 2) +
3279 pow((sp1y - sqy - sky), 2) + pow((sp1z - skz), 2) + pow(HQmass, 2) -
3280 pow((sp2x + sqx), 2) - pow((sp2y + sqy), 2) - pow(sp2z, 2)) /
3281 2.0 / (sp1z + sp2z - skz);
3282 aaa = sAA * sAA - 1.0;
3283 bbb = 2.0 * (sAA * sp2z + sAA * sBB - sE2);
3284 ccc = pow((sp2x + sqx), 2) + pow((sp2y + sqy), 2) + sp2z * sp2z +
3285 2.0 * sp2z * sBB + sBB * sBB - sE2 * sE2;
3286 abc2 = bbb * bbb - 4.0 * aaa * ccc;
3296 sq0A = (-bbb + abc) / 2.0 / aaa;
3297 sq0B = (-bbb - abc) / 2.0 / aaa;
3298 sqzA = sAA * sq0A + sBB;
3299 sqzB = sAA * sq0B + sBB;
3302 if (sq0A * sq0A - sqx * sqx - sqy * sqy - sqzA * sqzA < 0 &&
3303 sE1 - sq0A - sk0 > HQmass && sE2 + sq0A > 0) {
3308 if (sq0B * sq0B - sqx * sqx - sqy * sqy - sqzB * sqzB < 0 &&
3309 sE1 - sq0B - sk0 > HQmass && sE2 + sq0B > 0) {
3316 if (yesA == 0 && yesB == 0) {
3320 }
else if (yesA == 1 && yesB == 1) {
3322 if (abs(sq0A) < abs(sq0B)) {
3329 }
else if (yesA == 1) {
3340 }
while (flagDone == 0 && nloop1 < loopN && nloop2 < loopN);
3342 if (flagDone == 0) {
3348 p0[0] = sE1 - sq0 - sk0;
3349 p0[1] = sp1x - sqx - skx;
3350 p0[2] = sp1y - sqy - sky;
3351 p0[3] = sp1z - sqz - skz;
3361 rotate(zDirection[1], zDirection[2], zDirection[3], p0,
3363 rotate(zDirection[1], zDirection[2], zDirection[3], p2,
3365 rotate(zDirection[1], zDirection[2], zDirection[3], p4,
3372 if (p00[0] + p3[0] - p0[0] - p2[0] - p4[0] > 0.01) {
3373 JSINFO <<
MAGENTA <<
"Violation of energy-momentum conservation: "
3374 << p00[0] + p3[0] - p0[0] - p2[0] - p4[0] <<
" "
3375 << p00[1] + p3[1] - p0[1] - p2[1] - p4[1] <<
" "
3376 << p00[2] + p3[2] - p0[2] - p2[2] - p4[2] <<
" "
3377 << p00[3] + p3[3] - p0[3] - p2[3] - p4[3];
3382 if (abs(p0[0] * p0[0] - p0[1] * p0[1] - p0[2] * p0[2] - p0[3] * p0[3] -
3383 HQmass * HQmass) > 0.01 ||
3384 abs(p2[0] * p2[0] - p2[1] * p2[1] - p2[2] * p2[2] - p2[3] * p2[3]) >
3386 cout <<
"Wrong solution -- not on shell"
3387 <<
" " << sE1 <<
" " << sp1x <<
" " << sp1y <<
" " << sp1z
3388 <<
" " << sE2 <<
" " << sp2x <<
" " << sp2y <<
" " << sp2z
3389 <<
" " << sk0 <<
" " << skx <<
" " << sky <<
" " << skz <<
" "
3390 << sq0 <<
" " << sqx <<
" " << sqy <<
" " << sqz << endl;
3391 cout << abs(p0[0] * p0[0] - p0[1] * p0[1] - p0[2] * p0[2] -
3392 p0[3] * p0[3] - HQmass * HQmass)
3394 << abs(p2[0] * p2[0] - p2[1] * p2[1] - p2[2] * p2[2] -
3396 <<
" " << HQmass << endl;
3402 }
while (flagOut == 0 && nloopOut < loopN);
3411 double P3[4],
double P4[4],
double Pj0[4],
int &ic,
3412 double Tdiff,
double HQenergy,
double max_Ng,
3413 double temp_med,
double xLow,
double xInt) {
3426 double randomX, randomY;
3427 int count_sample, nloopOut, flagOut;
3428 double theta_gluon, kperp_gluon;
3431 sqrt(P3[0] * P3[0] - P3[1] * P3[1] - P3[2] * P3[2] - P3[3] * P3[3]);
3433 if (abs(parID) != 4 && abs(parID) != 5) {
3435 P3[0] = sqrt(P3[1] * P3[1] + P3[2] * P3[2] + P3[3] * P3[3]);
3438 double P50[4] = {0.0};
3439 double P2i[4] = {0.0};
3440 double P3i[4] = {0.0};
3444 for (
int i = 0;
i <= 3;
i++) {
3454 xInt = (P3[0] - HQmass) / HQenergy - xLow;
3460 double px0 = P2[1] + P3[1];
3461 double py0 = P2[2] + P3[2];
3462 double pz0 = P2[3] + P3[3];
3465 rotate(px0, py0, pz0, P3, 1);
3466 rotate(px0, py0, pz0, P2, 1);
3467 rotate(px0, py0, pz0, Pj0, 1);
3469 for (
int i = 0;
i <= 3;
i++) {
3470 P50[
i] = P2[
i] + P3[
i];
3480 randomX = xLow + xInt * ZeroOneDistribution(*GetMt19937Generator());
3481 randomY = ZeroOneDistribution(*GetMt19937Generator());
3482 }
while (tau_f(randomX, randomY, HQenergy, HQmass) < 1.0 /
pi / temp_med);
3485 while (max_Ng * ZeroOneDistribution(*GetMt19937Generator()) > dNg_over_dxdydt(parID, randomX, randomY,
3486 HQenergy, HQmass, temp_med,
3488 count_sample = count_sample + 1;
3489 if (count_sample > 1
e+5) {
3501 randomX = xLow + xInt * ZeroOneDistribution(*GetMt19937Generator());
3502 randomY = ZeroOneDistribution(*GetMt19937Generator());
3503 }
while (tau_f(randomX, randomY, HQenergy, HQmass) < 1.0 /
pi / temp_med);
3506 if (parID == 21 && randomX > 0.5)
3507 randomX = 1.0 - randomX;
3508 theta_gluon = 2.0 *
pi * ZeroOneDistribution(*GetMt19937Generator());
3509 kperp_gluon = randomX * randomY * HQenergy;
3510 kpGluon[1] = kperp_gluon * cos(theta_gluon);
3511 kpGluon[2] = kperp_gluon * sin(theta_gluon);
3512 kpGluon[3] = randomX * HQenergy * sqrt(1.0 - randomY * randomY);
3513 kpGluon[0] = sqrt(kpGluon[1] * kpGluon[1] + kpGluon[2] * kpGluon[2] +
3514 kpGluon[3] * kpGluon[3]);
3516 rotate(Pj0[1], Pj0[2], Pj0[3], kpGluon, -1);
3546 double sp0z = sqrt(P50[1] * P50[1] + P50[2] * P50[2] + P50[3] * P50[3]);
3547 double sk10 = P2[0];
3548 double sk1zOld = P2[3];
3549 double sk1z, sk1p, sk1x, sk1y, sktheta;
3550 double sp10 = P3[0];
3551 double sk20 = P4[0];
3552 double sk2x = P4[1];
3553 double sk2y = P4[2];
3554 double sk2z = P4[3];
3555 double sk2p = sqrt(sk2x * sk2x + sk2y * sk2y);
3557 double stheta12, cos12Min2;
3558 double sAA, aaa, bbb, ccc, abc, abc2;
3559 double sk1z1, sk1z2, sk1p1, sk1p2;
3565 sAA = sk10 * sk10 + sk2p * sk2p + sp0z * sp0z + sk2z * sk2z -
3566 2.0 * sp0z * sk2z + HQmass * HQmass - (sp10 - sk20) * (sp10 - sk20);
3568 (sAA * sAA / 4.0 / sk10 / sk10 - (sp0z - sk2z) * (sp0z - sk2z)) / sk2p /
3572 if (cos12Min2 > 1.0) {
3580 stheta12 = 2.0 *
pi * ZeroOneDistribution(*GetMt19937Generator());
3581 aaa = 4.0 * ((sp0z - sk2z) * (sp0z - sk2z) +
3582 sk2p * sk2p * cos(stheta12) * cos(stheta12));
3583 bbb = -4.0 * sAA * (sp0z - sk2z);
3585 4.0 * sk10 * sk10 * sk2p * sk2p * cos(stheta12) * cos(stheta12);
3587 abc2 = bbb * bbb - 4.0 * aaa * ccc;
3597 sk1z1 = (-bbb + abc) / 2.0 / aaa;
3598 sk1z2 = (-bbb - abc) / 2.0 / aaa;
3599 sk1p1 = sqrt(sk10 * sk10 - sk1z1 * sk1z1);
3600 sk1p2 = sqrt(sk10 * sk10 - sk1z2 * sk1z2);
3605 if (2.0 * sk1p1 * sk2p * cos(stheta12) - 2.0 * (sp0z - sk2z) * sk1z1 +
3608 sk10 > abs(sk1z1) &&
3609 sp10 * sp10 - (sp0z - sk1z1) * (sp0z - sk1z1) -
3610 (sk10 * sk10 - sk1z1 * sk1z1) >
3616 if (2.0 * sk1p2 * sk2p * cos(stheta12) - 2.0 * (sp0z - sk2z) * sk1z2 +
3619 sk10 > abs(sk1z2) &&
3620 sp10 * sp10 - (sp0z - sk1z2) * (sp0z - sk1z2) -
3621 (sk10 * sk10 - sk1z2 * sk1z2) >
3629 if (yesA == 0 && yesB == 0) {
3633 }
else if (yesA == 1 && yesB == 1) {
3635 if (abs(sk1z1 - sk1zOld) < abs(sk1z2 - sk1zOld)) {
3640 }
else if (yesA == 1) {
3650 sk1p = sqrt(sk10 * sk10 - sk1z * sk1z);
3653 }
while (flagDone == 0 && nloop1 < loopN && nloop2 < loopN);
3655 if (flagDone == 0) {
3661 sktheta = atan2(sk2y, sk2x);
3662 sktheta = sktheta + stheta12;
3663 sk1p = sqrt(sk10 * sk10 - sk1z * sk1z);
3664 sk1x = sk1p * cos(sktheta);
3665 sk1y = sk1p * sin(sktheta);
3672 P3[0] = sp10 - sk20;
3673 P3[1] = -sk1x - sk2x;
3674 P3[2] = -sk1y - sk2y;
3675 P3[3] = sp0z - sk1z - sk2z;
3679 rotate(px0, py0, pz0, P2, -1);
3680 rotate(px0, py0, pz0, P3, -1);
3681 rotate(px0, py0, pz0, P4, -1);
3682 rotate(px0, py0, pz0, Pj0, -1);
3692 if (abs(P2[0] * P2[0] - P2[1] * P2[1] - P2[2] * P2[2] - P2[3] * P2[3]) >
3694 abs(P3[0] * P3[0] - P3[1] * P3[1] - P3[2] * P3[2] - P3[3] * P3[3] -
3695 HQmass * HQmass) > 0.01 ||
3696 abs(P4[0] * P4[0] - P4[1] * P4[1] - P4[2] * P4[2] - P4[3] * P4[3]) >
3698 cout <<
"Wrong solution -- not on shell"
3699 <<
" " << sk10 <<
" " << sk1x <<
" " << sk1y <<
" " << sk1z
3700 <<
" " << sk20 <<
" " << sk2x <<
" " << sk2y <<
" " << sk2z
3701 <<
" " << stheta12 <<
" " << sp10 <<
" " << sp10 - sk20 <<
" "
3702 << -sk1x - sk2x <<
" " << -sk1y - sk2y <<
" " << sp0z <<
" "
3703 << sp0z - sk1z - sk2z <<
" " << HQmass <<
" "
3704 << pow(sp10 - sk20, 2) - pow(sk1x + sk2x, 2) -
3705 pow(sk1y + sk2y, 2) - pow(sp0z - sk1z - sk2z, 2) -
3708 cout << abs(P2[0] * P2[0] - P2[1] * P2[1] - P2[2] * P2[2] -
3711 << abs(P3[0] * P3[0] - P3[1] * P3[1] - P3[2] * P3[2] -
3712 P3[3] * P3[3] - HQmass * HQmass)
3714 << abs(P4[0] * P4[0] - P4[1] * P4[1] - P4[2] * P4[2] -
3724 for (
int i = 0;
i <= 3;
i++) {
3725 if (ic == 0 && abs(P2i[
i] + P3i[
i] - P2[
i] - P3[
i] - P4[
i]) > 0.01) {
3726 cout <<
"Warning: Violation of E.M. conservation! " << i <<
" "
3727 << abs(P2i[i] + P3i[i] - P2[i] - P3[i] - P4[i]) << endl;
3733 abs(P2[0] * P2[0] - P2[1] * P2[1] - P2[2] * P2[2] - P2[3] * P2[3]);
3734 double shell3 = abs(P3[0] * P3[0] - P3[1] * P3[1] - P3[2] * P3[2] -
3735 P3[3] * P3[3] - HQmass * HQmass);
3737 abs(P4[0] * P4[0] - P4[1] * P4[1] - P4[2] * P4[2] - P4[3] * P4[3]);
3738 if (ic == 0 && (shell2 > 0.01 || shell3 > 0.01 || shell4 > 0.01)) {
3739 cout <<
"Warning: Violation of on-shell: " << shell2 <<
" " << shell3
3740 <<
" " << shell4 << endl;
3744 }
while (flagOut == 0 && nloopOut < loopN);
3751 void LBT::rotate(
double px,
double py,
double pz,
double pr[4],
int icc) {
3757 double wx, wy, wz,
E,
pt, w, cosa, sina, cosb, sinb;
3758 double wx1, wy1, wz1;
3764 E = sqrt(px * px + py * py + pz * pz);
3765 pt = sqrt(px * px + py * py);
3767 w = sqrt(wx * wx + wy * wy + wz * wz);
3781 wx1 = wx * cosb * cosa + wy * cosb * sina - wz * sinb;
3782 wy1 = -wx * sina + wy * cosa;
3783 wz1 = wx * sinb * cosa + wy * sinb * sina + wz * cosb;
3787 wx1 = wx * cosa * cosb - wy * sina + wz * cosa * sinb;
3788 wy1 = wx * sina * cosb + wy * cosa + wz * sina * sinb;
3789 wz1 = -wx * sinb + wz * cosb;
3811 double KKPoisson = 0;
3812 target = exp(-alambda);
3813 p = ZeroOneDistribution(*GetMt19937Generator());
3815 while (p > target) {
3816 p = p * ZeroOneDistribution(*GetMt19937Generator());
3817 KKPoisson = KKPoisson + 1;
3823 double &temp_med,
double &HQenergy,
double &max_Ng) {
3826 int time_num, temp_num, HQenergy_num;
3828 double rate_EGrid_low, rate_EGrid_high, max_EGrid_low, max_EGrid_high;
3829 double rate_T1E1, rate_T1E2, rate_T2E1, rate_T2E2, max_T1E1, max_T1E2,
3832 if (time_gluon > t_max) {
3833 cout <<
"accumulated time exceeds t_max" << endl;
3834 cout << time_gluon <<
" " << temp_med <<
" " << HQenergy << endl;
3850 if (temp_med < temp_min) {
3851 cout <<
"temperature drops below temp_min" << endl;
3852 cout << time_gluon <<
" " << temp_med <<
" " << HQenergy << endl;
3853 temp_med = temp_min;
3856 if(time_gluon < t_max_1) {
3857 time_num = (int)(time_gluon / delta_tg_1 + 0.5) + 1;
3859 time_num = (int)((time_gluon - t_max_1) / delta_tg_2 + 0.5) + t_gn_1 + 1;
3863 temp_num = (int)((temp_med - temp_min) / delta_temp);
3864 HQenergy_num = (int)(HQenergy / delta_HQener);
3865 if (HQenergy_num >= HQener_gn)
3866 HQenergy_num = HQener_gn - 1;
3867 if (temp_num >= temp_gn)
3868 temp_num = temp_gn - 1;
3871 rate_T1E1 = dNg_over_dt_g[time_num][temp_num][HQenergy_num];
3872 rate_T1E2 = dNg_over_dt_g[time_num][temp_num][HQenergy_num + 1];
3873 rate_T2E1 = dNg_over_dt_g[time_num][temp_num + 1][HQenergy_num];
3874 rate_T2E2 = dNg_over_dt_g[time_num][temp_num + 1][HQenergy_num + 1];
3875 max_T1E1 = max_dNgfnc_g[time_num][temp_num][HQenergy_num];
3876 max_T1E2 = max_dNgfnc_g[time_num][temp_num][HQenergy_num + 1];
3877 max_T2E1 = max_dNgfnc_g[time_num][temp_num + 1][HQenergy_num];
3878 max_T2E2 = max_dNgfnc_g[time_num][temp_num + 1][HQenergy_num + 1];
3879 }
else if (abs(parID) == 4 || abs(parID) == 5) {
3880 rate_T1E1 = dNg_over_dt_c[time_num][temp_num][HQenergy_num];
3881 rate_T1E2 = dNg_over_dt_c[time_num][temp_num][HQenergy_num + 1];
3882 rate_T2E1 = dNg_over_dt_c[time_num][temp_num + 1][HQenergy_num];
3883 rate_T2E2 = dNg_over_dt_c[time_num][temp_num + 1][HQenergy_num + 1];
3884 max_T1E1 = max_dNgfnc_c[time_num][temp_num][HQenergy_num];
3885 max_T1E2 = max_dNgfnc_c[time_num][temp_num][HQenergy_num + 1];
3886 max_T2E1 = max_dNgfnc_c[time_num][temp_num + 1][HQenergy_num];
3887 max_T2E2 = max_dNgfnc_c[time_num][temp_num + 1][HQenergy_num + 1];
3889 rate_T1E1 = dNg_over_dt_q[time_num][temp_num][HQenergy_num];
3890 rate_T1E2 = dNg_over_dt_q[time_num][temp_num][HQenergy_num + 1];
3891 rate_T2E1 = dNg_over_dt_q[time_num][temp_num + 1][HQenergy_num];
3892 rate_T2E2 = dNg_over_dt_q[time_num][temp_num + 1][HQenergy_num + 1];
3893 max_T1E1 = max_dNgfnc_q[time_num][temp_num][HQenergy_num];
3894 max_T1E2 = max_dNgfnc_q[time_num][temp_num][HQenergy_num + 1];
3895 max_T2E1 = max_dNgfnc_q[time_num][temp_num + 1][HQenergy_num];
3896 max_T2E2 = max_dNgfnc_q[time_num][temp_num + 1][HQenergy_num + 1];
3899 rate_EGrid_low = rate_T1E1 + (temp_med - temp_min - temp_num * delta_temp) /
3900 delta_temp * (rate_T2E1 - rate_T1E1);
3901 rate_EGrid_high = rate_T1E2 + (temp_med - temp_min - temp_num * delta_temp) /
3902 delta_temp * (rate_T2E2 - rate_T1E2);
3903 max_EGrid_low = max_T1E1 + (temp_med - temp_min - temp_num * delta_temp) /
3904 delta_temp * (max_T2E1 - max_T1E1);
3905 max_EGrid_high = max_T1E2 + (temp_med - temp_min - temp_num * delta_temp) /
3906 delta_temp * (max_T2E2 - max_T1E2);
3908 delta_Ng = rate_EGrid_low + (HQenergy - HQenergy_num * delta_HQener) /
3910 (rate_EGrid_high - rate_EGrid_low);
3911 max_Ng = max_EGrid_low + (HQenergy - HQenergy_num * delta_HQener) /
3912 delta_HQener * (max_EGrid_high - max_EGrid_low);
3914 delta_Ng = delta_Ng * 6.0 / D2piT * dtLRF;
3915 max_Ng = max_Ng * 6.0 / D2piT;
3930 double u = 2.0 * m2m - s -
t;
3933 MM = 64.0 / 9.0 * (pow((m2m - u), 2) + pow((s - m2m), 2) + 2.0 * m2m *
t) /
3942 double u = 2.0 * m2m - s -
t;
3945 MM = 32.0 * (s - m2m) * (m2m - u) / t /
t;
3946 MM = MM + 64.0 / 9.0 * ((s - m2m) * (m2m - u) + 2.0 * m2m * (s + m2m)) /
3948 MM = MM + 64.0 / 9.0 * ((s - m2m) * (m2m - u) + 2.0 * m2m * (u + m2m)) /
3950 MM = MM + 16.0 / 9.0 * m2m * (4.0 * m2m -
t) / ((s - m2m) * (m2m -
u));
3951 MM = MM + 16.0 * ((s - m2m) * (m2m - u) + m2m * (s -
u)) / (t * (s - m2m));
3952 MM = MM + 16.0 * ((s - m2m) * (m2m - u) - m2m * (s -
u)) / (t * (u - m2m));
3983 double cMass = 1.27;
3984 double bMass = 4.19;
3986 if (kTFnc < cMass) {
3988 }
else if (kTFnc < bMass) {
4002 double cMass = 1.27;
4003 double bMass = 4.19;
4005 if (kTFnc < cMass) {
4007 }
else if (kTFnc < bMass) {
4008 resultFnc = 0.172508;
4010 resultFnc = 0.130719;
4025 resultFnc = 2.0 * pow(1.0 - z0g + pow(z0g, 2), 3) / z0g / (1.0 - z0g);
4027 resultFnc = (1.0 - z0g) * (2.0 - 2.0 * z0g + z0g * z0g) / z0g;
4034 double LBT::tau_f(
double x0g,
double y0g,
double HQenergy,
double HQmass) {
4038 resultFnc = 2.0 * HQenergy * x0g * (1.0 - x0g) /
4039 (pow((x0g * y0g * HQenergy), 2) + x0g * x0g * HQmass * HQmass);
4047 double HQmass,
double temp_med,
double Tdiff) {
4049 double resultFnc, tauFnc, qhatFnc;
4051 qhatFnc = qhat_over_T3 *
4054 tauFnc = tau_f(x0g, y0g, HQenergy, HQmass);
4056 resultFnc = 4.0 /
pi * CA * alphasHQ(x0g * y0g * HQenergy, temp_med) *
4057 splittingP(parID, x0g) * qhatFnc * pow(y0g, 5) *
4058 pow(sin(Tdiff / 2.0 / tauFnc /
sctr), 2) *
4059 pow((HQenergy * HQenergy /
4060 (y0g * y0g * HQenergy * HQenergy + HQmass * HQmass)),
4062 x0g / x0g / HQenergy / HQenergy /
sctr;
4073 ifstream fxyMC(
"../hydroProfile/mc_glauber.dat");
4074 if (!fxyMC.is_open()) {
4075 cout <<
"Erro openning date fxyMC!\n";
4086 fxyMC >> initMCX[numXY] >> initMCY[numXY];
4090 cout <<
"Number of (x,y) points from MC-Glauber: " << numXY << endl;
4097 for (
int i = 0;
i < dimParList;
4148 Vfrozen[0][
i] = 0.0;
4149 Vfrozen[1][
i] = 0.0;
4150 Vfrozen[2][
i] = 0.0;
4151 Vfrozen[3][
i] = 0.0;
4152 Vfrozen0[0][
i] = 0.0;
4153 Vfrozen0[1][
i] = 0.0;
4154 Vfrozen0[2][
i] = 0.0;
4155 Vfrozen0[3][
i] = 0.0;
4158 vcfrozen[0][
i] = 0.0;
4159 vcfrozen[1][
i] = 0.0;
4160 vcfrozen[2][
i] = 0.0;
4161 vcfrozen[3][
i] = 0.0;
4162 vcfrozen0[0][
i] = 0.0;
4163 vcfrozen0[1][
i] = 0.0;
4164 vcfrozen0[2][
i] = 0.0;
4165 vcfrozen0[3][
i] = 0.0;
4173 double ipx, ipy, ipz, ip0, iwt;
4174 double pT_len, ipT,
phi, rapidity;
4177 double px0 = sqrt(ener * ener - amss * amss);
4182 for (
int i = 1;
i <= nj;
i =
i + 2) {
4184 if (fixPosition == 1) {
4189 int index_xy = (int)(ZeroOneDistribution(*GetMt19937Generator()) * numXY);
4190 if (index_xy >= numXY)
4191 index_xy = numXY - 1;
4192 V[1][
i] = initMCX[index_xy];
4193 V[2][
i] = initMCY[index_xy];
4196 V[0][
i] = -log(1.0 - ZeroOneDistribution(*GetMt19937Generator()));
4198 if (fixMomentum == 1) {
4204 P[5][
i] = sqrt(px0 * px0 + py0 * py0);
4207 pT_len = ipTmax - ipTmin;
4208 ipT = ipTmin + ZeroOneDistribution(*GetMt19937Generator()) * pT_len;
4209 phi = ZeroOneDistribution(*GetMt19937Generator()) * 2.0 *
pi;
4210 ipx = ipT * cos(phi);
4211 ipy = ipT * sin(phi);
4212 rapidity = 2.0 * eta_cut * ZeroOneDistribution(*GetMt19937Generator()) - eta_cut;
4213 ipz = sqrt(ipT * ipT + amss * amss) * sinh(rapidity);
4214 ip0 = sqrt(ipT * ipT + ipz * ipz + amss * amss);
4227 V[1][
i] = V[1][
i] +
P[1][
i] /
P[0][
i] *
tau0;
4228 V[2][
i] = V[2][
i] +
P[2][
i] /
P[0][
i] *
tau0;
4230 for (
int j = 0;
j <= 3;
j++)
4231 Prad[
j][
i] =
P[
j][
i];
4233 Vfrozen[0][
i] =
tau0;
4234 Vfrozen[1][
i] = V[1][
i];
4235 Vfrozen[2][
i] = V[2][
i];
4236 Vfrozen[3][
i] = V[3][
i];
4238 vcfrozen[1][
i] = 0.0;
4239 vcfrozen[2][
i] = 0.0;
4240 vcfrozen[3][
i] = 0.0;
4246 KATT1[
i + 1] = -KATT1[
i];
4247 P[1][
i + 1] = -
P[1][
i];
4248 P[2][
i + 1] = -
P[2][
i];
4249 P[3][
i + 1] = -
P[3][
i];
4250 P[0][
i + 1] =
P[0][
i];
4251 P[4][
i + 1] =
P[4][
i];
4252 P[5][
i + 1] =
P[5][
i];
4254 V[1][
i + 1] = V[1][
i];
4255 V[2][
i + 1] = V[2][
i];
4256 V[3][
i + 1] = V[3][
i];
4257 V[0][
i + 1] = V[0][
i];
4258 for (
int j = 0;
j <= 3;
j++)
4259 Prad[
j][
i + 1] =
P[
j][
i];
4260 Vfrozen[0][
i + 1] = Vfrozen[0][
i];
4261 Vfrozen[1][
i + 1] = Vfrozen[1][
i];
4262 Vfrozen[2][
i + 1] = Vfrozen[2][
i];
4263 Vfrozen[3][
i + 1] = Vfrozen[3][
i];
4264 Tfrozen[
i + 1] = Tfrozen[
i];
4265 vcfrozen[1][
i + 1] = vcfrozen[1][
i];
4266 vcfrozen[2][
i + 1] = vcfrozen[2][
i];
4267 vcfrozen[3][
i + 1] = vcfrozen[3][
i];
4273 double setX, setY, setZ;
4275 if (fixPosition == 1) {
4280 int index_xy = (int)(ZeroOneDistribution(*GetMt19937Generator()) * numXY);
4281 if (index_xy >= numXY)
4282 index_xy = numXY - 1;
4283 setX = initMCX[index_xy];
4284 setY = initMCY[index_xy];
4288 for (
int i = 1;
i <= nj;
i++) {
4293 V[0][
i] = -log(1.0 - ZeroOneDistribution(*GetMt19937Generator()));
4295 V[1][
i] = V[1][
i] +
P[1][
i] /
P[0][
i] *
tau0;
4296 V[2][
i] = V[2][
i] +
P[2][
i] /
P[0][
i] *
tau0;
4298 Vfrozen[0][
i] =
tau0;
4299 Vfrozen[1][
i] = V[1][
i];
4300 Vfrozen[2][
i] = V[2][
i];
4301 Vfrozen[3][
i] = V[3][
i];
4303 vcfrozen[1][
i] = 0.0;
4304 vcfrozen[2][
i] = 0.0;
4305 vcfrozen[3][
i] = 0.0;
4313 const char *cstring = fileName.c_str();
4315 ifstream
input(cstring);
4318 cout <<
"Parameter file is missing!" << endl;
4324 while (getline(input, line)) {
4326 strncpy(str, line.c_str(),
sizeof(
str)-1);
4329 char *divideChar[5];
4330 divideChar[0] = strtok(str,
" ");
4333 while (divideChar[nChar] != NULL) {
4338 divideChar[nChar] = strtok(NULL,
" ");
4345 string firstStr(divideChar[0]);
4346 string secondStr(divideChar[1]);
4347 string thirdStr(divideChar[2]);
4349 if (secondStr ==
"=") {
4350 if (firstStr ==
"flag:fixMomentum")
4351 fixMomentum = atoi(divideChar[2]);
4352 else if (firstStr ==
"flag:fixPosition")
4353 fixPosition = atoi(divideChar[2]);
4354 else if (firstStr ==
"flag:initHardFlag")
4355 initHardFlag = atoi(divideChar[2]);
4356 else if (firstStr ==
"flag:flagJetX")
4357 flagJetX = atoi(divideChar[2]);
4358 else if (firstStr ==
"flag:vacORmed")
4359 vacORmed = atoi(divideChar[2]);
4360 else if (firstStr ==
"flag:bulkType")
4361 bulkFlag = atoi(divideChar[2]);
4362 else if (firstStr ==
"flag:Kprimary")
4363 Kprimary = atoi(divideChar[2]);
4364 else if (firstStr ==
"flag:KINT0")
4365 KINT0 = atoi(divideChar[2]);
4366 else if (firstStr ==
"para:nEvent")
4367 ncall = atoi(divideChar[2]);
4368 else if (firstStr ==
"para:nParton")
4369 nj = atoi(divideChar[2]);
4370 else if (firstStr ==
"para:parID")
4371 Kjet = atoi(divideChar[2]);
4372 else if (firstStr ==
"para:tau0")
4373 tau0 = atof(divideChar[2]);
4374 else if (firstStr ==
"para:tauend")
4375 tauend = atof(divideChar[2]);
4376 else if (firstStr ==
"para:dtau")
4377 dtau = atof(divideChar[2]);
4378 else if (firstStr ==
"para:temperature")
4379 temp0 = atof(divideChar[2]);
4380 else if (firstStr ==
"para:alpha_s")
4381 fixAlphas = atof(divideChar[2]);
4382 else if (firstStr ==
"para:hydro_Tc")
4383 hydro_Tc = atof(divideChar[2]);
4384 else if (firstStr ==
"para:pT_min")
4385 ipTmin = atof(divideChar[2]);
4386 else if (firstStr ==
"para:pT_max")
4387 ipTmax = atof(divideChar[2]);
4388 else if (firstStr ==
"para:eta_cut")
4389 eta_cut = atof(divideChar[2]);
4390 else if (firstStr ==
"para:Ecut")
4391 Ecut = atof(divideChar[2]);
4392 else if (firstStr ==
"para:ener")
4393 ener = atof(divideChar[2]);
4394 else if (firstStr ==
"para:mass")
4395 amss = atof(divideChar[2]);
4396 else if (firstStr ==
"para:KPamp")
4397 KPamp = atof(divideChar[2]);
4398 else if (firstStr ==
"para:KPsig")
4399 KPsig = atof(divideChar[2]);
4400 else if (firstStr ==
"para:KTamp")
4401 KTamp = atof(divideChar[2]);
4402 else if (firstStr ==
"para:KTsig")
4403 KTsig = atof(divideChar[2]);
4412 KTsig = KTsig * hydro_Tc;
4413 preKT = fixAlphas / 0.3;
4460 if (initHardFlag == 1) {
4461 if (lightOut == 1 && heavyOut == 1) {
4464 cout <<
"Wrong # of arguments for command line input" << endl;
4465 cout <<
"./LBT parameter_file HQ_output light_positive_output "
4466 "light_negative_output"
4469 }
else if (heavyOut == 1) {
4472 cout <<
"Wrong # of arguments for command line input" << endl;
4473 cout <<
"./LBT parameter_file HQ_output" << endl;
4475 }
else if (lightOut == 1) {
4478 cout <<
"Wrong # of arguments for command line input" << endl;
4479 cout <<
"./LBT parameter_file light_positive_output "
4480 "light_negative_output"
4486 cout <<
"Wrong # of arguments for command line input" << endl;
4487 cout <<
"./LBT parameter_file" << endl;
4488 cout <<
"No output specified, both heavyOut and lightOut are set to 0"
4492 }
else if (initHardFlag == 2) {
4493 if (lightOut == 1 && heavyOut == 1) {
4496 cout <<
"Wrong # of arguments for command line input" << endl;
4497 cout <<
"./LBT parameter_file input_parton_list HQ_output "
4498 "light_positive_output light_negative_output"
4501 }
else if (heavyOut == 1) {
4504 cout <<
"Wrong # of arguments for command line input" << endl;
4505 cout <<
"./LBT parameter_file input_parton_list HQ_output" << endl;
4507 }
else if (lightOut == 1) {
4510 cout <<
"Wrong # of arguments for command line input" << endl;
4511 cout <<
"./LBT parameter_file input_parton_list light_positive_output "
4512 "light_negative_output"
4518 cout <<
"Wrong # of arguments for command line input" << endl;
4519 cout <<
"./LBT parameter_file input_parton_list" << endl;
4520 cout <<
"No output specified, both heavyOut and lightOut are set to 0"
4525 cout <<
"Wrong input for initHardFlag!" << endl;