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 jet in 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 "LBT.h"
0040 #include "Martini.h"
0041 #include "Brick.h"
0042 #include "GubserHydro.h"
0043 #include "HydroFromFile.h"
0044 #include "PGun.h"
0045 #include "PythiaGun.h"
0046 #include "HadronizationManager.h"
0047 #include "Hadronization.h"
0048 #include "ColoredHadronization.h"
0049 #include "ColorlessHadronization.h"
0050 
0051 #ifdef USE_HDF5
0052 #include "InitialFromFile.h"
0053 #endif
0054 // using namespace std;
0055 // Add initial state module for test
0056 #include "TrentoInitial.h"
0057 
0058 #include <chrono>
0059 #include <thread>
0060 
0061 using namespace Jetscape;
0062 
0063 // Forward declaration
0064 void Show();
0065 
0066 // -------------------------------------
0067 
0068 int main(int argc, char** argv)
0069 {
0070   clock_t t; t = clock();
0071   time_t start, end; time(&start);
0072   
0073   cout<<endl;
0074     
0075   // DEBUG=true by default and REMARK=false
0076   // can be also set also via XML file (at least partially)
0077   JetScapeLogger::Instance()->SetInfo(true);
0078   JetScapeLogger::Instance()->SetDebug(false);
0079   JetScapeLogger::Instance()->SetRemark(false);
0080   //SetVerboseLevel (9 a lot of additional debug output ...)
0081   //If you want to suppress it: use SetVerboseLevle(0) or max  SetVerboseLevle(9) or 10
0082   JetScapeLogger::Instance()->SetVerboseLevel(6);
0083    
0084   Show();
0085 
0086   auto jetscape = make_shared<JetScape>();
0087   jetscape->SetXMLMainFileName("../config/jetscape_main.xml");
0088   jetscape->SetXMLUserFileName("../config/jetscape_user.xml");
0089   // auto jetscape = make_shared<JetScape>("./jetscape_init_pythiagun.xml",5);
0090   jetscape->SetId("primary");
0091   jetscape->SetReuseHydro (true);
0092   jetscape->SetNReuseHydro (10001);
0093     
0094     auto pGun= make_shared<PGun> ();
0095 
0096   auto jlossmanager = make_shared<JetEnergyLossManager> ();
0097   auto jloss = make_shared<JetEnergyLoss> ();
0098   auto hydro = make_shared<HydroFromFile> ();
0099   //auto hydro = make_shared<GubserHydro> ();
0100   
0101   auto matter = make_shared<Matter> ();
0102   auto lbt = make_shared<LBT> ();
0103   auto martini = make_shared<Martini> ();
0104   auto adscft = make_shared<AdSCFT> ();
0105   //DBEUG: Remark:
0106   //does not matter unfortunately since not called recursively, done by JetEnergyLoss class ...
0107   //matter->SetActive(false);
0108   //martini->SetActive(false);
0109   // This works ... (check with above logic ...)
0110   //jloss->SetActive(false);
0111 
0112   //auto pythiaGun= make_shared<PythiaGun> ();
0113 
0114   auto hadroMgr = make_shared<HadronizationManager> ();
0115   auto hadro = make_shared<Hadronization> ();
0116   auto hadroModule = make_shared<ColoredHadronization> ();
0117   auto colorless = make_shared<ColorlessHadronization> ();
0118 
0119   // only pure Ascii writer implemented and working with graph output ...
0120   auto writer= make_shared<JetScapeWriterAscii> ("test_out.dat");
0121   //auto writer= make_shared<JetScapeWriterAsciiGZ> ("test_out.dat.gz");  
0122 #ifdef USE_HEPMC
0123   //auto writer= make_shared<JetScapeWriterHepMC> ("test_out.hepmc");
0124 #endif
0125   //writer->SetActive(false);
0126 
0127   //Remark: For now modules have to be added
0128   //in proper "workflow" order (can be defined via xml and sorted if necessary)
0129   
0130 #ifdef USE_HDF5
0131   auto initial = make_shared<InitialFromFile>();
0132   jetscape->Add(initial);
0133 #endif
0134 
0135 //  jetscape->Add(pythiaGun);
0136     jetscape->Add(pGun);
0137 
0138    //Some modifications will be needed for reusing hydro events, so far
0139   //simple test hydros always executed "on the fly" ...
0140   jetscape->Add(hydro);
0141 
0142   // Matter with silly "toy shower (no physics)
0143   // and Martini dummy ...
0144   // Switching Q2 (or whatever variable used
0145   // hardcoded at 5 to be changed to xml)
0146   jloss->Add(matter);
0147   //jloss->Add(lbt);  // go to 3rd party and ./get_lbtTab before adding this module
0148   //jloss->Add(martini);
0149   //jloss->Add(adscft);
0150   
0151   jlossmanager->Add(jloss);
0152   
0153   jetscape->Add(jlossmanager);
0154 
0155   hadro->Add(hadroModule);
0156   //hadro->Add(colorless);
0157   hadroMgr->Add(hadro);
0158   jetscape->Add(hadroMgr);
0159 
0160   jetscape->Add(writer);
0161 
0162   // Initialize all modules tasks
0163   jetscape->Init();
0164 
0165   // Run JetScape with all task/modules as specified ...
0166   jetscape->Exec();
0167 
0168   // "dummy" so far ...
0169   // Most thinkgs done in write and clear ...
0170   jetscape->Finish();
0171   
0172   INFO_NICE<<"Finished!";
0173   cout<<endl;
0174 
0175 // Some information is only known after the full run,
0176   // Therefore store information at the end of the file, in a footer
0177 /*  writer->WriteComment ( "EVENT GENERATION INFORMATION" );
0178   Pythia8::Info& info = pythiaGun->info;
0179   std::ostringstream oss;
0180   oss.str(""); oss << "nTried    = " << info.nTried();
0181   writer->WriteComment ( oss.str() );
0182   oss.str(""); oss << "nSelected = " << info.nSelected();
0183   writer->WriteComment ( oss.str() );
0184   oss.str(""); oss << "nAccepted = " << info.nAccepted();
0185   writer->WriteComment ( oss.str() );
0186   oss.str(""); oss << "sigmaGen  = " << info.sigmaGen();  
0187   writer->WriteComment ( oss.str() );
0188   oss.str(""); oss << "sigmaErr  = " << info.sigmaErr();
0189   writer->WriteComment ( oss.str() );
0190 
0191   oss.str(""); oss << "eCM  = " << info.eCM();
0192   writer->WriteComment ( oss.str() );
0193   oss.str(""); oss << "pTHatMin  = " << pythiaGun->GetpTHatMin();
0194   writer->WriteComment ( oss.str() );
0195   oss.str(""); oss << "pTHatMax  = " << pythiaGun->GetpTHatMax();
0196   //writer->WriteComment ( oss.str() );
0197   //oss.str(""); oss << "JETSCAPE Random Seed  = " << JetScapeTaskSupport::Instance()->GetRandomSeed();
0198   writer->WriteComment ( oss.str() );
0199   writer->WriteComment ( "/EVENT GENERATION INFORMATION" );
0200 */
0201   t = clock() - t;
0202   time(&end);
0203   printf ("CPU time: %f seconds.\n",((float)t)/CLOCKS_PER_SEC);
0204   printf ("Real time: %f seconds.\n",difftime(end,start));
0205 
0206   // Print pythia statistics
0207   // pythiaGun->stat();
0208 
0209   // Demonstrate how to work with pythia statistics
0210   //Pythia8::Info& info = pythiaGun->info;
0211 /*  cout << " nTried    = " << info.nTried() << endl;
0212   cout << " nSelected = " << info.nSelected()  << endl;
0213   cout << " nAccepted = " << info.nAccepted()  << endl;
0214   cout << " sigmaGen  = " <<   info.sigmaGen()  << endl;  
0215   cout << " sigmaErr  = " <<   info.sigmaErr()  << endl;
0216 */
0217   
0218   return 0;
0219 }
0220 
0221 // -------------------------------------
0222 
0223 void Show()
0224 {
0225   INFO_NICE<<"------------------------------------------------------";
0226   INFO_NICE<<"| Jet in hydro from file Test JetScape Framework ... |";
0227   INFO_NICE<<"------------------------------------------------------";
0228   INFO_NICE;
0229 }