ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PythiaBrickTest.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PythiaBrickTest.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 with Pythia IS
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 
34 // User modules derived from jetscape framework clasess
35 #include "TrentoInitial.h"
36 #include "AdSCFT.h"
37 #include "Matter.h"
38 #include "LBT.h"
39 #include "Martini.h"
40 #include "Brick.h"
41 #include "GubserHydro.h"
42 #include "PythiaGun.h"
43 #include "PartonPrinter.h"
44 #include "HadronizationManager.h"
45 #include "Hadronization.h"
46 #include "ColoredHadronization.h"
47 #include "ColorlessHadronization.h"
48 
49 #include <chrono>
50 #include <thread>
51 
52 using namespace std;
53 
54 using namespace Jetscape;
55 
56 // Forward declaration
57 void Show();
58 
59 // -------------------------------------
60 
61 int main(int argc, char** argv)
62 {
63  clock_t t; t = clock();
64  time_t start, end; time(&start);
65 
66  cout<<endl;
67 
68  // DEBUG=true by default and REMARK=false
69  // can be also set also via XML file (at least partially)
70  JetScapeLogger::Instance()->SetInfo(true);
71  JetScapeLogger::Instance()->SetDebug(false);
72  JetScapeLogger::Instance()->SetRemark(false);
73  //SetVerboseLevel (9 a lot of additional debug output ...)
74  //If you want to suppress it: use SetVerboseLevle(0) or max SetVerboseLevle(9) or 10
75  JetScapeLogger::Instance()->SetVerboseLevel(0);
76 
77 
78  Show();
79 
80  auto jetscape = make_shared<JetScape>("./jetscape_init.xml",200);
81  jetscape->SetId("primary");
82 
83  // Initial conditions and hydro
84  auto trento = make_shared<TrentoInitial>();
85  auto pythiaGun= make_shared<PythiaGun> ();
86  auto hydro = make_shared<Brick> ();
87  jetscape->Add(trento);
88  jetscape->Add(pythiaGun);
89  jetscape->Add(hydro);
90 
91 
92  // Energy loss
93  auto jlossmanager = make_shared<JetEnergyLossManager> ();
94  auto jloss = make_shared<JetEnergyLoss> ();
95 
96  auto matter = make_shared<Matter> ();
97  // auto lbt = make_shared<LBT> ();
98  // auto martini = make_shared<Martini> ();
99  // auto adscft = make_shared<AdSCFT> ();
100 
101  // Note: if you use Matter, it MUST come first (to set virtuality)
102  jloss->Add(matter);
103  // jloss->Add(lbt); // go to 3rd party and ./get_lbtTab before adding this module
104  // jloss->Add(martini);
105  // jloss->Add(adscft);
106  jlossmanager->Add(jloss);
107  jetscape->Add(jlossmanager);
108 
109 
110  // Hadronization
111  // This helper module currently needs to be added for hadronization.
112  auto printer = make_shared<PartonPrinter> ();
113  jetscape->Add(printer);
114  auto hadroMgr = make_shared<HadronizationManager> ();
115  auto hadro = make_shared<Hadronization> ();
116  auto hadroModule = make_shared<ColoredHadronization> ();
117  hadro->Add(hadroModule);
118  // auto colorless = make_shared<ColorlessHadronization> ();
119  // hadro->Add(colorless);
120  hadroMgr->Add(hadro);
121  jetscape->Add(hadroMgr);
122 
123 
124  // Output
125  auto writer= make_shared<JetScapeWriterAscii> ("test_out.dat");
126  jetscape->Add(writer);
127 #ifdef USE_GZIP
128  // same as JetScapeWriterAscii but gzipped
129  auto writergz= make_shared<JetScapeWriterAsciiGZ> ("test_out.dat.gz");
130  jetscape->Add(writergz);
131 #endif
132  // HEPMC3
133 #ifdef USE_HEPMC
134  auto hepmcwriter= make_shared<JetScapeWriterHepMC> ("test_out.hepmc");
135  jetscape->Add(hepmcwriter);
136 #endif
137 
138  // Intialize all modules tasks
139  jetscape->Init();
140 
141  // Run JetScape with all task/modules as specified
142  jetscape->Exec();
143 
144  // For the future, cleanup is mostly already done in write and clear
145  jetscape->Finish();
146 
147  INFO_NICE<<"Finished!";
148  cout<<endl;
149 
150  t = clock() - t;
151  time(&end);
152  printf ("CPU time: %f seconds.\n",((float)t)/CLOCKS_PER_SEC);
153  printf ("Real time: %f seconds.\n",difftime(end,start));
154 
155  // Print pythia statistics
156  // pythiaGun->stat();
157 
158  // // Demonstrate how to work with pythia statistics
159  // //Pythia8::Info& info = pythiaGun->info;
160  // cout << " nTried = " << info.nTried() << endl;
161  // cout << " nSelected = " << info.nSelected() << endl;
162  // cout << " nAccepted = " << info.nAccepted() << endl;
163  // cout << " sigmaGen = " << info.sigmaGen() << endl;
164  // cout << " sigmaErr = " << info.sigmaErr() << endl;
165 
166  return 0;
167 }
168 
169 // -------------------------------------
170 
171 void Show()
172 {
173  INFO_NICE<<"------------------------------------";
174  INFO_NICE<<"| Brick Test JetScape Framework ... |";
175  INFO_NICE<<"------------------------------------";
176  INFO_NICE;
177 }