Main program of the field/field04 example.
More...
#include <unistd.h>
#include "F04SteppingVerbose.hh"
#include "G4RunManager.hh"
#include "F04PhysicsList.hh"
#include "F04DetectorConstruction.hh"
#include "F04ActionInitialization.hh"
#include "G4UImanager.hh"
#include "Randomize.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 77 of file field04.cc.
81 G4Random::setTheEngine(
new CLHEP::RanecuEngine);
84 if (argc > 2) myseed = atoi(argv[argc-1]);
88 #ifdef G4MULTITHREADED 89 G4MTRunManager * runManager =
new G4MTRunManager;
91 G4VSteppingVerbose::SetInstance(
new F04SteppingVerbose);
92 G4RunManager * runManager =
new G4RunManager;
95 G4Random::setTheSeed(myseed);
101 while ((c=getopt(argc,argv,
"p")) != -1)
106 physicsList = optarg;
107 G4cout <<
"Physics List used is " << physicsList << G4endl;
110 fprintf(stderr,
"Option -%c requires an operand\n", optopt);
113 fprintf(stderr,
"Unrecognised option: -%c\n", optopt);
121 F04DetectorConstruction* detector =
new F04DetectorConstruction();
122 runManager->SetUserInitialization(detector);
124 runManager->SetUserInitialization(
new F04PhysicsList(physicsList));
126 runManager->SetUserInitialization(
new F04ActionInitialization(detector));
135 G4VisManager* visManager =
new G4VisExecutive;
138 visManager->Initialize();
143 G4UImanager* UImanager = G4UImanager::GetUIpointer();
147 if (argc > 2) { optmax = optmax-1; }
151 G4String command =
"/control/execute ";
152 for ( ; optind < optmax; optind++)
154 G4String macroFilename = argv[optind];
155 UImanager->ApplyCommand(command+macroFilename);
158 #else // Simple UI for Windows runs, no possibility of additional arguments 161 G4String command =
"/control/execute ";
163 UImanager->ApplyCommand(command+fileName);
170 G4UIExecutive * ui =
new G4UIExecutive(argc,argv);
173 G4cout <<
"At the prompt, issue commands to set up detector & field, then:" 175 G4cout <<
"/run/initialize" << G4endl;
176 G4cout <<
"Then if you want a viewer:"<< G4endl;
177 G4cout <<
"/control/execute vis.mac" << G4endl;
178 G4cout <<
"Then: " << G4endl;
179 G4cout <<
"/run/beamOn … etc." << G4endl;
182 UImanager->ApplyCommand(
"/control/execute gui.mac");