Application main program.
143{
144
145
146
147#ifdef G4MULTITHREADED
148 ROOT::EnableThreadSafety();
149#endif
150
151
152
153
154#ifdef USE_GEANT4
155 std::string g4Geometry = "geomRootToGeant4";
156 std::string g4PhysicsList = "FTFP_BERT";
157 std::string g4SpecialPhysics = "stepLimiter";
158 std::string g4Macro = "g4config.in";
159 std::string g4VisMacro = "g4vis.in";
160 std::string g4Session = "";
161 std::string g4UserClass = "";
162#endif
163#ifdef USE_GEANT3
164 std::string g3Geometry = "TGeant3TGeo";
165#endif
168
169 for (Int_t i = 1; i < argc; i = i + 2) {
170 std::cout << "processing " << argv[i] << " with " << argv[i + 1]
171 << std::endl;
172#ifdef USE_GEANT4
173 if (std::string(argv[i]) == "--g4-geometry" ||
174 std::string(argv[i]) == "-g4g")
175 g4Geometry = argv[i + 1];
176 else if (std::string(argv[i]) == "--g4-physics-list" ||
177 std::string(argv[i]) == "-g4pl")
178 g4PhysicsList = argv[i + 1];
179 else if (std::string(argv[i]) == "--g4-special-physics" ||
180 std::string(argv[i]) == "-g4sp")
181 g4SpecialPhysics = argv[i + 1];
182 else if (std::string(argv[i]) == "--g4-macro" ||
183 std::string(argv[i]) == "-g4m")
184 g4Macro = argv[i + 1];
185 else if (std::string(argv[i]) == "--g4-vis-macro" ||
186 std::string(argv[i]) == "-g4vm")
187 g4VisMacro = argv[i + 1];
188 else if (std::string(argv[i]) == "--g4-session" ||
189 std::string(argv[i]) == "-g4s")
190 g4Session = argv[i + 1];
191
192 else if (std::string(argv[i]) == "--g4-user-class" ||
193 std::string(argv[i]) == "-g4uc")
194 g4UserClass = argv[i + 1];
195#endif
196#ifdef USE_GEANT3
197 if (std::string(argv[i]) == "--g3-geometry" ||
198 std::string(argv[i]) == "-g3g")
199 g3Geometry = argv[i + 1];
200#endif
201 else if (std::string(argv[i]) == "--root-macro" ||
202 std::string(argv[i]) == "-rm")
204 else if (std::string(argv[i]) == "--verbose" ||
205 std::string(argv[i]) == "-v")
207 else {
208 PrintUsage("testE03");
209 return 1;
210 }
211 }
212
214#ifdef USE_GEANT4
215 PrintG4Configuration("testE03", g4Geometry, g4PhysicsList, g4SpecialPhysics,
216 g4Macro, g4VisMacro, g4Session, g4UserClass,
rootMacro);
217#endif
218#ifdef USE_GEANT3
219 PrintG3Configuration(
"testE03", g3Geometry,
rootMacro);
220#endif
221 }
222
223
224
225
228
229#ifdef USE_GEANT4
230 if (g4Geometry.find("VMC") != std::string::npos) {
232 }
233#endif
234#ifdef USE_GEANT3
235 if (g3Geometry == "TGeant3") {
237 }
238#endif
239
240#ifdef USE_GEANT4
241
243 if (!g4UserClass.size()) {
244 runConfiguration =
246 }
247 else if (g4UserClass == "geometry") {
248 runConfiguration =
250 }
251 else if (g4UserClass == "physics-list") {
253 }
254 else if (g4UserClass == "regions") {
255 runConfiguration =
257 }
258 else if (g4UserClass == "field") {
259 runConfiguration =
261 }
262 else {
263 PrintUsage("testE03");
264 return 1;
265 }
266
267
268 TGeant4* geant4 = new TGeant4(
269 "TGeant4", "The Geant4 Monte Carlo", runConfiguration, argc, argv);
270
271
272
273 if (g4Macro.size()) {
274 geant4->ProcessGeantMacro(g4Macro.data());
275 }
276#endif
277
278#ifdef USE_GEANT3
279 if (g3Geometry == "TGeant3") {
280 new TGeant3("C++ Interface to Geant3");
281 }
282 else if (g3Geometry == "TGeant3TGeo") {
283 new TGeant3TGeo("C++ Interface to Geant3");
284 }
285 else {
286 PrintUsage("testE03");
287 return 1;
288 }
289 gMC->SetProcess("DRAY", 1);
290 gMC->SetProcess("LOSS", 1);
291 gMC->SetProcess("HADR", 0);
292#endif
293
294
297#ifdef USE_GEANT4
298
299 if (g4VisMacro.size()) {
300 geant4->ProcessGeantMacro(g4VisMacro.data());
301 }
302#endif
304 }
305 else {
306
308 }
309
310 delete appl;
311}
Ex03bMCApplication Ex03MCApplication
Implementation of the TVirtualMCApplication.
void InitMC(const char *setup)
void RunMC(Int_t nofEvents)
void SetOldGeometry(Bool_t oldGeometry=kTRUE)
User Geant4 VMC run configuration.
User Geant4 VMC run configuration.
User Geant4 VMC run configuration.
User Geant4 VMC run configuration.