Implementation of the neuron example.
More...
#include "G4Types.hh"
#include "G4RunManager.hh"
#include "G4DNAChemistryManager.hh"
#include "G4Timer.hh"
#include "G4UImanager.hh"
#include "G4UIExecutive.hh"
#include "G4VisExecutive.hh"
#include "CommandLineParser.hh"
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
Go to the source code of this file.
Implementation of the neuron example.
Definition in file neuron.cc.
void GetNameAndPathOfExecutable |
( |
char ** |
argv, |
|
|
G4String & |
executable, |
|
|
G4String & |
path |
|
) |
| |
Definition at line 195 of file neuron.cc.
Referenced by Parse().
200 std::string aux(argv[0]);
203 #if defined(_WIN32) || defined(WIN32) 204 int pos = aux.rfind(
'\\');
206 int pos = aux.rfind(
'/');
210 path = aux.substr(0, pos + 1);
211 executable = aux.substr(pos + 1);
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 67 of file neuron.cc.
References Parse(), and parser().
71 G4Timer *timer =
new G4Timer();
82 Command* commandLine(0);
84 #ifdef G4MULTITHREADED 85 G4MTRunManager* runManager=
new G4MTRunManager;
86 if ((commandLine =
parser->GetCommandIfActive(
"-mt")))
89 if(commandLine->GetOption() ==
"NMAX")
91 nThreads = G4Threading::G4GetNumberOfCores();
95 nThreads = G4UIcommand::ConvertToInt(commandLine->GetOption());
97 G4cout <<
"===== neuron is started with " 98 << runManager->GetNumberOfThreads()
99 <<
" threads of MT MODE =====" << G4endl;
101 runManager->SetNumberOfThreads(nThreads);
104 G4RunManager* runManager =
new G4RunManager();
105 G4cout <<
"===== neuron is started with " 106 <<
" SEQUENTIAL MODE =====" << G4endl;
111 runManager->SetUserInitialization(detector);
112 runManager->SetUserInitialization(
new PhysicsList);
115 runManager->SetUserInitialization(
new ActionInitialization(detector));
118 runManager->Initialize();
121 G4VisManager* visManager =
new G4VisExecutive;
122 visManager->Initialize();
125 G4UImanager* UImanager = G4UImanager::GetUIpointer();
126 G4UIExecutive* ui(0);
129 if ((commandLine =
parser->GetCommandIfActive(
"-gui")))
131 ui =
new G4UIExecutive(argc, argv,
132 commandLine->GetOption());
135 UImanager->ApplyCommand(
"/control/execute gui.mac");
137 if(
parser->GetCommandIfActive(
"-novis") == 0)
140 if((commandLine =
parser->GetCommandIfActive(
"-vis")))
143 UImanager->ApplyCommand(
G4String(
"/vis/open ")+
144 commandLine->GetOption());
149 UImanager->ApplyCommand(
"/vis/open OGL 800x600-0+0");
151 UImanager->ApplyCommand(
"/control/execute vis.mac");
159 if ((commandLine =
parser->GetCommandIfActive(
"-vis")))
161 UImanager->ApplyCommand(
G4String(
"/vis/open ")+commandLine->GetOption());
162 UImanager->ApplyCommand(
"/control/execute vis.mac");
166 if ((commandLine =
parser->GetCommandIfActive(
"-mac")))
168 G4String command =
"/control/execute ";
169 UImanager->ApplyCommand(command + commandLine->GetOption());
173 UImanager->ApplyCommand(
"/control/execute ");
176 if ((commandLine =
parser->GetCommandIfActive(
"-gui")))
184 G4cout <<
" Calculation time = " 185 << timer->GetRealElapsed() <<
" s \n"<< G4endl;
void Parse(int &argc, char **argv)
CommandLineParser * parser(0)
void Parse |
( |
int & |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 216 of file neuron.cc.
References GetNameAndPathOfExecutable(), and parser().
Referenced by main().
221 parser = CommandLineParser::GetParser();
223 parser->AddCommand(
"-gui",
224 Command::OptionNotCompulsory,
225 "Select geant4 UI or just launch a geant4 terminal session",
228 parser->AddCommand(
"-mac",
230 "Give a mac file to execute",
239 #ifdef G4MULTITHREADED 242 "Launch in MT mode (events computed in parallel)",
243 " NOT RECOMMANDED WITH CHEMISTRY)",
247 parser->AddCommand(
"-sXY", Command::OptionNotCompulsory,
248 "Initial beam position uniformly spread on a square!");
249 parser->AddCommand(
"-dXY", Command::OptionNotCompulsory,
250 "Initial beam position uniformly spread on a disk!");
252 parser->AddCommand(
"-dnaliv", Command::OptionNotCompulsory,
253 "Activate Livermore + DNAPhysics");
254 parser->AddCommand(
"-dnachemON", Command::OptionNotCompulsory,
255 "Activate Livermore + DNAPhysics + DNAChemistry");
256 parser->AddCommand(
"-dnahad", Command::OptionNotCompulsory,
257 "Activate Hadronic + Livermore + DNAPhysics");
259 parser->AddCommand(
"-swc",
261 "Give a SWC file to simulation",
264 parser->AddCommand(
"-network",
266 "Give a DAT file to simulation",
269 parser->AddCommand(
"-vis",
271 "Select a visualization driver",
274 parser->AddCommand(
"-novis",
275 Command::WithoutOption,
276 "Deactivate visualization when using GUI");
282 parser->AddCommand(
"-out",
283 Command::OptionNotCompulsory,
290 if (
parser->Parse(argc, argv) != 0)
294 CommandLineParser::DeleteInstance();
301 if (
parser->CheckIfNotHandledOptionsExists(argc, argv))
void GetNameAndPathOfExecutable(char **argv, G4String &executable, G4String &path)
CommandLineParser * parser(0)
CommandLineParser* parser |
( |
0 |
| ) |
|