Geant4
10.03.p03
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
g4viscp.py
Go to the documentation of this file.
1
#$Id: g4viscp.py 66892 2013-01-17 10:57:59Z gunter $
2
"""
3
# ==================================================================
4
# Python module
5
#
6
# Visualization Control Panel
7
#
8
# Q, 2005
9
# ==================================================================
10
"""
11
from
G4interface
import
*
12
13
# ------------------------------------------------------------------
14
# Scene
15
# ------------------------------------------------------------------
16
class
G4Scene
:
17
"Scene"
18
def
__init__
(self, aname, vol= "world", acopyno=0,
19
amode=0, bmode=1):
20
self.
name
= aname
21
self.
volume
= vol
22
self.
copyno
= acopyno
23
self.
mode_eventaction
= amode
# 0: accumulate / 1: refresh
24
self.
mode_runaction
= bmode
# 0: accumulate / 1: refresh
25
self.
mode
= (
"accumulate"
,
"refresh"
)
26
27
def
create_scene
(self):
28
ApplyUICommand(
"/vis/scene/create "
+ self.
name
)
29
ApplyUICommand(
"/vis/scene/add/volume %s %d"
%
30
(self.
volume
, self.
copyno
))
31
ApplyUICommand(
"/vis/scene/add/trajectories"
)
32
self.
update_scene
()
33
34
def
update_scene
(self):
35
ApplyUICommand(
"/vis/scene/select "
+ self.
name
)
36
ApplyUICommand(
"/vis/sceneHandler/attach"
)
37
ApplyUICommand(
"/vis/scene/endOfEventAction %s"
%
38
(self.
mode
[self.
mode_eventaction
]) )
39
ApplyUICommand(
"/vis/scene/endOfRunAction %s"
%
40
(self.
mode
[self.
mode_runaction
]) )
41
42
# ------------------------------------------------------------------
43
# Visualization Control Panel
44
# ------------------------------------------------------------------
45
class
G4VisCP
:
46
"G4 Visualization Control Panel"
47
48
def
__init__
(self, gsys="OGLIX"):
49
self.
gsystem
= gsys
50
self.
scenelist
= [
G4Scene
(
"default"
)]
51
self.
viewpoint
= [270., 90.]
52
53
rc= ApplyUICommand(
"/vis/open "
+ gsys)
54
if
(rc != 0):
55
return
56
57
self.
scenelist
[0].create_scene()
58
ApplyUICommand(
"/vis/viewer/set/viewpointThetaPhi %f %f"
59
% (self.
viewpoint
[0], self.
viewpoint
[1]) )
60
ApplyUICommand(
"/tracking/storeTrajectory 1"
)
61
62
def
add_scene
(self, ascene):
63
self.scenelist.append(ascene)
64
65
def
select_scene
(self, iscene):
66
self.
scenelist
[iscene].update_scene()
67
ApplyUICommand(
"/vis/viewer/set/viewpointThetaPhi %f %f"
68
% (self.
viewpoint
[0], self.
viewpoint
[1]) )
69
python3.g4viscp.G4Scene
Definition:
g4viscp.py:16
python3.g4viscp.G4Scene.name
name
Definition:
g4viscp.py:20
python3.g4viscp.G4Scene.mode_runaction
mode_runaction
Definition:
g4viscp.py:24
python3.g4viscp.G4Scene.copyno
copyno
Definition:
g4viscp.py:22
python3.g4viscp.G4Scene.create_scene
def create_scene
Definition:
g4viscp.py:27
python3.g4viscp.G4Scene.update_scene
def update_scene
Definition:
g4viscp.py:34
python3.g4viscp.G4VisCP.viewpoint
viewpoint
Definition:
g4viscp.py:51
python3.g4viscp.G4VisCP.__init__
def __init__
Definition:
g4viscp.py:48
python3.g4viscp.G4VisCP.gsystem
gsystem
Definition:
g4viscp.py:49
python3.g4viscp.G4VisCP.select_scene
def select_scene
Definition:
g4viscp.py:65
python3.g4viscp.G4Scene.__init__
def __init__
Definition:
g4viscp.py:19
python3.g4viscp.G4VisCP.scenelist
scenelist
Definition:
g4viscp.py:50
python3.g4viscp.G4Scene.volume
volume
Definition:
g4viscp.py:21
python3.g4viscp.G4Scene.mode_eventaction
mode_eventaction
Definition:
g4viscp.py:23
python3.g4viscp.G4VisCP.add_scene
def add_scene
Definition:
g4viscp.py:62
python3.g4viscp.G4VisCP
Definition:
g4viscp.py:45
python3.g4viscp.G4Scene.mode
mode
Definition:
g4viscp.py:25
source
geant4.10.03.p03
environments
g4py
source
python3
g4viscp.py
Generated on Tue Nov 28 2017 21:43:42 for Geant4 by
1.8.5