ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
freestream-milneTest.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file freestream-milneTest.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 #include <iostream>
17 #include <time.h>
18 
19 // JetScape Framework includes ...
20 #include "JetScape.h"
21 #include "JetEnergyLoss.h"
22 #include "JetEnergyLossManager.h"
23 #include "JetScapeWriterStream.h"
24 #ifdef USE_HEPMC
25 #include "JetScapeWriterHepMC.h"
26 #endif
27 
28 //User modules derived from jetscape framework clasess
29 //to be used to run Jetscape ...
30 #include "AdSCFT.h"
31 #include "Matter.h"
32 #include "Martini.h"
33 #include "FreestreamMilneWrapper.h"
34 #include "MusicWrapper.h"
35 #include "TrentoInitial.h"
36 #include "PGun.h"
37 #include "PythiaGun.h"
38 #include "PartonPrinter.h"
39 //#include "HadronizationManager.h"
40 //#include "Hadronization.h"
41 //#include "ColoredHadronization.h"
42 
43 #include <chrono>
44 #include <thread>
45 
46 using namespace std;
47 
48 using namespace Jetscape;
49 
50 // Forward declaration
51 void Show();
52 
53 // -------------------------------------
54 
55 int main(int argc, char** argv)
56 {
57  clock_t t; t = clock();
58  time_t start, end; time(&start);
59 
60  cout<<endl;
61 
62  //DEBUG=true by default and REMARK=false
63  //can be also set also via XML file (at least partially)
64  JetScapeLogger::Instance()->SetInfo(true);
65  JetScapeLogger::Instance()->SetDebug(true);
66  JetScapeLogger::Instance()->SetRemark(false);
67  //SetVerboseLevel (9 a lot of additional debug output ...)
68  //If you want to suppress it: use SetVerboseLevel(0) or max SetVerboseLevel(9) or 10
69  JetScapeLogger::Instance()->SetVerboseLevel(0);
70 
71  Show();
72 
73  //auto jetscape = make_shared<JetScape>("./jetscape_init.xml",10);
74  //jetscape->SetReuseHydro (true);
75  //jetscape->SetNReuseHydro (5);
76 
77  auto jetscape = make_shared<JetScape>("./jetscape_init.xml",1);
78  jetscape->SetReuseHydro (false);
79  jetscape->SetNReuseHydro (0);
80 
81  auto jlossmanager = make_shared<JetEnergyLossManager> ();
82  auto jloss = make_shared<JetEnergyLoss> ();
83  auto trento = make_shared<TrentoInitial> ();
84  auto freestream = make_shared<FreestreamMilneWrapper> ();
85  auto hydro = make_shared<MpiMusic> ();
86  //auto hydro = make_shared<GubserHydro> ();
87 
88  auto matter = make_shared<Matter> ();
89  auto martini = make_shared<Martini> ();
90  auto adscft = make_shared<AdSCFT> ();
91  //DBEUG: Remark:
92  //does not matter unfortunately since not called recursively, done by JetEnergyLoss class ...
93  //matter->SetActive(false);
94  //martini->SetActive(false);
95  // This works ... (check with above logic ...)
96  //jloss->SetActive(false);
97 
98  // auto pGun= make_shared<PGun> ();
99  auto pythiaGun= make_shared<PythiaGun> ();
100 
101  auto printer = make_shared<PartonPrinter> ();
102 
103  //auto hadroMgr = make_shared<HadronizationManager> ();
104  //auto hadro = make_shared<Hadronization> ();
105  //auto hadroModule = make_shared<ColoredHadronization> ();
106 
107  // only pure Ascii writer implemented and working with graph output ...
108  auto writer= make_shared<JetScapeWriterAscii> ("test_out.dat");
109  //auto writer= make_shared<JetScapeWriterAsciiGZ> ("test_out.dat.gz");
110 #ifdef USE_HEPMC
111  //auto writer= make_shared<JetScapeWriterHepMC> ("test_out.dat");
112 #endif
113  //writer->SetActive(false);
114 
115  //Remark: For now modules have to be added
116  //in proper "workflow" order (can be defined via xml and sorted if necessary)
117 
118  jetscape->Add(trento);
119 
120  // jetscape->Add(pGun);
121  jetscape->Add(pythiaGun);
122 
123  jetscape->Add(freestream);
124 
125  //Some modifications will be needed for reusing hydro events, so far
126  //simple test hydros always executed "on the fly" ...
127  jetscape->Add(hydro);
128 
129  // Matter with silly "toy shower (no physics)
130  // and Martini dummy ...
131  // Switching Q2 (or whatever variable used
132  // hardcoded at 5 to be changed to xml)
133  jloss->Add(matter);
134  //jloss->Add(martini);
135  //jloss->Add(adscft);
136 
137  jlossmanager->Add(jloss);
138 
139  jetscape->Add(jlossmanager);
140 
141 
142  jetscape->Add(printer);
143 
144  //hadro->Add(hadroModule);
145  //hadroMgr->Add(hadro);
146  //jetscape->Add(hadroMgr);
147 
148 
149 
150  jetscape->Add(writer);
151 
152  // Intialize all modules tasks
153  jetscape->Init();
154 
155  // Run JetScape with all task/modules as specified ...
156  jetscape->Exec();
157 
158  // "dummy" so far ...
159  // Most thinkgs done in write and clear ...
160  jetscape->Finish();
161 
162  INFO_NICE<<"Finished!";
163  cout<<endl;
164 
165  // wait for 5s
166  //std::this_thread::sleep_for(std::chrono::milliseconds(500000));
167 
168  t = clock() - t;
169  time(&end);
170  printf ("CPU time: %f seconds.\n",((float)t)/CLOCKS_PER_SEC);
171  printf ("Real time: %f seconds.\n",difftime(end,start));
172  //printf ("Real time: %f seconds.\n",(start-end));
173  return 0;
174 }
175 
176 // -------------------------------------
177 
178 void Show()
179 {
180  INFO_NICE<<"-----------------------------------------------";
181  INFO_NICE<<"| freestream-milne Test JetScape Framework ... |";
182  INFO_NICE<<"-----------------------------------------------";
183  INFO_NICE;
184 }