LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
Brachy.cc File Reference
#include "G4Types.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIExecutive.hh"
#include "BrachyActionInitialization.hh"
#include "G4VisExecutive.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.

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