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