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