48 liquefier(nullptr), fEnableAutomaticTaskListDetermination(
true) {
70 JSINFO <<
"================================================================";
83 <<
"================================================================";
90 JSINFO <<
"Calling JetScape InitTasks()...";
99 if (nextElement !=
nullptr)
104 if (nextElement !=
nullptr)
107 elems.push_back(mElement->
Name());
115 if (nextElement !=
nullptr)
120 if (nextElement !=
nullptr)
123 if (!std::binary_search(elems.begin(), elems.end(), uElement->
Name())) {
124 JSWARN <<
"User XML tag <" << uElement->
Name() <<
"> is unrecognized. A default entry in the main XML file is required.";
135 std::vector<std::string> elems;
138 sort(elems.begin(), elems.end());
147 if ((
int)log_debug.find(
"off") >= 0)
149 VERBOSE(1) <<
"JetScape Debug = " << log_debug;
153 if ((
int)log_remark.find(
"on") >= 0)
155 VERBOSE(1) <<
"JetScape Remark = " << log_remark;
161 VERBOSE(1) <<
"JetScape Verbose Level = " << m_vlevel;
167 if ((
int)enableAutomaticTaskListDetermination.find(
"true") >= 0) {
170 <<
"Enable automatic task list determination from User XML: True.";
171 }
else if ((
int)enableAutomaticTaskListDetermination.find(
"false") >= 0) {
174 <<
"Enable automatic task list determination from User XML: False.";
187 if ((
int)reuseHydro.find(
"true") >= 0) {
189 JSINFO <<
"Reuse Hydro: " << reuseHydro;
194 JSINFO <<
"nReuseHydro: " << nReuseHydro;
201 JSDEBUG <<
"JetScape Debug from XML = " << log_debug;
202 JSDEBUG <<
"JetScape Remark from XML = " << log_remark;
209 VERBOSE(2) <<
"Checking if Liquifier should be created...";
216 if (elementName ==
"Liquefier") {
217 liquefier = make_shared<CausalLiquefier>();
218 JSINFO <<
"Created liquefier.";
230 VERBOSE(2) <<
"Parsing element: " << elementName;
233 if (elementName ==
"IS") {
237 while (childElement) {
239 VERBOSE(2) <<
"Parsing childElement: " << childElementName;
242 if (childElementName ==
"Trento") {
243 auto trento = JetScapeModuleFactory::createInstance(
"TrentoInitial");
246 JSINFO <<
"JetScape::DetermineTaskList() -- Initial State: Added "
247 "Trento module to task list.";
251 else if (childElementName ==
"initial_profile_path") {
254 JetScapeModuleFactory::createInstance(
"InitialFromFile");
257 JSINFO <<
"JetScape::DetermineTaskList() -- Initial state: Added "
258 "InitialFromFile to task list.";
261 JSWARN <<
"InitialFromFile is attempted to be added, but HDF5 is not "
264 }
else if (childElementName ==
"IPGlasma") {
265 auto ipglasma = JetScapeModuleFactory::createInstance(
"IPGlasma");
268 JSINFO <<
"JetScape::DetermineTaskList() -- Initial State: Added "
269 "IPGlasma module to task list.";
271 }
else if (childElementName ==
"initial_Ncoll_list") {
273 JetScapeModuleFactory::createInstance(
"NcollListFromFile");
276 JSINFO <<
"JetScape::DetermineTaskList() -- Initial state: Added "
277 "NcollListFromFile to task list.";
281 else if (((
int)childElementName.find(
"CustomModule") >= 0)) {
283 JetScapeModuleFactory::createInstance(childElementName);
286 JSINFO <<
"JetScape::DetermineTaskList() -- Initial state: Added "
287 << childElementName <<
" to task list.";
296 else if (elementName ==
"Hard") {
300 while (childElement) {
302 VERBOSE(2) <<
"Parsing childElement: " << childElementName;
305 if (childElementName ==
"PGun") {
306 auto pGun = JetScapeModuleFactory::createInstance(childElementName);
309 JSINFO <<
"JetScape::DetermineTaskList() -- Hard Process: Added "
310 "PGun to task list.";
314 else if (childElementName ==
"PythiaGun") {
316 JetScapeModuleFactory::createInstance(childElementName);
319 JSINFO <<
"JetScape::DetermineTaskList() -- Hard Process: Added "
320 "PythiaGun to task list.";
324 else if (childElementName ==
"epemGun") {
326 JetScapeModuleFactory::createInstance(childElementName);
329 JSINFO <<
"JetScape::DetermineTaskList() -- Hard Process: Added "
330 "epemGun to task list.";
333 else if (((
int)childElementName.find(
"CustomModule") >= 0)) {
335 JetScapeModuleFactory::createInstance(childElementName);
338 JSINFO <<
"JetScape::DetermineTaskList() -- Hard Process: Added "
339 << childElementName <<
" to task list.";
349 else if (elementName ==
"Preequilibrium") {
353 while (childElement) {
355 VERBOSE(2) <<
"Parsing childElement: " << childElementName;
358 if (childElementName ==
"NullPreDynamics") {
360 JetScapeModuleFactory::createInstance(childElementName);
363 JSINFO <<
"JetScape::DetermineTaskList() -- PreDynamics: Added "
364 "NullPreDynamics to task list.";
366 }
else if (childElementName ==
"Glasma") {
368 JetScapeModuleFactory::createInstance(childElementName);
371 JSINFO <<
"JetScape::DetermineTaskList() -- PreDynamics: Added "
372 "Glasma to task list.";
374 }
else if (childElementName ==
"FreestreamMilne") {
376 #ifdef USE_FREESTREAM
378 JetScapeModuleFactory::createInstance(childElementName);
381 JSINFO <<
"JetScape::DetermineTaskList() -- PreDynamics: Added "
382 "FreestreamMilne to task list.";
385 JSWARN <<
"FreestreamMilne is attempted to be added, but freestream "
388 }
else if (((
int)childElementName.find(
"CustomModule") >= 0)) {
391 JetScapeModuleFactory::createInstance(childElementName);
394 JSINFO <<
"JetScape::DetermineTaskList() -- PreDynamics: Added "
395 << childElementName <<
" to task list.";
405 else if (elementName ==
"Hydro") {
408 VERBOSE(2) <<
"Checking if liquefer should be added: Hydro";
409 bool bAddLiquefier =
false;
412 while (childElementLiquefier) {
414 VERBOSE(2) <<
"Parsing childElementLiq: " << childElementName;
415 if (childElementName ==
"AddLiquefier") {
417 if ((
int)strAddLiquefier.find(
"true") >= 0) {
418 bAddLiquefier =
true;
419 VERBOSE(1) <<
"Add liquefier to Hydro: True.";
421 VERBOSE(1) <<
"Add liquefier to Hydro: False.";
430 while (childElement) {
432 VERBOSE(2) <<
"Parsing childElement: " << childElementName;
435 if (childElementName ==
"Brick") {
436 auto hydro = JetScapeModuleFactory::createInstance(childElementName);
439 JSINFO <<
"JetScape::DetermineTaskList() -- Hydro: Added Brick to "
445 JSINFO <<
"JetScape::DetermineTaskList() -- Hydro: Added "
446 "liquefier to Brick.";
451 else if (childElementName ==
"Gubser") {
452 auto hydro = JetScapeModuleFactory::createInstance(childElementName);
455 JSINFO <<
"JetScape::DetermineTaskList() -- Hydro: Added Gubser to "
461 JSINFO <<
"JetScape::DetermineTaskList() -- Hydro: Added "
462 "liquefier to Gubser.";
467 else if (childElementName ==
"hydro_from_file") {
468 auto hydro = JetScapeModuleFactory::createInstance(
"HydroFromFile");
471 JSINFO <<
"JetScape::DetermineTaskList() -- Hydro: Added "
472 "hydro_from_file to task list.";
477 JSINFO <<
"JetScape::DetermineTaskList() -- Hydro: Added "
478 "liquefier to hydro_from_file.";
483 else if (childElementName ==
"MUSIC") {
485 auto hydro = JetScapeModuleFactory::createInstance(
"MUSIC");
488 JSINFO <<
"JetScape::DetermineTaskList() -- Hydro: Added MUSIC to "
494 JSINFO <<
"JetScape::DetermineTaskList() -- Hydro: Added "
495 "liquefier to MUSIC.";
499 JSWARN <<
"MUSIC is attempted to be added, but it is not installed!";
503 else if (childElementName ==
"CLVisc") {
504 auto hydro = JetScapeModuleFactory::createInstance(
"CLVisc");
507 JSINFO <<
"JetScape::DetermineTaskList() -- Hydro: Added CLVisc to "
511 <<
"CLVisc is attempted to be added, but it is not installed!";
516 else if (((
int)childElementName.find(
"CustomModule") >= 0)) {
518 JetScapeModuleFactory::createInstance(childElementName);
521 JSINFO <<
"JetScape::DetermineTaskList() -- Hydro: Added "
522 << childElementName <<
" to task list.";
527 JSINFO <<
"JetScape::DetermineTaskList() -- Hydro: Added "
528 "liquefier to CustomModule.";
538 else if (elementName ==
"Eloss") {
540 auto jlossmanager = make_shared<JetEnergyLossManager>();
541 auto jloss = make_shared<JetEnergyLoss>();
546 if ((
int)strAddLiquefier.find(
"true") >= 0) {
548 JSINFO <<
"JetScape::DetermineTaskList() -- Added liquefier to Eloss.";
550 VERBOSE(1) <<
"Add liquefier to Eloss: False.";
556 while (childElement) {
558 VERBOSE(2) <<
"Parsing childElement: " << childElementName;
561 if (childElementName ==
"Matter") {
562 auto matter = JetScapeModuleFactory::createInstance(childElementName);
566 JSINFO <<
"JetScape::DetermineTaskList() -- Eloss: Added Matter to "
571 else if (childElementName ==
"Lbt") {
572 auto lbt = JetScapeModuleFactory::createInstance(childElementName);
576 JSINFO <<
"JetScape::DetermineTaskList() -- Eloss: Added LBT to "
581 else if (childElementName ==
"Martini") {
583 JetScapeModuleFactory::createInstance(childElementName);
586 JSINFO <<
"JetScape::DetermineTaskList() -- Eloss: Added Martini "
591 else if (childElementName ==
"AdSCFT") {
592 auto adscft = JetScapeModuleFactory::createInstance(childElementName);
595 JSINFO <<
"JetScape::DetermineTaskList() -- Eloss: Added AdS/CFT "
600 else if (((
int)childElementName.find(
"CustomModule") >= 0)) {
602 JetScapeModuleFactory::createInstance(childElementName);
604 jloss->Add(customModule);
605 JSINFO <<
"JetScape::DetermineTaskList() -- Eloss: Added "
606 << childElementName <<
" to Eloss list.";
613 jlossmanager->Add(jloss);
618 else if (elementName ==
"JetHadronization") {
621 auto hadroMgr = make_shared<HadronizationManager>();
622 auto hadro = make_shared<Hadronization>();
627 if (hadronizationName ==
"colored") {
629 JetScapeModuleFactory::createInstance(
"ColoredHadronization");
631 hadro->Add(hadroModule);
632 JSINFO <<
"JetScape::DetermineTaskList() -- JetHadronization: Added "
633 "ColoredHadronization to task list.";
635 }
else if (hadronizationName ==
"colorless") {
637 JetScapeModuleFactory::createInstance(
"ColorlessHadronization");
639 hadro->Add(hadroModule);
640 JSINFO <<
"JetScape::DetermineTaskList() -- JetHadronization: Added "
641 "ColorlessHadronization to task list.";
643 }
else if (hadronizationName ==
"hybrid") {
645 JetScapeModuleFactory::createInstance(
"HybridHadronization");
647 hadro->Add(hadroModule);
648 JSINFO <<
"JetScape::DetermineTaskList() -- JetHadronization: Added "
649 "HybridHadronization to task list.";
653 else if (((
int)hadronizationName.find(
"CustomModule") >= 0)) {
655 JetScapeModuleFactory::createInstance(hadronizationName);
657 hadro->Add(customModule);
658 JSINFO <<
"JetScape::DetermineTaskList() -- JetHadronization: Added "
659 << hadronizationName <<
" to task list.";
663 hadroMgr->Add(hadro);
668 else if (elementName ==
"SoftParticlization") {
672 while (childElement) {
674 VERBOSE(2) <<
"Parsing childElement: " << childElementName;
677 if (childElementName ==
"iSS") {
678 #ifdef iSpectraSampler
680 JetScapeModuleFactory::createInstance(childElementName);
683 JSINFO <<
"JetScape::DetermineTaskList() -- SoftParticlization: "
684 "Added iSS to task list.";
687 JSWARN <<
"iSS is attempted to be added, but iSS is not installed!";
691 else if (((
int)childElementName.find(
"CustomModule") >= 0)) {
693 JetScapeModuleFactory::createInstance(childElementName);
697 <<
"JetScape::DetermineTaskList() -- SoftParticlization: Added "
698 << childElementName <<
" to task list.";
707 else if (elementName ==
"Afterburner") {
711 while (childElement) {
713 VERBOSE(2) <<
"Parsing childElement: " << childElementName;
716 if (childElementName ==
"SMASH") {
719 JetScapeModuleFactory::createInstance(childElementName);
722 JSINFO <<
"JetScape::DetermineTaskList() -- Afterburner: Added "
723 "SMASH to task list.";
727 <<
"SMASH is attempted to be added, but SMASH is not installed!";
731 else if (((
int)childElementName.find(
"CustomModule") >= 0)) {
733 JetScapeModuleFactory::createInstance(childElementName);
736 JSINFO <<
"JetScape::DetermineTaskList() -- Afterburner: Added "
737 << childElementName <<
" to task list.";
746 else if (elementName ==
"PartonPrinter") {
748 auto partonPrinter = JetScapeModuleFactory::createInstance(elementName);
751 JSINFO <<
"JetScape::DetermineTaskList() -- Added PartonPrinter to "
755 else if (elementName ==
"HadronPrinter") {
756 auto hadronPrinter = JetScapeModuleFactory::createInstance(elementName);
759 JSINFO <<
"JetScape::DetermineTaskList() -- Added HadronPrinter to "
765 VERBOSE(2) <<
"Nothing to do.";
774 shared_ptr<JetScapeModuleBase> module) {
778 while (childElement) {
780 if (childElementName ==
"name") {
797 std::string outputFilenameAsciiGZ = outputFilename;
799 std::string outputFilenameRootHepMC = outputFilename;
800 std::string outputFilenameFinalStatePartonsAscii = outputFilename;
801 std::string outputFilenameFinalStateHadronsAscii = outputFilename;
805 outputFilenameAscii.append(
".dat"));
807 outputFilenameAsciiGZ.append(
".dat.gz"));
809 outputFilenameHepMC.append(
".hepmc"));
811 outputFilenameRootHepMC.append(
"_hepmc.root"));
813 outputFilenameFinalStatePartonsAscii.append(
"_final_state_partons.dat"));
815 outputFilenameFinalStateHadronsAscii.append(
"_final_state_hadrons.dat"));
824 VERBOSE(2) <<
"Parsing element: " << elementName;
826 if (((
int)elementName.find(
"CustomWriter") >= 0)) {
829 element = element->NextSiblingElement();
838 VERBOSE(2) <<
"Parsing writer: " << writerName;
839 if ((
int)enableWriter.find(
"on") >= 0) {
841 auto writer = JetScapeModuleFactory::createInstance(writerName);
847 JSINFO <<
"JetScape::DetermineTaskList() -- " << writerName <<
" ("
848 << outputFilename.c_str() <<
") added to task list.";
852 else if (strcmp(writerName,
"JetScapeWriterHepMC") == 0) {
854 VERBOSE(2) <<
"Manually creating JetScapeWriterHepMC (due to multiple "
856 auto writer = std::make_shared<JetScapeWriterHepMC>(outputFilename);
858 JSINFO <<
"JetScape::DetermineTaskList() -- " << writerName <<
" ("
859 << outputFilename.c_str() <<
") added to task list.";
862 else if (strcmp(writerName,
"JetScapeWriterRootHepMC") == 0) {
865 VERBOSE(2) <<
"Manually creating JetScapeWriterRootHepMC (due to multiple "
867 auto writer = std::make_shared<JetScapeWriterRootHepMC>(outputFilename);
869 JSINFO <<
"JetScape::DetermineTaskList() -- " << writerName <<
" ("
870 << outputFilename.c_str() <<
") added to task list.";
874 VERBOSE(2) <<
"Writer is NOT created...";
877 VERBOSE(2) <<
"Writer is off.";
885 JSINFO <<
"Set Hydro,JetEnergylossManager and IS Pointers for "
886 <<
"SignalManager to create Signal/Slots";
888 bool hydro_pointer_is_set =
false;
890 if (dynamic_pointer_cast<InitialState>(
it)) {
892 dynamic_pointer_cast<InitialState>(
it));
893 }
else if (dynamic_pointer_cast<PreequilibriumDynamics>(
it)) {
895 dynamic_pointer_cast<PreequilibriumDynamics>(
it));
896 }
else if (dynamic_pointer_cast<FluidDynamics>(
it) &&
897 !hydro_pointer_is_set) {
899 dynamic_pointer_cast<FluidDynamics>(
it));
900 hydro_pointer_is_set =
true;
901 }
else if (dynamic_pointer_cast<JetEnergyLossManager>(
it)) {
903 dynamic_pointer_cast<JetEnergyLossManager>(
it));
904 }
else if (dynamic_pointer_cast<HardProcess>(
it)) {
906 dynamic_pointer_cast<HardProcess>(
it));
907 }
else if (dynamic_pointer_cast<JetScapeWriter>(
it) &&
it->GetActive()) {
909 dynamic_pointer_cast<JetScapeWriter>(
it));
910 }
else if (dynamic_pointer_cast<PartonPrinter>(
it)) {
912 dynamic_pointer_cast<PartonPrinter>(
it));
913 }
else if (dynamic_pointer_cast<SoftParticlization>(
it)) {
915 dynamic_pointer_cast<SoftParticlization>(
it));
916 }
else if (dynamic_pointer_cast<HadronizationManager>(
it)) {
918 dynamic_pointer_cast<HadronizationManager>(
it));
919 }
else if (dynamic_pointer_cast<HadronPrinter>(
it)) {
921 dynamic_pointer_cast<HadronPrinter>(
it));
934 vector<weak_ptr<JetScapeWriter>> vWriter;
937 if (dynamic_pointer_cast<JetScapeWriter>(
it)) {
938 if (
it->GetActive()) {
939 vWriter.push_back(dynamic_pointer_cast<JetScapeWriter>(
it));
946 JSINFO << BOLDRED <<
"Run Event # = " <<
i;
948 VERBOSE(1) << BOLDRED <<
"Run Event # = " <<
i;
965 for (
auto w : vWriter) {
972 for (
auto w : vWriter) {
975 f->WriteHeaderToFile();
980 for (
auto w : vWriter) {
988 for (
auto w : vWriter) {
1000 throw std::runtime_error(
"Incompatible reusal settings.");
1002 bool hydro_pointer_is_set =
false;
1004 if (!dynamic_pointer_cast<FluidDynamics>(
it) &&
1005 !dynamic_pointer_cast<PreequilibriumDynamics>(
it) &&
1006 !dynamic_pointer_cast<InitialState>(
it)) {
1011 if (dynamic_pointer_cast<FluidDynamics>(
it) && hydro_pointer_is_set) {
1018 <<
" --> ACTIVATING";
1019 it->SetActive(
true);
1020 if (dynamic_pointer_cast<FluidDynamics>(
it)) {
1021 hydro_pointer_is_set =
true;
1026 <<
" --> DE-ACTIVATING";
1027 it->SetActive(
false);
1028 if (dynamic_pointer_cast<FluidDynamics>(
it)) {
1029 hydro_pointer_is_set =
true;
1045 JSDEBUG <<
"More infos wrap up/saving to file/closing file ...";