Geant4  10.00.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 #include "BrachyAnalysisManager.hh"
52 
53 #ifdef G4VIS_USE
54 #include "G4VisExecutive.hh"
55 #endif
56 
58 #include "BrachyPhysicsList.hh"
60 #include "G4SDManager.hh"
61 #include "Randomize.hh"
62 #include "G4RunManager.hh"
63 #include "G4SDManager.hh"
64 #include "G4UImanager.hh"
65 #include "G4UImessenger.hh"
66 
67 #include "G4ScoringManager.hh"
68 
69 #ifdef G4UI_USE
70 #include "G4UIExecutive.hh"
71 #endif
72 
73 #include "G4ScoringManager.hh"
74 #include "BrachyUserScoreWriter.hh"
75 
76 int main(int argc ,char ** argv)
77 
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 
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)
int main(int argc, char **argv)
Definition: Brachy.cc:76
void Initialize()
#define G4endl
Definition: G4ios.hh:61
static G4ScoringManager * GetScoringManager()