Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:19:54

0001 // -----------------------------------------
0002 // JetScape (modular/task) based framework
0003 // Intial Design: Joern Putschke (2017)
0004 //                (Wayne State University)
0005 // -----------------------------------------
0006 // License and Doxygen-like Documentation to be added ...
0007 
0008 // ------------------------------------------------------------
0009 // JetScape Framework Writer Test Program
0010 // Test by Kurt Jung (UIC)
0011 // Validate parton and vertex linkage through new initial-state module
0012 // -------------------------------------------------------------
0013 
0014 #include <iostream>
0015 #include <time.h>
0016 
0017 // JetScape Framework includes ...
0018 #include "JetScape.h"
0019 #include "JetEnergyLoss.h"
0020 #include "JetEnergyLossManager.h"
0021 #include "JetScapeWriterAscii.h"
0022 #include "JetScapeWriterAsciiGZ.h"
0023 #ifdef USE_HEPMC
0024 #include "JetScapeWriterHepMC.h"
0025 #endif
0026 
0027 // User modules derived from jetscape framework clasess
0028 // to be used to run Jetscape ...
0029 #include "InitialState.h"
0030 #include "Matter.h"
0031 #include "Martini.h"
0032 #include "Brick.h"
0033 #include "GubserHydro.h"
0034 #include "PGun.h"
0035 
0036 #include <chrono>
0037 #include <thread>
0038 
0039 using namespace std;
0040 
0041 using namespace Jetscape;
0042 
0043 // Forward declaration
0044 void Show();
0045 
0046 // -------------------------------------
0047 
0048 int main(int argc, char** argv)
0049 {
0050   clock_t t; t = clock();
0051   time_t start, end; time(&start);
0052   
0053   cout<<endl;
0054     
0055   // DEBUG=true by default and REMARK=false
0056   // can be also set also via XML file (at least partially)
0057   JetScapeLogger::Instance()->SetDebug(false);
0058   JetScapeLogger::Instance()->SetRemark(false);
0059   //SetVerboseLevel (9 a lot of additional debug output ...)
0060   //If you want to suppress it: use SetVerboseLevle(0) or max  SetVerboseLevle(9) or 10
0061   JetScapeLogger::Instance()->SetVerboseLevel(8);
0062    
0063   Show();
0064 
0065   auto jetscape = make_shared<JetScape>("./jetscape_init.xml",10);
0066   jetscape->SetId("primary");
0067   auto initState = make_shared<InitialState> ();
0068   auto jlossmanager = make_shared<JetEnergyLossManager> ();
0069   auto jloss = make_shared<JetEnergyLoss> ();
0070   auto hydro = make_shared<Brick> ();
0071   //auto hydro = make_shared<GubserHydro> ();
0072   
0073   auto matter = make_shared<Matter> ();
0074   auto martini = make_shared<Martini> ();
0075   
0076   auto pGun= make_shared<PGun> ();
0077 
0078   // only pure Ascii writer implemented and working with graph output ...
0079   //auto writer= make_shared<JetScapeWriterAscii> ("test_out.dat");
0080   auto writer= make_shared<JetScapeWriterAsciiGZ> ("test_out.dat.gz");  
0081 #ifdef HepMC
0082   auto writer= make_shared<JetScapeWriterHepMC> ("test_out.hepmc");
0083 #endif
0084 
0085   jetscape->Add(initState);
0086 
0087   //Remark: For now modules have to be added
0088   //in proper "workflow" order (can be defined via xml and sorted if necessary)
0089   
0090   jetscape->Add(pGun);
0091 
0092    //Some modifications will be needed for reusing hydro events, so far
0093   //simple test hydros always executed "on the fly" ...
0094   jetscape->Add(hydro);
0095 
0096   jloss->Add(matter);
0097   jloss->Add(martini);
0098   
0099   jlossmanager->Add(jloss);
0100   
0101   jetscape->Add(jlossmanager);
0102   
0103   jetscape->Add(writer);
0104 
0105   // Initialize all modules tasks
0106   jetscape->Init();
0107 
0108   // Run JetScape with all task/modules as specified ...
0109   jetscape->Exec();
0110 
0111   jetscape->Finish();
0112   
0113   INFO_NICE<<"Finished!";
0114   cout<<endl;
0115 
0116   // wait for 5s
0117   //std::this_thread::sleep_for(std::chrono::milliseconds(500000));
0118 
0119   t = clock() - t;
0120   time(&end);
0121   printf ("CPU time: %f seconds.\n",((float)t)/CLOCKS_PER_SEC);
0122   printf ("Real time: %f seconds.\n",difftime(end,start));
0123   //printf ("Real time: %f seconds.\n",(start-end));
0124   return 0;
0125 }
0126 
0127 // -------------------------------------
0128 
0129 void Show()
0130 {
0131   INFO_NICE<<"------------------------------------";
0132   INFO_NICE<<"| Writer Test JetScape Framework ... |";
0133   INFO_NICE<<"------------------------------------";
0134   INFO_NICE;
0135 }