Chem1 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) |
|
Chem1 example.
Definition in file chem1.cc.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 71 of file chem1.cc.
References Parse(), and parser().
81 Command* commandLine(0);
83 #ifdef G4MULTITHREADED 84 G4MTRunManager* runManager=
new G4MTRunManager;
85 if ((commandLine =
parser->GetCommandIfActive(
"-mt")))
88 if(commandLine->GetOption() ==
"NMAX")
90 nThreads = G4Threading::G4GetNumberOfCores();
94 nThreads = G4UIcommand::ConvertToInt(commandLine->GetOption());
96 G4cout <<
"===== Chem1 is started with " 97 << runManager->GetNumberOfThreads()
98 <<
" threads =====" << G4endl;
100 runManager->SetNumberOfThreads(nThreads);
103 G4RunManager* runManager =
new G4RunManager();
110 runManager->SetUserInitialization(
new PhysicsList);
111 runManager->SetUserInitialization(detector);
112 runManager->SetUserInitialization(
new ActionInitialization());
115 runManager->Initialize();
118 G4VisManager* visManager =
new G4VisExecutive;
121 visManager->Initialize();
124 G4UImanager* UImanager = G4UImanager::GetUIpointer();
125 G4UIExecutive* ui(0);
128 if ((commandLine =
parser->GetCommandIfActive(
"-gui")))
130 ui =
new G4UIExecutive(argc, argv, commandLine->GetOption());
132 if (ui->IsGUI()) UImanager->ApplyCommand(
"/control/execute gui.mac");
134 if (
parser->GetCommandIfActive(
"-novis") == 0)
137 if ((commandLine =
parser->GetCommandIfActive(
"-vis")))
140 UImanager->ApplyCommand(
141 G4String(
"/vis/open ") + 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(
159 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 beam.in");
174 if ((commandLine =
parser->GetCommandIfActive(
"-gui")))
188 CommandLineParser::DeleteInstance();
void Parse(int &argc, char **argv)
CommandLineParser * parser(0)
void Parse |
( |
int & |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 193 of file chem1.cc.
References parser().
Referenced by main().
198 parser = CommandLineParser::GetParser();
201 "-gui", Command::OptionNotCompulsory,
202 "Select geant4 UI or just launch a geant4 terminal session",
"qt");
204 parser->AddCommand(
"-mac", Command::WithOption,
"Give a mac file to execute",
213 #ifdef G4MULTITHREADED 216 "Launch in MT mode (events computed in parallel," 217 " NOT RECOMMANDED WITH CHEMISTRY)",
"2");
220 parser->AddCommand(
"-chemOFF", Command::WithoutOption,
221 "Deactivate chemistry");
223 parser->AddCommand(
"-vis", Command::WithOption,
224 "Select a visualization driver",
"OGL 600x600-0+0");
226 parser->AddCommand(
"-novis", Command::WithoutOption,
227 "Deactivate visualization when using GUI");
232 if (
parser->Parse(argc, argv) != 0)
236 CommandLineParser::DeleteInstance();
243 if (
parser->CheckIfNotHandledOptionsExists(argc, argv))
CommandLineParser * parser(0)
CommandLineParser* parser |
( |
0 |
| ) |
|