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

Main program of the RE05 example. More...

#include "G4RunManager.hh"
#include "RE05SteppingVerbose.hh"
#include "G4UImanager.hh"
#include "RE05DetectorConstruction.hh"
#include "RE05CalorimeterROGeometry.hh"
#include "QBBC.hh"
#include "G4ParallelWorldPhysics.hh"
#include "RE05ActionInitialization.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the RE05 example.

Definition in file exampleRE05.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 59 of file exampleRE05.cc.

References G4UImanager::ApplyCommand(), G4UImanager::GetUIpointer(), G4RunManager::Initialize(), G4VisManager::Initialize(), G4VUserDetectorConstruction::RegisterParallelWorld(), G4VModularPhysicsList::RegisterPhysics(), G4UIExecutive::SessionStart(), G4VSteppingVerbose::SetInstance(), G4MTRunManager::SetNumberOfThreads(), G4MTRunManager::SetUserInitialization(), and G4RunManager::SetUserInitialization().

60 {
61 #ifdef G4MULTITHREADED
62  G4MTRunManager* runManager = new G4MTRunManager;
63  G4int number_of_threads = 4; // default number of threads
64  runManager->SetNumberOfThreads(number_of_threads);
66 #else
67  G4VSteppingVerbose* verbosity = new RE05SteppingVerbose;
69  G4RunManager* runManager = new G4RunManager;
70 #endif
71 
72  G4String parallelWorldName = "ReadoutWorld";
73  // User Initialization classes (mandatory)
74  //
76  detector->RegisterParallelWorld
77  (new RE05CalorimeterROGeometry(parallelWorldName));
78  runManager->SetUserInitialization(detector);
79  //
80  G4VModularPhysicsList* physicsList = new QBBC;
81  physicsList
82  ->RegisterPhysics(new G4ParallelWorldPhysics(parallelWorldName));
83  runManager->SetUserInitialization(physicsList);
84  //
86  runManager->SetUserInitialization(actions);
87 
88  runManager->Initialize();
89 
90 #ifdef G4VIS_USE
91  G4VisManager* visManager = new G4VisExecutive;
92  visManager->Initialize();
93 #endif
94 
95  //get the pointer to the User Interface manager
96  G4UImanager* UImanager = G4UImanager::GetUIpointer();
97 
98  if (argc!=1) // batch mode
99  {
100  G4String command = "/control/execute ";
101  G4String fileName = argv[1];
102  UImanager->ApplyCommand(command+fileName);
103  }
104  else // interactive mode : define UI session
105  {
106 #ifdef G4UI_USE
107  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
108 #ifdef G4VIS_USE
109  UImanager->ApplyCommand("/control/execute vis.mac");
110 #endif
111  ui->SessionStart();
112  delete ui;
113 #endif
114 
115 #ifdef G4VIS_USE
116  delete visManager;
117 #endif
118  }
119 
120  // Job termination
121  // Free the store: user actions, physics_list and detector_description are
122  // owned and deleted by the run manager, so they should not
123  // be deleted in the main() program !
124  delete runManager;
125 
126  return 0;
127 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void RegisterPhysics(G4VPhysicsConstructor *)
void SetNumberOfThreads(G4int n)
int G4int
Definition: G4Types.hh:78
void RegisterParallelWorld(G4VUserParallelWorld *)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
virtual void SetUserInitialization(G4VUserPhysicsList *userPL)
void Initialize()
static void SetInstance(G4VSteppingVerbose *Instance)
virtual void Initialize()
Definition: QBBC.hh:44
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419