EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LBT_brickTest.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file LBT_brickTest.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 Brick 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 "TrentoInitial.h"
35 #include "AdSCFT.h"
36 #include "Matter.h"
37 #include "LBT.h"
38 #include "Martini.h"
39 #include "Brick.h"
40 #include "GubserHydro.h"
41 #include "PGun.h"
42 #include "PartonPrinter.h"
43 #include "HadronizationManager.h"
44 #include "Hadronization.h"
45 #include "ColoredHadronization.h"
46 #include "ColorlessHadronization.h"
47 
48 #include <chrono>
49 #include <thread>
50 
51 using namespace std;
52 
53 using namespace Jetscape;
54 
55 // Forward declaration
56 void Show();
57 
58 // -------------------------------------
59 
60 int main(int argc, char** argv)
61 {
62  clock_t t; t = clock();
63  time_t start, end; time(&start);
64 
65  cout<<endl;
66 
67  // DEBUG=true by default and REMARK=false
68  // can be also set also via XML file (at least partially)
69  JetScapeLogger::Instance()->SetDebug(false);
70  JetScapeLogger::Instance()->SetRemark(false);
71  //SetVerboseLevel (9 a lot of additional debug output ...)
72  //If you want to suppress it: use SetVerboseLevle(0) or max SetVerboseLevle(9) or 10
73  JetScapeLogger::Instance()->SetVerboseLevel(8);
74 
75  Show();
76 
77  auto jetscape = make_shared<JetScape>("./jetscape_init.xml",3);
78  jetscape->SetId("primary");
79 
80  // Initial conditions and hydro
81  auto trento = make_shared<TrentoInitial>();
82  auto pGun= make_shared<PGun> ();
83  auto hydro = make_shared<Brick> ();
84  jetscape->Add(trento);
85  jetscape->Add(pGun);
86  jetscape->Add(hydro);
87 
88  // Energy loss
89  auto jlossmanager = make_shared<JetEnergyLossManager> ();
90  auto jloss = make_shared<JetEnergyLoss> ();
91  auto lbt = make_shared<LBT> ();
92  jloss->Add(lbt);
93  jlossmanager->Add(jloss);
94  jetscape->Add(jlossmanager);
95 
96  // Hadronization
97  // This helper module currently needs to be added for hadronization.
98  auto printer = make_shared<PartonPrinter> ();
99  jetscape->Add(printer);
100  auto hadroMgr = make_shared<HadronizationManager> ();
101  auto hadro = make_shared<Hadronization> ();
102  auto hadroModule = make_shared<ColoredHadronization> ();
103  hadro->Add(hadroModule);
104  // auto colorless = make_shared<ColorlessHadronization> ();
105  // hadro->Add(colorless);
106  hadroMgr->Add(hadro);
107  jetscape->Add(hadroMgr);
108 
109  // Output
110  auto writer= make_shared<JetScapeWriterAscii> ("test_out.dat");
111  // same as JetScapeWriterAscii but gzipped
112  // auto writer= make_shared<JetScapeWriterAsciiGZ> ("test_out.dat.gz");
113  // HEPMC3
114 #ifdef USE_HEPMC
115  // auto writer= make_shared<JetScapeWriterHepMC> ("test_out.hepmc");
116 #endif
117  jetscape->Add(writer);
118 
119 
120  // Intialize all modules tasks
121  jetscape->Init();
122 
123  // Run JetScape with all task/modules as specified ...
124  jetscape->Exec();
125 
126  // "dummy" so far ...
127  // Most thinkgs done in write and clear ...
128  jetscape->Finish();
129 
130  INFO_NICE<<"Finished!";
131  cout<<endl;
132 
133  // wait for 5s
134  //std::this_thread::sleep_for(std::chrono::milliseconds(500000));
135 
136  t = clock() - t;
137  time(&end);
138  printf ("CPU time: %f seconds.\n",((float)t)/CLOCKS_PER_SEC);
139  printf ("Real time: %f seconds.\n",difftime(end,start));
140  //printf ("Real time: %f seconds.\n",(start-end));
141  return 0;
142 }
143 
144 // -------------------------------------
145 
146 void Show()
147 {
148  INFO_NICE<<"------------------------------------";
149  INFO_NICE<<"| Brick Test JetScape Framework ... |";
150  INFO_NICE<<"------------------------------------";
151  INFO_NICE;
152 }