EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
hydroJetTest.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file hydroJetTest.cc
1 /*******************************************************************************
2  * Copyright (c) The JETSCAPE Collaboration, 2018
3  *
4  * Modular, task-based framework for simulating all aspects of heavy-ion collisions
5  *
6  * For the list of contributors see AUTHORS.
7  *
8  * Report issues at https://github.com/JETSCAPE/JETSCAPE/issues
9  *
10  * or via email to bugs.jetscape@gmail.com
11  *
12  * Distributed under the GNU General Public License 3.0 (GPLv3 or later).
13  * See COPYING for details.
14  ******************************************************************************/
15 // ------------------------------------------------------------
16 // JetScape Framework jet in hydro from file Test Program
17 // (use either shared library (need to add paths; see setup.csh)
18 // (or create static library and link in)
19 // -------------------------------------------------------------
20 
21 #include <iostream>
22 #include <time.h>
23 #include <chrono>
24 #include <thread>
25 
26 // JetScape Framework includes ...
27 #include "JetScape.h"
28 #include "JetEnergyLoss.h"
29 #include "JetEnergyLossManager.h"
30 #include "JetScapeWriterStream.h"
31 #ifdef USE_HEPMC
32 #include "JetScapeWriterHepMC.h"
33 #endif
34 
35 // User modules derived from jetscape framework clasess
36 // to be used to run Jetscape ...
37 #include "AdSCFT.h"
38 #include "Matter.h"
39 #include "LBT.h"
40 #include "Martini.h"
41 #include "Brick.h"
42 #include "GubserHydro.h"
43 #include "HydroFromFile.h"
44 #include "PythiaGun.h"
45 #include "PartonPrinter.h"
46 #include "HadronizationManager.h"
47 #include "Hadronization.h"
48 #include "ColoredHadronization.h"
49 #include "ColorlessHadronization.h"
50 
51 #ifdef USE_HDF5
52 #include "InitialFromFile.h"
53 #endif
54 // using namespace std;
55 // Add initial state module for test
56 #include "TrentoInitial.h"
57 
58 #include <chrono>
59 #include <thread>
60 
61 using namespace Jetscape;
62 
63 // Forward declaration
64 void Show();
65 
66 // -------------------------------------
67 
68 int main(int argc, char** argv)
69 {
70  clock_t t; t = clock();
71  time_t start, end; time(&start);
72 
73  cout<<endl;
74 
75  // DEBUG=true by default and REMARK=false
76  // can be also set also via XML file (at least partially)
77  JetScapeLogger::Instance()->SetInfo(true);
78  JetScapeLogger::Instance()->SetDebug(false);
79  JetScapeLogger::Instance()->SetRemark(false);
80  //SetVerboseLevel (9 a lot of additional debug output ...)
81  //If you want to suppress it: use SetVerboseLevle(0) or max SetVerboseLevle(9) or 10
82  JetScapeLogger::Instance()->SetVerboseLevel(8);
83 
84  Show();
85 
86  auto jetscape = make_shared<JetScape>("./jetscape_init.xml", 20);
87  // auto jetscape = make_shared<JetScape>("./jetscape_init_pythiagun.xml",5);
88  jetscape->SetId("primary");
89  jetscape->SetReuseHydro (true);
90  jetscape->SetNReuseHydro (20);
91 
92  auto jlossmanager = make_shared<JetEnergyLossManager> ();
93  auto jloss = make_shared<JetEnergyLoss> ();
94  auto hydro = make_shared<HydroFromFile> ();
95  //auto hydro = make_shared<GubserHydro> ();
96 
97  auto matter = make_shared<Matter> ();
98  auto lbt = make_shared<LBT> ();
99  auto martini = make_shared<Martini> ();
100  auto adscft = make_shared<AdSCFT> ();
101  //DBEUG: Remark:
102  //does not matter unfortunately since not called recursively, done by JetEnergyLoss class ...
103  //matter->SetActive(false);
104  //martini->SetActive(false);
105  // This works ... (check with above logic ...)
106  //jloss->SetActive(false);
107 
108  auto pythiaGun= make_shared<PythiaGun> ();
109 
110  auto printer = make_shared<PartonPrinter> ();
111 
112  auto hadroMgr = make_shared<HadronizationManager> ();
113  auto hadro = make_shared<Hadronization> ();
114  auto hadroModule = make_shared<ColoredHadronization> ();
115  auto colorless = make_shared<ColorlessHadronization> ();
116 
117  // only pure Ascii writer implemented and working with graph output ...
118  auto writer= make_shared<JetScapeWriterAscii> ("test_out.dat");
119  //auto writer= make_shared<JetScapeWriterAsciiGZ> ("test_out.dat.gz");
120 #ifdef USE_HEPMC
121  auto writerhepmc= make_shared<JetScapeWriterHepMC> ("test_out.hepmc");
122  jetscape->Add(writerhepmc);
123 #endif
124  //writer->SetActive(false);
125 
126  //Remark: For now modules have to be added
127  //in proper "workflow" order (can be defined via xml and sorted if necessary)
128 
129 #ifdef USE_HDF5
130  auto initial = make_shared<InitialFromFile>();
131  jetscape->Add(initial);
132 #endif
133 
134  jetscape->Add(pythiaGun);
135 
136  //Some modifications will be needed for reusing hydro events, so far
137  //simple test hydros always executed "on the fly" ...
138  jetscape->Add(hydro);
139 
140  // Matter with silly "toy shower (no physics)
141  // and Martini dummy ...
142  // Switching Q2 (or whatever variable used
143  // hardcoded at 5 to be changed to xml)
144  jloss->Add(matter);
145  //jloss->Add(lbt); // go to 3rd party and ./get_lbtTab before adding this module
146  //jloss->Add(martini);
147  jloss->Add(adscft);
148 
149  jlossmanager->Add(jloss);
150 
151  jetscape->Add(jlossmanager);
152 
153  jetscape->Add(printer);
154 
155  hadro->Add(hadroModule);
156  //hadro->Add(colorless);
157  hadroMgr->Add(hadro);
158  jetscape->Add(hadroMgr);
159 
160  jetscape->Add(writer);
161 
162  // Intialize all modules tasks
163  jetscape->Init();
164 
165  // Run JetScape with all task/modules as specified ...
166  jetscape->Exec();
167 
168  // "dummy" so far ...
169  // Most thinkgs done in write and clear ...
170  jetscape->Finish();
171 
172  INFO_NICE<<"Finished!";
173  cout<<endl;
174 
175 // Some information is only known after the full run,
176  // Therefore store information at the end of the file, in a footer
177  writer->WriteComment ( "EVENT GENERATION INFORMATION" );
178  Pythia8::Info& info = pythiaGun->info;
179  std::ostringstream oss;
180  oss.str(""); oss << "nTried = " << info.nTried();
181  writer->WriteComment ( oss.str() );
182  oss.str(""); oss << "nSelected = " << info.nSelected();
183  writer->WriteComment ( oss.str() );
184  oss.str(""); oss << "nAccepted = " << info.nAccepted();
185  writer->WriteComment ( oss.str() );
186  oss.str(""); oss << "sigmaGen = " << info.sigmaGen();
187  writer->WriteComment ( oss.str() );
188  oss.str(""); oss << "sigmaErr = " << info.sigmaErr();
189  writer->WriteComment ( oss.str() );
190 
191  oss.str(""); oss << "eCM = " << info.eCM();
192  writer->WriteComment ( oss.str() );
193  oss.str(""); oss << "pTHatMin = " << pythiaGun->GetpTHatMin();
194  writer->WriteComment ( oss.str() );
195  oss.str(""); oss << "pTHatMax = " << pythiaGun->GetpTHatMax();
196  //writer->WriteComment ( oss.str() );
197  //oss.str(""); oss << "JETSCAPE Random Seed = " << JetScapeTaskSupport::Instance()->GetRandomSeed();
198  writer->WriteComment ( oss.str() );
199  writer->WriteComment ( "/EVENT GENERATION INFORMATION" );
200 
201  t = clock() - t;
202  time(&end);
203  printf ("CPU time: %f seconds.\n",((float)t)/CLOCKS_PER_SEC);
204  printf ("Real time: %f seconds.\n",difftime(end,start));
205 
206  // Print pythia statistics
207  // pythiaGun->stat();
208 
209  // Demonstrate how to work with pythia statistics
210  //Pythia8::Info& info = pythiaGun->info;
211  cout << " nTried = " << info.nTried() << endl;
212  cout << " nSelected = " << info.nSelected() << endl;
213  cout << " nAccepted = " << info.nAccepted() << endl;
214  cout << " sigmaGen = " << info.sigmaGen() << endl;
215  cout << " sigmaErr = " << info.sigmaErr() << endl;
216 
217 
218  return 0;
219 }
220 
221 // -------------------------------------
222 
223 void Show()
224 {
225  INFO_NICE<<"------------------------------------------------------";
226  INFO_NICE<<"| Jet in hydro from file Test JetScape Framework ... |";
227  INFO_NICE<<"------------------------------------------------------";
228  INFO_NICE;
229 }