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