39#include "Ex03PrimaryGenerator.h"
43#include "Ex03RunConfiguration1.h"
44#include "Ex03RunConfiguration2.h"
45#include "Ex03RunConfiguration3.h"
46#include "Ex03RunConfiguration4.h"
47#include "TG4RunConfiguration.h"
52#include "TGeant3TGeo.h"
62std::string g4Geometry =
"geomRoot";
63std::string g4PhysicsList =
"FTFP_BERT";
64std::string g4SpecialPhysics =
"stepLimiter";
65std::string g4Macro =
"g4config.in";
66std::string g4VisMacro =
"g4vis.in";
67std::string g4Session =
"";
68std::string g4UserClass =
"";
71std::string g3Geometry =
"TGeant3TGeo";
81void PrintUsage(
const std::string& programName)
85 <<
" " << programName <<
"\n"
87 <<
" [-g4g, --g4-geometry]: Geant4 VMC geometry option\n"
88 <<
" [-g4pl, --g4-physics-list]: Geant4 physics list selection\n"
89 <<
" [-g4sp, --g4-special-physics]: Geant4 special physics selection\n"
90 <<
" [-g4m, --g4-macro]: Geant4 macro\n"
91 <<
" [-g4vm, --g4-vis-macro]: Geant4 visualization macro\n"
92 <<
" [-g4uc, --g4-user-class]: Geant4 user class \n"
93 <<
" (geometry, regions, physics-list, "
97 <<
" [-g3g, --g3-geometry]: Geant3 geometry option "
100 <<
" [-r4m, --root-macro]: Root macro\n"
101 <<
" [-v, --verbose]: verbose option (yes,no)\n"
103 <<
" [-fe, --first-engine]: first engine (g3,g4)\n"
109void PrintConfiguration(
const std::string& programName)
111 std::cout <<
" Running " << programName <<
" with options:" << std::endl;
113 std::cout <<
" --g4-geometry: " << g4Geometry << std::endl
114 <<
" --g4-physics-list: " << g4PhysicsList << std::endl;
115 if (g4SpecialPhysics.size()) {
116 std::cout <<
" --g4-special-physics: " << g4SpecialPhysics << std::endl;
118 if (g4Macro.size()) {
119 std::cout <<
" --g4-macro: " << g4Macro << std::endl;
121 if (g4VisMacro.size()) {
122 std::cout <<
" --g4-vis-macro: " << g4VisMacro << std::endl;
124 if (g4Session.size()) {
125 std::cout <<
" --g4-session: " << g4Session << std::endl;
127 if (g4UserClass.size()) {
128 std::cout <<
" --g4-user-class: " << g4UserClass << std::endl;
132 std::cout <<
" --g3-geometry: " << g3Geometry << std::endl;
135 std::cout <<
" --first-engine: " <<
firstEngine << std::endl;
138 std::cout <<
" --root-macro: " <<
rootMacro << std::endl;
142void CreateGeant4(
int argc,
char** argv)
147 if (!g4UserClass.size()) {
149 g4Geometry, g4PhysicsList, g4SpecialPhysics,
false,
false);
151 else if (g4UserClass ==
"geometry") {
155 else if (g4UserClass ==
"physics-list") {
158 else if (g4UserClass ==
"regions") {
162 else if (g4UserClass ==
"field") {
164 g4Geometry, g4PhysicsList, g4SpecialPhysics,
false,
false);
167 PrintUsage(
"testE03s");
172 TGeant4* geant4 =
new TGeant4(
173 "TGeant4",
"The Geant4 Monte Carlo", runConfiguration, argc, argv);
177 if (g4Macro.size()) {
178 geant4->ProcessGeantMacro(g4Macro.data());
186 TGeant3TGeo* geant3 =
new TGeant3TGeo(
"C++ Interface to Geant3");
187 geant3->SetProcess(
"DRAY", 1);
188 geant3->SetProcess(
"LOSS", 1);
189 geant3->SetProcess(
"HADR", 0);
201#ifdef G4MULTITHREADED
202 ROOT::EnableThreadSafety();
206 for (Int_t i = 1; i < argc; i = i + 2) {
207 std::cout <<
"processing " << argv[i] <<
" with " << argv[i + 1]
209 if (std::string(argv[i]) ==
"--root-macro" || std::string(argv[i]) ==
"-rm")
211 else if (std::string(argv[i]) ==
"--verbose" ||
212 std::string(argv[i]) ==
"-v")
215 else if (std::string(argv[i]) ==
"--g4-geometry" ||
216 std::string(argv[i]) ==
"-g4g")
217 g4Geometry = argv[i + 1];
218 else if (std::string(argv[i]) ==
"--g4-physics-list" ||
219 std::string(argv[i]) ==
"-g4pl")
220 g4PhysicsList = argv[i + 1];
221 else if (std::string(argv[i]) ==
"--g4-special-physics" ||
222 std::string(argv[i]) ==
"-g4sp")
223 g4SpecialPhysics = argv[i + 1];
224 else if (std::string(argv[i]) ==
"--g4-macro" ||
225 std::string(argv[i]) ==
"-g4m")
226 g4Macro = argv[i + 1];
227 else if (std::string(argv[i]) ==
"--g4-vis-macro" ||
228 std::string(argv[i]) ==
"-g4vm")
229 g4VisMacro = argv[i + 1];
230 else if (std::string(argv[i]) ==
"--g4-session" ||
231 std::string(argv[i]) ==
"-g4s")
232 g4Session = argv[i + 1];
234 else if (std::string(argv[i]) ==
"--g4-user-class" ||
235 std::string(argv[i]) ==
"-g4uc")
236 g4UserClass = argv[i + 1];
239 else if (std::string(argv[i]) ==
"--g3-geometry" ||
240 std::string(argv[i]) ==
"-g3g")
241 g3Geometry = argv[i + 1];
244 else if (std::string(argv[i]) ==
"--first-engine" ||
245 std::string(argv[i]) ==
"-fe")
249 PrintUsage(
"testE03c");
255 PrintConfiguration(
"testE03c");
260 Bool_t isMulti =
false;
269 "ExampleE03",
"The exampleE03 MC application", isMulti, isMulti);
274 CreateGeant4(argc, argv);
277 CreateGeant4(argc, argv);
301 std::cout <<
"Go to call macro" << std::endl;
Definition of the Ex03cMCApplication class.
User Geant4 VMC run configuration.
User Geant4 VMC run configuration.
User Geant4 VMC run configuration.
User Geant4 VMC run configuration.
Implementation of the TVirtualMCApplication.
void InitMC(const char *setup)
void RunMC(Int_t nofEvents)
void SetDebug(Int_t debug)
Set debug option for multiple run.
int main(int argc, char **argv)
Application main program.