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

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

#include "ExTGDetectorConstruction.hh"
#include "ExTGDetectorConstructionWithSD.hh"
#include "ExTGDetectorConstructionWithCpp.hh"
#include "ExTGDetectorConstructionWithCuts.hh"
#include "ExTGPhysicsList.hh"
#include "ExTGPrimaryGeneratorAction.hh"
#include "ExTGActionInitialization.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/P03 example.

Definition in file textGeom.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 59 of file textGeom.cc.

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

60 {
61  // Run manager
62  //
63 #ifdef G4MULTITHREADED
64  G4MTRunManager* runManager = new G4MTRunManager;
65  runManager->SetNumberOfThreads(1);
66 #else
67  G4RunManager* runManager = new G4RunManager;
68 #endif
69 
70  // User Initialization classes (mandatory)
71  //
73 
74  //
75  runManager->SetUserInitialization(new ExTGPhysicsList);
76 
77  // User Action classes
78  //
79  //MT runManager->SetUserAction(new ExTGPrimaryGeneratorAction);
80 
82 
83  // Run action that dumps GEANT4 in-memory geometry to text file
84  //MT runManager->SetUserAction(new ExTGRunAction);
85 
86  // Initialize G4 kernel
87  //
88  // runManager->Initialize();
89 
90  // Get the pointer to the User Interface manager
91  //
92  G4UImanager * UImanager = G4UImanager::GetUIpointer();
93 
94 #ifdef G4VIS_USE
95  G4VisManager* visManager = new G4VisExecutive;
96  visManager->Initialize();
97 #endif
98 
99  if (argc!=1) // batch mode
100  {
101  G4String command = "/control/execute ";
102  G4String fileName = argv[1];
103  UImanager->ApplyCommand(command+fileName);
104  }
105  else // interactive mode : define visualization and UI terminal
106  {
107 #ifdef G4UI_USE
108  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
109 #ifdef G4VIS_USE
110  UImanager->ApplyCommand("/control/execute run.mac");
111 #endif
112  ui->SessionStart();
113  delete ui;
114 #endif
115  }
116 
117  // Free the store: user actions, physics_list and detector_description are
118  // owned and deleted by the run manager, so they should not
119  // be deleted in the main() program !
120 
121 #ifdef G4VIS_USE
122  delete visManager;
123 #endif
124  delete runManager;
125 
126  return 0;
127 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
Detector construction class using text geometry file.
void SetNumberOfThreads(G4int n)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419