Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
AnaEx01.cc File Reference

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

#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "ActionInitialization.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"

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 58 of file AnaEx01.cc.

References G4UImanager::ApplyCommand(), G4UImanager::GetUIpointer(), G4RunManager::Initialize(), G4VisManager::Initialize(), G4UIExecutive::SessionStart(), G4MTRunManager::SetNumberOfThreads(), and G4RunManager::SetUserInitialization().

59 {
60  // Construct the default run manager
61  //
62 #ifdef G4MULTITHREADED
63  G4int nThreads = 4;
64  G4MTRunManager * runManager = new G4MTRunManager;
65  runManager->SetNumberOfThreads(nThreads);
66 #else
67  G4RunManager * runManager = new G4RunManager;
68 #endif
69 
70  // Set mandatory initialization classes
71  //
73  runManager->SetUserInitialization(detector);
74  runManager->SetUserInitialization(new PhysicsList);
75  runManager->SetUserInitialization(new ActionInitialization(detector));
76 
77  // Initialize G4 kernel
78  //
79  runManager->Initialize();
80 
81  // Get the pointer to the User Interface manager
82  //
84 
85  if (argc!=1) // batch mode
86  {
87  G4String command = "/control/execute ";
88  G4String fileName = argv[1];
89  UImanager->ApplyCommand(command+fileName);
90  }
91  else
92  { // interactive mode : define visualization and UI terminal
93 #ifdef G4VIS_USE
94  G4VisManager* visManager = new G4VisExecutive;
95  visManager->Initialize();
96 #ifdef G4UI_USE
97  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
98 #endif
99  UImanager->ApplyCommand("/control/execute vis.mac");
100 #endif
101 
102 #ifdef G4UI_USE
103  ui->SessionStart();
104  delete ui;
105 #endif
106 
107 #ifdef G4VIS_USE
108  delete visManager;
109 #endif
110  }
111 
112  // Job termination
113  delete runManager;
114 
115  return 0;
116 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetNumberOfThreads(G4int n)
int G4int
Definition: G4Types.hh:78
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
virtual void Initialize()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419