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

Main program of the persistency/P01 example. More...

#include "ExP01DetectorConstruction.hh"
#include "ExP01PhysicsList.hh"
#include "ExP01PrimaryGeneratorAction.hh"
#include "ExP01RunAction.hh"
#include "ExP01EventAction.hh"
#include "ExP01SteppingAction.hh"
#include "ExP01SteppingVerbose.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 persistency/P01 example.

Definition in file exampleP01.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 57 of file exampleP01.cc.

References G4UImanager::ApplyCommand(), G4UImanager::GetUIpointer(), G4RunManager::Initialize(), G4VisManager::Initialize(), G4UIExecutive::SessionStart(), G4VSteppingVerbose::SetInstance(), G4RunManager::SetUserAction(), and G4RunManager::SetUserInitialization().

57  {
58 
59  //my Verbose output class
61 
62  // Run manager
63  G4RunManager * runManager = new G4RunManager;
64 
65  // UserInitialization classes (mandatory)
67  runManager->SetUserInitialization(ExP01detector);
68  runManager->SetUserInitialization(new ExP01PhysicsList);
69 
70 #ifdef G4VIS_USE
71  // Visualization, if you choose to have it!
72  G4VisManager* visManager = new G4VisExecutive;
73  visManager->Initialize();
74 #endif
75 
76  // UserAction classes
77  runManager->SetUserAction(new ExP01PrimaryGeneratorAction(ExP01detector));
78  runManager->SetUserAction(new ExP01RunAction);
79  runManager->SetUserAction(new ExP01EventAction);
80  runManager->SetUserAction(new ExP01SteppingAction);
81 
82  //Initialize G4 kernel
83  runManager->Initialize();
84 
85  //get the pointer to the User Interface manager
86  G4UImanager * UImanager = G4UImanager::GetUIpointer();
87 
88  if(argc==1)
89  // Define (G)UI terminal for interactive mode
90  {
91 #ifdef G4UI_USE
92  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
93 #ifdef G4VIS_USE
94  UImanager->ApplyCommand("/control/execute vis.mac");
95 #endif
96  ui->SessionStart();
97  delete ui;
98 #endif
99  }
100  else
101  // Batch mode
102  {
103  G4String command = "/control/execute ";
104  G4String fileName = argv[1];
105  UImanager->ApplyCommand(command+fileName);
106  }
107 
108 #ifdef G4VIS_USE
109  delete visManager;
110 #endif
111 
112  delete runManager;
113 
114  return 0;
115 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
Detector Construction for the persistency example.
Stepping verbose for the persistency example.
Run action for the persistency example.
Physics list for the persistency example.
void Initialize()
static void SetInstance(G4VSteppingVerbose *Instance)
Primary generator action for the persistency example.
virtual void Initialize()
Event action for the persistency example.
Stepping action for the persistency example.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
virtual void SetUserAction(G4UserRunAction *userAction)