48 #ifdef G4MULTITHREADED 49 #include "G4MTRunManager.hh" 51 #include "G4RunManager.hh" 54 #include "G4UImanager.hh" 56 #include "FTFP_BERT.hh" 57 #include "G4OpticalPhysics.hh" 58 #include "G4EmStandardPhysics_option4.hh" 60 #include "OpNoviceDetectorConstruction.hh" 61 #include "OpNoviceActionInitialization.hh" 63 #include "G4VisExecutive.hh" 64 #include "G4UIExecutive.hh" 69 G4cerr <<
" Usage: " << G4endl;
70 G4cerr <<
" OpNovice [-m macro ] [-u UIsession] [-t nThreads] [-r seed] " 72 G4cerr <<
" note: -t option is available only for multi-threaded mode." 79 int main(
int argc,
char** argv)
90 #ifdef G4MULTITHREADED 94 G4long myseed = 345354;
95 for ( G4int i=1; i<argc; i=i+2 ) {
96 if (
G4String(argv[i]) ==
"-m" ) macro = argv[i+1];
97 else if (
G4String(argv[i]) ==
"-u" ) session = argv[i+1];
98 else if (
G4String(argv[i]) ==
"-r" ) myseed = atoi(argv[i+1]);
99 #ifdef G4MULTITHREADED 100 else if (
G4String(argv[i]) ==
"-t" ) {
101 nThreads = G4UIcommand::ConvertToInt(argv[i+1]);
111 G4UIExecutive* ui =
nullptr;
112 if ( macro.size() == 0 ) {
113 ui =
new G4UIExecutive(argc, argv);
118 G4Random::setTheEngine(
new CLHEP::RanecuEngine);
122 #ifdef G4MULTITHREADED 123 G4MTRunManager * runManager =
new G4MTRunManager;
124 if ( nThreads > 0 ) runManager->SetNumberOfThreads(nThreads);
126 G4RunManager * runManager =
new G4RunManager;
130 G4Random::setTheSeed(myseed);
135 runManager-> SetUserInitialization(
new OpNoviceDetectorConstruction());
137 G4VModularPhysicsList* physicsList =
new FTFP_BERT;
138 physicsList->ReplacePhysics(
new G4EmStandardPhysics_option4());
139 G4OpticalPhysics* opticalPhysics =
new G4OpticalPhysics();
140 physicsList->RegisterPhysics(opticalPhysics);
141 runManager-> SetUserInitialization(physicsList);
144 runManager->SetUserInitialization(
new OpNoviceActionInitialization());
148 G4VisManager* visManager =
new G4VisExecutive(
"Quiet");
149 visManager->Initialize();
152 G4UImanager* UImanager = G4UImanager::GetUIpointer();
154 if ( macro.size() ) {
156 G4String command =
"/control/execute ";
157 UImanager->ApplyCommand(command+macro);
161 UImanager->ApplyCommand(
"/control/execute vis.mac");
163 UImanager->ApplyCommand(
"/control/execute gui.mac");
static G4UIterminal * session
int main(int argc, char **argv)