Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SMASHTest.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SMASHTest.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 // Move it here to avoid conflicts:
25 // 1. Conflicts with MUSIC macros: hbarc, theta, limit, etc
26 // 2. Conflict of make_unique from smash and from JetScape
27 #include "SmashWrapper.h"
28 
29 // JetScape Framework includes ...
30 #include "JetScape.h"
31 #include "JetEnergyLoss.h"
32 #include "JetEnergyLossManager.h"
33 #include "JetScapeWriterStream.h"
34 #ifdef USE_HEPMC
35 #include "JetScapeWriterHepMC.h"
36 #endif
37 
38 // User modules derived from jetscape framework clasess
39 #include "AdSCFT.h"
40 #include "Matter.h"
41 #include "Martini.h"
42 #include "MusicWrapper.h"
43 // Make sure that nasty MUSIC macros are neutralized
44 #undef PI
45 #undef hbarc
46 #undef default_tol
47 #undef absol
48 #undef maxi
49 #undef mini
50 #undef sgn
51 #undef theta
52 #undef gmn
53 #undef limit
54 
55 #include "FreestreamMilneWrapper.h"
56 #include "iSpectraSamplerWrapper.h"
57 #include "TrentoInitial.h"
58 #include "PGun.h"
59 #include "HadronizationManager.h"
60 #include "Hadronization.h"
61 #include "ColoredHadronization.h"
62 
63 #include <chrono>
64 #include <thread>
65 
66 using namespace std;
67 
68 using namespace Jetscape;
69 
70 // Forward declaration
71 void Show();
72 
73 // -------------------------------------
74 
75 int main(int argc, char** argv)
76 {
77  clock_t t; t = clock();
78  time_t start, end; time(&start);
79 
80  cout<<endl;
81 
82  // DEBUG=true by default and REMARK=false
83  // can be also set also via XML file (at least partially)
84  JetScapeLogger::Instance()->SetInfo(true);
85  JetScapeLogger::Instance()->SetDebug(true);
86  JetScapeLogger::Instance()->SetRemark(false);
87  //SetVerboseLevel (9 a lot of additional debug output ...)
88  //If you want to suppress it: use SetVerboseLevel(0) or max SetVerboseLevel(9) or 10
89  JetScapeLogger::Instance()->SetVerboseLevel(8);
90 
91  Show();
92 
93  auto jetscape = make_shared<JetScape>();
94  const char* mainXMLName = "../config/jetscape_main.xml";
95  const char* userXMLName = "../config/jetscape_user.xml";
96 
97  jetscape->SetXMLMainFileName(mainXMLName);
98  jetscape->SetXMLUserFileName(userXMLName);
99 
100  jetscape->SetNumberOfEvents(1);
101  jetscape->SetReuseHydro (false);
102  jetscape->SetNReuseHydro (0);
103  // jetscape->SetNumberOfEvents(10);
104  // jetscape->SetReuseHydro (true);
105  // jetscape->SetNReuseHydro (5);
106 
107  // Initial conditions and hydro
108  auto trento = make_shared<TrentoInitial>();
109  auto freestream = make_shared<FreestreamMilneWrapper> ();
110  auto pGun= make_shared<PGun> ();
111  auto hydro = make_shared<MpiMusic> ();
112  jetscape->Add(trento);
113  jetscape->Add(freestream);
114  jetscape->Add(pGun);
115  jetscape->Add(hydro);
116 
117  // surface sampler
118  auto iSS = make_shared<iSpectraSamplerWrapper> ();
119  jetscape->Add(iSS);
120 
121  // afterburner
122  auto smash = make_shared<SmashWrapper> ();
123  jetscape->Add(smash);
124 
125  // Energy loss
126  auto jlossmanager = make_shared<JetEnergyLossManager> ();
127  auto jloss = make_shared<JetEnergyLoss> ();
128 
129  auto matter = make_shared<Matter> ();
130  // auto lbt = make_shared<LBT> ();
131  // auto martini = make_shared<Martini> ();
132  // auto adscft = make_shared<AdSCFT> ();
133 
134  // Note: if you use Matter, it MUST come first (to set virtuality)
135  jloss->Add(matter);
136  // jloss->Add(lbt); // go to 3rd party and ./get_lbtTab before adding this module
137  // jloss->Add(martini);
138  // jloss->Add(adscft);
139  jlossmanager->Add(jloss);
140  jetscape->Add(jlossmanager);
141 
142  // Hadronization
143  auto hadroMgr = make_shared<HadronizationManager> ();
144  auto hadro = make_shared<Hadronization> ();
145  auto hadroModule = make_shared<ColoredHadronization> ();
146  hadro->Add(hadroModule);
147  // auto colorless = make_shared<ColorlessHadronization> ();
148  // hadro->Add(colorless);
149  hadroMgr->Add(hadro);
150  jetscape->Add(hadroMgr);
151 
152  // Output
153  auto writer= make_shared<JetScapeWriterAscii> ("test_out.dat");
154  // same as JetScapeWriterAscii but gzipped
155  // auto writer= make_shared<JetScapeWriterAsciiGZ> ("test_out.dat.gz");
156  // HEPMC3
157 #ifdef USE_HEPMC
158  // auto writer= make_shared<JetScapeWriterHepMC> ("test_out.hepmc");
159 #endif
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  // wait for 5s
176  //std::this_thread::sleep_for(std::chrono::milliseconds(500000));
177 
178  t = clock() - t;
179  time(&end);
180  printf ("CPU time: %f seconds.\n",((float)t)/CLOCKS_PER_SEC);
181  printf ("Real time: %f seconds.\n",difftime(end,start));
182  //printf ("Real time: %f seconds.\n",(start-end));
183  return 0;
184 }
185 
186 // -------------------------------------
187 
188 void Show()
189 {
190  INFO_NICE<<"-----------------------------------------------";
191  INFO_NICE<<"| SMASH Test JetScape Framework ... |";
192  INFO_NICE<<"-----------------------------------------------";
193  INFO_NICE;
194 }