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