Implementation of the microdosimetry example.
More...
#include "G4Types.hh"
#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"
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 194 of file microdosimetry.cc.
Referenced by Parse().
199 std::string aux(argv[0]);
202 #if defined(_WIN32) || defined(WIN32) 203 int pos = aux.rfind(
'\\');
205 int pos = aux.rfind(
'/');
209 path = aux.substr(0, pos + 1);
210 executable = aux.substr(pos + 1);
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 65 of file microdosimetry.cc.
References Parse(), and parser().
75 Command* commandLine(0);
77 #ifdef G4MULTITHREADED 78 G4MTRunManager* runManager=
new G4MTRunManager;
79 if ((commandLine =
parser->GetCommandIfActive(
"-mt")))
82 if(commandLine->GetOption() ==
"NMAX")
84 nThreads = G4Threading::G4GetNumberOfCores();
88 nThreads = G4UIcommand::ConvertToInt(commandLine->GetOption());
90 G4cout <<
"===== Microdosimetry is started with " 91 << runManager->GetNumberOfThreads()
92 <<
" threads =====" << G4endl;
94 runManager->SetNumberOfThreads(nThreads);
97 G4RunManager* runManager =
new G4RunManager();
103 runManager->SetUserInitialization(detector);
105 runManager->SetUserInitialization(
new PhysicsList);
109 runManager->SetUserInitialization(
new ActionInitialization());
113 runManager->Initialize();
117 G4VisManager* visManager =
new G4VisExecutive;
118 visManager->Initialize();
122 G4UImanager* UImanager = G4UImanager::GetUIpointer();
123 G4UIExecutive* ui(0);
127 if ((commandLine =
parser->GetCommandIfActive(
"-gui")))
129 ui =
new G4UIExecutive(argc, argv,
130 commandLine->GetOption());
133 UImanager->ApplyCommand(
"/control/execute gui.mac");
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 800x600-0+0");
149 UImanager->ApplyCommand(
"/control/execute vis.mac");
157 if ((commandLine =
parser->GetCommandIfActive(
"-vis")))
159 UImanager->ApplyCommand(
G4String(
"/vis/open ")+commandLine->GetOption());
160 UImanager->ApplyCommand(
"/control/execute vis.mac");
164 if ((commandLine =
parser->GetCommandIfActive(
"-mac")))
166 G4String command =
"/control/execute ";
167 UImanager->ApplyCommand(command + commandLine->GetOption());
171 UImanager->ApplyCommand(
"/control/execute microdosimetry.in");
174 if ((commandLine =
parser->GetCommandIfActive(
"-gui")))
177 G4UIQt* UIQt =
static_cast<G4UIQt*
> (UImanager->GetG4UIWindow());
179 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 215 of file microdosimetry.cc.
References GetNameAndPathOfExecutable(), and parser().
Referenced by main().
220 parser = CommandLineParser::GetParser();
222 parser->AddCommand(
"-gui",
223 Command::OptionNotCompulsory,
224 "Select geant4 UI or just launch a geant4 terminal session",
227 parser->AddCommand(
"-mac",
229 "Give a mac file to execute",
238 #ifdef G4MULTITHREADED 241 "Launch in MT mode (events computed in parallel)",
245 parser->AddCommand(
"-vis",
247 "Select a visualization driver",
250 parser->AddCommand(
"-novis",
251 Command::WithoutOption,
252 "Deactivate visualization when using GUI");
258 parser->AddCommand(
"-out",
259 Command::OptionNotCompulsory,
266 if (
parser->Parse(argc, argv) != 0)
270 CommandLineParser::DeleteInstance();
277 if (
parser->CheckIfNotHandledOptionsExists(argc, argv))
void GetNameAndPathOfExecutable(char **argv, G4String &executable, G4String &path)
CommandLineParser * parser(0)
CommandLineParser* parser |
( |
0 |
| ) |
|