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