47 #ifdef G4MULTITHREADED 48 #include "G4MTRunManager.hh" 50 #include "F04SteppingVerbose.hh" 51 #include "G4RunManager.hh" 54 #include "F04PhysicsList.hh" 55 #include "F04DetectorConstruction.hh" 57 #include "F04ActionInitialization.hh" 59 #include "G4UImanager.hh" 61 #include "Randomize.hh" 63 #include "G4VisExecutive.hh" 64 #include "G4UIExecutive.hh" 70 G4cerr <<
" Usage: " << G4endl;
71 G4cerr <<
" field04 [-m macro ] [-p physicsList] [-r randomSeed] [-s preinit|idle]" 80 int main(
int argc,
char** argv)
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");
int main(int argc, char **argv)