Analysis Software
Documentation for sPHENIX simulation 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 "NullPreDynamics.h"
41 #include "PGun.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(2);
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 null_predynamics = make_shared<NullPreDynamics> ();
93  auto pGun= make_shared<PGun> ();
94  auto hydro = make_shared<MpiMusic> ();
95  jetscape->Add(trento);
96  jetscape->Add(null_predynamics);
97  jetscape->Add(pGun);
98  jetscape->Add(hydro);
99 
100  // surface sampler
101  auto iSS = make_shared<iSpectraSamplerWrapper> ();
102  jetscape->Add(iSS);
103 
104  // Energy loss
105  auto jlossmanager = make_shared<JetEnergyLossManager> ();
106  auto jloss = make_shared<JetEnergyLoss> ();
107 
108  auto matter = make_shared<Matter> ();
109  // auto lbt = make_shared<LBT> ();
110  // auto martini = make_shared<Martini> ();
111  // auto adscft = make_shared<AdSCFT> ();
112 
113  // Note: if you use Matter, it MUST come first (to set virtuality)
114  jloss->Add(matter);
115  // jloss->Add(lbt); // go to 3rd party and ./get_lbtTab before adding this module
116  // jloss->Add(martini);
117  // jloss->Add(adscft);
118  jlossmanager->Add(jloss);
119  jetscape->Add(jlossmanager);
120 
121  // Hadronization
122  auto hadroMgr = make_shared<HadronizationManager> ();
123  auto hadro = make_shared<Hadronization> ();
124  auto hadroModule = make_shared<ColoredHadronization> ();
125  hadro->Add(hadroModule);
126  // auto colorless = make_shared<ColorlessHadronization> ();
127  // hadro->Add(colorless);
128  hadroMgr->Add(hadro);
129  jetscape->Add(hadroMgr);
130 
131  // Output
132  auto writer= make_shared<JetScapeWriterAscii> ("test_out.dat");
133  // same as JetScapeWriterAscii but gzipped
134  // auto writer= make_shared<JetScapeWriterAsciiGZ> ("test_out.dat.gz");
135  // HEPMC3
136 #ifdef USE_HEPMC
137  // auto writer= make_shared<JetScapeWriterHepMC> ("test_out.hepmc");
138 #endif
139  jetscape->Add(writer);
140 
141  // Initialize all modules tasks
142  jetscape->Init();
143 
144  // Run JetScape with all task/modules as specified ...
145  jetscape->Exec();
146 
147  // "dummy" so far ...
148  // Most thinkgs done in write and clear ...
149  jetscape->Finish();
150 
151  INFO_NICE<<"Finished!";
152  cout<<endl;
153 
154  // wait for 5s
155  //std::this_thread::sleep_for(std::chrono::milliseconds(500000));
156 
157  t = clock() - t;
158  time(&end);
159  printf ("CPU time: %f seconds.\n",((float)t)/CLOCKS_PER_SEC);
160  printf ("Real time: %f seconds.\n",difftime(end,start));
161  //printf ("Real time: %f seconds.\n",(start-end));
162  return 0;
163 }
164 
165 // -------------------------------------
166 
167 void Show()
168 {
169  INFO_NICE<<"-----------------------------------------------";
170  INFO_NICE<<"| MUSIC Test JetScape Framework ... |";
171  INFO_NICE<<"-----------------------------------------------";
172  INFO_NICE;
173 }