Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
gammaknife.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 // GEANT4 - GAMMAKNIFE example
28 // ----------------------------------------------------------------------------
29 // AUTHORS:
30 // G. Cuttone (a), J. Pipek (b) F.Romano* (a), M.G.Sabini (c)
31 //
32 // PAST AUTHORS:
33 // G.A.P. Cirrone (a), G.Russo (d), M.Russo (a)
34 //
35 // (a) Laboratori Nazionali del Sud - INFN, Catania, Italy
36 // (b) Faculty of Nuclear Sciences and Physical Engineering, Czech Technical University, Czech Republic
37 // (c) Dipartimento di Immagini, Ospedale Cannizzaro, Catania, Italy
38 // (d) Fondazione Istituto San Raffaele G.Giglio, Cefalù (Palermo), Italy
39 //
40 //
41 // *Corresponding author, email to francesco.romano@lns.infn.it
42 // ----------------------------------------------------------------------------
43 
44 #include "G4Types.hh"
45 
46 #ifdef G4MULTITHREADED
47 #include "G4MTRunManager.hh"
48 #else
49 #include "G4RunManager.hh"
50 #endif
51 
52 #include "G4UImanager.hh"
53 #include "G4UIterminal.hh"
54 #include "G4UItcsh.hh"
55 
56 #ifdef G4VIS_USE
57  #include "G4VisExecutive.hh"
58 #endif
59 #ifdef G4UI_USE
60  #include "G4UIExecutive.hh"
61 #endif
62 
64 #include "GammaKnifePhysicsList.hh"
66 #include "GammaKnifeRunAction.hh"
68 
69 #include "Randomize.hh"
70 #include "G4RunManager.hh"
71 #include "G4UImessenger.hh"
72 #include "G4ScoringManager.hh"
73 #include "globals.hh"
74 #include "GammaKnifeController.hh"
75 #include "G4PhysListFactory.hh"
76 
77 #include <ctime>
78 
79 int main(int argc ,char ** argv)
80 {
81 
82  G4Random::setTheEngine(new CLHEP::RanecuEngine);
83  G4int seconds = time(NULL);
84  G4Random::setTheSeed(seconds);
85 
86 #ifdef G4MULTITHREADED
87  G4MTRunManager * runManager = new G4MTRunManager;
88 #else
89  G4RunManager * runManager = new G4RunManager;
90 #endif
91 
92  G4ScoringManager::GetScoringManager(); // This enables scoring
93 
94  // Initialize the geometry
96  runManager -> SetUserInitialization(detector);
97 
98  // Initialize the physics
99  G4PhysListFactory factory;
100  G4VModularPhysicsList* phys = 0;
101  G4String physName = "";
102 
103  // Physics List name defined via environment variable
104  char* path = getenv("PHYSLIST");
105  if (path) { physName = G4String(path); }
106 
107  if(physName != "" && factory.IsReferencePhysList(physName))
108  {
109  phys = factory.GetReferencePhysList(physName);
110  }
111 
112  if(!phys) { phys = new GammaKnifePhysicsList(); }
113 
114  runManager->SetUserInitialization(phys);
115 
116 
118  runManager->SetUserInitialization(actionInitialization);
119 
120  GammaKnifeController* controller = new GammaKnifeController( detector );
121  controller->ReadFile("MachineAngle.in"); // pre-load default
122 
123  // Initialize G4 kernel
124  //
125  runManager->Initialize();
126 
127 #ifdef G4VIS_USE
128  // Visualization manager
129  G4VisManager* visManager = new G4VisExecutive;
130  visManager -> Initialize();
131 #endif
132 
133  // Get the pointer to the User Interface manager
134  G4UImanager* UImanager = G4UImanager::GetUIpointer();
135 
136  if (argc!=1) {
137  // batch mode
138  G4String command = "/control/execute ";
139  G4String fileName = argv[1];
140  UImanager->ApplyCommand(command+fileName);
141  }
142  else {
143  // interactive mode : define UI session
144 #ifdef G4UI_USE
145  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
146 #ifdef G4VIS_USE
147  UImanager->ApplyCommand("/control/execute defaultMacro.mac");
148 #else
149  UImanager->ApplyCommand("/control/execute batch.mac");
150 #endif
151  ui->SessionStart();
152  delete ui;
153 #endif
154  }
155 
156  // Job termination
157 #ifdef G4VIS_USE
158  delete visManager;
159 #endif
160 
161  delete runManager;
162  delete controller;
163 
164  return 0;
165 }
Definition of the GammaKnifeActionInitialization class.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:466
void Initialize()
Definition: errprop.cc:101
G4bool IsReferencePhysList(const G4String &)
G4VModularPhysicsList * GetReferencePhysList(const G4String &)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:73
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void ReadFile(std::string fileName)
int main(int argc, char **argv)
Definition: genwindef.cc:359
int G4int
Definition: G4Types.hh:78
static G4ScoringManager * GetScoringManager()
virtual void Initialize()