Application main program.
145{
146
147
148
149#ifdef G4MULTITHREADED
150 ROOT::EnableThreadSafety();
151#endif
152
153
154
155
156#ifdef USE_GEANT4
157 std::string g4Geometry = "geomRootToGeant4";
158 std::string g4PhysicsList = "FTFP_BERT";
159 std::string g4SpecialPhysics = "stepLimiter";
160 std::string g4Macro = "g4config.in";
161 std::string g4VisMacro = "g4vis.in";
162 std::string g4Session = "";
163 std::string g4UserClass = "";
164 std::string g4LocalField = "";
165#endif
166#ifdef USE_GEANT3
167 std::string g3Geometry = "TGeant3TGeo";
168#endif
171
172 for (Int_t i = 1; i < argc; i = i + 2) {
173 std::cout << "processing " << argv[i] << " with " << argv[i + 1]
174 << std::endl;
175#ifdef USE_GEANT4
176 if (std::string(argv[i]) == "--g4-geometry" ||
177 std::string(argv[i]) == "-g4g")
178 g4Geometry = argv[i + 1];
179 else if (std::string(argv[i]) == "--g4-physics-list" ||
180 std::string(argv[i]) == "-g4pl")
181 g4PhysicsList = argv[i + 1];
182 else if (std::string(argv[i]) == "--g4-special-physics" ||
183 std::string(argv[i]) == "-g4sp")
184 g4SpecialPhysics = argv[i + 1];
185 else if (std::string(argv[i]) == "--g4-macro" ||
186 std::string(argv[i]) == "-g4m")
187 g4Macro = argv[i + 1];
188 else if (std::string(argv[i]) == "--g4-vis-macro" ||
189 std::string(argv[i]) == "-g4vm")
190 g4VisMacro = argv[i + 1];
191 else if (std::string(argv[i]) == "--g4-session" ||
192 std::string(argv[i]) == "-g4s")
193 g4Session = argv[i + 1];
194
195 else if (std::string(argv[i]) == "--g4-user-class" ||
196 std::string(argv[i]) == "-g4uc")
197 g4UserClass = argv[i + 1];
198 else if (std::string(argv[i]) == "--g4-local-field" ||
199 std::string(argv[i]) == "-g4lf")
200 g4LocalField = argv[i + 1];
201#endif
202#ifdef USE_GEANT3
203 if (std::string(argv[i]) == "--g3-geometry" ||
204 std::string(argv[i]) == "-g3g")
205 g3Geometry = argv[i + 1];
206#endif
207 else if (std::string(argv[i]) == "--root-macro" ||
208 std::string(argv[i]) == "-rm")
210 else if (std::string(argv[i]) == "--verbose" ||
211 std::string(argv[i]) == "-v")
213 else {
214 PrintUsage("testA01");
215 return 1;
216 }
217 }
218
220#ifdef USE_GEANT4
221 PrintG4Configuration("testA01", g4Geometry, g4PhysicsList, g4SpecialPhysics,
222 g4Macro, g4VisMacro, g4Session, g4UserClass, g4LocalField,
rootMacro);
223#endif
224#ifdef USE_GEANT3
225 PrintG3Configuration(
"testA01", g3Geometry,
rootMacro);
226#endif
227 }
228
229
230
231
234#ifdef USE_GEANT4
235
236 if (g4LocalField.size()) {
237 G4cout << "setting local field to true" << G4endl;
239 }
240
241
243 if (!g4UserClass.size()) {
244 runConfiguration =
246 }
247 else if (g4UserClass == "geometry") {
249
250 if (g4LocalField.size()) {
252 ->SetUseLocalMagField(true);
253 }
254 }
255 else {
256 PrintUsage("testA01");
257 return 1;
258 }
259
260
261
262 TGeant4* geant4 = new TGeant4(
263 "TGeant4", "The Geant4 Monte Carlo", runConfiguration, argc, argv);
264
265
266
267 if (g4Macro.size()) {
268 geant4->ProcessGeantMacro(g4Macro.data());
269 }
270#endif
271
272#ifdef USE_GEANT3
273 if (g3Geometry == "TGeant3") {
274 new TGeant3("C++ Interface to Geant3");
275 }
276 else if (g3Geometry == "TGeant3TGeo") {
277 new TGeant3TGeo("C++ Interface to Geant3");
278 }
279 else {
280 PrintUsage("testA01");
281 return 1;
282 }
283 gMC->SetProcess("DRAY", 1);
284 gMC->SetProcess("LOSS", 1);
285 gMC->SetProcess("HADR", 1);
286#endif
287
288
290
295#ifdef USE_GEANT4
296
297 if (g4VisMacro.size()) {
298 geant4->ProcessGeantMacro(g4VisMacro.data());
299 }
300#endif
302 }
303 else {
304
306 }
307
308 delete appl;
309}
Implementation of the TVirtualMCApplication.
void SetWriteHits(Bool_t writeHits)
void RunMC(Int_t nofEvents)
void SetWriteStack(Bool_t writeStack)
A01PrimaryGenerator * GetPrimaryGenerator() const
void InitMC(const char *setup)
void SetUseLocalMagField(Bool_t localMagField)
void SetRandomize(Bool_t val)
User Geant4 VMC run configuration.