38 #include "ActionInitialization.hh" 40 #ifdef G4MULTITHREADED 41 #include "G4MTRunManager.hh" 43 #include "G4RunManager.hh" 46 #include "G4DNAChemistryManager.hh" 47 #include "G4UImanager.hh" 48 #include "G4UIExecutive.hh" 49 #include "G4VisExecutive.hh" 51 #include "CommandLineParser.hh" 54 CommandLineParser*
parser(0);
58 void Parse(
int& argc,
char** argv);
62 int main(
int argc,
char** argv)
72 Command* commandLine(0);
74 #ifdef G4MULTITHREADED 75 G4MTRunManager* runManager=
new G4MTRunManager;
76 if ((commandLine =
parser->GetCommandIfActive(
"-mt")))
79 if(commandLine->GetOption() ==
"NMAX")
81 nThreads = G4Threading::G4GetNumberOfCores();
85 nThreads = G4UIcommand::ConvertToInt(commandLine->GetOption());
87 G4cout <<
"===== clustering is started with " 88 << runManager->GetNumberOfThreads()
89 <<
" threads =====" << G4endl;
91 runManager->SetNumberOfThreads(nThreads);
94 G4RunManager* runManager =
new G4RunManager();
101 runManager->SetUserInitialization(
new PhysicsList);
102 runManager->SetUserInitialization(detector);
103 runManager->SetUserInitialization(
new ActionInitialization());
106 runManager->Initialize();
109 G4VisManager* visManager =
new G4VisExecutive;
110 visManager->Initialize();
113 G4UImanager* UImanager = G4UImanager::GetUIpointer();
114 G4UIExecutive* ui(0);
117 if ((commandLine =
parser->GetCommandIfActive(
"-gui")))
119 ui =
new G4UIExecutive(argc, argv, commandLine->GetOption());
121 if (ui->IsGUI()) UImanager->ApplyCommand(
"/control/execute gui.mac");
123 if (
parser->GetCommandIfActive(
"-novis") == 0)
126 if ((commandLine =
parser->GetCommandIfActive(
"-vis")))
129 UImanager->ApplyCommand(
130 G4String(
"/vis/open ") + commandLine->GetOption());
135 UImanager->ApplyCommand(
"/vis/open OGL 800x600-0+0");
137 UImanager->ApplyCommand(
"/control/execute vis.mac");
145 if ((commandLine =
parser->GetCommandIfActive(
"-vis")))
147 UImanager->ApplyCommand(
148 G4String(
"/vis/open ") + commandLine->GetOption());
149 UImanager->ApplyCommand(
"/control/execute vis.mac");
153 if ((commandLine =
parser->GetCommandIfActive(
"-mac")))
155 G4String command =
"/control/execute ";
156 UImanager->ApplyCommand(command + commandLine->GetOption());
160 UImanager->ApplyCommand(
"/control/execute run.in");
163 if ((commandLine =
parser->GetCommandIfActive(
"-gui")))
177 CommandLineParser::DeleteInstance();
189 parser = CommandLineParser::GetParser();
192 "-gui", Command::OptionNotCompulsory,
193 "Select geant4 UI or just launch a geant4 terminal session",
"qt");
195 parser->AddCommand(
"-mac", Command::WithOption,
"Give a mac file to execute",
204 #ifdef G4MULTITHREADED 207 "Launch in MT mode (events computed in parallel," 208 " NOT RECOMMENDED WITH CHEMISTRY)",
"2");
211 parser->AddCommand(
"-vis", Command::WithOption,
212 "Select a visualization driver",
"OGL 600x600-0+0");
214 parser->AddCommand(
"-novis", Command::WithoutOption,
215 "Deactivate visualization when using GUI");
220 if (
parser->Parse(argc, argv) != 0)
224 CommandLineParser::DeleteInstance();
232 if (
parser->CheckIfNotHandledOptionsExists(argc, argv))
CommandLineParser * parser(0)
void Parse(int &argc, char **argv)
int main(int argc, char **argv)