Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TwoStagesHydro.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TwoStagesHydro.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 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 
24 // JetScape Framework includes ...
25 #include "JetScape.h"
26 #include "JetEnergyLoss.h"
27 #include "JetEnergyLossManager.h"
28 #include "JetScapeWriterStream.h"
29 #ifdef USE_HEPMC
30 #include "JetScapeWriterHepMC.h"
31 #endif
32 
33 // User modules derived from jetscape framework clasess
34 #include "AdSCFT.h"
35 #include "Matter.h"
36 #include "LBT.h"
37 #include "Martini.h"
38 #include "Brick.h"
39 #include "MusicWrapper.h"
40 #include "CausalLiquefier.h"
41 #include "iSpectraSamplerWrapper.h"
42 #include "TrentoInitial.h"
43 #include "NullPreDynamics.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 #include <chrono>
53 #include <thread>
54 
55 using namespace std;
56 
57 using namespace Jetscape;
58 
59 // Forward declaration
60 void Show();
61 
62 // -------------------------------------
63 
64 int main(int argc, char** argv)
65 {
66  clock_t t; t = clock();
67  time_t start, end; time(&start);
68 
69  cout<<endl;
70 
71  // DEBUG=true by default and REMARK=false
72  // can be also set also via XML file (at least partially)
73  JetScapeLogger::Instance()->SetInfo(true);
74  JetScapeLogger::Instance()->SetDebug(true);
75  JetScapeLogger::Instance()->SetRemark(false);
76  //SetVerboseLevel (9 a lot of additional debug output ...)
77  //If you want to suppress it: use SetVerboseLevel(0) or max SetVerboseLevel(9) or 10
78  JetScapeLogger::Instance()->SetVerboseLevel(0);
79 
80  Show();
81 
82  auto jetscape = make_shared<JetScape>();
83  const char* mainXMLName = "../config/jetscape_main.xml";
84  const char* userXMLName = "../config/jetscape_user.xml";
85 
86  jetscape->SetXMLMainFileName(mainXMLName);
87  jetscape->SetXMLUserFileName(userXMLName);
88 
89  jetscape->SetNumberOfEvents(1);
90  jetscape->SetReuseHydro (true);
91  jetscape->SetNReuseHydro (5);
92  // jetscape->SetNumberOfEvents(2);
93  //jetscape->SetReuseHydro (false);
94  //jetscape->SetNReuseHydro (0);
95 
96  // Initial conditions and hydro
97  auto trento = make_shared<TrentoInitial>();
98  auto null_predynamics = make_shared<NullPreDynamics> ();
99  //auto pGun= make_shared<PGun> ();
100  auto pythiaGun= make_shared<PythiaGun> ();
101  auto hydro1 = make_shared<MpiMusic> ();
102  auto myliquefier = make_shared<CausalLiquefier> ();
103  hydro1->SetId("MUSIC_1");
104  //hydro1->add_a_liqueifier(myliquefier);
105 
106  jetscape->Add(trento);
107  jetscape->Add(null_predynamics);
108  jetscape->Add(pythiaGun);
109  //jetscape->Add(pGun);
110 
111  // add the first hydro
112  jetscape->Add(hydro1);
113 
114  // Energy loss
115  auto jlossmanager = make_shared<JetEnergyLossManager> ();
116  auto jloss = make_shared<JetEnergyLoss> ();
117  jloss->add_a_liquefier(myliquefier);
118 
119 
120  auto matter = make_shared<Matter> ();
121  auto lbt = make_shared<LBT> ();
122  //auto martini = make_shared<Martini> ();
123  // auto adscft = make_shared<AdSCFT> ();
124 
125  // Note: if you use Matter, it MUST come first (to set virtuality)
126  jloss->Add(matter);
127  jloss->Add(lbt); // go to 3rd party and ./get_lbtTab before adding this module
128  //jloss->Add(martini);
129  // jloss->Add(adscft);
130  jlossmanager->Add(jloss);
131  jetscape->Add(jlossmanager);
132 
133 
134  // add the second hydro
135  auto hydro2 = make_shared<MpiMusic> ();
136  hydro2->add_a_liquefier(myliquefier);
137  hydro2->SetId("MUSIC_2");
138  jetscape->Add(hydro2);
139 
140  // surface sampler
141  auto iSS = make_shared<iSpectraSamplerWrapper> ();
142  jetscape->Add(iSS);
143 
144  // Hadronization
145  // This helper module currently needs to be added for hadronization.
146  auto printer = make_shared<PartonPrinter> ();
147  jetscape->Add(printer);
148  auto hadroMgr = make_shared<HadronizationManager> ();
149  auto hadro = make_shared<Hadronization> ();
150  //auto hadroModule = make_shared<ColoredHadronization> ();
151  //hadro->Add(hadroModule);
152  auto colorless = make_shared<ColorlessHadronization> ();
153  hadro->Add(colorless);
154  hadroMgr->Add(hadro);
155  jetscape->Add(hadroMgr);
156 
157  // Output
158  auto writer= make_shared<JetScapeWriterAscii> ("test_out.dat");
159  // same as JetScapeWriterAscii but gzipped
160  // auto writer= make_shared<JetScapeWriterAsciiGZ> ("test_out.dat.gz");
161  // HEPMC3
162 #ifdef USE_HEPMC
163  // auto writer= make_shared<JetScapeWriterHepMC> ("test_out.hepmc");
164 #endif
165  jetscape->Add(writer);
166 
167  // Initialize all modules tasks
168  jetscape->Init();
169 
170  // Run JetScape with all task/modules as specified ...
171  jetscape->Exec();
172 
173  // "dummy" so far ...
174  // Most thinkgs done in write and clear ...
175  jetscape->Finish();
176 
177  INFO_NICE<<"Finished!";
178  cout<<endl;
179 
180  // wait for 5s
181  //std::this_thread::sleep_for(std::chrono::milliseconds(500000));
182 
183  t = clock() - t;
184  time(&end);
185  printf ("CPU time: %f seconds.\n",((float)t)/CLOCKS_PER_SEC);
186  printf ("Real time: %f seconds.\n",difftime(end,start));
187  //printf ("Real time: %f seconds.\n",(start-end));
188  return 0;
189 }
190 
191 // -------------------------------------
192 
193 void Show()
194 {
195  INFO_NICE<<"-----------------------------------------------";
196  INFO_NICE<<"| MUSIC Test JetScape Framework ... |";
197  INFO_NICE<<"-----------------------------------------------";
198  INFO_NICE;
199 }