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 62 of file clustering.cc.
References Parse(), and parser().
72 Command* commandLine(0);
74 #ifdef G4MULTITHREADED 75 G4MTRunManager* runManager=
new G4MTRunManager;
76 if ((commandLine =
parser->GetCommandIfActive(
"-mt")))
79 if(commandLine->GetOption() ==
"NMAX")
81 nThreads = G4Threading::G4GetNumberOfCores();
85 nThreads = G4UIcommand::ConvertToInt(commandLine->GetOption());
87 G4cout <<
"===== clustering is started with " 88 << runManager->GetNumberOfThreads()
89 <<
" threads =====" << G4endl;
91 runManager->SetNumberOfThreads(nThreads);
94 G4RunManager* runManager =
new G4RunManager();
101 runManager->SetUserInitialization(
new PhysicsList);
102 runManager->SetUserInitialization(detector);
103 runManager->SetUserInitialization(
new ActionInitialization());
106 runManager->Initialize();
109 G4VisManager* visManager =
new G4VisExecutive;
110 visManager->Initialize();
113 G4UImanager* UImanager = G4UImanager::GetUIpointer();
114 G4UIExecutive* ui(0);
117 if ((commandLine =
parser->GetCommandIfActive(
"-gui")))
119 ui =
new G4UIExecutive(argc, argv, commandLine->GetOption());
121 if (ui->IsGUI()) UImanager->ApplyCommand(
"/control/execute gui.mac");
123 if (
parser->GetCommandIfActive(
"-novis") == 0)
126 if ((commandLine =
parser->GetCommandIfActive(
"-vis")))
129 UImanager->ApplyCommand(
130 G4String(
"/vis/open ") + commandLine->GetOption());
135 UImanager->ApplyCommand(
"/vis/open OGL 800x600-0+0");
137 UImanager->ApplyCommand(
"/control/execute vis.mac");
145 if ((commandLine =
parser->GetCommandIfActive(
"-vis")))
147 UImanager->ApplyCommand(
148 G4String(
"/vis/open ") + commandLine->GetOption());
149 UImanager->ApplyCommand(
"/control/execute vis.mac");
153 if ((commandLine =
parser->GetCommandIfActive(
"-mac")))
155 G4String command =
"/control/execute ";
156 UImanager->ApplyCommand(command + commandLine->GetOption());
160 UImanager->ApplyCommand(
"/control/execute run.in");
163 if ((commandLine =
parser->GetCommandIfActive(
"-gui")))
177 CommandLineParser::DeleteInstance();
CommandLineParser * parser(0)
void Parse(int &argc, char **argv)
void Parse |
( |
int & |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 184 of file clustering.cc.
References parser().
Referenced by main().
189 parser = CommandLineParser::GetParser();
192 "-gui", Command::OptionNotCompulsory,
193 "Select geant4 UI or just launch a geant4 terminal session",
"qt");
195 parser->AddCommand(
"-mac", Command::WithOption,
"Give a mac file to execute",
204 #ifdef G4MULTITHREADED 207 "Launch in MT mode (events computed in parallel," 208 " NOT RECOMMENDED WITH CHEMISTRY)",
"2");
211 parser->AddCommand(
"-vis", Command::WithOption,
212 "Select a visualization driver",
"OGL 600x600-0+0");
214 parser->AddCommand(
"-novis", Command::WithoutOption,
215 "Deactivate visualization when using GUI");
220 if (
parser->Parse(argc, argv) != 0)
224 CommandLineParser::DeleteInstance();
232 if (
parser->CheckIfNotHandledOptionsExists(argc, argv))
CommandLineParser * parser(0)
CommandLineParser* parser |
( |
0 |
| ) |
|