Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
Brachy.cc File Reference
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIExecutive.hh"
#include "BrachyFactoryIr.hh"
#include "BrachyActionInitialization.hh"
#include "BrachyAnalysisManager.hh"
#include "BrachyDetectorConstruction.hh"
#include "BrachyPhysicsList.hh"
#include "BrachyPrimaryGeneratorAction.hh"
#include "G4SDManager.hh"
#include "Randomize.hh"
#include "G4UImessenger.hh"
#include "G4ScoringManager.hh"
#include "BrachyUserScoreWriter.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 76 of file Brachy.cc.

References G4cout, G4endl, G4ScoringManager::GetScoringManager(), G4UImanager::GetUIpointer(), Initialize(), G4VisManager::Initialize(), G4MTRunManager::SetNumberOfThreads(), G4ScoringManager::SetScoreWriter(), and G4RunManager::SetUserInitialization().

78 {
79 
80 #ifdef G4MULTITHREADED
81  G4MTRunManager* pRunManager = new G4MTRunManager;
82  pRunManager->SetNumberOfThreads(4); // Is equal to 2 by default
83 #else
84  G4RunManager* pRunManager = new G4RunManager;
85 #endif
86 
87  // Access to the Scoring Manager pointer
89 
90 
91  // Overwrite the default output file with user-defined one
93  scoringManager->SetScoreWriter(new BrachyUserScoreWriter(analysis));
94 
95  // Initialize the physics component
96  pRunManager -> SetUserInitialization(new BrachyPhysicsList);
97 
98  // Initialize the detector component
99  BrachyDetectorConstruction *pDetectorConstruction = new BrachyDetectorConstruction();
100  pRunManager -> SetUserInitialization(pDetectorConstruction);
101 
102 // Analysis Manager
103 #ifdef ANALYSIS_USE
104 analysis -> book();
105 #endif
106 
107  // User action initialization
108 
110  pRunManager->SetUserInitialization(actions);
111 
112  //Initialize G4 kernel
113  pRunManager -> Initialize();
114 
115 //// Initialize the Visualization component
116 #ifdef G4VIS_USE
117  // Visualization manager
118  G4VisManager* visManager = new G4VisExecutive;
119  visManager->Initialize();
120 #endif
121 
122  // get the pointer to the User Interface manager
123  G4UImanager* UImanager = G4UImanager::GetUIpointer();
124  if (argc == 1) // Define UI session for interactive mode.
125  {
126 #ifdef G4UI_USE
127  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
128  G4cout << " UI session starts ..." << G4endl;
129  UImanager -> ApplyCommand("/control/execute VisualisationMacro.mac");
130  ui -> SessionStart();
131  delete ui;
132 #endif
133  }
134  else // Batch mode
135  {
136  G4String command = "/control/execute ";
137  G4String fileName = argv[1];
138  UImanager -> ApplyCommand(command+fileName);
139  }
140 
141  // Job termination
142 #ifdef G4VIS_USE
143  delete visManager;
144 #endif
145 
146 #ifdef ANALYSIS_USE
147 // Close the output ROOT file with the results
148  analysis -> save();
149 #endif
150 
151  delete analysis;
152 
153 
154  delete pRunManager;
155 
156  return 0;
157 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetNumberOfThreads(G4int n)
void Initialize()
Definition: errprop.cc:96
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
G4GLOB_DLL std::ostream G4cout
void SetScoreWriter(G4VScoreWriter *sw)
void Initialize()
#define G4endl
Definition: G4ios.hh:61
static G4ScoringManager * GetScoringManager()