26 using namespace Jetscape;
38 JSINFO <<
"Initialize a particle sampler (iSS)";
41 GetXMLElementText({
"SoftParticlization",
"iSS",
"iSS_input_file"});
43 GetXMLElementText({
"SoftParticlization",
"iSS",
"iSS_table_path"});
45 GetXMLElementText({
"SoftParticlization",
"iSS",
46 "iSS_particle_table_path"});
48 GetXMLElementText({
"SoftParticlization",
"iSS",
"iSS_working_path"});
50 GetXMLElementInt({
"SoftParticlization",
"iSS",
"hydro_mode"});
51 int number_of_repeated_sampling = GetXMLElementInt(
52 {
"SoftParticlization",
"iSS",
"number_of_repeated_sampling"});
53 int flag_perform_decays = GetXMLElementInt(
54 {
"SoftParticlization",
"iSS",
"Perform_resonance_decays"});
55 int afterburner_type = (
56 GetXMLElementInt({
"SoftParticlization",
"iSS",
"afterburner_type"}));
58 if (!boost_invariance) {
62 iSpectraSampler_ptr_ = std::unique_ptr<iSS>(
63 new iSS(working_path, table_path, particle_table_path, input_file));
64 iSpectraSampler_ptr_->paraRdr_ptr->readFromFile(input_file);
67 int echoLevel = GetXMLElementInt({
"vlevel"});
68 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"JSechoLevel", echoLevel);
70 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"hydro_mode", hydro_mode);
71 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"afterburner_type",
73 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"output_samples_into_files", 0);
74 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"use_OSCAR_format", 0);
75 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"use_gzip_format", 0);
76 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"use_binary_format", 0);
77 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"store_samples_in_memory", 1);
78 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"number_of_repeated_sampling",
79 number_of_repeated_sampling);
80 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"perform_decays",
84 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"turn_on_shear", 1);
85 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"turn_on_bulk", 0);
86 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"turn_on_rhob", 0);
87 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"turn_on_diff", 0);
89 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"include_deltaf_shear", 1);
90 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"include_deltaf_bulk", 0);
91 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"bulk_deltaf_kind", 1);
92 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"include_deltaf_diffusion", 0);
94 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"restrict_deltaf", 0);
95 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"deltaf_max_ratio", 1.0);
96 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"f0_is_not_small", 1);
98 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"calculate_vn", 0);
99 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
"MC_sampling", 4);
101 iSpectraSampler_ptr_->paraRdr_ptr->setVal(
102 "sample_upto_desired_particle_number", 0);
103 iSpectraSampler_ptr_->paraRdr_ptr->echo();
107 JSINFO <<
"running iSS ...";
110 std::string music_input_file_path = GetXMLElementText(
111 {
"Hydro",
"MUSIC",
"MUSIC_input_file"});
113 GetXMLElementText({
"SoftParticlization",
"iSS",
"iSS_working_path"});
114 std::string music_input = working_path +
"/music_input";
115 std::ifstream
inputfile(music_input.c_str());
117 std::ostringstream system_command;
118 system_command <<
"ln -s " << music_input_file_path <<
" "
120 system(system_command.str().c_str());
124 int status = iSpectraSampler_ptr_->read_in_FO_surface();
126 JSWARN <<
"Some errors happened in reading in the hyper-surface";
130 auto random_seed = (*GetMt19937Generator())();
131 iSpectraSampler_ptr_->set_random_seed(random_seed);
132 VERBOSE(2) <<
"Random seed used for the iSS module" << random_seed;
134 status = iSpectraSampler_ptr_->generate_samples();
136 JSWARN <<
"Some errors happened in generating particle samples";
139 PassHadronListToJetscape();
140 JSINFO <<
"iSS finished.";
144 VERBOSE(2) <<
"Finish the particle sampling";
145 iSpectraSampler_ptr_->clear();
146 for (
unsigned i = 0;
i < Hadron_list_.size();
i++) {
147 Hadron_list_.at(
i).clear();
149 Hadron_list_.clear();
153 unsigned int nev = iSpectraSampler_ptr_->get_number_of_sampled_events();
154 VERBOSE(2) <<
"Passing all sampled hadrons to the JETSCAPE framework";
155 VERBOSE(4) <<
"number of events to pass : " << nev;
156 for (
unsigned int iev = 0; iev < nev; iev++) {
157 std::vector<shared_ptr<Hadron>> hadrons;
159 (iSpectraSampler_ptr_->get_number_of_particles(iev));
161 for (
unsigned int ipart = 0; ipart <
nparticles; ipart++) {
162 iSS_Hadron current_hadron =
163 (iSpectraSampler_ptr_->get_hadron(iev, ipart));
164 int hadron_label = 0;
165 int hadron_status = 11;
166 int hadron_id = current_hadron.pid;
168 double hadron_mass = current_hadron.mass;
169 FourVector hadron_p(current_hadron.px, current_hadron.py,
170 current_hadron.pz, current_hadron.E);
171 FourVector hadron_x(current_hadron.x, current_hadron.y, current_hadron.z,
175 hadrons.push_back(make_shared<Hadron>(hadron_label, hadron_id,
176 hadron_status, hadron_p, hadron_x,
181 Hadron_list_.push_back(hadrons);
183 VERBOSE(4) <<
"JETSCAPE received " << Hadron_list_.size() <<
" events.";
184 for (
unsigned int iev = 0; iev < Hadron_list_.size(); iev++) {
185 VERBOSE(4) <<
"In event " << iev <<
" JETSCAPE received "
186 << Hadron_list_.at(iev).size() <<
" particles.";
191 VERBOSE(4) <<
"In iSpectraSamplerWrapper::WriteTask";
196 f->WriteComment(
"JetScape module: " + GetId());
197 if (Hadron_list_.size() > 0) {
198 f->WriteComment(
"Final State Bulk Hadrons");
199 for (
unsigned int j = 0;
j < Hadron_list_.size();
j++) {
200 vector<shared_ptr<Hadron>> hadVec = Hadron_list_.at(
j);
201 for (
unsigned int i = 0;
i < hadVec.size();
i++) {
203 f->Write(hadVec.at(
i));
207 f->WriteComment(
"There are no bulk Hadrons");