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

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

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "PrimaryGeneratorAction.hh"
#include "SteppingVerbose.hh"
Include dependency graph for userPrimaryGenerator.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the eventgenerator/userPrimaryGenerator example.

Definition in file userPrimaryGenerator.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 54 of file userPrimaryGenerator.cc.

54  {
55 
56  //choose the Random engine
58 
59  //my Verbose output class
61 
62  // Construct the default run manager
63  G4RunManager* runManager = new G4RunManager;
64 
65  // set mandatory initialization classes
66  //
68  runManager->SetUserInitialization(new PhysicsList);
69 
70  runManager->SetUserAction(new PrimaryGeneratorAction);
71 
72  // get the pointer to the User Interface manager
74 
75 #ifdef G4VIS_USE
76  G4VisManager* visManager = new G4VisExecutive;
77  visManager->Initialize();
78 #endif
79 
80  if (argc!=1) // batch mode
81  {
82  G4String command = "/control/execute ";
83  G4String fileName = argv[1];
84  UI->ApplyCommand(command+fileName);
85  }
86 
87  else // define visualization and UI terminal for interactive mode
88  {
89 #ifdef G4UI_USE
90  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
91 #ifdef G4VIS_USE
92  UI->ApplyCommand("/control/execute vis.mac");
93 #endif
94  ui->SessionStart();
95  delete ui;
96 #endif
97 
98 #ifdef G4VIS_USE
99  delete visManager;
100 #endif
101  }
102 
103  // job termination
104  //
105  delete runManager;
106 
107  return 0;
108 }
The primary generator action class with particle gun.
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
void Initialize()
static void SetInstance(G4VSteppingVerbose *Instance)
Detector construction class to define materials and geometry.
static void setTheEngine(HepRandomEngine *theNewEngine)
Definition: Random.cc:270
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447
virtual void SetUserAction(G4UserRunAction *userAction)
Physics list class.
Definition: PhysicsList.hh:47

Here is the call graph for this function: