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