149 char* physListNameEnv = 0;
151 #ifdef G4MULTITHREADED 152 G4int nofThreads = 0;
156 for ( G4int i=1; i<argc; i=i+2 ) {
158 if ( g4argv ==
"-m" ) macro = argv[i+1];
159 else if ( g4argv ==
"-u" ) session = argv[i+1];
160 else if ( g4argv ==
"-p" ) physListName = argv[i+1];
161 #ifdef G4MULTITHREADED 162 else if ( g4argv ==
"-t" ) {
163 nofThreads = G4UIcommand::ConvertToInt(argv[i+1]);
166 else if ( g4argv ==
"-v" || g4argv ==
"--verbose" ) {
170 else if ( g4argv ==
"-h" || g4argv ==
"--help" ) {
182 G4UIExecutive* ui = 0;
183 if ( ! macro.size() ) {
184 ui =
new G4UIExecutive(argc, argv, session);
188 G4Random::setTheEngine(
new CLHEP::RanecuEngine());
191 #ifdef G4MULTITHREADED 192 G4MTRunManager * runManager =
new G4MTRunManager();
193 if ( nofThreads > 0 ) {
194 runManager->SetNumberOfThreads(nofThreads);
197 G4RunManager * runManager =
new G4RunManager();
205 g4alt::G4PhysListFactory factory;
206 G4VModularPhysicsList* physList =
nullptr;
212 G4String defaultPhysListName =
"FTFP_BERT";
213 if ( verbosity > 0 ) {
214 G4cout <<
"extensibleFactory: SetDefaultReferencePhysList to '" 215 << defaultPhysListName <<
"' ('' = system default)" 218 factory.SetDefaultReferencePhysList(defaultPhysListName);
221 G4PhysListRegistry* plreg = G4PhysListRegistry::Instance();
222 plreg->AddPhysicsExtension(
"RADIO",
"G4RadioactiveDecayPhysics");
223 plreg->AddPhysicsExtension(
"MYPHYSICS",
"MyG4PhysicsPhysics");
224 if ( verbosity > 0 ) {
225 G4cout <<
"extensibleFactory: adding extensions" << G4endl
226 <<
" RADIO ===> G4RadioactiveDecayPhysics" << G4endl
227 <<
" MYPHYSICS ===> MyG4PhysicsPhysics" << G4endl
233 if ( physListName.size() ) {
234 if ( verbosity > 0 ) {
235 G4cout <<
"extensibleFactory: explicitly using '" 236 << physListName <<
"'" << G4endl;
238 physList = factory.GetReferencePhysList(physListName);
240 if ( verbosity > 0 ) {
241 G4cout <<
"extensibleFactory: no -p flag;" 242 <<
" using ReferencePhysList() ($PHYSLIST or default)" << G4endl;
244 physList = factory.ReferencePhysList();
248 physListNameEnv = std::getenv(
"PHYSLIST");
249 if ( physListNameEnv ) {
250 G4cout <<
"extensibleFactory: $PHYSLIST=" 251 << physListNameEnv << G4endl;
260 G4cerr <<
"extensibleFactory: PhysicsList '" 261 << ( physListNameEnv ? physListNameEnv : physListName )
262 <<
"' was not available in g4alt::PhysListFactory." << G4endl;
263 PrintAvailable(verbosity);
267 G4ExceptionDescription ED;
268 ED <<
"The factory for the physicslist [" 269 << ( physListNameEnv ? physListNameEnv : physListName )
270 <<
"] does not exist!" 272 G4Exception(
"extensibleFactory",
273 "extensibleFactory001", FatalException, ED);
279 runManager->SetUserInitialization(physList);
282 ActionInitialization* actinit =
283 new ActionInitialization(
"extensibleFactory");
284 runManager->SetUserInitialization(actinit);
287 G4VisManager* visManager =
new G4VisExecutive;
290 visManager->Initialize();
293 G4UImanager* UImanager = G4UImanager::GetUIpointer();
295 if ( macro.size() ) {
297 G4String command =
"/control/execute ";
298 UImanager->ApplyCommand(command+macro);
302 UImanager->ApplyCommand(
"/control/execute init_vis.mac");
static G4UIterminal * session