41 #include "ActionInitialization.hh" 43 #ifdef G4MULTITHREADED 44 #include "G4MTRunManager.hh" 46 #include "G4RunManager.hh" 49 #include "G4UImanager.hh" 50 #include "Randomize.hh" 51 #include "G4VisExecutive.hh" 52 #include "G4UIExecutive.hh" 56 #include "CommandLineParser.hh" 61 CommandLineParser*
parser(0);
63 void Parse(
int& argc,
char** argv);
67 int main(
int argc,
char** argv)
77 Command* commandLine(0);
79 #ifdef G4MULTITHREADED 80 G4MTRunManager* runManager=
new G4MTRunManager;
81 if ((commandLine =
parser->GetCommandIfActive(
"-mt")))
84 if(commandLine->GetOption() ==
"NMAX")
86 nThreads = G4Threading::G4GetNumberOfCores();
90 nThreads = G4UIcommand::ConvertToInt(commandLine->GetOption());
92 G4cout <<
"===== PDB4DNA is started with " 93 << runManager->GetNumberOfThreads()
94 <<
" threads =====" << G4endl;
96 runManager->SetNumberOfThreads(nThreads);
99 G4RunManager* runManager =
new G4RunManager();
105 runManager->SetUserInitialization(
new PhysicsList);
106 runManager->SetUserInitialization(
new ActionInitialization());
113 G4VisManager* visManager =
new G4VisExecutive;
114 visManager->Initialize();
117 G4UImanager* UImanager = G4UImanager::GetUIpointer();
118 G4UIExecutive* ui(0);
121 if ((commandLine =
parser->GetCommandIfActive(
"-gui")))
123 ui =
new G4UIExecutive(argc, argv,
124 commandLine->GetOption());
126 if(
parser->GetCommandIfActive(
"-novis") == 0)
129 if ((commandLine =
parser->GetCommandIfActive(
"-vis")))
132 UImanager->ApplyCommand(
G4String(
"/vis/open ")+
133 commandLine->GetOption());
138 UImanager->ApplyCommand(
"/vis/open OGL 600x600-0+0");
140 UImanager->ApplyCommand(
"/control/execute vis.mac");
143 UImanager->ApplyCommand(
"/control/execute gui.mac");
150 if ((commandLine =
parser->GetCommandIfActive(
"-vis")))
152 UImanager->ApplyCommand(
G4String(
"/vis/open ")+
153 commandLine->GetOption());
154 UImanager->ApplyCommand(
"/control/execute vis.mac");
158 if ((commandLine =
parser->GetCommandIfActive(
"-mac")))
160 G4String command =
"/control/execute ";
161 UImanager->ApplyCommand(command + commandLine->GetOption());
165 UImanager->ApplyCommand(
"/control/execute init.mac");
168 if ((commandLine =
parser->GetCommandIfActive(
"-gui")))
171 G4UIQt* UIQt =
static_cast<G4UIQt*
> (UImanager->GetG4UIWindow());
173 UIQt->AddViewerTabFromFile(
"README",
"README from "+
G4String(argv[0]));
194 parser = CommandLineParser::GetParser();
196 parser->AddCommand(
"-gui",
197 Command::OptionNotCompulsory,
198 "Select geant4 UI or just launch a geant4 terminal session",
201 parser->AddCommand(
"-mac",
203 "Give a mac file to execute",
212 #ifdef G4MULTITHREADED 213 parser->AddCommand(
"-mt", Command::WithOption,
214 "Launch in MT mode (events computed in parallel)",
218 parser->AddCommand(
"-vis",
220 "Select a visualization driver",
223 parser->AddCommand(
"-novis",
224 Command::WithoutOption,
225 "Deactivate visualization when using GUI");
230 if (
parser->Parse(argc, argv) != 0)
234 CommandLineParser::DeleteInstance();
241 if (
parser->CheckIfNotHandledOptionsExists(argc, argv))
int main(int argc, char **argv)
void Parse(int &argc, char **argv)
CommandLineParser * parser(0)