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