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