Analysis Software
Documentation for sPHENIX simulation 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 "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)
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
83 
84  Show();
85 
86  auto jetscape = make_shared<JetScape>();
87  jetscape->SetXMLMainFileName("../config/jetscape_main.xml");
88  jetscape->SetXMLUserFileName("../config/jetscape_user.xml");
89  // auto jetscape = make_shared<JetScape>("./jetscape_init_pythiagun.xml",5);
90  jetscape->SetId("primary");
91  jetscape->SetReuseHydro (true);
92  jetscape->SetNReuseHydro (10001);
93 
94  auto pGun= make_shared<PGun> ();
95 
96  auto jlossmanager = make_shared<JetEnergyLossManager> ();
97  auto jloss = make_shared<JetEnergyLoss> ();
98  auto hydro = make_shared<HydroFromFile> ();
99  //auto hydro = make_shared<GubserHydro> ();
100 
101  auto matter = make_shared<Matter> ();
102  auto lbt = make_shared<LBT> ();
103  auto martini = make_shared<Martini> ();
104  auto adscft = make_shared<AdSCFT> ();
105  //DBEUG: Remark:
106  //does not matter unfortunately since not called recursively, done by JetEnergyLoss class ...
107  //matter->SetActive(false);
108  //martini->SetActive(false);
109  // This works ... (check with above logic ...)
110  //jloss->SetActive(false);
111 
112  //auto pythiaGun= make_shared<PythiaGun> ();
113 
114  auto hadroMgr = make_shared<HadronizationManager> ();
115  auto hadro = make_shared<Hadronization> ();
116  auto hadroModule = make_shared<ColoredHadronization> ();
117  auto colorless = make_shared<ColorlessHadronization> ();
118 
119  // only pure Ascii writer implemented and working with graph output ...
120  auto writer= make_shared<JetScapeWriterAscii> ("test_out.dat");
121  //auto writer= make_shared<JetScapeWriterAsciiGZ> ("test_out.dat.gz");
122 #ifdef USE_HEPMC
123  //auto writer= make_shared<JetScapeWriterHepMC> ("test_out.hepmc");
124 #endif
125  //writer->SetActive(false);
126 
127  //Remark: For now modules have to be added
128  //in proper "workflow" order (can be defined via xml and sorted if necessary)
129 
130 #ifdef USE_HDF5
131  auto initial = make_shared<InitialFromFile>();
132  jetscape->Add(initial);
133 #endif
134 
135 // jetscape->Add(pythiaGun);
136  jetscape->Add(pGun);
137 
138  //Some modifications will be needed for reusing hydro events, so far
139  //simple test hydros always executed "on the fly" ...
140  jetscape->Add(hydro);
141 
142  // Matter with silly "toy shower (no physics)
143  // and Martini dummy ...
144  // Switching Q2 (or whatever variable used
145  // hardcoded at 5 to be changed to xml)
146  jloss->Add(matter);
147  //jloss->Add(lbt); // go to 3rd party and ./get_lbtTab before adding this module
148  //jloss->Add(martini);
149  //jloss->Add(adscft);
150 
151  jlossmanager->Add(jloss);
152 
153  jetscape->Add(jlossmanager);
154 
155  hadro->Add(hadroModule);
156  //hadro->Add(colorless);
157  hadroMgr->Add(hadro);
158  jetscape->Add(hadroMgr);
159 
160  jetscape->Add(writer);
161 
162  // Initialize 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 }