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

Main program of the analysis/AnaEx01 example. More...

#include "DetectorConstruction.hh"
#include "ActionInitialization.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "FTFP_BERT.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
Include dependency graph for AnaEx01.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the analysis/AnaEx01 example.

Definition in file AnaEx01.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 53 of file AnaEx01.cc.

54 {
55  // Detect interactive mode (if no arguments) and define UI session
56  //
57  G4UIExecutive* ui = 0;
58  if ( argc == 1 ) {
59  ui = new G4UIExecutive(argc, argv);
60  }
61 
62  // Construct the default run manager
63  //
64 #ifdef G4MULTITHREADED
65  G4int nThreads = 4;
66  G4MTRunManager * runManager = new G4MTRunManager;
67  runManager->SetNumberOfThreads(nThreads);
68 #else
69  G4RunManager * runManager = new G4RunManager;
70 #endif
71 
72  // Set mandatory initialization classes
73  //
75  runManager->SetUserInitialization(detector);
76  runManager->SetUserInitialization(new FTFP_BERT);
77  runManager->SetUserInitialization(new ActionInitialization(detector));
78 
79  // Initialize visualization
80  //
81  G4VisManager* visManager = new G4VisExecutive;
82  visManager->Initialize();
83 
84  // Get the pointer to the User Interface manager
85  //
87 
88  if ( ! ui ) {
89  // batch mode
90  G4String command = "/control/execute ";
91  G4String fileName = argv[1];
92  UImanager->ApplyCommand(command+fileName);
93  }
94  else {
95  // interactive mode
96  UImanager->ApplyCommand("/control/execute init_vis.mac");
97  ui->SessionStart();
98  delete ui;
99  }
100 
101  // Job termination
102  delete visManager;
103  delete runManager;
104 
105  return 0;
106 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetNumberOfThreads(G4int n)
int G4int
Definition: G4Types.hh:78
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
void Initialize()
Detector construction class to define materials and geometry.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447

Here is the call graph for this function: