Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
field05.cc File Reference

Main program of the field/field05 example. More...

#include <unistd.h>
#include "F05SteppingVerbose.hh"
#include "G4RunManager.hh"
#include "F05PhysicsList.hh"
#include "F05DetectorConstruction.hh"
#include "F05ActionInitialization.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
Include dependency graph for field05.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the field/field05 example.

Definition in file field05.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 67 of file field05.cc.

68 {
69  // Choose the Random engine
70  //
71  G4Random::setTheEngine(new CLHEP::RanecuEngine);
72 
73  G4int myseed = 1234;
74  if (argc > 2) myseed = atoi(argv[argc-1]);
75 
76  // Construct the default run manager
77  //
78 #ifdef G4MULTITHREADED
79  G4MTRunManager * runManager = new G4MTRunManager;
80 #else
82  G4RunManager * runManager = new G4RunManager;
83 #endif
84 
85  G4Random::setTheSeed(myseed);
86 
87  // Set mandatory initialization classes
88  //
89  // Detector construction
91  // Physics list
92  runManager->SetUserInitialization(new F05PhysicsList());
93  // User action initialization
95 
96  // Initialize G4 kernel
97  //
98  runManager->Initialize();
99 
100 #ifdef G4VIS_USE
101  // Initialize visualization
102  //
103  G4VisManager* visManager = new G4VisExecutive;
104  // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
105  // G4VisManager* visManager = new G4VisExecutive("Quiet");
106  visManager->Initialize();
107 #endif
108 
109  // Get the pointer to the User Interface manager
110  //
111  G4UImanager* UImanager = G4UImanager::GetUIpointer();
112 
113  if (argc!=1) // batch mode
114  {
115  G4String command = "/control/execute ";
116  G4String fileName = argv[1];
117  UImanager->ApplyCommand(command+fileName);
118  }
119  else
120  { // interactive mode : define UI session
121 #ifdef G4UI_USE
122  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
123 #ifdef G4VIS_USE
124  UImanager->ApplyCommand("/control/execute vis.mac");
125 #else
126  UImanager->ApplyCommand("/control/execute field05.in");
127 #endif
128  if (ui->IsGUI())
129  UImanager->ApplyCommand("/control/execute gui.mac");
130  ui->SessionStart();
131  delete ui;
132 #endif
133  }
134 
135  // Job termination
136  // Free the store: user actions, physics_list and detector_description are
137  // owned and deleted by the run manager, so they should not
138  // be deleted in the main() program !
139 
140 #ifdef G4VIS_USE
141  delete visManager;
142 #endif
143  delete runManager;
144 
145  return 0;
146 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
Action initialization class.
int G4int
Definition: G4Types.hh:78
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
void Initialize()
static void SetInstance(G4VSteppingVerbose *Instance)
virtual void Initialize()
G4bool IsGUI() const
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447

Here is the call graph for this function: