Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SimpleValidate.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SimpleValidate.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 
17 #include <iostream>
18 #include <time.h>
19 
20 // Add includes here to test if it breaks anything
21 #include "JetScape.h"
22 #include "JetEnergyLoss.h"
23 #include "JetEnergyLossManager.h"
24 #include "JetScapeWriterStream.h"
25 #ifdef USE_HEPMC
26 #include "JetScapeWriterHepMC.h"
27 #endif
28 
29 #include "Brick.h"
30 #include "PGun.h"
31 #include "ElossValidation.h"
32 #include "HadronizationManager.h"
33 #include "Hadronization.h"
34 #include "ColoredHadronization.h"
35 
36 #include <chrono>
37 
38 using namespace Jetscape;
39 
40 // Forward declaration
41 void Show();
42 
43 // -------------------------------------
44 
45 int main(int argc, char** argv)
46 {
47  clock_t t; t = clock();
48  time_t start, end; time(&start);
49 
54 
55  Show();
56 
57  // Main framework task
58  auto jetscape = make_shared<JetScape>();
59  jetscape->SetXMLMainFileName("../config/jetscape_main.xml");
60  jetscape->SetXMLUserFileName("../config/jetscape_user.xml");
61  jetscape->SetId("primary");
62 
63  // Empty initial state
64  auto ini = make_shared<InitialState>();
65  ini->SetId("InitialState");
66 
67  // mono-energetic particle gun, fixed parameters in XML file
68  auto pGun= make_shared<PGun> ();
69 
70  // Simple brick, parameters in XML file
71  auto hydro = make_shared<Brick> ();
72 
73  // Energy loss manager, parameters in XML file
74  auto jlossmanager = make_shared<JetEnergyLossManager> ();
75 
76  // Energy loss wrapper
77  auto jloss = make_shared<JetEnergyLoss> ();
78 
79  // Energy loss module, can also add multiple ones.
80  // Parameters in XML file
81  // auto eloss1 = make_shared<ValidationEloss> ();
82  auto eloss1 = make_shared<ElossValidate> ();
83 
84  // Pure Ascii writer
85  auto writer= make_shared<JetScapeWriterAscii> ("validate_out.dat");
86 
87  //Remark: For now modules have to be added in proper "workflow" order
88  jetscape->Add(ini);
89  jetscape->Add(pGun);
90  jetscape->Add(hydro);
91 
92  // add module to the eloss wrapper, than the eloss wrapper to the manager
93  jloss->Add(eloss1);
94  jlossmanager->Add(jloss);
95  jetscape->Add(jlossmanager);
96 
97  // TODO: Should add hadronizer here
98 
99  // Add the writer
100  jetscape->Add(writer);
101 
102  // Initialize all modules tasks
103  jetscape->Init();
104 
105  // Run JetScape with all task/modules as specified ...
106  jetscape->Exec();
107 
108  jetscape->Finish();
109 
110  INFO_NICE<<"Finished!";
111  cout<<endl;
112 
113  t = clock() - t;
114  time(&end);
115  printf ("CPU time: %f seconds.\n",((float)t)/CLOCKS_PER_SEC);
116  printf ("Real time: %f seconds.\n",difftime(end,start));
117 
118  return 0;
119 }
120 
121 // -------------------------------------
122 
123 void Show()
124 {
125  INFO_NICE<<"--------------------------------------";
126  INFO_NICE<<"| Validation Test JetScape Framework |";
127  INFO_NICE<<"--------------------------------------";
128  INFO_NICE;
129 }