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

Main program of the eventgenerator/exgps example. More...

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "exGPSGeometryConstruction.hh"
#include "exGPSPhysicsList.hh"
#include "exGPSPrimaryGeneratorAction.hh"
#include "exGPSRunAction.hh"
#include "exGPSEventAction.hh"
#include "exGPSActionInitialization.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the eventgenerator/exgps example.

Definition in file exgps.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 58 of file exgps.cc.

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

58  {
59 
60  // Construct the default run manager
61 #ifdef G4MULTITHREADED
62  G4int nThreads = 4;
63  G4MTRunManager * runManager = new G4MTRunManager;
64  runManager->SetNumberOfThreads(nThreads);
65 #else
66  G4RunManager * runManager = new G4RunManager;
67 #endif
68 
69  // set mandatory initialization classes
71  runManager->SetUserInitialization(detector);
72  runManager->SetUserInitialization(new exGPSPhysicsList);
74 
75  //Initialize G4 kernel
76  runManager->Initialize();
77 
78  // visualization manager
79 #ifdef G4VIS_USE
80  G4VisManager* visManager = new G4VisExecutive;
81  visManager->Initialize();
82 #endif
83 
84  // get the pointer to the User Interface manager
85  G4UImanager* UImanager = G4UImanager::GetUIpointer();
86  // UI->ApplyCommand("/control/execute display.mac");
87 
88  if (argc!=1) // batch mode
89  {
90  G4String command = "/control/execute ";
91  G4String fileName = argv[1];
92  UImanager->ApplyCommand(command+fileName);
93  }
94  else
95  { // interactive mode : define UI session
96 #ifdef G4UI_USE
97  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
98  ui->SessionStart();
99  delete ui;
100 #endif
101  }
102 
103  // job termination
104 #ifdef G4VIS_USE
105  delete visManager;
106 #endif
107  delete runManager;
108 
109  return 0;
110 }
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