Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PythiaBrickTestRoot.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PythiaBrickTestRoot.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"
32 #endif
33 
34 
35 // User modules derived from jetscape framework clasess
36 #include "TrentoInitial.h"
37 #include "AdSCFT.h"
38 #include "Matter.h"
39 #include "LBT.h"
40 #include "Martini.h"
41 #include "Brick.h"
42 #include "GubserHydro.h"
43 #include "PythiaGun.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>();
81  jetscape->SetXMLMainFileName("../config/jetscape_main.xml");
82  jetscape->SetXMLUserFileName("../config/jetscape_user_root_test.xml");
83  jetscape->SetId("primary");
84 
85  // Initial conditions and hydro
86  auto trento = make_shared<TrentoInitial>();
87  auto pythiaGun= make_shared<PythiaGun> ();
88  auto hydro = make_shared<Brick> ();
89  jetscape->Add(trento);
90  jetscape->Add(pythiaGun);
91  jetscape->Add(hydro);
92 
93 
94  // Energy loss
95  auto jlossmanager = make_shared<JetEnergyLossManager> ();
96  auto jloss = make_shared<JetEnergyLoss> ();
97 
98  auto matter = make_shared<Matter> ();
99  // auto lbt = make_shared<LBT> ();
100  auto martini = make_shared<Martini> ();
101  // auto adscft = make_shared<AdSCFT> ();
102 
103  // Note: if you use Matter, it MUST come first (to set virtuality)
104  jloss->Add(matter);
105  // jloss->Add(lbt); // go to 3rd party and ./get_lbtTab before adding this module
106  // jloss->Add(martini);
107  // jloss->Add(adscft);
108  jlossmanager->Add(jloss);
109  jetscape->Add(jlossmanager);
110 
111 
112  // Hadronization
113  auto hadroMgr = make_shared<HadronizationManager> ();
114  auto hadro = make_shared<Hadronization> ();
115  //auto hadroModule = make_shared<ColoredHadronization> ();
116  //hadro->Add(hadroModule);
117  auto colorless = make_shared<ColorlessHadronization> ();
118  hadro->Add(colorless);
119  hadroMgr->Add(hadro);
120  jetscape->Add(hadroMgr);
121 
122 
123  // Output
124  auto writer= make_shared<JetScapeWriterAscii> ("test_out.dat");
125  jetscape->Add(writer);
126 #ifdef USE_GZIP
127  // same as JetScapeWriterAscii but gzipped
128  //auto writergz= make_shared<JetScapeWriterAsciiGZ> ("test_out.dat.gz");
129  //jetscape->Add(writergz);
130 #endif
131  // HEPMC3
132 #ifdef USE_HEPMC
133  //auto hepmcwriter= make_shared<JetScapeWriterHepMC> ("test_out.hepmc");
134  //jetscape->Add(hepmcwriter);
135  auto hepmcwriterRoot= make_shared<JetScapeWriterRootHepMC> ("test_out_hepmc.root");
136  jetscape->Add(hepmcwriterRoot);
137 #endif
138 
139  // Initialize all modules tasks
140  jetscape->Init();
141 
142  // Run JetScape with all task/modules as specified
143  jetscape->Exec();
144 
145  // For the future, cleanup is mostly already done in write and clear
146  jetscape->Finish();
147 
148  INFO_NICE<<"Finished!";
149  cout<<endl;
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 
156  // Print pythia statistics
157  // pythiaGun->stat();
158 
159  // // Demonstrate how to work with pythia statistics
160  // //Pythia8::Info& info = pythiaGun->info;
161  // cout << " nTried = " << info.nTried() << endl;
162  // cout << " nSelected = " << info.nSelected() << endl;
163  // cout << " nAccepted = " << info.nAccepted() << endl;
164  // cout << " sigmaGen = " << info.sigmaGen() << endl;
165  // cout << " sigmaErr = " << info.sigmaErr() << endl;
166 
167  return 0;
168 }
169 
170 // -------------------------------------
171 
172 void Show()
173 {
174  INFO_NICE<<"------------------------------------";
175  INFO_NICE<<"| Brick Test JetScape Framework ... |";
176  INFO_NICE<<"------------------------------------";
177  INFO_NICE;
178 }