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

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

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "globals.hh"
#include "QGSP_BERT.hh"
#include "G02DetectorConstruction.hh"
#include "G02PrimaryGeneratorAction.hh"
#include "G02RunAction.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the persistency/gdml/G02 example.

Definition in file geotest.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 62 of file geotest.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  G02RunAction* runAction = new G02RunAction;
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  G4VisManager* visManager = new G4VisExecutive;
83  visManager->Initialize();
84 #endif
85 
86  // Open a UI session: will stay there until the user types "exit"
87  //
88  G4UImanager* UImanager = G4UImanager::GetUIpointer();
89 
90  if ( argc==1 ) // Automatically run default macro for writing...
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  } else { // Provides macro in input
101 #ifdef G4UI_USE
102  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
103  G4String command = "/control/execute ";
104  G4String fileName = argv[1];
105  UImanager->ApplyCommand(command+fileName);
106  ui->SessionStart();
107  delete ui;
108 #endif
109  }
110 
111 #ifdef G4VIS_USE
112  delete visManager;
113 #endif
114 
115  // Job termination
116  //
117  delete runManager;
118 
119  return 0;
120 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
Detector construction used in GDML read/write example.
Run action used in GDML read/write example.
Definition: G02RunAction.hh:52
Primary generator action used in GDML read/write example.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
virtual void SetUserAction(G4UserRunAction *userAction)