1 | ####################################################################### |
---|
2 | # MACRO FILE NAME: exN03Vis14.mac # |
---|
3 | # # |
---|
4 | # AUTHOR(S): Laurent Garnier # |
---|
5 | # # |
---|
6 | # DATE: July 13, 2007 # |
---|
7 | # # |
---|
8 | # CONTENTS: A basic macro for visualization of detector geometry # |
---|
9 | # # |
---|
10 | # USAGE: % gmake visclean # |
---|
11 | # % $G4BINDIR/exampleN03 # |
---|
12 | # Idle> /control/execute visTutor/exN03Vis14.mac # |
---|
13 | # # |
---|
14 | # REQUIRED PLATFORMS & SOFTWARES: Unix, X-window, OpenGL,Qt # |
---|
15 | # DAWN (version 3.85 or after) # |
---|
16 | # gv (Ghostview), Tcl/Tk # |
---|
17 | # # |
---|
18 | # ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION: # |
---|
19 | # (See geant4/source/visualization/README for details.) # |
---|
20 | # # |
---|
21 | # % setenv OGLHOME ... (e.g. /usr/X11R6) # |
---|
22 | # % setenv G4VIS_BUILD_OPENGLQT_DRIVER 1 # |
---|
23 | # # |
---|
24 | # ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION: # |
---|
25 | # (See geant4/source/visualization/README for details.) # |
---|
26 | # # |
---|
27 | # % setenv G4VIS_USE_OPENGLQT 1 # |
---|
28 | # # |
---|
29 | # ADDITIONAL NOTES: # |
---|
30 | # The compound command "/vis/open <vis-driver-name>" # |
---|
31 | # is equivalent to the following set of commands: # |
---|
32 | # # |
---|
33 | # /vis/sceneHandler/create $1 # |
---|
34 | # /vis/viewer/create # |
---|
35 | # # |
---|
36 | # The compound command "/vis/drawVolume <physical-volume-name>" # |
---|
37 | # is equivalent to the following set of commands: # |
---|
38 | # # |
---|
39 | # /vis/scene/create # |
---|
40 | # /vis/scene/add/volume $1 # |
---|
41 | # /vis/sceneHandler/attach # |
---|
42 | # # |
---|
43 | ####################################################################### |
---|
44 | |
---|
45 | ########################################### |
---|
46 | # Visualization of detector geometry |
---|
47 | # with the OGLSQT (OpenGL Stored QT) driver |
---|
48 | ########################################### |
---|
49 | |
---|
50 | # Invoke the OGLSQt driver |
---|
51 | /vis/open OGLSQt |
---|
52 | |
---|
53 | # Bird's-eye view of the detector geometry |
---|
54 | # |
---|
55 | # viewpoint : (theta,phi) = (20*deg, 70*deg), |
---|
56 | # zoom factor: 0.8 of the full screen size |
---|
57 | # |
---|
58 | /vis/viewer/reset |
---|
59 | /vis/viewer/set/viewpointThetaPhi 20 70 |
---|
60 | /vis/viewer/zoom 0.8 |
---|
61 | /vis/drawVolume |
---|
62 | |
---|
63 | # The following two commands "flush" |
---|
64 | # the action of the current viewer. |
---|
65 | # They are required for the post-processing drivers |
---|
66 | # such as DAWNFILE, VRMLFILE, HepRep drivers, etc. |
---|
67 | # For OpenGL drivers, these commands are not required |
---|
68 | # but harmless even if they are described. |
---|
69 | /vis/viewer/flush |
---|
70 | |
---|
71 | ########################################################## |
---|
72 | # Visualization with the DAWNFILE driver |
---|
73 | # |
---|
74 | # * Each visualized view is saved to a file "g4_XX.eps" |
---|
75 | # with the "vectorized" PostScript format. |
---|
76 | # |
---|
77 | # * Set an environmental variable if you wish to |
---|
78 | # skip DAWN GUI: |
---|
79 | # % setenv G4DAWNFILE_VIEWER "dawn -d" |
---|
80 | ########################################################## |
---|
81 | |
---|
82 | # Invoke the DAWNFILE driver |
---|
83 | /vis/open DAWNFILE |
---|
84 | |
---|
85 | # Bird's-eye view of a detector component (Absorber) |
---|
86 | # viewpoint : (theta,phi) = (35*deg, 35*deg), |
---|
87 | # zoom factor: 1.1 of the full screen size |
---|
88 | # coordinate axes: |
---|
89 | # x-axis:red, y-axis:green, z-axis:blue |
---|
90 | # origin: (0,0,0), length: 500 |
---|
91 | # Scale: length = 10 cm, Orientation = z, color = red, |
---|
92 | # placing_algorithm = manual, |
---|
93 | # center = (-2.5 cm , -5 cm, 0 cm) |
---|
94 | # |
---|
95 | /vis/viewer/reset |
---|
96 | /vis/viewer/zoom 1.1 |
---|
97 | /vis/viewer/set/viewpointThetaPhi 35 35 |
---|
98 | /vis/drawVolume Absorber |
---|
99 | /vis/scene/add/axes 0 0 0 500 mm |
---|
100 | /vis/scene/add/text 0 0 0 mm 40 -100 -140 Absorber |
---|
101 | /vis/scene/add/scale 10 cm z 1 0 0 manual -2.5 -5 0 cm |
---|
102 | |
---|
103 | # "Flush the action of all the existing viewers. |
---|
104 | # Note: You should execute these commands, e.g., |
---|
105 | # when the current scene is modified. |
---|
106 | /vis/scene/notifyHandlers |
---|
107 | /vis/viewer/update |
---|
108 | |
---|
109 | # FOR FUTURE UPDATION |
---|
110 | #/vis/viewer/flushAll |
---|
111 | |
---|
112 | # Bird's-eye view of a detector component (Gap) |
---|
113 | /vis/viewer/reset |
---|
114 | /vis/viewer/zoom 1.1 |
---|
115 | /vis/viewer/set/viewpointThetaPhi 35 35 |
---|
116 | /vis/drawVolume Gap |
---|
117 | /vis/scene/add/axes 0 0 0 500 mm |
---|
118 | /vis/scene/add/text 0 0 0 mm 50 -100 -140 Gap |
---|
119 | /vis/scene/add/scale 10 cm z 1 0 0 manual -2.5 -5 0 cm |
---|
120 | |
---|
121 | # "Flush the action of all the existing viewers. |
---|
122 | /vis/scene/notifyHandlers |
---|
123 | /vis/viewer/update |
---|
124 | |
---|
125 | # FOR FUTURE UPDATION |
---|
126 | #/vis/viewer/flushAll |
---|
127 | |
---|
128 | |
---|
129 | # Bird's-eye view of the whole detector components (world) |
---|
130 | # * The argument "world" of the command |
---|
131 | # "/vis/scene/add/volume" is omittable. |
---|
132 | # * "/vis/viewer/set/culling false" makes the invisible |
---|
133 | # world volume visible. |
---|
134 | # (The invisibility of the world volume is set |
---|
135 | # in ExN03DetectorConstruction.cc.) |
---|
136 | /vis/viewer/reset |
---|
137 | /vis/viewer/zoom 1.1 |
---|
138 | /vis/viewer/set/viewpointThetaPhi 35 35 |
---|
139 | /vis/viewer/set/culling global false |
---|
140 | /vis/drawVolume |
---|
141 | /vis/scene/add/axes 0 0 0 500 mm |
---|
142 | /vis/scene/add/text 0 0 0 mm 50 -100 -240 World |
---|
143 | /vis/scene/add/scale 10 cm x 1 0 0 |
---|
144 | |
---|
145 | # "Flush the action of all the existing viewers. |
---|
146 | /vis/scene/notifyHandlers |
---|
147 | /vis/viewer/update |
---|
148 | |
---|
149 | # FOR FUTURE UPDATION |
---|
150 | #/vis/viewer/flushAll |
---|
151 | |
---|
152 | |
---|
153 | # Make the culling on for next visualization |
---|
154 | # Note: You may also use "/vis/viewer/reset" |
---|
155 | # for this initialization. |
---|
156 | /vis/viewer/set/culling global true |
---|