clustering example
More...
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "ActionInitialization.hh"
#include "G4RunManager.hh"
#include "G4DNAChemistryManager.hh"
#include "G4UImanager.hh"
#include "G4UIExecutive.hh"
#include "G4VisExecutive.hh"
#include "CommandLineParser.hh"
Go to the source code of this file.
|
CommandLineParser * | parser (0) |
|
void | Parse (int &argc, char **argv) |
|
int | main (int argc, char **argv) |
|
clustering example
Definition in file clustering.cc.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 59 of file clustering.cc.
References Parse(), and parser().
69 Command* commandLine(0);
71 #ifdef G4MULTITHREADED 72 G4MTRunManager* runManager=
new G4MTRunManager;
73 if ((commandLine =
parser->GetCommandIfActive(
"-mt")))
76 if(commandLine->GetOption() ==
"NMAX")
78 nThreads = G4Threading::G4GetNumberOfCores();
82 nThreads = G4UIcommand::ConvertToInt(commandLine->GetOption());
84 G4cout <<
"===== clustering is started with " 85 << runManager->GetNumberOfThreads()
86 <<
" threads =====" << G4endl;
88 runManager->SetNumberOfThreads(nThreads);
91 G4RunManager* runManager =
new G4RunManager();
99 runManager->SetUserInitialization(detector);
100 runManager->SetUserInitialization(
new ActionInitialization());
103 runManager->Initialize();
106 G4VisManager* visManager =
new G4VisExecutive;
107 visManager->Initialize();
110 G4UImanager* UImanager = G4UImanager::GetUIpointer();
111 G4UIExecutive* ui(0);
114 if ((commandLine =
parser->GetCommandIfActive(
"-gui")))
116 ui =
new G4UIExecutive(argc, argv, commandLine->GetOption());
118 if (ui->IsGUI()) UImanager->ApplyCommand(
"/control/execute gui.mac");
120 if (
parser->GetCommandIfActive(
"-novis") == 0)
123 if ((commandLine =
parser->GetCommandIfActive(
"-vis")))
126 UImanager->ApplyCommand(
127 G4String(
"/vis/open ") + commandLine->GetOption());
132 UImanager->ApplyCommand(
"/vis/open OGL 800x600-0+0");
134 UImanager->ApplyCommand(
"/control/execute vis.mac");
142 if ((commandLine =
parser->GetCommandIfActive(
"-vis")))
144 UImanager->ApplyCommand(
145 G4String(
"/vis/open ") + commandLine->GetOption());
146 UImanager->ApplyCommand(
"/control/execute vis.mac");
150 if ((commandLine =
parser->GetCommandIfActive(
"-mac")))
152 G4String command =
"/control/execute ";
153 UImanager->ApplyCommand(command + commandLine->GetOption());
157 UImanager->ApplyCommand(
"/control/execute run.in");
160 if ((commandLine =
parser->GetCommandIfActive(
"-gui")))
174 CommandLineParser::DeleteInstance();
CommandLineParser * parser(0)
void Parse(int &argc, char **argv)
void Parse |
( |
int & |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 179 of file clustering.cc.
References parser().
Referenced by main().
184 parser = CommandLineParser::GetParser();
187 "-gui", Command::OptionNotCompulsory,
188 "Select geant4 UI or just launch a geant4 terminal session",
"qt");
190 parser->AddCommand(
"-mac", Command::WithOption,
"Give a mac file to execute",
199 #ifdef G4MULTITHREADED 202 "Launch in MT mode (events computed in parallel," 203 " NOT RECOMMENDED WITH CHEMISTRY)",
"2");
206 parser->AddCommand(
"-vis", Command::WithOption,
207 "Select a visualization driver",
"OGL 600x600-0+0");
209 parser->AddCommand(
"-novis", Command::WithoutOption,
210 "Deactivate visualization when using GUI");
215 if (
parser->Parse(argc, argv) != 0)
219 CommandLineParser::DeleteInstance();
226 if (
parser->CheckIfNotHandledOptionsExists(argc, argv))
CommandLineParser * parser(0)
CommandLineParser* parser |
( |
0 |
| ) |
|