Geant4.10
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4.10.00.p01
environments
g4py
examples
gdml
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 OGLIX"
)
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:54
read_gdml.MyDetectorConstruction.__init__
def __init__
Definition:
python3/read_gdml.py:15
read_gdml.MyDetectorConstruction.__del__
def __del__
Definition:
python3/read_gdml.py:21
read_gdml.MyDetectorConstruction.world
world
Definition:
python3/read_gdml.py:17
read_gdml.MyDetectorConstruction
Definition:
python3/read_gdml.py:12
G4VUserDetectorConstruction
Definition:
G4VUserDetectorConstruction.hh:50
python.gApplyUICommand
gApplyUICommand
Definition:
source/python/__init__.py:168
MyDetectorConstruction
Definition:
MyDetectorConstruction.hh:45
read_gdml.MyDetectorConstruction.gdml_parser
gdml_parser
Definition:
python3/read_gdml.py:18
Generated on Wed Apr 30 2014 15:55:28 for Geant4.10 by
1.8.7