EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MUSICTest.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MUSICTest.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 "MusicWrapper.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>("./jetscape_init.xml",10);
77  // jetscape->SetReuseHydro (true);
78  // jetscape->SetNReuseHydro (5);
79 
80  auto jetscape = make_shared<JetScape>("./jetscape_init.xml",1);
81  jetscape->SetReuseHydro (false);
82  jetscape->SetNReuseHydro (0);
83 
84  // Initial conditions and hydro
85  auto trento = make_shared<TrentoInitial>();
86  auto pGun= make_shared<PGun> ();
87  auto hydro = make_shared<MpiMusic> ();
88  jetscape->Add(trento);
89  jetscape->Add(pGun);
90  jetscape->Add(hydro);
91 
92  // surface sampler
93  auto iSS = make_shared<iSpectraSamplerWrapper> ();
94  jetscape->Add(iSS);
95 
96  // Energy loss
97  auto jlossmanager = make_shared<JetEnergyLossManager> ();
98  auto jloss = make_shared<JetEnergyLoss> ();
99 
100  auto matter = make_shared<Matter> ();
101  // auto lbt = make_shared<LBT> ();
102  // auto martini = make_shared<Martini> ();
103  // auto adscft = make_shared<AdSCFT> ();
104 
105  // Note: if you use Matter, it MUST come first (to set virtuality)
106  jloss->Add(matter);
107  // jloss->Add(lbt); // go to 3rd party and ./get_lbtTab before adding this module
108  // jloss->Add(martini);
109  // jloss->Add(adscft);
110  jlossmanager->Add(jloss);
111  jetscape->Add(jlossmanager);
112 
113  // Hadronization
114  // This helper module currently needs to be added for hadronization.
115  auto printer = make_shared<PartonPrinter> ();
116  jetscape->Add(printer);
117  auto hadroMgr = make_shared<HadronizationManager> ();
118  auto hadro = make_shared<Hadronization> ();
119  auto hadroModule = make_shared<ColoredHadronization> ();
120  hadro->Add(hadroModule);
121  // auto colorless = make_shared<ColorlessHadronization> ();
122  // hadro->Add(colorless);
123  hadroMgr->Add(hadro);
124  jetscape->Add(hadroMgr);
125 
126  // Output
127  auto writer= make_shared<JetScapeWriterAscii> ("test_out.dat");
128  // same as JetScapeWriterAscii but gzipped
129  // auto writer= make_shared<JetScapeWriterAsciiGZ> ("test_out.dat.gz");
130  // HEPMC3
131 #ifdef USE_HEPMC
132  // auto writer= make_shared<JetScapeWriterHepMC> ("test_out.hepmc");
133 #endif
134  jetscape->Add(writer);
135 
136  // Intialize all modules tasks
137  jetscape->Init();
138 
139  // Run JetScape with all task/modules as specified ...
140  jetscape->Exec();
141 
142  // "dummy" so far ...
143  // Most thinkgs done in write and clear ...
144  jetscape->Finish();
145 
146  INFO_NICE<<"Finished!";
147  cout<<endl;
148 
149  // wait for 5s
150  //std::this_thread::sleep_for(std::chrono::milliseconds(500000));
151 
152  t = clock() - t;
153  time(&end);
154  printf ("CPU time: %f seconds.\n",((float)t)/CLOCKS_PER_SEC);
155  printf ("Real time: %f seconds.\n",difftime(end,start));
156  //printf ("Real time: %f seconds.\n",(start-end));
157  return 0;
158 }
159 
160 // -------------------------------------
161 
162 void Show()
163 {
164  INFO_NICE<<"-----------------------------------------------";
165  INFO_NICE<<"| MUSIC Test JetScape Framework ... |";
166  INFO_NICE<<"-----------------------------------------------";
167  INFO_NICE;
168 }