Main program of the physicslists/factory example.
More...
#include "DetectorConstruction.hh"
#include "ActionInitialization.hh"
#include "PrimaryGeneratorAction.hh"
#include "G4RunManager.hh"
#include "G4PhysListFactory.hh"
#include "G4VModularPhysicsList.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
Go to the source code of this file.
|
int | main (int argc, char **argv) |
|
Main program of the physicslists/factory example.
Definition in file factory.cc.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 76 of file factory.cc.
References PrintUsage(), and session.
89 #ifdef G4MULTITHREADED 92 for ( G4int i=1; i<argc; i=i+2 ) {
93 if (
G4String(argv[i]) ==
"-m" ) macro = argv[i+1];
94 else if (
G4String(argv[i]) ==
"-u" ) session = argv[i+1];
95 else if (
G4String(argv[i]) ==
"-p" ) physListName = argv[i+1];
96 #ifdef G4MULTITHREADED 97 else if (
G4String(argv[i]) ==
"-t" ) {
98 nofThreads = G4UIcommand::ConvertToInt(argv[i+1]);
109 G4UIExecutive* ui = 0;
110 if ( ! macro.size() ) {
111 ui =
new G4UIExecutive(argc, argv, session);
115 G4Random::setTheEngine(
new CLHEP::RanecuEngine());
118 #ifdef G4MULTITHREADED 119 G4MTRunManager * runManager =
new G4MTRunManager();
120 if ( nofThreads > 0 ) {
121 runManager->SetNumberOfThreads(nofThreads);
124 G4RunManager * runManager =
new G4RunManager();
128 G4PhysListFactory factory;
129 G4VModularPhysicsList* physList =
nullptr;
132 if ( ! physListName.size() ) {
134 char* physListNameEnv = std::getenv(
"PHYSLIST");
135 if ( physListNameEnv ) {
136 physListName =
G4String(physListNameEnv);
141 if ( physListName.size() && (! factory.IsReferencePhysList(physListName) ) ) {
142 G4cerr <<
"Physics list " << physListName
143 <<
" is not available in PhysListFactory." << G4endl;
144 physListName.clear();
148 if ( ! physListName.size() ) {
149 physListName =
"FTFP_BERT";
153 physList = factory.GetReferencePhysList(physListName);
157 runManager->SetUserInitialization(physList);
160 runManager->SetUserInitialization(
new ActionInitialization(
"factory"));
163 G4VisManager* visManager =
new G4VisExecutive;
166 visManager->Initialize();
169 G4UImanager* UImanager = G4UImanager::GetUIpointer();
171 if ( macro.size() ) {
173 G4String command =
"/control/execute ";
174 UImanager->ApplyCommand(command+macro);
178 UImanager->ApplyCommand(
"/control/execute init_vis.mac");
static G4UIterminal * session