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