Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:18:30

0001 /*******************************************************************************
0002  * Copyright (c) The JETSCAPE Collaboration, 2018
0003  *
0004  * Modular, task-based framework for simulating all aspects of heavy-ion collisions
0005  * 
0006  * For the list of contributors see AUTHORS.
0007  *
0008  * Report issues at https://github.com/JETSCAPE/JETSCAPE/issues
0009  *
0010  * or via email to bugs.jetscape@gmail.com
0011  *
0012  * Distributed under the GNU General Public License 3.0 (GPLv3 or later).
0013  * See COPYING for details.
0014  ******************************************************************************/
0015 // ------------------------------------------------------------
0016 // JetScape Framework hydro from file Test Program
0017 // (use either shared library (need to add paths; see setup.csh)
0018 // (or create static library and link in)
0019 // -------------------------------------------------------------
0020 
0021 #include <iostream>
0022 #include <time.h>
0023 
0024 // Move it here to avoid conflicts:
0025 // 1. Conflicts with MUSIC macros: hbarc, theta, limit, etc
0026 // 2. Conflict of make_unique from smash and from JetScape
0027 #include "SmashWrapper.h"
0028 
0029 // JetScape Framework includes ...
0030 #include "JetScape.h"
0031 #include "JetEnergyLoss.h"
0032 #include "JetEnergyLossManager.h"
0033 #include "JetScapeWriterStream.h"
0034 #ifdef USE_HEPMC
0035 #include "JetScapeWriterHepMC.h"
0036 #endif
0037 
0038 // User modules derived from jetscape framework clasess
0039 #include "AdSCFT.h"
0040 #include "Matter.h"
0041 #include "Martini.h"
0042 #include "MusicWrapper.h"
0043 // Make sure that nasty MUSIC macros are neutralized
0044 #undef PI
0045 #undef hbarc
0046 #undef default_tol
0047 #undef absol
0048 #undef maxi
0049 #undef mini
0050 #undef sgn
0051 #undef theta
0052 #undef gmn
0053 #undef limit
0054 
0055 #include "FreestreamMilneWrapper.h"
0056 #include "iSpectraSamplerWrapper.h"
0057 #include "TrentoInitial.h"
0058 #include "PGun.h"
0059 #include "HadronizationManager.h"
0060 #include "Hadronization.h"
0061 #include "ColoredHadronization.h"
0062 
0063 #include <chrono>
0064 #include <thread>
0065 
0066 using namespace std;
0067 
0068 using namespace Jetscape;
0069 
0070 // Forward declaration
0071 void Show();
0072 
0073 // -------------------------------------
0074 
0075 int main(int argc, char** argv)
0076 {
0077   clock_t t; t = clock();
0078   time_t start, end; time(&start);
0079 
0080   cout<<endl;
0081 
0082   // DEBUG=true by default and REMARK=false
0083   // can be also set also via XML file (at least partially)
0084   JetScapeLogger::Instance()->SetInfo(true);
0085   JetScapeLogger::Instance()->SetDebug(true);
0086   JetScapeLogger::Instance()->SetRemark(false);
0087   //SetVerboseLevel (9 a lot of additional debug output ...)
0088   //If you want to suppress it: use SetVerboseLevel(0) or max  SetVerboseLevel(9) or 10
0089   JetScapeLogger::Instance()->SetVerboseLevel(8);
0090 
0091   Show();
0092 
0093   auto jetscape = make_shared<JetScape>();
0094   const char* mainXMLName = "../config/jetscape_main.xml";
0095   const char* userXMLName = "../config/jetscape_user.xml";
0096 
0097   jetscape->SetXMLMainFileName(mainXMLName);
0098   jetscape->SetXMLUserFileName(userXMLName);
0099 
0100   jetscape->SetNumberOfEvents(1);
0101   jetscape->SetReuseHydro (false);
0102   jetscape->SetNReuseHydro (0);
0103   // jetscape->SetNumberOfEvents(10);
0104   // jetscape->SetReuseHydro (true);
0105   // jetscape->SetNReuseHydro (5);
0106 
0107   // Initial conditions and hydro
0108   auto trento = make_shared<TrentoInitial>();
0109   auto freestream = make_shared<FreestreamMilneWrapper> ();
0110   auto pGun= make_shared<PGun> ();
0111   auto hydro = make_shared<MpiMusic> ();
0112   jetscape->Add(trento);
0113   jetscape->Add(freestream);
0114   jetscape->Add(pGun);
0115   jetscape->Add(hydro);
0116 
0117   // surface sampler
0118   auto iSS = make_shared<iSpectraSamplerWrapper> ();
0119   jetscape->Add(iSS);
0120 
0121   // afterburner
0122   auto smash = make_shared<SmashWrapper> ();
0123   jetscape->Add(smash);
0124 
0125   // Energy loss
0126   auto jlossmanager = make_shared<JetEnergyLossManager> ();
0127   auto jloss = make_shared<JetEnergyLoss> ();
0128 
0129   auto matter = make_shared<Matter> ();
0130   // auto lbt = make_shared<LBT> ();
0131   // auto martini = make_shared<Martini> ();
0132   // auto adscft = make_shared<AdSCFT> ();
0133 
0134   // Note: if you use Matter, it MUST come first (to set virtuality)
0135   jloss->Add(matter);
0136   // jloss->Add(lbt);  // go to 3rd party and ./get_lbtTab before adding this module
0137   // jloss->Add(martini);
0138   // jloss->Add(adscft);
0139   jlossmanager->Add(jloss);
0140   jetscape->Add(jlossmanager);
0141 
0142   // Hadronization
0143   auto hadroMgr = make_shared<HadronizationManager> ();
0144   auto hadro = make_shared<Hadronization> ();
0145   auto hadroModule = make_shared<ColoredHadronization> ();
0146   hadro->Add(hadroModule);
0147   // auto colorless = make_shared<ColorlessHadronization> ();
0148   // hadro->Add(colorless);
0149   hadroMgr->Add(hadro);
0150   jetscape->Add(hadroMgr);
0151 
0152   // Output
0153   auto writer= make_shared<JetScapeWriterAscii> ("test_out.dat");
0154   // same as JetScapeWriterAscii but gzipped
0155   // auto writer= make_shared<JetScapeWriterAsciiGZ> ("test_out.dat.gz");
0156   // HEPMC3
0157 #ifdef USE_HEPMC
0158   // auto writer= make_shared<JetScapeWriterHepMC> ("test_out.hepmc");
0159 #endif
0160   jetscape->Add(writer);
0161 
0162   // Initialize all modules tasks
0163   jetscape->Init();
0164 
0165   // Run JetScape with all task/modules as specified ...
0166   jetscape->Exec();
0167 
0168   // "dummy" so far ...
0169   // Most thinkgs done in write and clear ...
0170   jetscape->Finish();
0171 
0172   INFO_NICE<<"Finished!";
0173   cout<<endl;
0174 
0175   // wait for 5s
0176   //std::this_thread::sleep_for(std::chrono::milliseconds(500000));
0177 
0178   t = clock() - t;
0179   time(&end);
0180   printf ("CPU time: %f seconds.\n",((float)t)/CLOCKS_PER_SEC);
0181   printf ("Real time: %f seconds.\n",difftime(end,start));
0182   //printf ("Real time: %f seconds.\n",(start-end));
0183   return 0;
0184 }
0185 
0186 // -------------------------------------
0187 
0188 void Show()
0189 {
0190   INFO_NICE<<"-----------------------------------------------";
0191   INFO_NICE<<"| SMASH Test JetScape Framework ... |";
0192   INFO_NICE<<"-----------------------------------------------";
0193   INFO_NICE;
0194 }