Geant4  10.02.p02
Brachy.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // --------------------------------------------------------------
27 // GEANT 4 - Brachytherapy example
28 // --------------------------------------------------------------
29 //
30 // Code developed by:
31 // S. Agostinelli, F. Foppiano, S. Garelli , M. Tropeano, S.Guatelli
32 
33 //
34 // *******************************
35 // * *
36 // * Brachy.cc *
37 // * *
38 // *******************************
39 //
40 //
41 #ifdef G4MULTITHREADED
42  #include "G4MTRunManager.hh"
43 #else
44  #include "G4RunManager.hh"
45 #endif
46 
47 #include "G4UImanager.hh"
48 #include "G4UIExecutive.hh"
49 #include "BrachyFactoryIr.hh"
51 
52 #ifdef ANALYSIS_USE
53 #include "BrachyAnalysisManager.hh"
54 #endif
55 
56 #ifdef G4VIS_USE
57 #include "G4VisExecutive.hh"
58 #endif
59 
61 #include "BrachyPhysicsList.hh"
63 #include "G4SDManager.hh"
64 #include "Randomize.hh"
65 #include "G4RunManager.hh"
66 #include "G4SDManager.hh"
67 #include "G4UImanager.hh"
68 #include "G4UImessenger.hh"
69 
70 #include "G4ScoringManager.hh"
71 
72 #ifdef G4UI_USE
73 #include "G4UIExecutive.hh"
74 #endif
75 
76 #include "G4ScoringManager.hh"
77 #include "BrachyUserScoreWriter.hh"
78 
79 int main(int argc ,char ** argv)
80 
81 {
82 
83 #ifdef G4MULTITHREADED
84  G4MTRunManager* pRunManager = new G4MTRunManager;
85  pRunManager->SetNumberOfThreads(4); // Is equal to 2 by default
86 #else
87  G4RunManager* pRunManager = new G4RunManager;
88 #endif
89 
90  // Access to the Scoring Manager pointer
92 
93 
94  // Overwrite the default output file with user-defined one
95  scoringManager->SetScoreWriter(new BrachyUserScoreWriter());
96 
97  // Initialize the physics component
98  pRunManager -> SetUserInitialization(new BrachyPhysicsList);
99 
100  // Initialize the detector component
101  BrachyDetectorConstruction *pDetectorConstruction = new BrachyDetectorConstruction();
102  pRunManager -> SetUserInitialization(pDetectorConstruction);
103 
104 // Analysis Manager
105 #ifdef ANALYSIS_USE
107  analysis -> book();
108 #endif
109 
110  // User action initialization
111 
113  pRunManager->SetUserInitialization(actions);
114 
115  //Initialize G4 kernel
116  pRunManager -> Initialize();
117 
119 #ifdef G4VIS_USE
120  // Visualization manager
121  G4VisManager* visManager = new G4VisExecutive;
122  visManager->Initialize();
123 #endif
124 
125  // get the pointer to the User Interface manager
126  G4UImanager* UImanager = G4UImanager::GetUIpointer();
127  if (argc == 1) // Define UI session for interactive mode.
128  {
129 #ifdef G4UI_USE
130  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
131  G4cout << " UI session starts ..." << G4endl;
132  UImanager -> ApplyCommand("/control/execute VisualisationMacro.mac");
133  ui -> SessionStart();
134  delete ui;
135 #endif
136  }
137  else // Batch mode
138  {
139  G4String command = "/control/execute ";
140  G4String fileName = argv[1];
141  UImanager -> ApplyCommand(command+fileName);
142  }
143 
144  // Job termination
145 #ifdef G4VIS_USE
146  delete visManager;
147 #endif
148 
149 #ifdef ANALYSIS_USE
150 // Close the output ROOT file with the results
151  analysis -> save();
152  delete analysis;
153 #endif
154 
155  delete pRunManager;
156 
157  return 0;
158 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetNumberOfThreads(G4int n)
void Initialize()
Definition: errprop.cc:101
static BrachyAnalysisManager * GetInstance()
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
G4GLOB_DLL std::ostream G4cout
void SetScoreWriter(G4VScoreWriter *sw)
int main(int argc, char **argv)
Definition: Brachy.cc:79
void Initialize()
#define G4endl
Definition: G4ios.hh:61
static G4ScoringManager * GetScoringManager()