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 #include <iostream>
0017 #include <time.h>
0018 
0019 // JetScape Framework includes ...
0020 #include "JetScape.h"
0021 #include "JetEnergyLoss.h"
0022 #include "JetEnergyLossManager.h"
0023 #include "JetScapeWriterStream.h"
0024 #ifdef USE_HEPMC
0025 #include "JetScapeWriterHepMC.h"
0026 #endif
0027 
0028 //User modules derived from jetscape framework clasess
0029 //to be used to run Jetscape ...
0030 #include "AdSCFT.h"
0031 #include "Matter.h"
0032 #include "Martini.h"
0033 #include "FreestreamMilneWrapper.h"
0034 #include "MusicWrapper.h"
0035 #include "iSpectraSamplerWrapper.h"
0036 #include "TrentoInitial.h"
0037 #include "PGun.h"
0038 #include "PythiaGun.h"
0039 //#include "HadronizationManager.h"
0040 //#include "Hadronization.h"
0041 //#include "ColoredHadronization.h"
0042 
0043 #include <chrono>
0044 #include <thread>
0045 
0046 using namespace std;
0047 
0048 using namespace Jetscape;
0049 
0050 // Forward declaration
0051 void Show();
0052 
0053 // -------------------------------------
0054 
0055 int main(int argc, char** argv)
0056 {
0057   clock_t t; t = clock();
0058   time_t start, end; time(&start);
0059 
0060   cout<<endl;
0061 
0062   //DEBUG=true by default and REMARK=false
0063   //can be also set also via XML file (at least partially)
0064   JetScapeLogger::Instance()->SetInfo(true);
0065   JetScapeLogger::Instance()->SetDebug(true);
0066   JetScapeLogger::Instance()->SetRemark(false);
0067   //SetVerboseLevel (9 a lot of additional debug output ...)
0068   //If you want to suppress it: use SetVerboseLevel(0) or max  SetVerboseLevel(9) or 10
0069   JetScapeLogger::Instance()->SetVerboseLevel(0);
0070 
0071   Show();
0072 
0073   auto jetscape = make_shared<JetScape>();
0074   const char* mainXMLName = "../config/jetscape_main.xml";
0075   const char* userXMLName = "../config/jetscape_user.xml";
0076 
0077   jetscape->SetXMLMainFileName(mainXMLName);
0078   jetscape->SetXMLUserFileName(userXMLName);
0079 
0080   jetscape->SetNumberOfEvents(1);
0081   jetscape->SetReuseHydro (false);
0082   jetscape->SetNReuseHydro (0);
0083   // jetscape->SetNumberOfEvents(10);
0084   //jetscape->SetReuseHydro (true);
0085   //jetscape->SetNReuseHydro (5);
0086 
0087   auto trento = make_shared<TrentoInitial> ();
0088   auto freestream = make_shared<FreestreamMilneWrapper> ();
0089   auto hydro = make_shared<MpiMusic> ();
0090   //auto hydro = make_shared<GubserHydro> ();
0091   
0092   // surface sampler
0093   auto iSS = make_shared<iSpectraSamplerWrapper> ();
0094 
0095   auto jlossmanager = make_shared<JetEnergyLossManager> ();
0096   auto jloss = make_shared<JetEnergyLoss> ();
0097   auto matter = make_shared<Matter> ();
0098   //auto martini = make_shared<Martini> ();
0099   //auto adscft = make_shared<AdSCFT> ();
0100   //DBEUG: Remark:
0101   //does not matter unfortunately since not called recursively, done by JetEnergyLoss class ...
0102   //matter->SetActive(false);
0103   //martini->SetActive(false);
0104   // This works ... (check with above logic ...)
0105   //jloss->SetActive(false);
0106 
0107   // auto pGun= make_shared<PGun> ();
0108   auto pythiaGun= make_shared<PythiaGun> ();
0109 
0110   //auto hadroMgr = make_shared<HadronizationManager> ();
0111   //auto hadro = make_shared<Hadronization> ();
0112   //auto hadroModule = make_shared<ColoredHadronization> ();
0113 
0114   // only pure Ascii writer implemented and working with graph output ...
0115   auto writer= make_shared<JetScapeWriterAscii> ("test_out.dat");
0116   //auto writer= make_shared<JetScapeWriterAsciiGZ> ("test_out.dat.gz");
0117 #ifdef USE_HEPMC
0118   //auto writer= make_shared<JetScapeWriterHepMC> ("test_out.dat");
0119 #endif
0120   //writer->SetActive(false);
0121 
0122   //Remark: For now modules have to be added
0123   //in proper "workflow" order (can be defined via xml and sorted if necessary)
0124 
0125   jetscape->Add(trento);
0126 
0127   // jetscape->Add(pGun);
0128   jetscape->Add(pythiaGun);
0129 
0130   jetscape->Add(freestream);
0131 
0132   //Some modifications will be needed for reusing hydro events, so far
0133   //simple test hydros always executed "on the fly" ...
0134   jetscape->Add(hydro);
0135   jetscape->Add(iSS);
0136 
0137   // Matter with silly "toy shower (no physics)
0138   // and Martini dummy ...
0139   // Switching Q2 (or whatever variable used
0140   // hardcoded at 5 to be changed to xml)
0141   jloss->Add(matter);
0142   //jloss->Add(martini);
0143   //jloss->Add(adscft);
0144 
0145   jlossmanager->Add(jloss);
0146 
0147   jetscape->Add(jlossmanager);
0148 
0149 
0150   //hadro->Add(hadroModule);
0151   //hadroMgr->Add(hadro);
0152   //jetscape->Add(hadroMgr);
0153 
0154 
0155 
0156   jetscape->Add(writer);
0157 
0158   // Initialize all modules tasks
0159   jetscape->Init();
0160 
0161   // Run JetScape with all task/modules as specified ...
0162   jetscape->Exec();
0163 
0164   // "dummy" so far ...
0165   // Most thinkgs done in write and clear ...
0166   jetscape->Finish();
0167 
0168   INFO_NICE<<"Finished!";
0169   cout<<endl;
0170 
0171   // wait for 5s
0172   //std::this_thread::sleep_for(std::chrono::milliseconds(500000));
0173 
0174   t = clock() - t;
0175   time(&end);
0176   printf ("CPU time: %f seconds.\n",((float)t)/CLOCKS_PER_SEC);
0177   printf ("Real time: %f seconds.\n",difftime(end,start));
0178   //printf ("Real time: %f seconds.\n",(start-end));
0179   return 0;
0180 }
0181 
0182 // -------------------------------------
0183 
0184 void Show()
0185 {
0186   INFO_NICE<<"-----------------------------------------------";
0187   INFO_NICE<<"| freestream-milne Test JetScape Framework ... |";
0188   INFO_NICE<<"-----------------------------------------------";
0189   INFO_NICE;
0190 }