Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FirstTestMatterVacuum.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FirstTestMatterVacuum.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>(argv[1],10000);
80  jetscape->SetId("primary");
81 
82  // Initial conditions and hydro
83  auto trento = make_shared<TrentoInitial>();
84  auto pythiaGun= make_shared<PythiaGun> ();
85  auto hydro = make_shared<Brick> ();
86  jetscape->SetReuseHydro(false);
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 
105  // jloss->Add(martini);
106 
107  // jloss->Add(adscft);
108  jlossmanager->Add(jloss);
109  jetscape->Add(jlossmanager);
110 
111  auto printer = make_shared<PartonPrinter> () ;
112  jetscape->Add(printer);
113 
114  // Hadronization
115  auto hadroMgr = make_shared<HadronizationManager> ();
116  auto hadro = make_shared<Hadronization> ();
117  //auto hadroModule = make_shared<ColoredHadronization> ();
118  //hadro->Add(hadroModule);
119  auto colorless = make_shared<ColorlessHadronization> ();
120  hadro->Add(colorless);
121  hadroMgr->Add(hadro);
122  jetscape->Add(hadroMgr);
123 
124 
125  // Output
126  auto writer= make_shared<JetScapeWriterAscii> (argv[2]);
127  jetscape->Add(writer);
128 //#ifdef USE_GZIP
129 // // same as JetScapeWriterAscii but gzipped
130 // auto writergz= make_shared<JetScapeWriterAsciiGZ> ("test_out.dat.gz");
131 // jetscape->Add(writergz);
132 //#endif
133 // // HEPMC3
134 //#ifdef USE_HEPMC
135 // auto hepmcwriter= make_shared<JetScapeWriterHepMC> ("test_out.hepmc");
136 // jetscape->Add(hepmcwriter);
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  ofstream WriteSigmaHard;
168  WriteSigmaHard.open(argv[3],std::ios::out);
169  WriteSigmaHard<<info.sigmaGen()<<"\t"<<info.sigmaErr()<<endl;
170  WriteSigmaHard.close();
171 
172  return 0;
173 }
174 
175 // -------------------------------------
176 
177 void Show()
178 {
179  INFO_NICE<<"------------------------------------";
180  INFO_NICE<<"| Brick Test JetScape Framework ... |";
181  INFO_NICE<<"------------------------------------";
182  INFO_NICE;
183 }