26 JSINFO <<
"Initializing Afterburner : " << GetId() <<
" ...";
28 ZeroOneDistribution = uniform_real_distribution<double>{0.0, 1.0};
32 void Afterburner::Exec() {
33 VERBOSE(2) <<
"Afterburner running: " << GetId() <<
" ...";
37 std::vector<std::vector<std::shared_ptr<Hadron>>> Afterburner::GetSoftParticlizationHadrons() {
38 auto soft_particlization = JetScapeSignalManager::Instance()->GetSoftParticlizationPointer().lock();
39 if (!soft_particlization) {
40 JSWARN <<
"No soft particlization module found. Check if fragmentation"
41 <<
" hadrons are handed to afterburner.";
42 std::vector<std::shared_ptr<Hadron>> hadrons;
43 dummy.push_back(hadrons);
46 return soft_particlization->Hadron_list_;
50 std::vector<shared_ptr<Hadron>> Afterburner::GetFragmentationHadrons() {
51 JSINFO <<
"Get fragmentation hadrons in Afterburner";
52 auto hadronization_mgr = JetScapeSignalManager::Instance()->GetHadronizationManagerPointer().lock();
53 if (!hadronization_mgr) {
54 JSWARN <<
"No hardronization module found. It is necessary to include"
55 <<
" fragmentation hadrons to afterburner as requested.";
58 std::vector<shared_ptr<Hadron>> h_list;
59 hadronization_mgr->GetHadrons(h_list);
60 JSINFO <<
"Got " << h_list.size() <<
" fragmentation hadrons from HadronizationManager.";
62 std::vector<shared_ptr<Hadron>> h_list_new;
63 rand_int_ptr_ = (std::make_shared<std::uniform_int_distribution<int>>(0,1));
64 for (
auto h : h_list) {
65 if (
h->has_no_position()) {
66 JSDEBUG <<
"Found fragmentation hadron without properly set position in "
67 "Afterburner.\nInclusion of fragmentation hadrons only "
68 "possible for HybridHadronization.";
74 const double rand_x = ZeroOneDistribution(*GetMt19937Generator()) * 2
e-4 - 1
e-4;
75 const double rand_y = ZeroOneDistribution(*GetMt19937Generator()) * 2e-4 - 1e-4;
76 const double rand_z = ZeroOneDistribution(*GetMt19937Generator()) * 2e-4 - 1e-4;
77 double position_smeared[4] = {r.
t(), r.
x()+rand_x, r.
y()+rand_y, r.
z()+rand_z};
78 h->set_x(position_smeared);
80 if ((std::abs(
h->pid())>10) && (
h->pid() != 21)) {
83 if (
h->pid() == 310 ||
h->pid() == 130) {
84 const int rand_int = (*rand_int_ptr_)(*GetMt19937Generator());
85 const int id = (rand_int == 0) ? 311 : -311;
88 h_list_new.push_back(
h);
89 }
else if(
h->pstat() < 0) {
92 if (
h->pid() == 310 ||
h->pid() == 130) {
93 const int rand_int = (*rand_int_ptr_)(*GetMt19937Generator());
94 const int id = (rand_int == 0) ? 311 : -311;
98 }
else if((std::abs(
h->pid())<10) || (
h->pid() == 21)){
99 JSWARN <<
"Found a free quark or gluon! This can not be handed over to SMASH.\n"
100 "Check confinement in hadronization module!";
106 std::vector<std::vector<std::shared_ptr<Hadron>>> Afterburner::GatherAfterburnerHadrons() {
107 std::vector<std::vector<shared_ptr<Hadron>>> afterburner_had_events;
108 afterburner_had_events = GetSoftParticlizationHadrons();
110 if (GetXMLElementInt({
"Afterburner",
"output_only_final_state_hadrons"})) {
114 auto soft_particlization = JetScapeSignalManager::Instance()->GetSoftParticlizationPointer().lock();
115 if (soft_particlization) {
116 soft_particlization->Hadron_list_.clear();
120 if (GetXMLElementInt({
"Afterburner",
"include_fragmentation_hadrons"})) {
121 if (afterburner_had_events.size() > 1) {
122 JSWARN <<
"Fragmentation hadrons in Afterburner are only possible without "
123 "repeated sampling from SoftParticlization. Exiting.";
126 std::vector<shared_ptr<Hadron>> frag_hadrons = GetFragmentationHadrons();
128 if (GetXMLElementInt({
"Afterburner",
"output_only_final_state_hadrons"})) {
131 auto hadronization_mgr = JetScapeSignalManager::Instance()->GetHadronizationManagerPointer().lock();
132 hadronization_mgr->DeleteRealHadrons();
135 afterburner_had_events[0].insert(afterburner_had_events[0].
end(),
136 frag_hadrons.begin(), frag_hadrons.end());
139 return afterburner_had_events;