ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
ECCE @ EIC Software
Deprecated List
Modules
Namespaces
Classes
Files
File List
acts
analysis
coresoftware
Doxygen_Assist
ecce-detectors
fun4all_eicdetectors
geant4
tree
geant4-10.6-release
config
environments
g4py
examples
source
boost
digits_hits
event
gdml
geometry
global
graphics_reps
intercoms
interface
materials
particles
physics_lists
processes
run
track
tracking
visualization
__init__.py
colortable.py
g4thread.py
g4viscp.py
hepunit.py
tests
zmq
examples
source
macros
online_distribution
tutorials
doxygen_mainpage.h
File Members
External Links
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
g4viscp.py
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file g4viscp.py
1
"""
2
# ==================================================================
3
# Python module
4
#
5
# Visualization Control Panel
6
#
7
# Q, 2005
8
# ==================================================================
9
"""
10
from
G4interface
import
*
11
12
# ------------------------------------------------------------------
13
# Scene
14
# ------------------------------------------------------------------
15
class
G4Scene
:
16
"Scene"
17
def
__init__
(self, aname, vol= "world", acopyno=0,
18
amode=0, bmode=1):
19
self.
name
= aname
20
self.
volume
= vol
21
self.
copyno
= acopyno
22
self.
mode_eventaction
= amode
# 0: accumulate / 1: refresh
23
self.
mode_runaction
= bmode
# 0: accumulate / 1: refresh
24
self.
mode
= (
"accumulate"
,
"refresh"
)
25
26
def
create_scene
(self):
27
ApplyUICommand(
"/vis/scene/create "
+ self.
name
)
28
ApplyUICommand(
"/vis/scene/add/volume %s %d"
%
29
(self.
volume
, self.
copyno
))
30
ApplyUICommand(
"/vis/scene/add/trajectories"
)
31
self.
update_scene
()
32
33
def
update_scene
(self):
34
ApplyUICommand(
"/vis/scene/select "
+ self.
name
)
35
ApplyUICommand(
"/vis/sceneHandler/attach"
)
36
ApplyUICommand(
"/vis/scene/endOfEventAction %s"
%
37
(self.
mode
[self.
mode_eventaction
]) )
38
ApplyUICommand(
"/vis/scene/endOfRunAction %s"
%
39
(self.
mode
[self.
mode_runaction
]) )
40
41
# ------------------------------------------------------------------
42
# Visualization Control Panel
43
# ------------------------------------------------------------------
44
class
G4VisCP
:
45
"G4 Visualization Control Panel"
46
47
def
__init__
(self, gsys="OGLIX"):
48
self.
gsystem
= gsys
49
self.
scenelist
= [
G4Scene
(
"default"
)]
50
self.
viewpoint
= [270., 90.]
51
52
rc= ApplyUICommand(
"/vis/open "
+ gsys)
53
if
(rc != 0):
54
return
55
56
self.
scenelist
[0].create_scene()
57
ApplyUICommand(
"/vis/viewer/set/viewpointThetaPhi %f %f"
58
% (self.
viewpoint
[0], self.
viewpoint
[1]) )
59
ApplyUICommand(
"/tracking/storeTrajectory 1"
)
60
61
def
add_scene
(self, ascene):
62
self.scenelist.append(ascene)
63
64
def
select_scene
(self, iscene):
65
self.
scenelist
[iscene].update_scene()
66
ApplyUICommand(
"/vis/viewer/set/viewpointThetaPhi %f %f"
67
% (self.
viewpoint
[0], self.
viewpoint
[1]) )
68
geant4
tree
geant4-10.6-release
environments
g4py
source
g4viscp.py
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:52
using
1.8.2 with
ECCE GitHub integration