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