Application main program.
140{
141
142
143
144#ifdef G4MULTITHREADED
145 ROOT::EnableThreadSafety();
146#endif
147
148
149
150
151#ifdef USE_GEANT4
152 std::string g4Geometry = "geomRootToGeant4";
153 std::string g4PhysicsList = "emStandard";
154 std::string g4SpecialPhysics = "stepLimiter";
155 std::string g4Macro = "g4config.in";
156 std::string g4Macro2 = "g4config2.in";
157
158 std::string g4VisMacro = "";
159 std::string g4Session = "";
160#endif
161#ifdef USE_GEANT3
162 std::string g3Geometry = "TGeant3TGeo";
163#endif
166
167 for (Int_t i = 1; i < argc; i = i + 2) {
168 std::cout << "processing " << argv[i] << " with " << argv[i + 1]
169 << std::endl;
170#ifdef USE_GEANT4
171 if (std::string(argv[i]) == "--g4-geometry" ||
172 std::string(argv[i]) == "-g4g")
173 g4Geometry = argv[i + 1];
174 else if (std::string(argv[i]) == "--g4-physics-list" ||
175 std::string(argv[i]) == "-g4pl")
176 g4PhysicsList = argv[i + 1];
177 else if (std::string(argv[i]) == "--g4-special-physics" ||
178 std::string(argv[i]) == "-g4sp")
179 g4SpecialPhysics = argv[i + 1];
180 else if (std::string(argv[i]) == "--g4-macro" ||
181 std::string(argv[i]) == "-g4m")
182 g4Macro = argv[i + 1];
183 else if (std::string(argv[i]) == "--g4-vis-macro" ||
184 std::string(argv[i]) == "-g4vm")
185 g4VisMacro = argv[i + 1];
186 else if (std::string(argv[i]) == "--g4-session" ||
187 std::string(argv[i]) == "-g4s")
188 g4Session = argv[i + 1];
189#endif
190#ifdef USE_GEANT3
191 if (std::string(argv[i]) == "--g3-geometry" ||
192 std::string(argv[i]) == "-g3g")
193 g3Geometry = argv[i + 1];
194#endif
195 else if (std::string(argv[i]) == "--root-macro" ||
196 std::string(argv[i]) == "-rm")
198 else if (std::string(argv[i]) == "--verbose" ||
199 std::string(argv[i]) == "-v")
201 else {
202 PrintUsage("testTR");
203 return 1;
204 }
205 }
206
208#ifdef USE_GEANT4
209 PrintG4Configuration("testTR", g4Geometry, g4PhysicsList, g4SpecialPhysics,
210 g4Macro, g4Macro2, g4VisMacro, g4Session,
rootMacro);
211#endif
212#ifdef USE_GEANT3
213 PrintG3Configuration(
"testTR", g3Geometry,
rootMacro);
214#endif
215 }
216
217
218
219
224
225#ifdef USE_GEANT4
226
228 g4Geometry, g4PhysicsList, g4SpecialPhysics, false, false);
229
230
231 TGeant4* geant4 = new TGeant4(
232 "TGeant4", "The Geant4 Monte Carlo", runConfiguration, argc, argv);
233
234
235
236 if (g4Macro.size()) {
237 geant4->ProcessGeantMacro(g4Macro.data());
238 }
239#endif
240
241#ifdef USE_GEANT3
242 if (g3Geometry == "TGeant3") {
243 new TGeant3("C++ Interface to Geant3");
244 }
245 else if (g3Geometry == "TGeant3TGeo") {
246 new TGeant3TGeo("C++ Interface to Geant3");
247 }
248 else {
249 PrintUsage("testTR");
250 return 1;
251 }
252 gMC->SetProcess("DRAY", 1);
253 gMC->SetProcess("LOSS", 1);
254 gMC->SetProcess("HADR", 0);
255#endif
256
257
260#ifdef USE_GEANT4
261 if (g4Macro2.size()) {
262
263 geant4->ProcessGeantMacro("g4config2.in");
264 }
265
266
267 if (g4VisMacro.size()) {
268 geant4->ProcessGeantMacro(g4VisMacro.data());
269 }
270#endif
272 }
273 else {
274
276 }
277
278 delete appl;
279}
Implementation of the TVirtualMCApplication.
PrimaryGenerator * GetPrimaryGenerator() const
void SetPrintModulo(Int_t value)
void RunMC(Int_t nofEvents)
void InitMC(const char *setup)
void SetNofPrimaries(Int_t nofPrimaries)