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

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

Include dependency graph for field02.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the field/field02 example.

Definition in file field02.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 62 of file field02.cc.

63 {
64  // Choose the Random engine
65  //
66  G4Random::setTheEngine(new CLHEP::RanecuEngine);
67 
68  // Construct the default run manager
69  //
70 #ifdef G4MULTITHREADED
71  G4MTRunManager * runManager = new G4MTRunManager;
72 #else
74  G4RunManager * runManager = new G4RunManager;
75 #endif
76 
77  // Set mandatory initialization classes
78  //
79  // Detector construction
81  runManager->SetUserInitialization(detector);
82  // Physics list
83  G4VModularPhysicsList* physicsList = new FTFP_BERT;
84  physicsList->RegisterPhysics(new G4StepLimiterPhysics());
85  runManager->SetUserInitialization(physicsList);
86  // User action initialization
87  runManager->SetUserInitialization(new F02ActionInitialization(detector));
88 
89  // Initialize G4 kernel
90  //
91  runManager->Initialize();
92 
93 #ifdef G4VIS_USE
94  // Initialize visualization
95  //
96  G4VisManager* visManager = new G4VisExecutive;
97  // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
98  // G4VisManager* visManager = new G4VisExecutive("Quiet");
99  visManager->Initialize();
100 #endif
101 
102  // Get the pointer to the User Interface manager
103  //
104  G4UImanager* UImanager = G4UImanager::GetUIpointer();
105 
106  if (argc!=1) // batch mode
107  {
108  G4String command = "/control/execute ";
109  G4String fileName = argv[1];
110  UImanager->ApplyCommand(command+fileName);
111  }
112  else
113  { // interactive mode : define UI session
114 #ifdef G4UI_USE
115  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
116  if (ui->IsGUI())
117  UImanager->ApplyCommand("/control/execute gui.mac");
118  ui->SessionStart();
119  delete ui;
120 #endif
121  }
122 
123  // Job termination
124  // Free the store: user actions, physics_list and detector_description are
125  // owned and deleted by the run manager, so they should not
126  // be deleted in the main() program !
127 
128 #ifdef G4VIS_USE
129  delete visManager;
130 #endif
131  delete runManager;
132 
133  return 0;
134 }
Action initialization class.
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void RegisterPhysics(G4VPhysicsConstructor *)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
void Initialize()
TFTFP_BERT< G4VModularPhysicsList > FTFP_BERT
Definition: FTFP_BERT.hh:63
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: