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

Main program of the RE06 example. More...

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "RE06DetectorConstruction.hh"
#include "RE06ParallelWorld.hh"
#include "RE06PhysicsList.hh"
#include "RE06PrimaryGeneratorAction.hh"
#include "RE06RunAction.hh"
#include "RE06SteppingVerbose.hh"
#include "RE06ActionInitialization.hh"
#include "RE06WorkerInitialization.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the RE06 example.

Definition in file exampleRE06.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 61 of file exampleRE06.cc.

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

62 {
63  // Construct the stepping verbose class
66 
67  // Construct the run manager
68  //
69 #ifdef G4MULTITHREADED
70  G4MTRunManager * runManager = new G4MTRunManager;
71  runManager->SetNumberOfThreads(4);
73 #else
74  G4RunManager* runManager = new G4RunManager;
75 #endif
76 
77  // Set mandatory initialization classes
78  //
80  detector->RegisterParallelWorld(new RE06ParallelWorld("ParallelScoringWorld"));
81  runManager->SetUserInitialization(detector);
82  //
83  G4VUserPhysicsList* physics = new RE06PhysicsList;
84  runManager->SetUserInitialization(physics);
85 
86  // Set user action classes
87  //
89 
90 #ifdef G4VIS_USE
91  // Visualization manager
92  //
93  G4VisManager* visManager = new G4VisExecutive;
94  visManager->Initialize();
95 #endif
96 
97  // Initialize G4 kernel
98  //
99  runManager->Initialize();
100 
101  // Get the pointer to the User Interface manager
102  //
103  G4UImanager* UImanager = G4UImanager::GetUIpointer();
104 
105  if (argc==1) // Define UI session for interactive mode
106  {
107 #ifdef G4UI_USE
108  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
109 #ifdef G4VIS_USE
110  UImanager->ApplyCommand("/control/execute vis.mac");
111 #endif
112  ui->SessionStart();
113  delete ui;
114 #endif
115  }
116  else // Batch mode
117  {
118  G4String command = "/control/execute ";
119  G4String fileName = argv[1];
120  UImanager->ApplyCommand(command+fileName);
121  }
122 
123  // Job termination
124  // Free the store:
125  // user actions, physics_list and detector_description are
126  // owned and deleted by the run manager, so they should not
127  // be deleted in the main() program !
128 
129 #ifdef G4VIS_USE
130  delete visManager;
131 #endif
132  delete runManager;
133 
134  return 0;
135 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetNumberOfThreads(G4int n)
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()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419