Back to home page

sPhenix code displayed by LXR

 
 

    


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

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