Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
Brachy.cc
이 파일의 문서화 페이지로 가기
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 currently by:
31 // S.Guatelli & D. Cutajar
32 
33 //
34 // *******************************
35 // * *
36 // * Brachy.cc *
37 // * *
38 // *******************************
39 //
40 //
41 #include "G4Types.hh"
42 
43 #ifdef G4MULTITHREADED
44  #include "G4MTRunManager.hh"
45 #else
46  #include "G4RunManager.hh"
47 #endif
48 
49 #include "G4UImanager.hh"
50 #include "G4UIExecutive.hh"
51 
53 
54 #ifdef ANALYSIS_USE
55 #include "BrachyAnalysisManager.hh"
56 #endif
57 
58 #ifdef G4VIS_USE
59 #include "G4VisExecutive.hh"
60 #endif
61 
63 #include "BrachyPhysicsList.hh"
65 #include "G4SDManager.hh"
66 #include "Randomize.hh"
67 #include "G4RunManager.hh"
68 #include "G4SDManager.hh"
69 #include "G4UImanager.hh"
70 #include "G4UImessenger.hh"
71 
72 #include "G4ScoringManager.hh"
73 
74 #ifdef G4UI_USE
75 #include "G4UIExecutive.hh"
76 #endif
77 
78 #include "G4ScoringManager.hh"
79 #include "BrachyUserScoreWriter.hh"
80 
81 int main(int argc ,char ** argv)
82 
83 {
84 #ifdef G4MULTITHREADED
85  G4MTRunManager* pRunManager = new G4MTRunManager;
86  pRunManager->SetNumberOfThreads(4); // Is equal to 2 by default
87 #else
88  G4RunManager* pRunManager = new G4RunManager;
89 #endif
90 
91  G4cout << "***********************" << G4endl;
92  G4cout << "*** " << G4Random::getTheSeed() << " ***" << G4endl;
93  G4cout << "***********************" << G4endl;
94  // Access to the Scoring Manager pointer
95 
97 
98  // Overwrite the default output file with user-defined one
99  scoringManager->SetScoreWriter(new BrachyUserScoreWriter());
100 
101  // Initialize the physics component
102  pRunManager -> SetUserInitialization(new BrachyPhysicsList);
103 
104  // Initialize the detector component
105  BrachyDetectorConstruction *pDetectorConstruction = new BrachyDetectorConstruction();
106  pRunManager -> SetUserInitialization(pDetectorConstruction);
107 
108 // Analysis Manager
109 #ifdef ANALYSIS_USE
111  analysis -> book();
112 #endif
113 
114  // User action initialization
115 
117  pRunManager->SetUserInitialization(actions);
118 
119  //Initialize G4 kernel
120  pRunManager -> Initialize();
121 
123 #ifdef G4VIS_USE
124  // Visualization manager
125  G4VisManager* visManager = new G4VisExecutive;
126  visManager->Initialize();
127 #endif
128 
129  // get the pointer to the User Interface manager
130  G4UImanager* UImanager = G4UImanager::GetUIpointer();
131  if (argc == 1) // Define UI session for interactive mode.
132  {
133 #ifdef G4UI_USE
134  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
135  G4cout << " UI session starts ..." << G4endl;
136  UImanager -> ApplyCommand("/control/execute VisualisationMacro.mac");
137  ui -> SessionStart();
138  delete ui;
139 #endif
140  }
141  else // Batch mode
142  {
143  G4String command = "/control/execute ";
144  G4String fileName = argv[1];
145  UImanager -> ApplyCommand(command+fileName);
146  }
147 
148  // Job termination
149 #ifdef G4VIS_USE
150  delete visManager;
151 #endif
152 
153 #ifdef ANALYSIS_USE
154 // Close the output ROOT file with the results
155  analysis -> save();
156  delete analysis;
157 #endif
158 
159  delete pRunManager;
160 
161  return 0;
162 }
void SetNumberOfThreads(G4int n)
void SetScoreWriter(G4VScoreWriter *sw)
#define G4endl
Definition: G4ios.hh:61
void Initialize()
Definition: errprop.cc:101
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:73
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
int main(int argc, char **argv)
Definition: genwindef.cc:359
static BrachyAnalysisManager * GetInstance()
G4GLOB_DLL std::ostream G4cout
void Initialize()
static G4ScoringManager * GetScoringManager()