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

Main program of the runAndEvent/RE03 example. More...

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4ScoringManager.hh"
#include "RE03DetectorConstruction.hh"
#include "FTFP_BERT.hh"
#include "RE03ActionInitialization.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the runAndEvent/RE03 example.

Definition in file RE03.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 57 of file RE03.cc.

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

58 {
59  // Construct the run manager
60  //
61 #ifdef G4MULTITHREADED
62  G4MTRunManager * runManager = new G4MTRunManager;
63  runManager->SetNumberOfThreads(4);
64 #else
65  G4RunManager * runManager = new G4RunManager;
66 #endif
67 
68  // Activate UI-command base scorer
70  scManager->SetVerboseLevel(1);
71 
72 //====================================================================
73 // Un-comment this line for user defined score writer
74 // scManager->SetScoreWriter(new RE03UserScoreWriter());
75 //====================================================================
76 
77  // Set mandatory initialization classes
78  //
80  runManager->SetUserInitialization(detector);
81  //
82  G4VUserPhysicsList* physics = new FTFP_BERT;
83  runManager->SetUserInitialization(physics);
84 
85  // Set user action classes through Worker Initialization
86  //
88  runManager->SetUserInitialization(actions);
89 
90 #ifdef G4VIS_USE
91  // Visualization manager
92  G4VisManager* visManager = new G4VisExecutive;
93  visManager->Initialize();
94 #endif
95 
96  // Initialize G4 kernel
97  //
98  runManager->Initialize();
99 
100  // Get the pointer to the User Interface manager
101  //
102  G4UImanager* UImanager = G4UImanager::GetUIpointer();
103 
104  if (argc==1) // Define UI session for interactive mode
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  else // Batch mode
116  {
117  G4String command = "/control/execute ";
118  G4String fileName = argv[1];
119  UImanager->ApplyCommand(command+fileName);
120  }
121 
122  // Job termination
123  // Free the store: user actions, physics_list and detector_description are
124  // owned and deleted by the run manager, so they should not
125  // be deleted in the main() program !
126 
127 #ifdef G4VIS_USE
128  delete visManager;
129 #endif
130  delete runManager;
131 
132  return 0;
133 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetNumberOfThreads(G4int n)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
TFTFP_BERT< G4VModularPhysicsList > FTFP_BERT
Definition: FTFP_BERT.hh:63
virtual void Initialize()
static G4ScoringManager * GetScoringManager()
void SetVerboseLevel(G4int vl)
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419