42#include "TG4RunConfiguration.h"
47#include "TGeant3TGeo.h"
59void PrintUsage(std::string programName)
61 std::cerr <<
" Usage: " << std::endl;
62 std::cerr <<
" " << programName << std::endl;
64 std::cerr <<
" [-g4g, --g4-geometry]: Geant4 VMC geometry option"
66 std::cerr <<
" [-g4pl, --g4-physics-list]: Geant4 physics list selection"
69 <<
" [-g4sp, --g4-special-physics]: Geant4 special physics selection"
71 std::cerr <<
" [-g4m, --g4-macro]: Geant4 macro" << std::endl;
72 std::cerr <<
" [-g4vm, --g4-vis-macro]: Geant4 visualization macro"
76 std::cerr <<
" [-g3g, --g3-geometry]: Geant3 geometry option "
77 "(TGeant3,TGeant3TGeo)"
80 std::cerr <<
" [-rm, --root-macro]: Root macro" << std::endl;
81 std::cerr <<
" [-v, --verbose]: verbose option (yes,no)"
87void PrintG4Configuration(
const std::string& programName,
88 const std::string& g4Geometry,
const std::string& g4PhysicsList,
89 const std::string& g4SpecialPhysics,
const std::string& g4Macro,
90 const std::string& g4VisMacro,
const std::string& g4Session,
93 std::cout <<
" Running " << programName <<
" with options:" << std::endl;
94 std::cout <<
" --g4-geometry: " << g4Geometry << std::endl;
95 std::cout <<
" --g4-physics-list: " << g4PhysicsList << std::endl;
96 if (g4SpecialPhysics.size()) {
97 std::cout <<
" --g4-special-physics: " << g4SpecialPhysics << std::endl;
100 std::cout <<
" --g4-macro: " << g4Macro << std::endl;
102 if (g4VisMacro.size()) {
103 std::cout <<
" --g4-vis-macro: " << g4VisMacro << std::endl;
105 if (g4Session.size()) {
106 std::cout <<
" --g4-session: " << g4Session << std::endl;
109 std::cout <<
" --root-macro: " <<
rootMacro << std::endl;
116void PrintG3Configuration(
const std::string& programName,
117 const std::string& g3Geometry,
const std::string&
rootMacro)
119 std::cout <<
" Running: " << std::endl;
120 std::cout <<
" " << programName << std::endl;
121 std::cout <<
" --g3-geometry: " << g3Geometry << std::endl;
123 std::cout <<
" --root-macro: " <<
rootMacro << std::endl;
136#ifdef G4MULTITHREADED
137 ROOT::EnableThreadSafety();
144 std::string g4Geometry =
"geomRootToGeant4";
145 std::string g4PhysicsList =
"emStandard";
146 std::string g4SpecialPhysics =
"stepLimiter";
147 std::string g4Macro =
"";
148 std::string g4VisMacro =
"";
149 std::string g4Session =
"";
152 std::string g3Geometry =
"TGeant3TGeo";
157 for (Int_t i = 1; i < argc; i = i + 2) {
158 std::cout <<
"processing " << argv[i] <<
" with " << argv[i + 1]
161 if (std::string(argv[i]) ==
"--g4-geometry" ||
162 std::string(argv[i]) ==
"-g4g")
163 g4Geometry = argv[i + 1];
164 else if (std::string(argv[i]) ==
"--g4-physics-list" ||
165 std::string(argv[i]) ==
"-g4pl")
166 g4PhysicsList = argv[i + 1];
167 else if (std::string(argv[i]) ==
"--g4-special-physics" ||
168 std::string(argv[i]) ==
"-g4sp")
169 g4SpecialPhysics = argv[i + 1];
170 else if (std::string(argv[i]) ==
"--g4-macro" ||
171 std::string(argv[i]) ==
"-g4m")
172 g4Macro = argv[i + 1];
173 else if (std::string(argv[i]) ==
"--g4-vis-macro" ||
174 std::string(argv[i]) ==
"-g4vm")
175 g4VisMacro = argv[i + 1];
176 else if (std::string(argv[i]) ==
"--g4-session" ||
177 std::string(argv[i]) ==
"-g4s")
178 g4Session = argv[i + 1];
181 if (std::string(argv[i]) ==
"--g3-geometry" ||
182 std::string(argv[i]) ==
"-g3g")
183 g3Geometry = argv[i + 1];
185 else if (std::string(argv[i]) ==
"--root-macro" ||
186 std::string(argv[i]) ==
"-rm")
188 else if (std::string(argv[i]) ==
"--verbose" ||
189 std::string(argv[i]) ==
"-v")
192 PrintUsage(
"testE01");
199 PrintG4Configuration(
"testE01", g4Geometry, g4PhysicsList, g4SpecialPhysics,
200 g4Macro, g4VisMacro, g4Session,
rootMacro);
203 PrintG3Configuration(
"testE01", g3Geometry,
rootMacro);
214 if (g4Geometry.find(
"VMC") != std::string::npos) {
219 if (g3Geometry ==
"TGeant3") {
231 TGeant4* geant4 =
new TGeant4(
232 "TGeant4",
"The Geant4 Monte Carlo", runConfiguration, argc, argv);
236 if (g4Macro.size()) {
237 geant4->ProcessGeantMacro(g4Macro.data());
240 geant4->ProcessGeantCommand(
"/mcVerbose/all 1");
245 if (g3Geometry ==
"TGeant3") {
246 geant3 =
new TGeant3(
"C++ Interface to Geant3");
248 else if (g3Geometry ==
"TGeant3TGeo") {
249 geant3 =
new TGeant3TGeo(
"C++ Interface to Geant3");
252 PrintUsage(
"testE01");
Definition of the Ex01MCApplication class.
Implementation of the TVirtualMCApplication.
void InitMC(const char *setup)
void RunMC(Int_t nofEvents)
void SetOldGeometry(Bool_t oldGeometry=kTRUE)
int main(int argc, char **argv)
Application main program.