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 // JetScape Framework includes ...
0025 #include "JetScape.h"
0026 #include "JetEnergyLoss.h"
0027 #include "JetEnergyLossManager.h"
0028 #include "JetScapeWriterStream.h"
0029 #ifdef USE_HEPMC
0030 #include "JetScapeWriterHepMC.h"
0031 #endif
0032 
0033 // User modules derived from jetscape framework clasess
0034 #include "AdSCFT.h"
0035 #include "Matter.h"
0036 #include "Martini.h"
0037 #include "MusicWrapper.h"
0038 #include "iSpectraSamplerWrapper.h"
0039 #include "TrentoInitial.h"
0040 #include "NullPreDynamics.h"
0041 #include "PGun.h"
0042 #include "HadronizationManager.h"
0043 #include "Hadronization.h"
0044 #include "ColoredHadronization.h"
0045 
0046 #include <chrono>
0047 #include <thread>
0048 
0049 using namespace std;
0050 
0051 using namespace Jetscape;
0052 
0053 // Forward declaration
0054 void Show();
0055 
0056 // -------------------------------------
0057 
0058 int main(int argc, char** argv)
0059 {
0060   clock_t t; t = clock();
0061   time_t start, end; time(&start);
0062   
0063   cout<<endl;
0064     
0065   // DEBUG=true by default and REMARK=false
0066   // can be also set also via XML file (at least partially)
0067   JetScapeLogger::Instance()->SetInfo(true);
0068   JetScapeLogger::Instance()->SetDebug(true);
0069   JetScapeLogger::Instance()->SetRemark(false);
0070   //SetVerboseLevel (9 a lot of additional debug output ...)
0071   //If you want to suppress it: use SetVerboseLevel(0) or max  SetVerboseLevel(9) or 10
0072   JetScapeLogger::Instance()->SetVerboseLevel(8);
0073    
0074   Show();
0075 
0076   auto jetscape = make_shared<JetScape>();
0077   const char* mainXMLName = "../config/jetscape_main.xml";
0078   const char* userXMLName = "../config/jetscape_user.xml";
0079 
0080   jetscape->SetXMLMainFileName(mainXMLName);
0081   jetscape->SetXMLUserFileName(userXMLName);
0082 
0083   jetscape->SetNumberOfEvents(2);
0084   jetscape->SetReuseHydro (false);
0085   jetscape->SetNReuseHydro (0);
0086   // jetscape->SetNumberOfEvents(10);
0087   // jetscape->SetReuseHydro (true);
0088   // jetscape->SetNReuseHydro (5);
0089 
0090   // Initial conditions and hydro
0091   auto trento = make_shared<TrentoInitial>();
0092   auto null_predynamics = make_shared<NullPreDynamics> ();
0093   auto pGun= make_shared<PGun> ();
0094   auto hydro = make_shared<MpiMusic> ();
0095   jetscape->Add(trento);
0096   jetscape->Add(null_predynamics);
0097   jetscape->Add(pGun);
0098   jetscape->Add(hydro);
0099 
0100   // surface sampler
0101   auto iSS = make_shared<iSpectraSamplerWrapper> ();
0102   jetscape->Add(iSS);
0103 
0104   // Energy loss
0105   auto jlossmanager = make_shared<JetEnergyLossManager> ();
0106   auto jloss = make_shared<JetEnergyLoss> ();
0107 
0108   auto matter = make_shared<Matter> ();
0109   // auto lbt = make_shared<LBT> ();
0110   // auto martini = make_shared<Martini> ();
0111   // auto adscft = make_shared<AdSCFT> ();
0112 
0113   // Note: if you use Matter, it MUST come first (to set virtuality)
0114   jloss->Add(matter);
0115   // jloss->Add(lbt);  // go to 3rd party and ./get_lbtTab before adding this module
0116   // jloss->Add(martini);
0117   // jloss->Add(adscft);  
0118   jlossmanager->Add(jloss);  
0119   jetscape->Add(jlossmanager);
0120   
0121   // Hadronization
0122   auto hadroMgr = make_shared<HadronizationManager> ();
0123   auto hadro = make_shared<Hadronization> ();
0124   auto hadroModule = make_shared<ColoredHadronization> ();
0125   hadro->Add(hadroModule);
0126   // auto colorless = make_shared<ColorlessHadronization> ();
0127   // hadro->Add(colorless);
0128   hadroMgr->Add(hadro);
0129   jetscape->Add(hadroMgr);
0130 
0131   // Output
0132   auto writer= make_shared<JetScapeWriterAscii> ("test_out.dat");
0133   // same as JetScapeWriterAscii but gzipped
0134   // auto writer= make_shared<JetScapeWriterAsciiGZ> ("test_out.dat.gz");
0135   // HEPMC3
0136 #ifdef USE_HEPMC
0137   // auto writer= make_shared<JetScapeWriterHepMC> ("test_out.hepmc");
0138 #endif
0139   jetscape->Add(writer);
0140 
0141   // Initialize all modules tasks
0142   jetscape->Init();
0143 
0144   // Run JetScape with all task/modules as specified ...
0145   jetscape->Exec();
0146 
0147   // "dummy" so far ...
0148   // Most thinkgs done in write and clear ...
0149   jetscape->Finish();
0150   
0151   INFO_NICE<<"Finished!";
0152   cout<<endl;
0153 
0154   // wait for 5s
0155   //std::this_thread::sleep_for(std::chrono::milliseconds(500000));
0156 
0157   t = clock() - t;
0158   time(&end);
0159   printf ("CPU time: %f seconds.\n",((float)t)/CLOCKS_PER_SEC);
0160   printf ("Real time: %f seconds.\n",difftime(end,start));
0161   //printf ("Real time: %f seconds.\n",(start-end));
0162   return 0;
0163 }
0164 
0165 // -------------------------------------
0166 
0167 void Show()
0168 {
0169   INFO_NICE<<"-----------------------------------------------";
0170   INFO_NICE<<"| MUSIC Test JetScape Framework ... |";
0171   INFO_NICE<<"-----------------------------------------------";
0172   INFO_NICE;
0173 }