39 #include "ActionInitialization.hh" 41 #ifdef G4MULTITHREADED 42 #include "G4MTRunManager.hh" 44 #include "G4RunManager.hh" 47 #include "G4DNAChemistryManager.hh" 48 #include "G4UImanager.hh" 49 #include "G4UIExecutive.hh" 50 #include "G4VisExecutive.hh" 52 #include "CommandLineParser.hh" 66 CommandLineParser*
parser(0);
68 void Parse(
int& argc,
char** argv);
70 int main(
int argc,
char** argv)
80 Command* commandLine(
nullptr);
82 #ifdef G4MULTITHREADED 83 G4MTRunManager* runManager=
new G4MTRunManager;
84 if ((commandLine =
parser->GetCommandIfActive(
"-mt")))
87 if(commandLine->GetOption() ==
"NMAX")
89 nThreads = G4Threading::G4GetNumberOfCores();
93 nThreads = G4UIcommand::ConvertToInt(commandLine->GetOption());
95 G4cout <<
"===== Chem1 is started with " << nThreads
96 <<
" threads =====" << G4endl;
98 runManager->SetNumberOfThreads(nThreads);
101 G4RunManager* runManager =
new G4RunManager();
109 runManager->SetUserInitialization(
new PhysicsList);
110 runManager->SetUserInitialization(detector);
111 runManager->SetUserInitialization(
new ActionInitialization());
114 G4VisManager* visManager =
nullptr;
117 G4UImanager* UImanager = G4UImanager::GetUIpointer();
118 G4UIExecutive* ui(
nullptr);
121 if ((commandLine =
parser->GetCommandIfActive(
"-gui")))
123 visManager =
new G4VisExecutive;
124 visManager->Initialize();
126 ui =
new G4UIExecutive(argc, argv, commandLine->GetOption());
128 if(
parser->GetCommandIfActive(
"-novis") == 0)
131 if((commandLine =
parser->GetCommandIfActive(
"-vis")))
134 UImanager->ApplyCommand(
G4String(
"/vis/open ")+
135 commandLine->GetOption());
140 UImanager->ApplyCommand(
"/vis/open OGL 800x600-0+0");
142 UImanager->ApplyCommand(
"/control/execute vis.mac");
147 UImanager->ApplyCommand(
"/control/execute gui.mac");
150 else if ((commandLine =
parser->GetCommandIfActive(
"-vis")))
155 visManager =
new G4VisExecutive;
156 visManager->Initialize();
158 ui =
new G4UIExecutive(argc, argv, commandLine->GetOption());
159 UImanager->ApplyCommand(
G4String(
"/vis/open ")+commandLine->GetOption());
160 UImanager->ApplyCommand(
"/control/execute vis.mac");
163 if ((commandLine =
parser->GetCommandIfActive(
"-mac")))
165 G4String command =
"/control/execute ";
166 UImanager->ApplyCommand(command + commandLine->GetOption());
170 UImanager->ApplyCommand(
"/control/execute beam.in");
187 CommandLineParser::DeleteInstance();
197 parser = CommandLineParser::GetParser();
200 "-gui", Command::OptionNotCompulsory,
201 "Select geant4 UI or just launch a geant4 terminal session",
"qt");
203 parser->AddCommand(
"-mac", Command::WithOption,
"Give a mac file to execute",
212 #ifdef G4MULTITHREADED 215 "Launch in MT mode (events computed in parallel," 216 " NOT RECOMMANDED WITH CHEMISTRY)",
"2");
219 parser->AddCommand(
"-chemOFF", Command::WithoutOption,
220 "Deactivate chemistry");
222 parser->AddCommand(
"-vis", Command::WithOption,
223 "Select a visualization driver",
"OGL 600x600-0+0");
225 parser->AddCommand(
"-novis", Command::WithoutOption,
226 "Deactivate visualization when using GUI");
231 if (
parser->Parse(argc, argv) != 0)
235 CommandLineParser::DeleteInstance();
242 if (
parser->CheckIfNotHandledOptionsExists(argc, argv))
void Parse(int &argc, char **argv)
CommandLineParser * parser(0)
int main(int argc, char **argv)