42 #include "F06PhysicsList.hh" 43 #include "G4Transportation.hh" 45 #include "F06DetectorConstruction.hh" 46 #include "F06ActionInitialization.hh" 48 #ifdef G4MULTITHREADED 49 #include "G4MTRunManager.hh" 51 #include "G4RunManager.hh" 54 #include "G4UImanager.hh" 55 #include "G4UIcommand.hh" 57 #include "Randomize.hh" 59 #include "G4VisExecutive.hh" 60 #include "G4UIExecutive.hh" 65 G4cerr <<
" Usage: " << G4endl;
66 G4cerr <<
" field06 [-m macro ] [-u UIsession] [-t nThreads] [-r randomSeed] " 68 G4cerr <<
" note: -t option is available only for multi-threaded mode." 75 int main(
int argc,
char** argv)
86 #ifdef G4MULTITHREADED 90 G4long randomSeed = 1234;
91 for ( G4int i=1; i<argc; i=i+2 ) {
92 if (
G4String(argv[i]) ==
"-m" ) macro = argv[i+1];
93 else if (
G4String(argv[i]) ==
"-u" ) session = argv[i+1];
94 else if (
G4String(argv[i]) ==
"-r" ) randomSeed = atoi(argv[i+1]);
95 #ifdef G4MULTITHREADED 96 else if (
G4String(argv[i]) ==
"-t" ) {
97 nThreads = G4UIcommand::ConvertToInt(argv[i+1]);
107 G4UIExecutive* ui =
nullptr;
108 if ( macro.size() == 0 ) {
109 ui =
new G4UIExecutive(argc, argv, session);
114 G4Random::setTheEngine(
new CLHEP::RanecuEngine);
118 #ifdef G4MULTITHREADED 119 G4MTRunManager * runManager =
new G4MTRunManager;
120 if ( nThreads > 0 ) runManager->SetNumberOfThreads(nThreads);
122 G4RunManager * runManager =
new G4RunManager;
126 G4Random::setTheSeed(randomSeed);
131 runManager->SetUserInitialization(
new F06DetectorConstruction());
133 runManager->SetUserInitialization(
new F06PhysicsList());
136 G4Transportation::EnableGravity(
true);
139 runManager->SetUserInitialization(
new F06ActionInitialization());
143 G4VisManager* visManager =
new G4VisExecutive;
146 visManager->Initialize();
150 G4UImanager* UImanager = G4UImanager::GetUIpointer();
154 G4String command =
"/control/execute ";
155 UImanager->ApplyCommand(command+macro);
159 UImanager->ApplyCommand(
"/control/execute init_vis.mac");
161 UImanager->ApplyCommand(
"/control/execute gui.mac");
static G4UIterminal * session
int main(int argc, char **argv)