Geant4
9.6.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4_9_6_p02
examples
advanced
gammaknife
gammaknife.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
// GEANT4 - GAMMAKNIFE example
28
// ----------------------------------------------------------------------------
29
// AUTHORS:
30
// G. Cuttone (a), J. Pipek (b) F.Romano* (a,c), M.G.Sabini (d)
31
//
32
// PAST AUTHORS:
33
// G.A.P. Cirrone (a), G.Russo (e), 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) Centro Studi e Ricerche e Museo Storico della Fisica E.Fermi, Roma, Italy
38
// (d) Dipartimento di Immagini, Ospedale Cannizzaro, Catania, Italy
39
// (e) Fondazione Istituto San Raffaele G.Giglio, Cefalù (Palermo), Italy
40
//
41
//
42
// *Corresponding author, email to francesco.romano@lns.infn.it
43
// ----------------------------------------------------------------------------
44
45
#include "
G4RunManager.hh
"
46
#include "
G4UImanager.hh
"
47
#include "
G4UIterminal.hh
"
48
#include "
G4UItcsh.hh
"
49
#ifdef G4VIS_USE
50
#include "
G4VisExecutive.hh
"
51
#endif
52
#ifdef G4UI_USE
53
#include "
G4UIExecutive.hh
"
54
#endif
55
#include "
GammaKnifeDetectorConstruction.hh
"
56
#include "
GammaKnifePhysicsList.hh
"
57
#include "
GammaKnifePrimaryGeneratorAction.hh
"
58
#include "
GammaKnifeRunAction.hh
"
59
#include "
Randomize.hh
"
60
#include "
G4RunManager.hh
"
61
#include "
G4UImessenger.hh
"
62
#include "
G4ScoringManager.hh
"
63
#include "
globals.hh
"
64
#include "
GammaKnifeController.hh
"
65
#include "
G4PhysListFactory.hh
"
66
67
#include <ctime>
68
69
int
main
(
int
argc ,
char
** argv)
70
{
71
72
CLHEP::HepRandom::setTheEngine
(
new
CLHEP::RanecuEngine
);
73
G4int
seconds = time(NULL);
74
CLHEP::HepRandom::setTheSeed
(seconds);
75
76
G4RunManager
* runManager =
new
G4RunManager
;
77
G4ScoringManager::GetScoringManager
();
// This enables scoring
78
79
// Initialize the geometry
80
GammaKnifeDetectorConstruction
* detector =
new
GammaKnifeDetectorConstruction
();
81
runManager -> SetUserInitialization(detector);
82
83
84
// Initialize the physics
85
G4PhysListFactory
factory;
86
G4VModularPhysicsList
* phys = 0;
87
G4String
physName =
""
;
88
89
// Physics List name defined via environment variable
90
char
* path = getenv(
"PHYSLIST"
);
91
if
(path) { physName =
G4String
(path); }
92
93
if
(physName !=
""
&& factory.
IsReferencePhysList
(physName))
94
{
95
phys = factory.
GetReferencePhysList
(physName);
96
}
97
98
if
(!phys) { phys =
new
GammaKnifePhysicsList
(); }
99
100
runManager->
SetUserInitialization
(phys);
101
102
// Initialize the primary particles
103
runManager -> SetUserAction(
new
GammaKnifePrimaryGeneratorAction
());
104
105
GammaKnifeController
* controller =
new
GammaKnifeController
( detector );
106
controller->
ReadFile
(
"MachineAngle.in"
);
// pre-load default
107
108
// Optional UserActions: run, event, stepping
109
GammaKnifeRunAction
* pRunAction =
new
GammaKnifeRunAction
();
110
runManager -> SetUserAction(pRunAction);
111
112
// Initialize G4 kernel
113
//
114
runManager->
Initialize
();
115
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
125
if
(argc!=1) {
126
// batch mode
127
G4String
command =
"/control/execute "
;
128
G4String
fileName = argv[1];
129
UImanager->
ApplyCommand
(command+fileName);
130
}
131
else
{
132
// interactive mode : define UI session
133
#ifdef G4UI_USE
134
G4UIExecutive
* ui =
new
G4UIExecutive
(argc, argv);
135
#ifdef G4VIS_USE
136
UImanager->
ApplyCommand
(
"/control/execute defaultMacro.mac"
);
137
#else
138
UImanager->
ApplyCommand
(
"/control/execute batch.mac"
);
139
#endif
140
ui->
SessionStart
();
141
delete
ui;
142
#endif
143
}
144
145
// Job termination
146
#ifdef G4VIS_USE
147
delete
visManager;
148
#endif
149
150
delete
runManager;
151
delete
controller;
152
153
return
0;
154
}
Generated on Sat May 25 2013 14:32:09 for Geant4 by
1.8.4