20 double gluon_beta,
double gluon_pmin,
21 double quark_alpha,
double quark_beta,
22 double strange_supp,
double diquark_supp,
23 double sigma_perp,
double leading_frag_mean,
24 double leading_frag_width,
double stringz_a,
25 double stringz_b,
double string_sigma_T,
26 double factor_t_form,
bool use_yoyo_model,
27 double prob_proton_to_d_uu)
28 : pmin_gluon_lightcone_(gluon_pmin),
29 pow_fgluon_beta_(gluon_beta),
30 pow_fquark_alpha_(quark_alpha),
31 pow_fquark_beta_(quark_beta),
32 sigma_qperp_(sigma_perp),
33 leading_frag_mean_(leading_frag_mean),
34 leading_frag_width_(leading_frag_width),
35 kappa_tension_string_(string_tension),
36 additional_xsec_supp_(0.7),
37 time_formation_const_(time_formation),
38 soft_t_form_(factor_t_form),
40 use_yoyo_model_(use_yoyo_model),
41 prob_proton_to_d_uu_(prob_proton_to_d_uu) {
43 pythia_parton_ = make_unique<Pythia8::Pythia>(PYTHIA_XML_DIR,
false);
50 stringz_a, stringz_b, string_sigma_T);
53 pythia_hadron_ = make_unique<Pythia8::Pythia>(PYTHIA_XML_DIR,
false);
57 stringz_a, stringz_b, string_sigma_T);
68 for (
int imu = 0; imu < 3; imu++) {
77 double diquark_supp,
double stringz_a,
79 double string_sigma_T) {
81 pythia_in->readString(
"ParticleData:modeBreitWigner = 4");
84 pythia_in->readString(
"MultipartonInteractions:pTmin = 1.5");
85 pythia_in->readString(
"MultipartonInteractions:nSample = 10000");
87 pythia_in->readString(
"StringPT:sigma = " + std::to_string(string_sigma_T));
89 pythia_in->readString(
"StringFlav:probQQtoQ = " +
90 std::to_string(diquark_supp));
92 pythia_in->readString(
"StringFlav:probStoUD = " +
93 std::to_string(strange_supp));
95 pythia_in->readString(
"StringZ:aLund = " + std::to_string(stringz_a));
96 pythia_in->readString(
"StringZ:bLund = " + std::to_string(stringz_b));
99 pythia_in->readString(
"PDF:pSet = 13");
100 pythia_in->readString(
"PDF:pSetB = 13");
101 pythia_in->readString(
"PDF:piSet = 1");
102 pythia_in->readString(
"PDF:piSetB = 1");
103 pythia_in->readString(
"Beams:idA = 2212");
104 pythia_in->readString(
"Beams:idB = 2212");
105 pythia_in->readString(
"Beams:eCM = 10.");
108 pythia_in->readString(
"Random:setSeed = on");
110 pythia_in->readString(
"Print:quiet = on");
112 pythia_in->readString(
"HadronLevel:Decay = off");
115 int pdgid = ptype.pdgcode().get_decimal();
116 double mass_pole = ptype.mass();
117 double width_pole = ptype.width_at_pole();
119 if (pythia_in->particleData.isParticle(pdgid)) {
121 pythia_in->particleData.m0(pdgid, mass_pole);
122 pythia_in->particleData.mWidth(pdgid, width_pole);
123 }
else if (pdgid == 310 || pdgid == 130) {
125 pythia_in->particleData.m0(pdgid,
kaon_mass);
126 pythia_in->particleData.mWidth(pdgid, 0.);
131 pythia_in->readString(
"Check:epTolErr = 1e-6");
132 pythia_in->readString(
"Check:epTolWarn = 1e-8");
141 double p_pos_tot = 0.0, p_neg_tot = 0.0;
145 bstring += data.pdgcode().baryon_number();
147 const double pparallel = data.momentum().threevec() * evecLong;
148 p_pos_tot += (data.momentum().x0() + pparallel) /
sqrt2_;
149 p_neg_tot += (data.momentum().x0() - pparallel) /
sqrt2_;
158 std::vector<double> xvertex_pos, xvertex_neg;
159 xvertex_pos.resize(nfrag + 1);
160 xvertex_neg.resize(nfrag + 1);
166 for (
int i = 0; i < nfrag; i++) {
167 const double pparallel =
168 intermediate_particles[i].momentum().threevec() * evecLong;
173 (intermediate_particles[i].momentum().x0() + pparallel) /
177 const int ineg = nfrag - i - 1;
179 xvertex_neg[ineg + 1] -
180 (intermediate_particles[ineg].momentum().x0() - pparallel) /
189 for (
int i = 0; i < nfrag; i++) {
192 intermediate_particles[i].momentum().
LorentzBoost(-vstring);
193 intermediate_particles[i].set_4momentum(momentum);
197 double t_prod = (xvertex_pos[i] + xvertex_neg[i + 1]) /
sqrt2_;
199 t_prod, evecLong * (xvertex_pos[i] - xvertex_neg[i + 1]) /
sqrt2_);
202 fragment_position = fragment_position.
LorentzBoost(-vstring);
204 intermediate_particles[i].set_formation_time(
208 double gamma_factor = 1.0 / std::sqrt(1 - (v_calc).sqr());
209 intermediate_particles[i].set_slow_formation_times(
223 massA_ = incoming[0].effective_mass();
224 massB_ = incoming[1].effective_mass();
226 plab_[0] = incoming[0].momentum();
227 plab_[1] = incoming[1].momentum();
260 double QTrn, QTrx, QTry;
261 double pabscomHX_sqr, massX;
270 if (mstrMin > mstrMax) {
276 QTrn = std::sqrt(QTrx * QTrx + QTry * QTry);
283 const bool foundPabsX = pabscomHX_sqr > QTrn * QTrn;
288 double sign_direction = is_AB_to_AX ? 1. : -1.;
292 (
evecBasisAB_[0] * std::sqrt(pabscomHX_sqr - QTrn * QTrn) +
294 const FourVector pstrHcom(std::sqrt(pabscomHX_sqr + massH * massH),
296 const FourVector pstrXcom(std::sqrt(pabscomHX_sqr + massX * massX),
304 is_AB_to_AX ?
pcom_[1].threevec() :
pcom_[0].threevec();
309 ParticleList new_intermediate_particles;
310 bool separate_fragment_baryon =
false;
312 fragment_string(idqX1, idqX2, massX, evec,
true, separate_fragment_baryon,
313 new_intermediate_particles);
334 const std::array<std::array<int, 2>, 2> &quarks,
335 const std::array<FourVector, 2> &pstr_com, std::array<double, 2> &m_str,
336 std::array<ThreeVector, 2> &evec_str) {
337 std::array<bool, 2> found_mass;
338 for (
int i = 0; i < 2; i++) {
339 found_mass[i] =
false;
341 m_str[i] = pstr_com[i].sqr();
342 m_str[i] = (m_str[i] > 0.) ? std::sqrt(m_str[i]) : 0.;
343 const double threshold =
pythia_hadron_->particleData.m0(quarks[i][0]) +
346 if (m_str[i] > threshold) {
347 found_mass[i] =
true;
363 evec_str[i] = prs.threevec() / prs.threevec().abs();
367 return found_mass[0] && found_mass[1];
371 const std::array<std::array<int, 2>, 2> &quarks,
372 const std::array<FourVector, 2> &pstr_com,
373 const std::array<double, 2> &m_str,
374 const std::array<ThreeVector, 2> &evec_str,
bool flip_string_ends,
375 bool separate_fragment_baryon) {
376 const std::array<FourVector, 2> ustr_com = {pstr_com[0] / m_str[0],
377 pstr_com[1] / m_str[1]};
378 for (
int i = 0; i < 2; i++) {
379 ParticleList new_intermediate_particles;
384 int nfrag =
fragment_string(quarks[i][0], quarks[i][1], m_str[i], evec,
385 flip_string_ends, separate_fragment_baryon,
386 new_intermediate_particles);
409 std::array<std::array<int, 2>, 2> quarks;
410 std::array<FourVector, 2> pstr_com;
411 std::array<double, 2> m_str;
412 std::array<ThreeVector, 2> evec_str;
422 const double xfracA =
424 const double xfracB =
429 const double QTrn = std::sqrt(QTrx * QTrx + QTry * QTry);
431 const double QPos = -QTrn * QTrn / (2. * xfracB *
PNegB_);
432 const double QNeg = QTrn * QTrn / (2. * xfracA *
PPosA_);
444 const bool found_masses =
449 const bool flip_string_ends =
true;
450 const bool separate_fragment_baryon =
false;
453 flip_string_ends, separate_fragment_baryon);
464 std::array<std::array<int, 2>, 2> quarks;
465 std::array<FourVector, 2> pstr_com;
466 std::array<double, 2> m_str;
467 std::array<ThreeVector, 2> evec_str;
470 int idqA1, idqA2, idqB1, idqB2;
474 const int bar_a =
PDGcodes_[0].baryon_number(),
477 (bar_a == 0 && bar_b == 1) ||
478 (bar_a == 0 && bar_b == 0)) {
479 quarks[0][0] = idqB1;
480 quarks[0][1] = idqA2;
481 quarks[1][0] = idqA1;
482 quarks[1][1] = idqB2;
483 }
else if (((bar_a == 0) && (bar_b == -1)) ||
486 quarks[0][0] = idqA1;
487 quarks[0][1] = idqB2;
488 quarks[1][0] = idqB1;
489 quarks[1][1] = idqA2;
491 std::stringstream ss;
492 ss <<
" StringProcess::next_NDiff : baryonA = " << bar_a
493 <<
", baryonB = " << bar_b;
494 throw std::runtime_error(ss.str());
502 const double QTrn = std::sqrt(QTrx * QTrx + QTry * QTry);
504 const double QPos = -QTrn * QTrn / (2. * xfracB *
PNegB_);
505 const double QNeg = QTrn * QTrn / (2. * xfracA *
PPosA_);
506 const double dPPos = -xfracA *
PPosA_ - QPos;
507 const double dPNeg = xfracB *
PNegB_ - QNeg;
514 m_str[0] = pstr_com[0].sqr();
521 const bool found_masses =
526 const bool flip_string_ends =
false;
527 const bool separate_fragment_baryon =
true;
530 flip_string_ends, separate_fragment_baryon);
536 const auto &log = logger<LogArea::Pythia>();
543 std::array<int, 2> pdg_for_pythia;
544 std::array<std::array<int, 5>, 2> excess_quark;
545 std::array<std::array<int, 5>, 2> excess_antiq;
546 for (
int i = 0; i < 2; i++) {
547 for (
int j = 0; j < 5; j++) {
548 excess_quark[i][j] = 0;
549 excess_antiq[i][j] = 0;
554 log.debug(
" incoming particle ", i,
" : ",
PDGcodes_[i],
555 " is mapped onto ", pdg_for_pythia[i]);
557 PdgCode pdgcode_for_pythia(std::to_string(pdg_for_pythia[i]));
562 log.debug(
" excess_quark[", i,
"] = (", excess_quark[i][0],
", ",
563 excess_quark[i][1],
", ", excess_quark[i][2],
", ",
564 excess_quark[i][3],
", ", excess_quark[i][4],
")");
565 log.debug(
" excess_antiq[", i,
"] = (", excess_antiq[i][0],
", ",
566 excess_antiq[i][1],
", ", excess_antiq[i][2],
", ",
567 excess_antiq[i][3],
", ", excess_antiq[i][4],
")");
574 bool same_initial_state = previous_idA == pdg_for_pythia[0] &&
575 previous_idB == pdg_for_pythia[1] &&
586 log.debug(
"Pythia initialized with ", pdg_for_pythia[0],
" + ",
587 pdg_for_pythia[1],
" at CM energy [GeV] ",
sqrtsAB_);
589 throw std::runtime_error(
"Pythia failed to initialize.");
598 log.debug(
"pythia_parton_ : rndm is initialized with seed ", seed_new);
602 log.debug(
"Pythia hard event created");
604 log.debug(
"Pythia final state computed, success = ", final_state_success);
605 if (!final_state_success) {
609 ParticleList new_intermediate_particles;
610 ParticleList new_non_hadron_particles;
612 Pythia8::Vec4 pSum = 0.;
635 std::array<int, 3> col;
636 for (
int j = 0; j < 3; j++) {
649 bool correct_constituents =
651 if (!correct_constituents) {
652 log.debug(
"failed to find correct partonic constituents.");
658 while (ipart < npart) {
663 log.debug(
"PDG ID from Pythia: ", pdgid);
665 log.debug(
"4-momentum from Pythia: ", momentum);
669 log.warn(
"PDG ID ", pdgid,
670 " does not exist in ParticleType - start over.");
671 final_state_success =
false;
680 bool hadronize_success =
false;
681 bool find_forward_string =
true;
682 log.debug(
"Hard non-diff: partonic process gives ",
689 log.debug(
" Dummy event in hard string routine failed.");
690 hadronize_success =
false;
707 log.debug(
"Pythia hadronized, success = ", hadronize_success);
709 new_intermediate_particles.clear();
710 if (hadronize_success) {
711 for (
int i = 0; i < event_hadron.size(); i++) {
712 if (event_hadron[i].isFinal()) {
713 int pythia_id = event_hadron[i].id();
714 log.debug(
"PDG ID from Pythia: ", pythia_id);
727 log.debug(
"4-momentum from Pythia: ", momentum);
728 log.debug(
"appending the particle ", pythia_id,
729 " to the intermediate particle list.");
730 bool found_ptype =
false;
731 if (event_hadron[i].isHadron()) {
733 new_intermediate_particles);
736 new_non_hadron_particles);
739 log.warn(
"PDG ID ", pythia_id,
740 " does not exist in ParticleType - start over.");
741 hadronize_success =
false;
749 if (!hadronize_success) {
758 find_forward_string = !find_forward_string;
761 if (hadronize_success) {
764 data.set_cross_section_scaling_factor(1.);
772 return hadronize_success;
777 std::array<int, 5> &excess_quark,
778 std::array<int, 5> &excess_antiq) {
781 std::array<int, 3> qcontent_actual = pdg_actual.
quark_content();
782 std::array<int, 3> qcontent_mapped = pdg_mapped.
quark_content();
784 excess_quark = {0, 0, 0, 0, 0};
785 excess_antiq = {0, 0, 0, 0, 0};
786 for (
int i = 0; i < 3; i++) {
787 if (qcontent_actual[i] > 0) {
788 int j = qcontent_actual[i] - 1;
789 excess_quark[j] += 1;
792 if (qcontent_mapped[i] > 0) {
793 int j = qcontent_mapped[i] - 1;
794 excess_quark[j] -= 1;
797 if (qcontent_actual[i] < 0) {
798 int j = std::abs(qcontent_actual[i]) - 1;
799 excess_antiq[j] += 1;
802 if (qcontent_mapped[i] < 0) {
803 int j = std::abs(qcontent_mapped[i]) - 1;
804 excess_antiq[j] -= 1;
810 Pythia8::Particle &particle, std::array<int, 5> &excess_constituent) {
811 const auto &log = logger<LogArea::Pythia>();
814 if (!particle.isQuark() && !particle.isDiquark()) {
819 const std::array<int, 5> excess_null = {0, 0, 0, 0, 0};
820 if (excess_constituent == excess_null) {
825 std::array<int, 2> pdgid = {0, 0};
828 if (particle.isQuark()) {
830 pdgid[0] = particle.id();
831 }
else if (particle.isDiquark()) {
836 for (
int iq = 0; iq < nq; iq++) {
837 int jq = std::abs(pdgid[iq]) - 1;
839 std::vector<int> k_found;
842 if (excess_constituent[jq] < 0) {
843 for (
int k = 0; k < 5; k++) {
845 if (k != jq && excess_constituent[k] > 0) {
846 k_found.push_back(k);
852 if (k_found.size() > 0) {
855 k_select = k_found[l];
858 pdgid[iq] = pdgid[iq] > 0 ? k_select + 1 : -(k_select + 1);
859 excess_constituent[jq] += 1;
860 excess_constituent[k_select] -= 1;
865 if (particle.isQuark()) {
866 pdgid_new = pdgid[0];
867 }
else if (particle.isDiquark()) {
868 if (std::abs(pdgid[0]) < std::abs(pdgid[1])) {
869 std::swap(pdgid[0], pdgid[1]);
872 pdgid_new = std::abs(pdgid[0]) * 1000 + std::abs(pdgid[1]) * 100;
873 if (std::abs(pdgid[0]) == std::abs(pdgid[1])) {
876 pdgid_new += spin_deg;
879 if (particle.id() < 0) {
883 log.debug(
" parton id = ", particle.id(),
" is converted to ", pdgid_new);
886 Pythia8::Vec4 pquark = particle.p();
888 double e_new = std::sqrt(mass_new * mass_new + pquark.pAbs() * pquark.pAbs());
890 particle.id(pdgid_new);
892 particle.m(mass_new);
896 Pythia8::Event &event_intermediate, std::array<int, 5> &nquark_total,
897 std::array<int, 5> &nantiq_total) {
898 for (
int iflav = 0; iflav < 5; iflav++) {
899 nquark_total[iflav] = 0;
900 nantiq_total[iflav] = 0;
903 for (
int ip = 1; ip < event_intermediate.size(); ip++) {
904 if (!event_intermediate[ip].isFinal()) {
907 const int pdgid = event_intermediate[ip].id();
910 for (
int iflav = 0; iflav < 5; iflav++) {
911 nquark_total[iflav] +=
916 for (
int iflav = 0; iflav < 5; iflav++) {
917 nantiq_total[iflav] +=
pythia_hadron_->particleData.nQuarksInCode(
918 std::abs(pdgid), iflav + 1);
925 Pythia8::Event &event_intermediate, std::array<int, 5> &nquark_total,
926 std::array<int, 5> &nantiq_total,
bool sign_constituent,
927 std::array<std::array<int, 5>, 2> &excess_constituent) {
928 const auto &log = logger<LogArea::Pythia>();
930 Pythia8::Vec4 pSum = event_intermediate[0].p();
936 for (
int iflav = 0; iflav < 5; iflav++) {
943 excess_constituent[0][iflav] + excess_constituent[1][iflav];
944 if (sign_constituent) {
945 nquark_final += nquark_total[iflav];
947 nquark_final += nantiq_total[iflav];
952 bool enough_quark = nquark_final >= 0;
956 log.debug(
" not enough constituents with flavor ", iflav + 1,
957 " : try to split a gluon to qqbar.");
958 for (
int ic = 0; ic < std::abs(nquark_final); ic++) {
962 if (excess_constituent[0][iflav] < 0) {
971 for (
int ip = 2; ip < event_intermediate.size(); ip++) {
972 if (!event_intermediate[ip].isFinal() ||
973 !event_intermediate[ip].isGluon()) {
977 const double y_gluon_current = event_intermediate[ip].y();
978 const double y_gluon_forward = event_intermediate[iforward].y();
979 if ((ih_mod == 0 && y_gluon_current > y_gluon_forward) ||
980 (ih_mod == 1 && y_gluon_current < y_gluon_forward)) {
985 if (!event_intermediate[iforward].isGluon()) {
986 log.debug(
"There is no gluon to split into qqbar.");
991 Pythia8::Vec4 pgluon = event_intermediate[iforward].p();
993 const int pdgid = iflav + 1;
995 const int status = event_intermediate[iforward].status();
999 const int col = event_intermediate[iforward].col();
1000 const int acol = event_intermediate[iforward].acol();
1003 std::array<double, 2> px_quark;
1004 std::array<double, 2> py_quark;
1005 std::array<double, 2> pz_quark;
1007 std::array<double, 2> e_quark;
1009 std::array<Pythia8::Vec4, 2> pquark;
1011 const double sigma_qt_frag =
pythia_hadron_->parm(
"StringPT:sigma");
1016 for (
int isign = 0; isign < 2; isign++) {
1020 px_quark[isign] = 0.5 * pgluon.px() + (isign == 0 ? 1. : -1.) * qx;
1021 py_quark[isign] = 0.5 * pgluon.py() + (isign == 0 ? 1. : -1.) * qy;
1022 pz_quark[isign] = 0.5 * pgluon.pz();
1024 std::sqrt(mass * mass + px_quark[isign] * px_quark[isign] +
1025 py_quark[isign] * py_quark[isign] +
1026 pz_quark[isign] * pz_quark[isign]);
1027 pquark[isign] = Pythia8::Vec4(px_quark[isign], py_quark[isign],
1028 pz_quark[isign], e_quark[isign]);
1033 pSum += pquark[0] + pquark[1] - pgluon;
1035 event_intermediate.append(pdgid, status, col, 0, pquark[0], mass);
1036 event_intermediate.append(-pdgid, status, 0, acol, pquark[1], mass);
1038 event_intermediate.remove(iforward, iforward);
1040 log.debug(
" gluon at iforward = ", iforward,
" is splitted into ",
1041 pdgid,
",", -pdgid,
" qqbar pair.");
1044 nquark_total[iflav] += 1;
1045 nantiq_total[iflav] += 1;
1052 event_intermediate[0].p(pSum);
1053 event_intermediate[0].m(pSum.mCalc());
1059 std::array<int, 5> &nquark_total,
1060 std::array<std::array<int, 5>, 2> &excess_quark,
1061 std::array<std::array<int, 5>, 2> &excess_antiq) {
1062 const auto &log = logger<LogArea::Pythia>();
1064 for (
int iflav = 0; iflav < 5; iflav++) {
1071 nquark_total[iflav] + excess_quark[0][iflav] + excess_quark[1][iflav];
1075 bool enough_quark = nquark_final >= 0;
1077 if (!enough_quark) {
1078 log.debug(
" not enough constituents with flavor ", iflav + 1,
1079 " : try to modify excess of constituents.");
1080 for (
int ic = 0; ic < std::abs(nquark_final); ic++) {
1084 if (excess_quark[0][iflav] < 0) {
1092 excess_quark[ih_mod][iflav] += 1;
1093 excess_antiq[ih_mod][iflav] += 1;
1100 for (
int jflav = 0; jflav < 5; jflav++) {
1102 if (jflav != iflav && excess_quark[ih_mod][jflav] > 0) {
1105 excess_quark[ih_mod][jflav] -= 1;
1106 excess_antiq[ih_mod][jflav] -= 1;
1118 Pythia8::Event &event_intermediate,
1119 std::array<std::array<int, 5>, 2> &excess_quark,
1120 std::array<std::array<int, 5>, 2> &excess_antiq) {
1121 const auto &log = logger<LogArea::Pythia>();
1123 Pythia8::Vec4 pSum = event_intermediate[0].p();
1124 const double energy_init = pSum.e();
1125 log.debug(
" initial total energy [GeV] : ", energy_init);
1128 std::array<int, 5> nquark_total;
1129 std::array<int, 5> nantiq_total;
1134 event_intermediate, nquark_total, nantiq_total,
true, excess_quark);
1136 event_intermediate, nquark_total, nantiq_total,
false, excess_antiq);
1140 if (!split_for_quark || !split_for_antiq) {
1146 for (
int iflav = 0; iflav < 5; iflav++) {
1147 if (nquark_total[iflav] + excess_quark[0][iflav] + excess_quark[1][iflav] <
1149 log.debug(
"Not enough quark constituents of flavor ", iflav + 1);
1153 if (nantiq_total[iflav] + excess_antiq[0][iflav] + excess_antiq[1][iflav] <
1155 log.debug(
"Not enough antiquark constituents of flavor ", -(iflav + 1));
1160 for (
int ih = 0; ih < 2; ih++) {
1161 log.debug(
" initial excess_quark[", ih,
"] = (", excess_quark[ih][0],
", ",
1162 excess_quark[ih][1],
", ", excess_quark[ih][2],
", ",
1163 excess_quark[ih][3],
", ", excess_quark[ih][4],
")");
1164 log.debug(
" initial excess_antiq[", ih,
"] = (", excess_antiq[ih][0],
", ",
1165 excess_antiq[ih][1],
", ", excess_antiq[ih][2],
", ",
1166 excess_antiq[ih][3],
", ", excess_antiq[ih][4],
")");
1169 bool recovered_quarks =
false;
1170 while (!recovered_quarks) {
1173 std::array<bool, 2> find_forward = {
true,
false};
1174 const std::array<int, 5> excess_null = {0, 0, 0, 0, 0};
1175 std::array<int, 5> excess_total = excess_null;
1177 for (
int ih = 0; ih < 2; ih++) {
1178 int nfrag = event_intermediate.size();
1179 for (
int np_end = 0; np_end < nfrag - 1; np_end++) {
1186 pSum -= event_intermediate[iforward].p();
1188 if (event_intermediate[iforward].
id() > 0) {
1190 log.debug(
" excess_quark[", ih,
"] = (", excess_quark[ih][0],
", ",
1191 excess_quark[ih][1],
", ", excess_quark[ih][2],
", ",
1192 excess_quark[ih][3],
", ", excess_quark[ih][4],
")");
1195 log.debug(
" excess_antiq[", ih,
"] = (", excess_antiq[ih][0],
", ",
1196 excess_antiq[ih][1],
", ", excess_antiq[ih][2],
", ",
1197 excess_antiq[ih][3],
", ", excess_antiq[ih][4],
")");
1200 const int pdgid = event_intermediate[iforward].id();
1201 Pythia8::Vec4 pquark = event_intermediate[iforward].p();
1204 const int status = event_intermediate[iforward].status();
1205 const int color = event_intermediate[iforward].col();
1206 const int anticolor = event_intermediate[iforward].acol();
1209 event_intermediate.append(pdgid, status, color, anticolor, pquark,
1212 event_intermediate.remove(iforward, iforward);
1218 for (
int j = 0; j < 5; j++) {
1219 excess_total[j] += (excess_quark[ih][j] - excess_antiq[ih][j]);
1225 recovered_quarks = excess_total == excess_null;
1227 log.debug(
" valence quark contents of hadons are recovered.");
1229 log.debug(
" current total energy [GeV] : ", pSum.e());
1233 if (std::abs(pSum.e() - energy_init) <
really_small * energy_init) {
1237 double energy_current = pSum.e();
1239 for (
int i = 1; i < event_intermediate.size(); i++) {
1240 slope += event_intermediate[i].pAbs2() / event_intermediate[i].e();
1243 const double rescale_factor = 1. + (energy_init - energy_current) / slope;
1245 for (
int i = 1; i < event_intermediate.size(); i++) {
1246 const double px = rescale_factor * event_intermediate[i].px();
1247 const double py = rescale_factor * event_intermediate[i].py();
1248 const double pz = rescale_factor * event_intermediate[i].pz();
1249 const double pabs = rescale_factor * event_intermediate[i].pAbs();
1250 const double mass = event_intermediate[i].m();
1252 event_intermediate[i].px(px);
1253 event_intermediate[i].py(py);
1254 event_intermediate[i].pz(pz);
1255 event_intermediate[i].e(std::sqrt(mass * mass + pabs * pabs));
1256 pSum += event_intermediate[i].p();
1258 log.debug(
" parton momenta are rescaled by factor of ", rescale_factor);
1261 log.debug(
" final total energy [GeV] : ", pSum.e());
1264 event_intermediate[0].p(pSum);
1265 event_intermediate[0].m(pSum.mCalc());
1271 Pythia8::Event &event_intermediate,
1272 Pythia8::Event &event_hadronize) {
1273 const auto &log = logger<LogArea::Pythia>();
1275 Pythia8::Vec4 pSum = 0.;
1276 event_hadronize.reset();
1280 log.debug(
"Hard non-diff: iforward = ", iforward,
"(",
1281 event_intermediate[iforward].
id(),
")");
1283 pSum += event_intermediate[iforward].p();
1284 event_hadronize.append(event_intermediate[iforward]);
1286 int col_to_find = event_intermediate[iforward].acol();
1287 int acol_to_find = event_intermediate[iforward].col();
1288 event_intermediate.remove(iforward, iforward);
1289 log.debug(
"Hard non-diff: event_intermediate reduces in size to ",
1290 event_intermediate.size());
1293 while (col_to_find != 0 || acol_to_find != 0) {
1294 log.debug(
" col_to_find = ", col_to_find,
1295 ", acol_to_find = ", acol_to_find);
1298 for (
int i = 1; i < event_intermediate.size(); i++) {
1299 const int pdgid = event_intermediate[i].id();
1301 col_to_find != 0 && col_to_find == event_intermediate[i].col();
1303 acol_to_find != 0 && acol_to_find == event_intermediate[i].acol();
1305 log.debug(
" col_to_find ", col_to_find,
" from i ", i,
"(", pdgid,
1309 log.debug(
" acol_to_find ", acol_to_find,
" from i ", i,
"(", pdgid,
1313 if (found_col && !found_acol) {
1315 col_to_find = event_intermediate[i].acol();
1317 }
else if (!found_col && found_acol) {
1319 acol_to_find = event_intermediate[i].col();
1321 }
else if (found_col && found_acol) {
1330 event_intermediate.list();
1331 event_intermediate.listJunctions();
1332 event_hadronize.list();
1333 event_hadronize.listJunctions();
1334 if (col_to_find != 0) {
1335 log.error(
"No parton with col = ", col_to_find);
1337 if (acol_to_find != 0) {
1338 log.error(
"No parton with acol = ", acol_to_find);
1340 throw std::runtime_error(
"Hard string could not be identified.");
1342 pSum += event_intermediate[ifound].p();
1344 event_hadronize.append(event_intermediate[ifound]);
1346 event_intermediate.remove(ifound, ifound);
1347 log.debug(
"Hard non-diff: event_intermediate reduces in size to ",
1348 event_intermediate.size());
1354 event_hadronize[0].p(pSum);
1355 event_hadronize[0].m(pSum.mCalc());
1359 Pythia8::Event &event_intermediate,
1360 Pythia8::Event &event_hadronize) {
1361 const auto &log = logger<LogArea::Pythia>();
1363 event_hadronize.reset();
1371 const int kind = event_intermediate.kindJunction(0);
1372 bool sign_color = kind % 2 == 1;
1373 std::vector<int> col;
1374 for (
int j = 0; j < 3; j++) {
1375 col.push_back(event_intermediate.colJunction(0, j));
1377 event_hadronize.appendJunction(kind, col[0], col[1], col[2]);
1378 event_intermediate.eraseJunction(0);
1379 log.debug(
"junction (", col[0],
", ", col[1],
", ", col[2],
") with kind ",
1380 kind,
" will be handled.");
1382 bool found_string =
false;
1383 while (!found_string) {
1386 found_string =
true;
1387 for (
unsigned int j = 0; j < col.size(); j++) {
1388 found_string = found_string && col[j] == 0;
1390 if (!found_string) {
1393 log.debug(
" still has leg(s) unfinished.");
1394 sign_color = !sign_color;
1395 std::vector<int> junction_to_move;
1396 for (
int i = 0; i < event_intermediate.sizeJunction(); i++) {
1397 const int kind_new = event_intermediate.kindJunction(i);
1401 if (sign_color != (kind_new % 2 == 1)) {
1405 std::array<int, 3> col_new;
1406 for (
int k = 0; k < 3; k++) {
1407 col_new[k] = event_intermediate.colJunction(i, k);
1410 int n_legs_connected = 0;
1412 for (
unsigned int j = 0; j < col.size(); j++) {
1416 for (
int k = 0; k < 3; k++) {
1417 if (col[j] == col_new[k]) {
1418 n_legs_connected += 1;
1426 if (n_legs_connected > 0) {
1427 for (
int k = 0; k < 3; k++) {
1428 if (col_new[k] != 0) {
1429 col.push_back(col_new[k]);
1432 log.debug(
" junction ", i,
" (",
1433 event_intermediate.colJunction(i, 0),
", ",
1434 event_intermediate.colJunction(i, 1),
", ",
1435 event_intermediate.colJunction(i, 2),
") with kind ",
1436 kind_new,
" will be added.");
1437 junction_to_move.push_back(i);
1443 for (
unsigned int i = 0; i < junction_to_move.size(); i++) {
1444 unsigned int imove = junction_to_move[i] - i;
1445 const int kind_add = event_intermediate.kindJunction(imove);
1446 std::array<int, 3> col_add;
1447 for (
int k = 0; k < 3; k++) {
1448 col_add[k] = event_intermediate.colJunction(imove, k);
1451 event_hadronize.appendJunction(kind_add, col_add[0], col_add[1],
1454 event_intermediate.eraseJunction(imove);
1459 Pythia8::Vec4 pSum = event_hadronize[0].p();
1460 find_forward_string = pSum.pz() > 0.;
1464 Pythia8::Event &event_intermediate,
1465 Pythia8::Event &event_hadronize) {
1466 const auto &log = logger<LogArea::Pythia>();
1468 Pythia8::Vec4 pSum = event_hadronize[0].p();
1469 for (
unsigned int j = 0; j < col.size(); j++) {
1473 bool found_leg =
false;
1474 while (!found_leg) {
1476 for (
int i = 1; i < event_intermediate.size(); i++) {
1477 const int pdgid = event_intermediate[i].id();
1478 if (sign_color && col[j] == event_intermediate[i].col()) {
1479 log.debug(
" col[", j,
"] = ", col[j],
" from i ", i,
"(", pdgid,
1482 col[j] = event_intermediate[i].acol();
1484 }
else if (!sign_color && col[j] == event_intermediate[i].acol()) {
1485 log.debug(
" acol[", j,
"] = ", col[j],
" from i ", i,
"(", pdgid,
1488 col[j] = event_intermediate[i].col();
1495 if (event_intermediate.sizeJunction() == 0) {
1496 event_intermediate.list();
1497 event_intermediate.listJunctions();
1498 event_hadronize.list();
1499 event_hadronize.listJunctions();
1500 log.error(
"No parton with col = ", col[j],
1501 " connected with junction leg ", j);
1502 throw std::runtime_error(
"Hard string could not be identified.");
1505 pSum += event_intermediate[ifound].p();
1507 event_hadronize.append(event_intermediate[ifound]);
1509 event_intermediate.remove(ifound, ifound);
1510 log.debug(
"Hard non-diff: event_intermediate reduces in size to ",
1511 event_intermediate.size());
1521 event_hadronize[0].p(pSum);
1522 event_hadronize[0].m(pSum.mCalc());
1527 const auto &log = logger<LogArea::Pythia>();
1528 const std::array<FourVector, 2> ustrcom = {
FourVector(1., 0., 0., 0.),
1542 std::swap(baryon, antibaryon);
1544 if (baryon.
baryon_number() != 1 || antibaryon.baryon_number() != -1) {
1545 throw std::invalid_argument(
"Expected baryon-antibaryon pair.");
1549 constexpr
int n_q_types = 5;
1550 std::vector<int> qcount_bar, qcount_antibar;
1551 std::vector<int> n_combinations;
1552 bool no_combinations =
true;
1553 for (
int i = 0; i < n_q_types; i++) {
1555 qcount_antibar.push_back(-antibaryon.net_quark_number(i + 1));
1556 const int n_i = qcount_bar[i] * qcount_antibar[i];
1557 n_combinations.push_back(n_i);
1559 no_combinations =
false;
1565 if (no_combinations) {
1566 for (
int i = 0; i < 2; i++) {
1580 const int q_annihilate = discrete_distr() + 1;
1581 qcount_bar[q_annihilate - 1]--;
1582 qcount_antibar[q_annihilate - 1]--;
1585 std::vector<int> remaining_quarks, remaining_antiquarks;
1586 for (
int i = 0; i < n_q_types; i++) {
1587 for (
int j = 0; j < qcount_bar[i]; j++) {
1588 remaining_quarks.push_back(i + 1);
1590 for (
int j = 0; j < qcount_antibar[i]; j++) {
1591 remaining_antiquarks.push_back(-(i + 1));
1594 assert(remaining_quarks.size() == 2);
1595 assert(remaining_antiquarks.size() == 2);
1601 std::swap(remaining_quarks[0], remaining_quarks[1]);
1604 std::swap(remaining_antiquarks[0], remaining_antiquarks[1]);
1607 bool kin_threshold_satisfied =
true;
1608 for (
int i = 0; i < 2; i++) {
1609 const double mstr_min =
1612 if (mstr_min > mstr[i]) {
1613 kin_threshold_satisfied =
false;
1616 if (!kin_threshold_satisfied) {
1620 for (
int i = 0; i < 2; i++) {
1621 ParticleList new_intermediate_particles;
1625 fragment_string(remaining_quarks[i], remaining_antiquarks[i], mstr[i],
1626 evec,
true,
false, new_intermediate_particles);
1639 ThreeVector &evec_polar, std::array<ThreeVector, 3> &evec_basis) {
1640 if (std::abs(evec_polar.
x3()) < (1. - 1.0e-8)) {
1645 evec_basis[0] = evec_polar;
1647 theta = std::acos(evec_basis[0].x3());
1649 ex = evec_basis[0].x1();
1650 ey = evec_basis[0].x2();
1651 et = std::sqrt(ex * ex + ey * ey);
1653 phi = std::acos(ex / et);
1655 phi = -std::acos(ex / et);
1660 evec_basis[1].set_x1(cos(theta) * cos(phi));
1661 evec_basis[1].set_x2(cos(theta) * sin(phi));
1662 evec_basis[1].set_x3(-sin(theta));
1664 evec_basis[2].set_x1(-sin(phi));
1665 evec_basis[2].set_x2(cos(phi));
1666 evec_basis[2].set_x3(0.);
1669 if (evec_polar.
x3() > 0.) {
1691 assert((std::abs(diquark) > 1000) && (std::abs(diquark) < 5510) &&
1692 (std::abs(diquark) % 100 < 10));
1695 deg_spin = std::abs(diquark) % 10;
1697 const int sign_anti = diquark > 0 ? 1 : -1;
1700 q1 = sign_anti * (std::abs(diquark) - (std::abs(diquark) % 1000)) / 1000;
1701 q2 = sign_anti * (std::abs(diquark) % 1000 - deg_spin) / 100;
1705 assert((q1 > 0 && q2 > 0) || (q1 < 0 && q2 < 0));
1706 if (std::abs(q1) < std::abs(q2)) {
1709 int diquark = std::abs(q1 * 1000 + q2 * 100);
1714 return (q1 < 0) ? -diquark : diquark;
1761 std::swap(idq1, idq2);
1767 bool separate_fragment_baryon,
1768 ParticleList &intermediate_particles) {
1769 const auto &log = logger<LogArea::Pythia>();
1771 intermediate_particles.clear();
1773 log.debug(
"initial quark content for fragment_string : ", idq1,
", ", idq2);
1775 std::array<int, 2> idqIn;
1781 std::array<double, 2> m_const;
1783 for (
int i = 0; i < 2; i++) {
1785 bstring +=
pythia_hadron_->particleData.baryonNumberType(idqIn[i]);
1789 log.debug(
"baryon number of string times 3 : ", bstring);
1796 evecLong = -evecLong;
1799 if (m_const[0] + m_const[1] > mString) {
1800 throw std::runtime_error(
"String fragmentation: m1 + m2 > mString");
1802 Pythia8::Vec4 pSum = 0.;
1804 int number_of_fragments = 0;
1806 if (separate_fragment_baryon && (std::abs(bstring) == 3) &&
1807 (mString > m_const[0] + m_const[1] + 1.)) {
1812 const double ssbar_supp =
pythia_hadron_->parm(
"StringFlav:probStoUD");
1813 const double sigma_qt_frag =
pythia_hadron_->parm(
"StringPT:sigma");
1814 std::array<ThreeVector, 3> evec_basis;
1819 double QTrx, QTry, QTrn;
1822 double ppos_string_new, pneg_string_new;
1824 double mTrn_string_new;
1826 std::array<double, 2> m_trans;
1828 const int niter_max = 10000;
1830 bool found_leading_baryon =
false;
1831 while (!found_leading_baryon) {
1832 int idnew_qqbar = 0;
1850 id_diquark = std::abs(idq2);
1851 idqIn[1] = -idnew_qqbar;
1856 id_diquark = std::abs(idq1);
1857 idqIn[0] = idnew_qqbar;
1859 log.debug(
"quark constituents for leading baryon : ", idnew_qqbar,
", ",
1863 std::array<int, 5> frag_net_q;
1866 for (
int iq = 0; iq < 5; iq++) {
1868 (bstring > 0 ? 1 : -1) *
1869 (
pythia_hadron_->particleData.nQuarksInCode(idnew_qqbar, iq + 1) +
1872 const int frag_iso3 = frag_net_q[1] - frag_net_q[0];
1873 const int frag_strange = -frag_net_q[2];
1874 const int frag_charm = frag_net_q[3];
1875 const int frag_bottom = -frag_net_q[4];
1876 log.debug(
" conserved charges of leading baryon : iso3 = ", frag_iso3,
1877 ", strangeness = ", frag_strange,
", charmness = ", frag_charm,
1878 ", bottomness = ", frag_bottom);
1880 std::vector<int> pdgid_possible;
1881 std::vector<double> weight_possible;
1882 std::vector<double> weight_summed;
1888 (bstring > 0 ? 1 : -1) * std::abs(ptype.pdgcode().get_decimal());
1890 (bstring == 3 * ptype.pdgcode().baryon_number()) &&
1891 (frag_iso3 == ptype.pdgcode().isospin3()) &&
1892 (frag_strange == ptype.pdgcode().strangeness()) &&
1893 (frag_charm == ptype.pdgcode().charmness()) &&
1894 (frag_bottom == ptype.pdgcode().bottomness())) {
1895 const int spin_degeneracy = ptype.pdgcode().spin_degeneracy();
1896 const double mass_pole = ptype.mass();
1897 const double weight =
1898 static_cast<double>(spin_degeneracy) / mass_pole;
1899 pdgid_possible.push_back(pdgid);
1900 weight_possible.push_back(weight);
1902 log.debug(
" PDG id ", pdgid,
" is possible with weight ", weight);
1905 const int n_possible = pdgid_possible.size();
1906 weight_summed.push_back(0.);
1907 for (
int i = 0; i < n_possible; i++) {
1908 weight_summed.push_back(weight_summed[i] + weight_possible[i]);
1915 for (
int i = 0; i < n_possible; i++) {
1916 if ((uspc >= weight_summed[i]) && (uspc < weight_summed[i + 1])) {
1917 pdgid_frag = pdgid_possible[i];
1918 log.debug(
"PDG id ", pdgid_frag,
" selected for leading baryon.");
1923 const double mass_frag =
pythia_hadron_->particleData.mSel(pdgid_frag);
1928 log.debug(
"Transverse momentum (", QTrx,
", ", QTry,
1929 ") GeV selected for the leading baryon.");
1930 QTrn = std::sqrt(QTrx * QTrx + QTry * QTry);
1932 const double mTrn_frag = std::sqrt(QTrn * QTrn + mass_frag * mass_frag);
1941 bool xfrac_accepted =
false;
1942 while (!xfrac_accepted) {
1943 const double angle =
1954 const double xf_tmp =
1956 const double xf_env = (1. +
really_small) / (1. + xf_tmp * xf_tmp / 4.);
1957 const double xf_pdf = std::exp(-xf_tmp * xf_tmp / 2.);
1958 if (
random::uniform(0., xf_env) < xf_pdf && xfrac > 0. && xfrac < 1.) {
1959 xfrac_accepted =
true;
1966 const double ppos_frag = xfrac * mString /
sqrt2_;
1967 const double pneg_frag = 0.5 * mTrn_frag * mTrn_frag / ppos_frag;
1968 ppos_string_new = mString /
sqrt2_ - ppos_frag;
1969 pneg_string_new = mString /
sqrt2_ - pneg_frag;
1971 std::sqrt(std::max(0., 2. * ppos_string_new * pneg_string_new));
1976 for (
int i = 0; i < 2; i++) {
1982 m_trans[0] = m_const[0];
1986 m_trans[1] = std::sqrt(m_const[1] * m_const[1] + QTrn * QTrn);
1991 m_trans[0] = std::sqrt(m_const[0] * m_const[0] + QTrn * QTrn);
1994 m_trans[1] = m_const[1];
1997 if (mTrn_string_new > m_trans[0] + m_trans[1]) {
1998 found_leading_baryon =
true;
2001 evec_basis[0] * (ppos_frag - pneg_frag) /
sqrt2_ +
2002 evec_basis[1] * QTrx + evec_basis[2] * QTry);
2003 log.debug(
"appending the leading baryon ", pdgid_frag,
2004 " to the intermediate particle list.");
2008 intermediate_particles);
2010 log.error(
"PDG ID ", pdgid_frag,
" should exist in ParticleType.");
2011 throw std::runtime_error(
"string fragmentation failed.");
2013 number_of_fragments++;
2014 log.debug(
"proceed to the next step");
2017 if (iiter == niter_max) {
2024 std::array<double, 2> ppos_parton;
2026 std::array<double, 2> pneg_parton;
2034 const double pb_const =
2035 (mTrn_string_new * mTrn_string_new + m_trans[0] * m_trans[0] -
2036 m_trans[1] * m_trans[1]) /
2037 (4. * pneg_string_new);
2038 const double pc_const =
2039 0.5 * m_trans[0] * m_trans[0] * ppos_string_new / pneg_string_new;
2040 ppos_parton[0] = pb_const + (bstring > 0 ? -1. : 1.) *
2041 std::sqrt(pb_const * pb_const - pc_const);
2042 ppos_parton[1] = ppos_string_new - ppos_parton[0];
2046 for (
int i = 0; i < 2; i++) {
2047 pneg_parton[i] = 0.5 * m_trans[i] * m_trans[i] / ppos_parton[i];
2050 const int status = 1;
2051 int color, anticolor;
2053 Pythia8::Vec4 pquark;
2061 three_mom = evec_basis[0] * (ppos_parton[0] - pneg_parton[0]) /
sqrt2_;
2066 three_mom = evec_basis[0] * (ppos_parton[0] - pneg_parton[0]) /
sqrt2_ -
2067 evec_basis[1] * QTrx - evec_basis[2] * QTry;
2069 pquark =
set_Vec4((ppos_parton[0] + pneg_parton[0]) /
sqrt2_, three_mom);
2071 pythia_hadron_->event.append(idqIn[0], status, color, anticolor, pquark,
2081 three_mom = evec_basis[0] * (ppos_parton[1] - pneg_parton[1]) /
sqrt2_ -
2082 evec_basis[1] * QTrx - evec_basis[2] * QTry;
2086 three_mom = evec_basis[0] * (ppos_parton[1] - pneg_parton[1]) /
sqrt2_;
2088 pquark =
set_Vec4((ppos_parton[1] + pneg_parton[1]) /
sqrt2_, three_mom);
2090 pythia_hadron_->event.append(idqIn[1], status, color, anticolor, pquark,
2096 double sign_direction = 1.;
2097 if (bstring == -3) {
2101 sign_direction = -1;
2105 const double pCMquark =
pCM(mString, m_const[0], m_const[1]);
2106 const double E1 = std::sqrt(m_const[0] * m_const[0] + pCMquark * pCMquark);
2107 const double E2 = std::sqrt(m_const[1] * m_const[1] + pCMquark * pCMquark);
2109 ThreeVector direction = sign_direction * evecLong;
2112 const int status1 = 1, color1 = 1, anticolor1 = 0;
2113 Pythia8::Vec4 pquark =
set_Vec4(E1, -direction * pCMquark);
2115 pythia_hadron_->event.append(idqIn[0], status1, color1, anticolor1, pquark,
2118 const int status2 = 1, color2 = 0, anticolor2 = 1;
2119 pquark =
set_Vec4(E2, direction * pCMquark);
2121 pythia_hadron_->event.append(idqIn[1], status2, color2, anticolor2, pquark,
2125 log.debug(
"fragmenting a string with ", idqIn[0],
", ", idqIn[1]);
2130 if (successful_hadronization) {
2131 for (
int ipyth = 0; ipyth <
pythia_hadron_->event.size(); ipyth++) {
2142 log.debug(
"appending the fragmented hadron ", pythia_id,
2143 " to the intermediate particle list.");
2147 log.warn(
"PDG ID ", pythia_id,
2148 " does not exist in ParticleType - start over.");
2149 intermediate_particles.clear();
2153 number_of_fragments++;
2156 return number_of_fragments;
2163 double suppression_factor) {
2178 ParticleList &list) {
2179 assert(list.size() >= 2);
2180 int end = list.size() - 1;
2183 i1 <= end && !list[i1].pdgcode().contains_enough_valence_quarks(nq1);
2187 i2 >= 0 && !list[i2].pdgcode().contains_enough_valence_quarks(nq2);
2190 std::pair<int, int> indices(i1, i2);
2195 ParticleList &outgoing_particles,
2197 double suppression_factor) {
2200 data.set_cross_section_scaling_factor(0.0);
2203 std::sort(outgoing_particles.begin(), outgoing_particles.end(),
2206 j.momentum().velocity() * evecLong;
2209 switch (baryon_string) {
2223 throw std::runtime_error(
"string is neither mesonic nor baryonic");
2228 std::pair<int, int> i =
find_leading(nq1, nq2, outgoing_particles);
2229 std::pair<int, int> j =
find_leading(nq2, nq1, outgoing_particles);
2230 if (baryon_string == 0 && i.second - i.first < j.second - j.first) {
2233 suppression_factor);
2237 suppression_factor);
2257 throw std::runtime_error(
"StringProcess::pdg_map_for_pythia failed.");
std::array< int, 3 > quark_content() const
The return is always an array of three numbers, which are pdgcodes of quarks: 1 - d...
double additional_xsec_supp_
additional cross-section suppression factor to take coherence effect into account.
std::array< int, 2 > NpartString_
number of particles fragmented from strings
bool next_NDiffSoft()
Soft Non-diffractive process is modelled in accordance with dual-topological approach Capella:1978ig...
int net_quark_number(const int quark) const
Returns the net number of quarks with given flavour number For public use, see strangeness(), charmness(), bottomness() and isospin3().
The ThreeVector class represents a physical three-vector with the components .
double PPosA_
forward lightcone momentum p^{+} of incoming particle A in CM-frame [GeV]
static FourVector reorient(Pythia8::Particle &particle, std::array< ThreeVector, 3 > &evec_basis)
compute the four-momentum properly oriented in the lab frame.
T beta_a0(T xmin, T b)
Draws a random number from a beta-distribution with a = 0.
constexpr double really_small
Numerical error tolerance.
static Pythia8::Vec4 set_Vec4(double energy, const ThreeVector &mom)
Easy setter of Pythia Vec4 from SMASH.
double pmin_gluon_lightcone_
the minimum lightcone momentum scale carried by a gluon [GeV]
ThreeVector velocity() const
Get the velocity (3-vector divided by zero component).
bool make_final_state_2strings(const std::array< std::array< int, 2 >, 2 > &quarks, const std::array< FourVector, 2 > &pstr_com, const std::array< double, 2 > &m_str, const std::array< ThreeVector, 2 > &evec_str, bool flip_string_ends, bool separate_fragment_baryon)
Prepare kinematics of two strings, fragment them and append to final_state.
FourVector LorentzBoost(const ThreeVector &v) const
Returns the FourVector boosted with velocity v.
int NpartFinal_
total number of final state particles
static void make_string_ends(const PdgCode &pdgcode_in, int &idq1, int &idq2, double xi)
make a random selection to determine partonic contents at the string ends.
int fragment_string(int idq1, int idq2, double mString, ThreeVector &evecLong, bool flip_string_ends, bool separate_fragment_baryon, ParticleList &intermediate_particles)
perform string fragmentation to determine species and momenta of hadrons by implementing PYTHIA 8...
void replace_constituent(Pythia8::Particle &particle, std::array< int, 5 > &excess_constituent)
Convert a partonic PYTHIA partice into the desired species and update the excess of constituents...
std::unique_ptr< Pythia8::Pythia > pythia_hadron_
PYTHIA object used in fragmentation.
std::array< FourVector, 2 > plab_
momenta of incoming particles in the lab frame [GeV]
int append_final_state(ParticleList &intermediate_particles, const FourVector &uString, const ThreeVector &evecLong)
compute the formation time and fill the arrays with final-state particles as described in Andersson:1...
void common_setup_pythia(Pythia8::Pythia *pythia_in, double strange_supp, double diquark_supp, double stringz_a, double stringz_b, double string_sigma_T)
Common setup of PYTHIA objects for soft and hard string routines.
static int pdg_map_for_pythia(PdgCode &pdg)
Take pdg code and map onto particle specie which can be handled by PYTHIA.
T pCM_sqr(const T sqrts, const T mass_a, const T mass_b) noexcept
std::array< PdgCode, 2 > PDGcodes_
PdgCodes of incoming particles.
void find_total_number_constituent(Pythia8::Event &event_intermediate, std::array< int, 5 > &nquark_total, std::array< int, 5 > &nantiq_total)
Compute how many quarks and antiquarks we have in the system, and update the correspoing arrays with ...
const FourVector & momentum() const
Get the particle's 4-momentum.
double prob_proton_to_d_uu_
Probability of splitting a nucleon into the quark flavour it has only once and a diquark it has twice...
int charge() const
The charge of the particle.
Pythia8::SigmaTotal pythia_sigmatot_
An object to compute cross-sections.
double PNegB_
backward lightcone momentum p^{-} of incoming particle B in CM-frame [GeV]
std::array< FourVector, 2 > pcom_
momenta of incoming particles in the center of mass frame [GeV]
void set_formation_time(const double &form_time)
Set the absolute formation time.
std::unique_ptr< Pythia8::Pythia > pythia_parton_
PYTHIA object used in hard string routine.
double sqrtsAB_
sqrt of Mandelstam variable s of collision [GeV]
static const ParticleType & find(PdgCode pdgcode)
Returns the ParticleType object for the given pdgcode.
void rearrange_excess(std::array< int, 5 > &nquark_total, std::array< std::array< int, 5 >, 2 > &excess_quark, std::array< std::array< int, 5 >, 2 > &excess_antiq)
Take total number of quarks and check if the system has enough constitents that need to be converted ...
static void quarks_from_diquark(int diquark, int &q1, int &q2, int °_spin)
find two quarks from a diquark.
static bool append_intermediate_list(int pdgid, FourVector momentum, ParticleList &intermediate_particles)
append new particle from PYTHIA to a specific particle list
static const ParticleTypeList & list_all()
void init(const ParticleList &incoming, double tcoll)
initialization feed intial particles, time of collision and gamma factor of the center of mass...
static int diquark_from_quarks(int q1, int q2)
Construct diquark from two quarks.
static void make_orthonormal_basis(ThreeVector &evec_polar, std::array< ThreeVector, 3 > &evec_basis)
compute three orthonormal basis vectors from unit vector in the longitudinal direction ...
T uniform_int(T min, T max)
Pythia8::Event event_intermediate_
event record for intermediate partonic state in the hard string routine
double kappa_tension_string_
string tension [GeV/fm]
double pow_fquark_alpha_
parameter for the quark distribution function
static void assign_all_scaling_factors(int baryon_string, ParticleList &outgoing_particles, const ThreeVector &evecLong, double suppression_factor)
Assign a cross section scaling factor to all outgoing particles.
void compute_incoming_lightcone_momenta()
compute the lightcone momenta of incoming particles where the longitudinal direction is set to be sam...
bool next_SDiff(bool is_AB_to_AX)
Single-diffractive process is based on single pomeron exchange described in Ingelman:1984ns.
bool use_yoyo_model_
Whether to calculate the string formation times from the yoyo-model.
static void assign_scaling_factor(int nquark, ParticleData &data, double suppression_factor)
Assign a cross section scaling factor to the given particle.
void compose_string_parton(bool find_forward_string, Pythia8::Event &event_intermediate, Pythia8::Event &event_hadronize)
Identify a set of partons, which are connected to form a color-neutral string, from a given PYTHIA ev...
bool next_DDiff()
Double-diffractive process ( A + B -> X + X ) is similar to the single-diffractive process...
void set_4momentum(const FourVector &momentum_vector)
Set the particle's 4-momentum directly.
ThreeVector vcomAB_
velocity three vector of the center of mass in the lab frame
ParticleList final_state_
final state array which must be accessed after the collision
bool pythia_parton_initialized_
Remembers if Pythia is initialized or not.
static std::pair< int, int > find_leading(int nq1, int nq2, ParticleList &list)
Find the leading string fragments.
double leading_frag_mean_
mean value of the fragmentation function for the leading baryons
PdgCode stores a Particle Data Group Particle Numbering Scheme particle type number.
double PNegA_
backward lightcone momentum p^{-} of incoming particle A in CM-frame [GeV]
constexpr double kaon_mass
Kaon mass in GeV.
double PPosB_
forward lightcone momentum p^{+} of incoming particle B in CM-frame [GeV]
static void convert_KaonLS(int &pythia_id)
convert Kaon-L or Kaon-S into K0 or Anti-K0
Discrete distribution with weight given by probability vector.
void find_junction_leg(bool sign_color, std::vector< int > &col, Pythia8::Event &event_intermediate, Pythia8::Event &event_hadronize)
Identify partons, which are associated with junction legs, from a given PYTHIA event record...
void compose_string_junction(bool &find_forward_string, Pythia8::Event &event_intermediate, Pythia8::Event &event_hadronize)
Identify a set of partons and junction(s), which are connected to form a color-neutral string...
FourVector ucomAB_
velocity four vector of the center of mass in the lab frame
double time_collision_
time of collision in the computational frame [fm]
bool set_mass_and_direction_2strings(const std::array< std::array< int, 2 >, 2 > &quarks, const std::array< FourVector, 2 > &pstr_com, std::array< double, 2 > &m_str, std::array< ThreeVector, 2 > &evec_str)
Determine string masses and directions in which strings are stretched.
T power(T n, T xMin, T xMax)
Draws a random number according to a power-law distribution ~ x^n.
double soft_t_form_
factor to be multiplied to formation times in soft strings
double leading_frag_width_
width of the fragmentation function for the leading baryons
bool restore_constituent(Pythia8::Event &event_intermediate, std::array< std::array< int, 5 >, 2 > &excess_quark, std::array< std::array< int, 5 >, 2 > &excess_antiq)
Take the intermediate partonic state from PYTHIA event with mapped hadrons and convert constituents i...
StringProcess(double string_tension, double time_formation, double gluon_beta, double gluon_pmin, double quark_alpha, double quark_beta, double strange_supp, double diquark_supp, double sigma_perp, double leading_frag_mean, double leading_frag_width, double stringz_a, double stringz_b, double string_sigma_T, double factor_t_form, bool use_yoyo_model, double prob_proton_to_d_uu)
Constructor, initializes pythia.
PdgCode pdgcode() const
Get the pdgcode of the particle.
double pow_fgluon_beta_
parameter for the gluon distribution function
double sqrt2_
square root of 2 ( )
constexpr int maximum_rndm_seed_in_pythia
The maximum value of the random seed used in PYTHIA.
std::array< ThreeVector, 3 > evecBasisAB_
Orthonormal basis vectors in the center of mass frame, where the 0th one is parallel to momentum of i...
int get_index_forward(bool find_forward, int np_end, Pythia8::Event &event)
Obtain index of the most forward or backward particle in a given PYTHIA event record.
double normal(const T &mean, const T &sigma)
Returns a random number drawn from a normal distribution.
bool next_BBbarAnn()
Baryon-antibaryon annihilation process Based on what UrQMD Bass:1998ca, Bleicher:1999xi does...
double sigma_qperp_
Transverse momentum spread of the excited strings.
void set_cross_section_scaling_factor(const double &xsec_scal)
Set the particle's initial cross_section_scaling_factor.
T pCM(const T sqrts, const T mass_a, const T mass_b) noexcept
The FourVector class holds relevant values in Minkowski spacetime with (+, −, −, −) metric signature.
static void find_excess_constituent(PdgCode &pdg_actual, PdgCode &pdg_mapped, std::array< int, 5 > &excess_quark, std::array< int, 5 > &excess_antiq)
Compare the valence quark contents of the actual and mapped hadrons and evaluate how many more consti...
bool next_NDiffHard()
Hard Non-diffractive process is based on PYTHIA 8 with partonic showers and interactions.
double massB_
mass of incoming particle B [GeV]
ParticleData contains the dynamic information of a certain particle.
T beta(T a, T b)
Draws a random number from a beta-distribution, where probability density of is .
double time_formation_const_
constant proper time in the case of constant formation time [fm]
double massA_
mass of incoming particle A [GeV]
int baryon_number() const
bool splitting_gluon_qqbar(Pythia8::Event &event_intermediate, std::array< int, 5 > &nquark_total, std::array< int, 5 > &nantiq_total, bool sign_constituent, std::array< std::array< int, 5 >, 2 > &excess_constituent)
Take total number of quarks and check if the system has enough constituents that need to be converted...
double pow_fquark_beta_
parameter for the quark distribution function