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 "CLViscWrapper.h"
0038 //#include "iSpectraSamplerWrapper.h"
0039 #include "TrentoInitial.h"
0040 #include "PGun.h"
0041 #include "PartonPrinter.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(1);
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 pGun= make_shared<PGun> ();
0093   auto hydro = make_shared<CLVisc> ();
0094   jetscape->Add(trento);
0095   jetscape->Add(pGun);
0096   jetscape->Add(hydro);
0097 
0098   // surface sampler
0099   //auto iSS = make_shared<iSpectraSamplerWrapper> ();
0100   //jetscape->Add(iSS);
0101 
0102   // Energy loss
0103   auto jlossmanager = make_shared<JetEnergyLossManager> ();
0104   auto jloss = make_shared<JetEnergyLoss> ();
0105 
0106   auto matter = make_shared<Matter> ();
0107   // auto lbt = make_shared<LBT> ();
0108   // auto martini = make_shared<Martini> ();
0109   // auto adscft = make_shared<AdSCFT> ();
0110 
0111   // Note: if you use Matter, it MUST come first (to set virtuality)
0112   jloss->Add(matter);
0113   // jloss->Add(lbt);  // go to 3rd party and ./get_lbtTab before adding this module
0114   // jloss->Add(martini);
0115   // jloss->Add(adscft);  
0116   jlossmanager->Add(jloss);  
0117   jetscape->Add(jlossmanager);
0118   
0119   // Hadronization
0120   // This helper module currently needs to be added for hadronization.
0121   auto printer = make_shared<PartonPrinter> ();
0122   jetscape->Add(printer);
0123   auto hadroMgr = make_shared<HadronizationManager> ();
0124   auto hadro = make_shared<Hadronization> ();
0125   auto hadroModule = make_shared<ColoredHadronization> ();
0126   hadro->Add(hadroModule);
0127   // auto colorless = make_shared<ColorlessHadronization> ();
0128   // hadro->Add(colorless);
0129   hadroMgr->Add(hadro);
0130   jetscape->Add(hadroMgr);
0131 
0132   // Output
0133   auto writer= make_shared<JetScapeWriterAscii> ("test_out.dat");
0134   // same as JetScapeWriterAscii but gzipped
0135   // auto writer= make_shared<JetScapeWriterAsciiGZ> ("test_out.dat.gz");
0136   // HEPMC3
0137 #ifdef USE_HEPMC
0138   // auto writer= make_shared<JetScapeWriterHepMC> ("test_out.hepmc");
0139 #endif
0140   jetscape->Add(writer);
0141 
0142   // Initialize all modules tasks
0143   jetscape->Init();
0144 
0145   // Run JetScape with all task/modules as specified ...
0146   jetscape->Exec();
0147 
0148   // "dummy" so far ...
0149   // Most thinkgs done in write and clear ...
0150   jetscape->Finish();
0151   
0152   INFO_NICE<<"Finished!";
0153   cout<<endl;
0154 
0155   // wait for 5s
0156   //std::this_thread::sleep_for(std::chrono::milliseconds(500000));
0157 
0158   t = clock() - t;
0159   time(&end);
0160   printf ("CPU time: %f seconds.\n",((float)t)/CLOCKS_PER_SEC);
0161   printf ("Real time: %f seconds.\n",difftime(end,start));
0162   //printf ("Real time: %f seconds.\n",(start-end));
0163   return 0;
0164 }
0165 
0166 // -------------------------------------
0167 
0168 void Show()
0169 {
0170   INFO_NICE<<"-----------------------------------------------";
0171   INFO_NICE<<"| CLVisc Test JetScape Framework ... |";
0172   INFO_NICE<<"-----------------------------------------------";
0173   INFO_NICE;
0174 }