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

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

#include <vector>
#include "G04ActionInitialization.hh"
#include "G04DetectorConstruction.hh"
#include "G04SensitiveDetector.hh"
#include "G4RunManager.hh"
#include "FTFP_BERT.hh"
#include "G4UImanager.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "G4GDMLParser.hh"
Include dependency graph for gdml_det.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the persistency/gdml/G04 example.

Definition in file gdml_det.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 56 of file gdml_det.cc.

57 {
58  G4cout << G4endl;
59  G4cout << "Usage: gdml_det <intput_gdml_file:mandatory>"
60  << G4endl;
61  G4cout << G4endl;
62 
63  if (argc<2)
64  {
65  G4cout << "Error! Mandatory input file is not specified!" << G4endl;
66  G4cout << G4endl;
67  return -1;
68  }
69 
70  // Detect interactive mode (if only one argument) and define UI session
71  //
72  G4UIExecutive* ui = 0;
73  if ( argc == 2 ) {
74  ui = new G4UIExecutive(argc, argv);
75  }
76 
78  parser.Read(argv[1]);
79 
80 #ifdef G4MULTITHREADED
81  G4MTRunManager* runManager = new G4MTRunManager;
82 #else
83  G4RunManager* runManager = new G4RunManager;
84 #endif
85 
86  runManager->SetUserInitialization(new G04DetectorConstruction(parser));
87  runManager->SetUserInitialization(new FTFP_BERT);
88 
89  // User action initialization
91  runManager->Initialize();
92 
93  // Initialize visualization
94  G4VisManager* visManager = new G4VisExecutive;
95  visManager->Initialize();
96 
97  // Get the pointer to the User Interface manager
99 
100  // Process macro or start UI session
101  if ( ! ui ) // batch mode
102  {
103  G4String command = "/control/execute ";
104  G4String fileName = argv[2];
105  UImanager->ApplyCommand(command+fileName);
106  }
107  else // interactive mode
108  {
109  UImanager->ApplyCommand("/control/execute vis.mac");
110  ui->SessionStart();
111  delete ui;
112  }
113 
114  delete visManager;
115  delete runManager;
116 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
Detector construction for laoding GDML geometry.
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
Action initialization class.
G4GLOB_DLL std::ostream G4cout
CommandLineParser * parser(0)
void Initialize()
void Read(const G4String &filename, G4bool Validate=true)
virtual void Initialize()
#define G4endl
Definition: G4ios.hh:61
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447

Here is the call graph for this function: