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