40 #include "ActionInitialization.hh" 42 #ifdef G4MULTITHREADED 43 #include "G4MTRunManager.hh" 45 #include "G4RunManager.hh" 48 #include "G4DNAChemistryManager.hh" 49 #include "G4UImanager.hh" 50 #include "G4UIExecutive.hh" 51 #include "G4VisExecutive.hh" 53 #include "CommandLineParser.hh" 67 CommandLineParser*
parser(0);
69 void Parse(
int& argc,
char** argv);
71 int main(
int argc,
char** argv)
81 Command* commandLine(0);
83 #ifdef G4MULTITHREADED 84 G4MTRunManager* runManager=
new G4MTRunManager;
85 if ((commandLine =
parser->GetCommandIfActive(
"-mt")))
88 if(commandLine->GetOption() ==
"NMAX")
90 nThreads = G4Threading::G4GetNumberOfCores();
94 nThreads = G4UIcommand::ConvertToInt(commandLine->GetOption());
96 G4cout <<
"===== Chem1 is started with " 97 << runManager->GetNumberOfThreads()
98 <<
" threads =====" << G4endl;
100 runManager->SetNumberOfThreads(nThreads);
103 G4RunManager* runManager =
new G4RunManager();
110 runManager->SetUserInitialization(
new PhysicsList);
111 runManager->SetUserInitialization(detector);
112 runManager->SetUserInitialization(
new ActionInitialization());
115 runManager->Initialize();
118 G4VisManager* visManager =
new G4VisExecutive;
121 visManager->Initialize();
124 G4UImanager* UImanager = G4UImanager::GetUIpointer();
125 G4UIExecutive* ui(0);
128 if ((commandLine =
parser->GetCommandIfActive(
"-gui")))
130 ui =
new G4UIExecutive(argc, argv, commandLine->GetOption());
132 if (ui->IsGUI()) UImanager->ApplyCommand(
"/control/execute gui.mac");
134 if (
parser->GetCommandIfActive(
"-novis") == 0)
137 if ((commandLine =
parser->GetCommandIfActive(
"-vis")))
140 UImanager->ApplyCommand(
141 G4String(
"/vis/open ") + commandLine->GetOption());
146 UImanager->ApplyCommand(
"/vis/open OGL 800x600-0+0");
148 UImanager->ApplyCommand(
"/control/execute vis.mac");
156 if ((commandLine =
parser->GetCommandIfActive(
"-vis")))
158 UImanager->ApplyCommand(
159 G4String(
"/vis/open ") + commandLine->GetOption());
160 UImanager->ApplyCommand(
"/control/execute vis.mac");
164 if ((commandLine =
parser->GetCommandIfActive(
"-mac")))
166 G4String command =
"/control/execute ";
167 UImanager->ApplyCommand(command + commandLine->GetOption());
171 UImanager->ApplyCommand(
"/control/execute beam.in");
174 if ((commandLine =
parser->GetCommandIfActive(
"-gui")))
188 CommandLineParser::DeleteInstance();
198 parser = CommandLineParser::GetParser();
201 "-gui", Command::OptionNotCompulsory,
202 "Select geant4 UI or just launch a geant4 terminal session",
"qt");
204 parser->AddCommand(
"-mac", Command::WithOption,
"Give a mac file to execute",
213 #ifdef G4MULTITHREADED 216 "Launch in MT mode (events computed in parallel," 217 " NOT RECOMMANDED WITH CHEMISTRY)",
"2");
220 parser->AddCommand(
"-chemOFF", Command::WithoutOption,
221 "Deactivate chemistry");
223 parser->AddCommand(
"-vis", Command::WithOption,
224 "Select a visualization driver",
"OGL 600x600-0+0");
226 parser->AddCommand(
"-novis", Command::WithoutOption,
227 "Deactivate visualization when using GUI");
232 if (
parser->Parse(argc, argv) != 0)
236 CommandLineParser::DeleteInstance();
243 if (
parser->CheckIfNotHandledOptionsExists(argc, argv))
void Parse(int &argc, char **argv)
CommandLineParser * parser(0)
int main(int argc, char **argv)