42 #include "ActionInitialization.hh" 44 #ifdef G4MULTITHREADED 45 #include "G4MTRunManager.hh" 47 #include "G4RunManager.hh" 50 #include "G4UImanager.hh" 51 #include "Randomize.hh" 52 #include "G4VisExecutive.hh" 53 #include "G4UIExecutive.hh" 57 #include "CommandLineParser.hh" 62 CommandLineParser*
parser(0);
64 void Parse(
int& argc,
char** argv);
68 int main(
int argc,
char** argv)
76 CLHEP::RanecuEngine defaultEngine(1234567);
77 G4Random::setTheEngine(&defaultEngine);
81 CLHEP::HepRandom::setTheEngine(
new CLHEP::RanecuEngine);
86 Command* commandLine(0);
88 #ifdef G4MULTITHREADED 89 G4MTRunManager* runManager=
new G4MTRunManager;
90 if ((commandLine =
parser->GetCommandIfActive(
"-mt")))
93 if(commandLine->GetOption() ==
"NMAX")
95 nThreads = G4Threading::G4GetNumberOfCores();
99 nThreads = G4UIcommand::ConvertToInt(commandLine->GetOption());
101 G4cout <<
"===== PDB4DNA is started with " 102 << runManager->GetNumberOfThreads()
103 <<
" threads =====" << G4endl;
105 runManager->SetNumberOfThreads(nThreads);
108 G4RunManager* runManager =
new G4RunManager();
114 runManager->SetUserInitialization(
new PhysicsList);
115 runManager->SetUserInitialization(
new ActionInitialization());
122 G4VisManager* visManager =
new G4VisExecutive;
123 visManager->Initialize();
126 G4UImanager* UImanager = G4UImanager::GetUIpointer();
127 G4UIExecutive* ui(0);
130 if ((commandLine =
parser->GetCommandIfActive(
"-gui")))
132 ui =
new G4UIExecutive(argc, argv,
133 commandLine->GetOption());
135 if(
parser->GetCommandIfActive(
"-novis") == 0)
138 if ((commandLine =
parser->GetCommandIfActive(
"-vis")))
141 UImanager->ApplyCommand(
G4String(
"/vis/open ")+
142 commandLine->GetOption());
147 UImanager->ApplyCommand(
"/vis/open OGL 600x600-0+0");
149 UImanager->ApplyCommand(
"/control/execute vis.mac");
152 UImanager->ApplyCommand(
"/control/execute gui.mac");
159 if ((commandLine =
parser->GetCommandIfActive(
"-vis")))
161 UImanager->ApplyCommand(
G4String(
"/vis/open ")+
162 commandLine->GetOption());
163 UImanager->ApplyCommand(
"/control/execute vis.mac");
167 if ((commandLine =
parser->GetCommandIfActive(
"-mac")))
169 G4String command =
"/control/execute ";
170 UImanager->ApplyCommand(command + commandLine->GetOption());
174 UImanager->ApplyCommand(
"/control/execute init.mac");
177 if ((commandLine =
parser->GetCommandIfActive(
"-gui")))
180 G4UIQt* UIQt =
static_cast<G4UIQt*
> (UImanager->GetG4UIWindow());
182 UIQt->AddViewerTabFromFile(
"README",
"README from "+
G4String(argv[0]));
203 parser = CommandLineParser::GetParser();
205 parser->AddCommand(
"-gui",
206 Command::OptionNotCompulsory,
207 "Select geant4 UI or just launch a geant4 terminal session",
210 parser->AddCommand(
"-mac",
212 "Give a mac file to execute",
221 #ifdef G4MULTITHREADED 222 parser->AddCommand(
"-mt", Command::WithOption,
223 "Launch in MT mode (events computed in parallel)",
227 parser->AddCommand(
"-vis",
229 "Select a visualization driver",
232 parser->AddCommand(
"-novis",
233 Command::WithoutOption,
234 "Deactivate visualization when using GUI");
239 if (
parser->Parse(argc, argv) != 0)
243 CommandLineParser::DeleteInstance();
250 if (
parser->CheckIfNotHandledOptionsExists(argc, argv))
int main(int argc, char **argv)
void Parse(int &argc, char **argv)
CommandLineParser * parser(0)