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

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

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "GeometryConstruction.hh"
#include "PhysicsList.hh"
#include "ActionInitialization.hh"
Include dependency graph for exgps.cc:

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 56 of file exgps.cc.

56  {
57 
58  // Construct the default run manager
59 #ifdef G4MULTITHREADED
60  G4MTRunManager * runManager = new G4MTRunManager;
62  if (argc==3) nThreads = G4UIcommand::ConvertToInt(argv[2]);
63  runManager->SetNumberOfThreads(nThreads);
64 #else
65  G4RunManager * runManager = new G4RunManager;
66 #endif
67 
68  // set mandatory initialization classes
70  runManager->SetUserInitialization(detector);
71  runManager->SetUserInitialization(new PhysicsList);
72 
74 
75 #ifdef G4VIS_USE
76  // visualization manager
77  G4VisManager* visManager = new G4VisExecutive;
78  visManager->Initialize();
79 #endif
80 
81  // get the pointer to the User Interface manager
82  G4UImanager* UImanager = G4UImanager::GetUIpointer();
83 
84  if (argc!=1) // batch mode
85  {
86  G4String command = "/control/execute ";
87  G4String fileName = argv[1];
88  UImanager->ApplyCommand(command+fileName);
89  }
90  else // interactive mode : define UI session
91  {
92 #ifdef G4UI_USE
93  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
94 #ifdef G4VIS_USE
95  UImanager->ApplyCommand("/control/execute vis.mac");
96 #endif
97  ui->SessionStart();
98  delete ui;
99 #endif
100 
101 #ifdef G4VIS_USE
102  delete visManager;
103 #endif
104  }
105 
106  // job termination
107  //
108  delete runManager;
109 
110  return 0;
111 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetNumberOfThreads(G4int n)
int G4int
Definition: G4Types.hh:78
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
G4int G4GetNumberOfCores()
Definition: G4Threading.cc:143
static G4int ConvertToInt(const char *st)
Definition: G4UIcommand.cc:447
void Initialize()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447
Physics list class.
Definition: PhysicsList.hh:47

Here is the call graph for this function: