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

Main program of the persistency/gdml/G03 example. More...

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "globals.hh"
#include "QGSP_BERT.hh"
#include "G03DetectorConstruction.hh"
#include "G03PrimaryGeneratorAction.hh"
#include "G03RunAction.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the persistency/gdml/G03 example.

Definition in file gdml_ext.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 62 of file gdml_ext.cc.

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

63 {
64 
65  // Construct the default run manager
66  //
67  G4RunManager* runManager = new G4RunManager;
68 
69  // Set mandatory initialization and user action classes
70  //
72  runManager->SetUserInitialization(detector);
73  runManager->SetUserInitialization(new QGSP_BERT);
75  G03RunAction* runAction = new G03RunAction;
76  runManager->SetUserAction(runAction);
77 
78  // Initialisation of runManager via macro for the interactive mode
79  // This gives possibility to give different names for GDML file to READ
80 
81 #ifdef G4VIS_USE
82  // Initialize visualization
83  //
84  G4VisManager* visManager = new G4VisExecutive;
85  visManager->Initialize();
86 #endif
87 
88  // run initialisation macro
90  if ( argc==1 ) // Define UI session for interactive mode.
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  else // Batch mode
102  {
103 #ifdef G4UI_USE
104  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
105  G4String command = "/control/execute ";
106  G4String fileName = argv[1];
107  UImanager->ApplyCommand(command+fileName);
108  ui->SessionStart();
109  delete ui;
110 #endif
111  }
112 
113 #ifdef G4VIS_USE
114  delete visManager;
115 #endif
116 
117  // Job termination
118  //
119  delete runManager;
120 
121  return 0;
122 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
Run action for the GDML extension example.
Definition: G03RunAction.hh:50
Detector construction for the GDML extensions example.
Primary generator action for the GDML extension example.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
virtual void SetUserAction(G4UserRunAction *userAction)