Main program of the field/field04 example.
More...
#include <unistd.h>
#include "G4Types.hh"
#include "F04SteppingVerbose.hh"
#include "G4RunManager.hh"
#include "F04PhysicsList.hh"
#include "F04DetectorConstruction.hh"
#include "F04ActionInitialization.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 field/field04 example.
Definition in file field04.cc.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 80 of file field04.cc.
References PrintUsage().
95 G4int randomSeed = 1234;
97 for ( G4int i=1; i<argc; i=i+2 ) {
98 if (
G4String(argv[i]) ==
"-m" ) macro = argv[i+1];
99 else if (
G4String(argv[i]) ==
"-r" ) randomSeed = atoi(argv[i+1]);
100 else if (
G4String(argv[i]) ==
"-p" ) physicsList = argv[i+1];
101 else if (
G4String(argv[i]) ==
"-s" ) startPhase = argv[i+1];
109 G4UIExecutive* ui =
nullptr;
110 if ( ! macro.size() ) {
111 ui =
new G4UIExecutive(argc, argv);
116 G4Random::setTheEngine(
new CLHEP::RanecuEngine);
120 #ifdef G4MULTITHREADED 121 G4MTRunManager * runManager =
new G4MTRunManager;
123 G4VSteppingVerbose::SetInstance(
new F04SteppingVerbose);
124 G4RunManager * runManager =
new G4RunManager;
127 G4Random::setTheSeed(randomSeed);
132 F04DetectorConstruction* detector =
new F04DetectorConstruction();
133 runManager->SetUserInitialization(detector);
135 runManager->SetUserInitialization(
new F04PhysicsList(physicsList));
137 runManager->SetUserInitialization(
new F04ActionInitialization(detector));
145 G4VisManager* visManager =
new G4VisExecutive;
148 visManager->Initialize();
152 G4UImanager* UImanager = G4UImanager::GetUIpointer();
156 if ( macro.size() ) {
158 G4String command =
"/control/execute ";
159 UImanager->ApplyCommand(command+macro);
163 if ( startPhase ==
"preinit" ) {
165 G4cout <<
"At the prompt, issue commands to set up detector & field, then:" 167 G4cout <<
"/run/initialize" << G4endl;
168 G4cout <<
"Then if you want a viewer:"<< G4endl;
169 G4cout <<
"/control/execute vis.mac" << G4endl;
170 G4cout <<
"Then: " << G4endl;
171 G4cout <<
"/run/beamOn … etc." << G4endl;
174 UImanager->ApplyCommand(
"/control/execute init_vis.mac");
177 UImanager->ApplyCommand(
"/control/execute gui.mac");