42 #include "ExUCNPhysicsList.hh" 43 #include "ExUCNDetectorConstruction.hh" 44 #include "ExUCNActionInitialization.hh" 46 #ifdef G4MULTITHREADED 47 #include "G4MTRunManager.hh" 49 #include "G4RunManager.hh" 52 #include "G4UImanager.hh" 53 #include "G4UIcommand.hh" 55 #include "Randomize.hh" 57 #include "G4VisExecutive.hh" 58 #include "G4UIExecutive.hh" 64 G4cerr <<
" Usage: " << G4endl;
65 G4cerr <<
" ExUCN [-m macro ] [-u UIsession] [-t nThreads] [-r seed] " 67 G4cerr <<
" note: -t option is available only for multi-threaded mode." 74 int main(
int argc,
char** argv)
85 #ifdef G4MULTITHREADED 90 for ( G4int i=1; i<argc; i=i+2 ) {
91 if (
G4String(argv[i]) ==
"-m" ) macro = argv[i+1];
92 else if (
G4String(argv[i]) ==
"-u" ) session = argv[i+1];
93 else if (
G4String(argv[i]) ==
"-r" ) myseed = atoi(argv[i+1]);
94 #ifdef G4MULTITHREADED 95 else if (
G4String(argv[i]) ==
"-t" ) {
96 nThreads = G4UIcommand::ConvertToInt(argv[i+1]);
106 G4UIExecutive* ui =
nullptr;
108 ui =
new G4UIExecutive(argc, argv);
113 G4Random::setTheEngine(
new CLHEP::RanecuEngine);
117 #ifdef G4MULTITHREADED 118 G4MTRunManager * runManager =
new G4MTRunManager;
119 if ( nThreads > 0 ) runManager->SetNumberOfThreads(nThreads);
121 G4RunManager * runManager =
new G4RunManager;
125 G4Random::setTheSeed(myseed);
130 runManager->SetUserInitialization(
new ExUCNDetectorConstruction());
132 runManager->SetUserInitialization(
new ExUCNPhysicsList());
134 runManager->SetUserInitialization(
new ExUCNActionInitialization());
138 runManager->Initialize();
142 G4VisManager* visManager =
new G4VisExecutive;
145 visManager->Initialize();
149 G4UImanager* UImanager = G4UImanager::GetUIpointer();
151 if ( macro.size() ) {
153 G4String command =
"/control/execute ";
154 UImanager->ApplyCommand(command+macro);
158 UImanager->ApplyCommand(
"/control/execute vis.mac");
160 UImanager->ApplyCommand(
"/control/execute gui.mac");
static G4UIterminal * session
int main(int argc, char **argv)