Geant4
10.03.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
read_gdml.py
Go to the documentation of this file.
1
#!/usr/bin/python
2
# ==================================================================
3
# An example for reading a GDML file
4
#
5
# ==================================================================
6
from
Geant4
import
*
7
import
g4py.ExN01pl, g4py.ParticleGun
8
9
# ==================================================================
10
# user actions in python
11
# ==================================================================
12
class
MyDetectorConstruction
(
G4VUserDetectorConstruction
):
13
"My Detector Construction"
14
15
def
__init__
(self):
16
G4VUserDetectorConstruction.__init__(self)
17
self.
world
=
None
18
self.
gdml_parser
=
G4GDMLParser
()
19
20
# -----------------------------------------------------------------
21
def
__del__
(self):
22
pass
23
24
# -----------------------------------------------------------------
25
def
Construct
(self):
26
self.gdml_parser.Read(
"qgeom.gdml"
)
27
self.
world
= self.gdml_parser.GetWorldVolume()
28
29
return
self.
world
30
31
32
# ==================================================================
33
# main
34
# ==================================================================
35
# set geometry
36
myDC=
MyDetectorConstruction
()
37
gRunManager.SetUserInitialization(myDC)
38
39
# minimal physics list
40
g4py.ExN01pl.Construct()
41
42
# set primary generator action
43
g4py.ParticleGun.Construct()
44
45
# initialize
46
gRunManager.Initialize()
47
48
# visualization
49
gApplyUICommand
(
"/vis/open OGLSX"
)
50
gApplyUICommand
(
"/vis/scene/create"
)
51
gApplyUICommand
(
"/vis/scene/add/volume"
)
52
gApplyUICommand
(
"/vis/sceneHandler/attach"
)
53
gApplyUICommand
(
"/vis/viewer/set/viewpointThetaPhi 90. -90."
)
54
G4VUserDetectorConstruction::Construct
virtual G4VPhysicalVolume * Construct()=0
G4GDMLParser
Definition:
G4GDMLParser.hh:55
read_gdml.MyDetectorConstruction.__init__
def __init__
Definition:
read_gdml.py:15
read_gdml.MyDetectorConstruction.__del__
def __del__
Definition:
read_gdml.py:21
read_gdml.MyDetectorConstruction.world
world
Definition:
read_gdml.py:17
read_gdml.MyDetectorConstruction
Definition:
read_gdml.py:12
G4VUserDetectorConstruction
Definition:
G4VUserDetectorConstruction.hh:50
python.gApplyUICommand
gApplyUICommand
Definition:
__init__.py:165
MyDetectorConstruction
Definition:
MyDetectorConstruction.hh:45
read_gdml.MyDetectorConstruction.gdml_parser
gdml_parser
Definition:
read_gdml.py:18
source
geant4.10.03.p02
environments
g4py
examples
gdml
read_gdml.py
Generated on Tue Nov 28 2017 21:43:06 for Geant4 by
1.8.5