Geant4_10
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 # ==================================================================
13  "My Detector Construction"
14 
15  def __init__(self):
16  G4VUserDetectorConstruction.__init__(self)
17  self.world= None
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
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 
virtual G4VPhysicalVolume * Construct()=0
gApplyUICommand
Definition: __init__.py:168