47 #include "ActionInitialization.hh" 50 #ifdef G4MULTITHREADED 51 #include "G4MTRunManager.hh" 53 #include "G4RunManager.hh" 56 #include "G4PhysListFactory.hh" 57 #include "G4VModularPhysicsList.hh" 58 #include "G4UImanager.hh" 59 #include "Randomize.hh" 60 #include "G4VisExecutive.hh" 61 #include "G4UIExecutive.hh" 67 G4cerr <<
" Usage: " << G4endl;
68 G4cerr <<
" factory [-m macro ] [-p physList ] [-u UIsession] [-t nThreads]" << G4endl;
69 G4cerr <<
" note: -t option is available only for multi-threaded mode." << G4endl;
76 int main(
int argc,
char** argv)
89 #ifdef G4MULTITHREADED 92 for ( G4int i=1; i<argc; i=i+2 ) {
93 if (
G4String(argv[i]) ==
"-m" ) macro = argv[i+1];
94 else if (
G4String(argv[i]) ==
"-u" ) session = argv[i+1];
95 else if (
G4String(argv[i]) ==
"-p" ) physListName = argv[i+1];
96 #ifdef G4MULTITHREADED 97 else if (
G4String(argv[i]) ==
"-t" ) {
98 nofThreads = G4UIcommand::ConvertToInt(argv[i+1]);
109 G4UIExecutive* ui = 0;
110 if ( ! macro.size() ) {
111 ui =
new G4UIExecutive(argc, argv, session);
115 G4Random::setTheEngine(
new CLHEP::RanecuEngine());
118 #ifdef G4MULTITHREADED 119 G4MTRunManager * runManager =
new G4MTRunManager();
120 if ( nofThreads > 0 ) {
121 runManager->SetNumberOfThreads(nofThreads);
124 G4RunManager * runManager =
new G4RunManager();
128 G4PhysListFactory factory;
129 G4VModularPhysicsList* physList =
nullptr;
132 if ( ! physListName.size() ) {
134 char* physListNameEnv = std::getenv(
"PHYSLIST");
135 if ( physListNameEnv ) {
136 physListName =
G4String(physListNameEnv);
141 if ( physListName.size() && (! factory.IsReferencePhysList(physListName) ) ) {
142 G4cerr <<
"Physics list " << physListName
143 <<
" is not available in PhysListFactory." << G4endl;
144 physListName.clear();
148 if ( ! physListName.size() ) {
149 physListName =
"FTFP_BERT";
153 physList = factory.GetReferencePhysList(physListName);
157 runManager->SetUserInitialization(physList);
160 runManager->SetUserInitialization(
new ActionInitialization(
"factory"));
163 G4VisManager* visManager =
new G4VisExecutive;
166 visManager->Initialize();
169 G4UImanager* UImanager = G4UImanager::GetUIpointer();
171 if ( macro.size() ) {
173 G4String command =
"/control/execute ";
174 UImanager->ApplyCommand(command+macro);
178 UImanager->ApplyCommand(
"/control/execute init_vis.mac");
static G4UIterminal * session
int main(int argc, char **argv)