Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
write_gdml.py
Go to the documentation of this file.
1 #!/usr/bin/python3
2 # ==================================================================
3 # An example of writing a GDML file
4 #
5 # ==================================================================
6 from Geant4 import *
7 import g4py.Qmaterials, g4py.Qgeom
8 import g4py.ExN01pl, g4py.ParticleGun
9 
10 # ==================================================================
11 # main
12 # ==================================================================
13 # set geometry
14 g4py.Qmaterials.Construct()
15 g4py.Qgeom.Construct()
16 
17 # minimal physics list
18 g4py.ExN01pl.Construct()
19 
20 # set primary generator action
21 g4py.ParticleGun.Construct()
22 
23 # initialize
24 gRunManager.Initialize()
25 
26 # visualization
27 gApplyUICommand("/vis/open OGLIX")
28 gApplyUICommand("/vis/scene/create")
29 gApplyUICommand("/vis/scene/add/volume")
30 gApplyUICommand("/vis/sceneHandler/attach")
31 gApplyUICommand("/vis/viewer/set/viewpointThetaPhi 90. -90.")
32 
33 # write to a GDML file
34 print("\n*** write to a GDML file...")
35 navigator= gTransportationManager.GetNavigatorForTracking()
36 world_volume= navigator.GetWorldVolume()
37 
38 gdml_parser = G4GDMLParser()
39 gdml_parser.Write("qgeom.gdml", world_volume)
40 
41 
gApplyUICommand
Definition: __init__.py:165
void print(G4double elem)