Analysis Software
Documentation for sPHENIX simulation 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 "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()->SetInfo(true);
70  JetScapeLogger::Instance()->SetDebug(false);
71  JetScapeLogger::Instance()->SetRemark(false);
72  //SetVerboseLevel (9 a lot of additional debug output ...)
73  //If you want to suppress it: use SetVerboseLevle(0) or max SetVerboseLevle(9) or 10
74  JetScapeLogger::Instance()->SetVerboseLevel(0);
75 
76 
77  Show();
78 
79  auto jetscape = make_shared<JetScape>();
80  jetscape->SetXMLMainFileName("../config/jetscape_main.xml");
81  jetscape->SetXMLUserFileName("../config/jetscape_user.xml");
82  jetscape->SetId("primary");
83 
84  // Initial conditions and hydro
85  auto trento = make_shared<TrentoInitial>();
86  auto pythiaGun= make_shared<PythiaGun> ();
87  auto hydro = make_shared<Brick> ();
88  jetscape->Add(trento);
89  jetscape->Add(pythiaGun);
90  jetscape->Add(hydro);
91 
92 
93  // Energy loss
94  auto jlossmanager = make_shared<JetEnergyLossManager> ();
95  auto jloss = make_shared<JetEnergyLoss> ();
96 
97  auto matter = make_shared<Matter> ();
98  // auto lbt = make_shared<LBT> ();
99  auto martini = make_shared<Martini> ();
100  // auto adscft = make_shared<AdSCFT> ();
101 
102  // Note: if you use Matter, it MUST come first (to set virtuality)
103  jloss->Add(matter);
104  // jloss->Add(lbt); // go to 3rd party and ./get_lbtTab before adding this module
105  // jloss->Add(martini);
106  // jloss->Add(adscft);
107  jlossmanager->Add(jloss);
108  jetscape->Add(jlossmanager);
109 
110 
111  // Hadronization
112  auto hadroMgr = make_shared<HadronizationManager> ();
113  auto hadro = make_shared<Hadronization> ();
114  //auto hadroModule = make_shared<ColoredHadronization> ();
115  //hadro->Add(hadroModule);
116  auto colorless = make_shared<ColorlessHadronization> ();
117  hadro->Add(colorless);
118  hadroMgr->Add(hadro);
119  jetscape->Add(hadroMgr);
120 
121 
122  // Output
123  auto writer= make_shared<JetScapeWriterAscii> ("test_out.dat");
124  jetscape->Add(writer);
125 #ifdef USE_GZIP
126  // same as JetScapeWriterAscii but gzipped
127  auto writergz= make_shared<JetScapeWriterAsciiGZ> ("test_out.dat.gz");
128  jetscape->Add(writergz);
129 #endif
130  // HEPMC3
131 #ifdef USE_HEPMC
132  auto hepmcwriter= make_shared<JetScapeWriterHepMC> ("test_out.hepmc");
133  jetscape->Add(hepmcwriter);
134 #endif
135 
136  // Initialize all modules tasks
137  jetscape->Init();
138 
139  // Run JetScape with all task/modules as specified
140  jetscape->Exec();
141 
142  // For the future, cleanup is mostly already done in write and clear
143  jetscape->Finish();
144 
145  INFO_NICE<<"Finished!";
146  cout<<endl;
147 
148  t = clock() - t;
149  time(&end);
150  printf ("CPU time: %f seconds.\n",((float)t)/CLOCKS_PER_SEC);
151  printf ("Real time: %f seconds.\n",difftime(end,start));
152 
153  // Print pythia statistics
154  // pythiaGun->stat();
155 
156  // // Demonstrate how to work with pythia statistics
157  // //Pythia8::Info& info = pythiaGun->info;
158  // cout << " nTried = " << info.nTried() << endl;
159  // cout << " nSelected = " << info.nSelected() << endl;
160  // cout << " nAccepted = " << info.nAccepted() << endl;
161  // cout << " sigmaGen = " << info.sigmaGen() << endl;
162  // cout << " sigmaErr = " << info.sigmaErr() << endl;
163 
164  return 0;
165 }
166 
167 // -------------------------------------
168 
169 void Show()
170 {
171  INFO_NICE<<"------------------------------------";
172  INFO_NICE<<"| Brick Test JetScape Framework ... |";
173  INFO_NICE<<"------------------------------------";
174  INFO_NICE;
175 }