Analysis Software
Documentation for sPHENIX simulation 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 "iSpectraSamplerWrapper.h"
36 #include "TrentoInitial.h"
37 #include "PGun.h"
38 #include "PythiaGun.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>();
74  const char* mainXMLName = "../config/jetscape_main.xml";
75  const char* userXMLName = "../config/jetscape_user.xml";
76 
77  jetscape->SetXMLMainFileName(mainXMLName);
78  jetscape->SetXMLUserFileName(userXMLName);
79 
80  jetscape->SetNumberOfEvents(1);
81  jetscape->SetReuseHydro (false);
82  jetscape->SetNReuseHydro (0);
83  // jetscape->SetNumberOfEvents(10);
84  //jetscape->SetReuseHydro (true);
85  //jetscape->SetNReuseHydro (5);
86 
87  auto trento = make_shared<TrentoInitial> ();
88  auto freestream = make_shared<FreestreamMilneWrapper> ();
89  auto hydro = make_shared<MpiMusic> ();
90  //auto hydro = make_shared<GubserHydro> ();
91 
92  // surface sampler
93  auto iSS = make_shared<iSpectraSamplerWrapper> ();
94 
95  auto jlossmanager = make_shared<JetEnergyLossManager> ();
96  auto jloss = make_shared<JetEnergyLoss> ();
97  auto matter = make_shared<Matter> ();
98  //auto martini = make_shared<Martini> ();
99  //auto adscft = make_shared<AdSCFT> ();
100  //DBEUG: Remark:
101  //does not matter unfortunately since not called recursively, done by JetEnergyLoss class ...
102  //matter->SetActive(false);
103  //martini->SetActive(false);
104  // This works ... (check with above logic ...)
105  //jloss->SetActive(false);
106 
107  // auto pGun= make_shared<PGun> ();
108  auto pythiaGun= make_shared<PythiaGun> ();
109 
110  //auto hadroMgr = make_shared<HadronizationManager> ();
111  //auto hadro = make_shared<Hadronization> ();
112  //auto hadroModule = make_shared<ColoredHadronization> ();
113 
114  // only pure Ascii writer implemented and working with graph output ...
115  auto writer= make_shared<JetScapeWriterAscii> ("test_out.dat");
116  //auto writer= make_shared<JetScapeWriterAsciiGZ> ("test_out.dat.gz");
117 #ifdef USE_HEPMC
118  //auto writer= make_shared<JetScapeWriterHepMC> ("test_out.dat");
119 #endif
120  //writer->SetActive(false);
121 
122  //Remark: For now modules have to be added
123  //in proper "workflow" order (can be defined via xml and sorted if necessary)
124 
125  jetscape->Add(trento);
126 
127  // jetscape->Add(pGun);
128  jetscape->Add(pythiaGun);
129 
130  jetscape->Add(freestream);
131 
132  //Some modifications will be needed for reusing hydro events, so far
133  //simple test hydros always executed "on the fly" ...
134  jetscape->Add(hydro);
135  jetscape->Add(iSS);
136 
137  // Matter with silly "toy shower (no physics)
138  // and Martini dummy ...
139  // Switching Q2 (or whatever variable used
140  // hardcoded at 5 to be changed to xml)
141  jloss->Add(matter);
142  //jloss->Add(martini);
143  //jloss->Add(adscft);
144 
145  jlossmanager->Add(jloss);
146 
147  jetscape->Add(jlossmanager);
148 
149 
150  //hadro->Add(hadroModule);
151  //hadroMgr->Add(hadro);
152  //jetscape->Add(hadroMgr);
153 
154 
155 
156  jetscape->Add(writer);
157 
158  // Initialize all modules tasks
159  jetscape->Init();
160 
161  // Run JetScape with all task/modules as specified ...
162  jetscape->Exec();
163 
164  // "dummy" so far ...
165  // Most thinkgs done in write and clear ...
166  jetscape->Finish();
167 
168  INFO_NICE<<"Finished!";
169  cout<<endl;
170 
171  // wait for 5s
172  //std::this_thread::sleep_for(std::chrono::milliseconds(500000));
173 
174  t = clock() - t;
175  time(&end);
176  printf ("CPU time: %f seconds.\n",((float)t)/CLOCKS_PER_SEC);
177  printf ("Real time: %f seconds.\n",difftime(end,start));
178  //printf ("Real time: %f seconds.\n",(start-end));
179  return 0;
180 }
181 
182 // -------------------------------------
183 
184 void Show()
185 {
186  INFO_NICE<<"-----------------------------------------------";
187  INFO_NICE<<"| freestream-milne Test JetScape Framework ... |";
188  INFO_NICE<<"-----------------------------------------------";
189  INFO_NICE;
190 }