Implementation of the microdosimetry example.
More...
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIExecutive.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#include "G4VisExecutive.hh"
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "CommandLineParser.hh"
#include "G4UIQt.hh"
Go to the source code of this file.
Implementation of the microdosimetry example.
Definition in file microdosimetry.cc.
void GetNameAndPathOfExecutable |
( |
char ** |
argv, |
|
|
G4String & |
executable, |
|
|
G4String & |
path |
|
) |
| |
Definition at line 193 of file microdosimetry.cc.
Referenced by Parse().
198 std::string aux(argv[0]);
201 #if defined(_WIN32) || defined(WIN32) 202 int pos = aux.rfind(
'\\');
204 int pos = aux.rfind(
'/');
208 path = aux.substr(0, pos + 1);
209 executable = aux.substr(pos + 1);
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 63 of file microdosimetry.cc.
References Parse(), and parser().
66 G4Random::setTheEngine(
new CLHEP::RanecuEngine);
76 Command* commandLine(0);
78 #ifdef G4MULTITHREADED 79 G4MTRunManager* runManager=
new G4MTRunManager;
80 if ((commandLine =
parser->GetCommandIfActive(
"-mt")))
83 if(commandLine->GetOption() ==
"NMAX")
85 nThreads = G4Threading::G4GetNumberOfCores();
89 nThreads = G4UIcommand::ConvertToInt(commandLine->GetOption());
91 G4cout <<
"===== Microdosimetry is started with " 92 << runManager->GetNumberOfThreads()
93 <<
" threads =====" << G4endl;
95 runManager->SetNumberOfThreads(nThreads);
98 G4RunManager* runManager =
new G4RunManager();
103 runManager->SetUserInitialization(detector);
105 runManager->SetUserInitialization(
new PhysicsList);
109 runManager->SetUserInitialization(
new ActionInitialization());
113 runManager->Initialize();
116 G4VisManager* visManager =
new G4VisExecutive;
119 visManager->Initialize();
122 G4UImanager* UImanager = G4UImanager::GetUIpointer();
123 G4UIExecutive* ui(0);
126 if ((commandLine =
parser->GetCommandIfActive(
"-gui")))
128 ui =
new G4UIExecutive(argc, argv,
129 commandLine->GetOption());
132 UImanager->ApplyCommand(
"/control/execute gui.mac");
134 if(
parser->GetCommandIfActive(
"-novis") == 0)
137 if((commandLine =
parser->GetCommandIfActive(
"-vis")))
140 UImanager->ApplyCommand(
G4String(
"/vis/open ")+
141 commandLine->GetOption());
146 UImanager->ApplyCommand(
"/vis/open OGL 800x600-0+0");
148 UImanager->ApplyCommand(
"/control/execute vis.mac");
156 if ((commandLine =
parser->GetCommandIfActive(
"-vis")))
158 UImanager->ApplyCommand(
G4String(
"/vis/open ")+commandLine->GetOption());
159 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 microdosimetry.in");
173 if ((commandLine =
parser->GetCommandIfActive(
"-gui")))
176 G4UIQt* UIQt =
static_cast<G4UIQt*
> (UImanager->GetG4UIWindow());
178 UIQt->AddViewerTabFromFile(
"README",
"README from "+
G4String(argv[0]));
void Parse(int &argc, char **argv)
CommandLineParser * parser(0)
void Parse |
( |
int & |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 214 of file microdosimetry.cc.
References GetNameAndPathOfExecutable(), and parser().
Referenced by main().
219 parser = CommandLineParser::GetParser();
221 parser->AddCommand(
"-gui",
222 Command::OptionNotCompulsory,
223 "Select geant4 UI or just launch a geant4 terminal session",
226 parser->AddCommand(
"-mac",
228 "Give a mac file to execute",
237 #ifdef G4MULTITHREADED 240 "Launch in MT mode (events computed in parallel)",
244 parser->AddCommand(
"-vis",
246 "Select a visualization driver",
249 parser->AddCommand(
"-novis",
250 Command::WithoutOption,
251 "Deactivate visualization when using GUI");
257 parser->AddCommand(
"-out",
258 Command::OptionNotCompulsory,
265 if (
parser->Parse(argc, argv) != 0)
269 CommandLineParser::DeleteInstance();
276 if (
parser->CheckIfNotHandledOptionsExists(argc, argv))
void GetNameAndPathOfExecutable(char **argv, G4String &executable, G4String &path)
CommandLineParser * parser(0)
CommandLineParser* parser |
( |
0 |
| ) |
|