#######################################################################
#  MACRO FILE NAME: exN03Vis1.mac                                     #
#                                                                     #
#  AUTHOR(S): Satoshi Tanaka                                          #
#                                                                     #
#  DATE:                                                              #
#        Nov      07, 2001                                            #
#        Sept     08-09, 2001 (at Hebden Bridge, UK)                  #
#        June     20, 2001                                            #
#        November 26, 2000                                            #
#        October  17, 2000                                            # 
#        June     06, 2000                                            # 
#        May      20, 2000                                            # 
#        November 10, 1999                                            #
#                                                                     #
#  CONTENTS: A basic macro for visualization of detector geometry     #
#                                                                     #
#  USAGE:  % gmake visclean                                           #
#          % $G4BINDIR/exampleN03                                     #
#          Idle> /control/execute visTutor/exN03Vis1.mac              #
#                                                                     #
#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window, OpenGL,            #
#                                  DAWN (version 3.85 or after)       #
#                                  gv (Ghostview), Tcl/Tk             #
#                                                                     #
#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
#  (See geant4/source/visualization/README for details.)              #
#                                                                     #
#    % setenv OGLHOME     ... (e.g. /usr/X11R6)                       #
#    % setenv G4VIS_BUILD_OPENGLX_DRIVER   1                          # 
#                                                                     #
#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
#  (See geant4/source/visualization/README for details.)              #
#                                                                     #
#    % setenv G4VIS_USE_OPENGLX            1                          #
#                                                                     # 
#  ADDITIONAL NOTES:                                                  #
#    The compound command "/vis/open "               #
#    is equivalent to the following set of commands:                  #
#                                                                     #
#      /vis/sceneHandler/create $1                                    #
#      /vis/viewer/create                                             #
#                                                                     #
#    The compound command "/vis/drawVolume "    #
#    is equivalent to the following set of commands:                  #
#                                                                     #
#      /vis/scene/create                                              #
#      /vis/scene/add/volume $1                                       #
#      /vis/sceneHandler/attach                                       #
#                                                                     #
#######################################################################

###########################################
# Visualization of detector geometry 
#  with the OGLSX (OpenGL Stored X) driver
###########################################

# Invoke the OGLSX driver 
/vis/open OGLSX

# Bird's-eye view of the detector geometry 
#
#  viewpoint  : (theta,phi) = (20*deg, 70*deg), 
#  zoom factor: 0.8 of the full screen size
#
/vis/viewer/reset
/vis/viewer/set/viewpointThetaPhi  20 70
/vis/viewer/zoom               0.8 
/vis/drawVolume

# The following two commands "flush" 
#  the action of the current viewer.
#  They are required for the post-processing drivers 
#  such as DAWNFILE, VRMLFILE, HepRep drivers, etc.
#  For OpenGL drivers, these commands are not required
#  but harmless even if they are described.
/vis/viewer/flush

##########################################################
# Visualization with the DAWNFILE driver
#
#  * Each visualized view is saved to a file "g4_XX.eps"  
#    with the "vectorized" PostScript format.
#
#  * Set an environmental variable if you wish to 
#    skip DAWN GUI:
#     % setenv G4DAWNFILE_VIEWER "dawn -d"
##########################################################

# Invoke the DAWNFILE driver 
/vis/open DAWNFILE

# Bird's-eye view of a detector component (Absorber)
#  viewpoint  : (theta,phi) = (35*deg, 35*deg), 
#  zoom factor: 1.1 of the full screen size
#  coordinate axes:
#     x-axis:red,  y-axis:green,  z-axis:blue
#     origin: (0,0,0),  length: 500
#  Scale: length = 10 cm, Orientation = z, color = red, 
#         placing_algorithm = manual, 
#         center = (-2.5 cm , -5 cm, 0 cm)
#
/vis/viewer/reset
/vis/viewer/zoom               1.1
/vis/viewer/set/viewpointThetaPhi  35 35
/vis/drawVolume           Absorber 
/vis/scene/add/axes      0 0 0 500 mm
/vis/scene/add/text      0 0 0 mm  40 -100 -140   Absorber 
/vis/scene/add/scale     10 cm z 1 0 0 manual -2.5 -5 0  cm

# "Flush the action of all the existing viewers.
#   Note: You should execute these commands, e.g.,  
#         when the current scene is modified.
/vis/scene/notifyHandlers
/vis/viewer/update

# FOR FUTURE UPDATION
#/vis/viewer/flushAll

# Bird's-eye view of a detector component (Gap)
/vis/viewer/reset
/vis/viewer/zoom               1.1
/vis/viewer/set/viewpointThetaPhi  35 35
/vis/drawVolume                Gap 
/vis/scene/add/axes  	  0 0 0 500 mm
/vis/scene/add/text       0 0 0 mm  50 -100 -140   Gap 
/vis/scene/add/scale      10 cm z 1 0 0 manual -2.5 -5  0 cm

# "Flush the action of all the existing viewers.
/vis/scene/notifyHandlers
/vis/viewer/update

# FOR FUTURE UPDATION
#/vis/viewer/flushAll


# Bird's-eye view of the whole detector components (world)
#  * The argument "world" of the command 
#    "/vis/scene/add/volume" is omittable.
#  * "/vis/viewer/set/culling false" makes the invisible 
#    world volume visible.
#    (The invisibility of the world volume is set 
#     in ExN03DetectorConstruction.cc.)
/vis/viewer/reset
/vis/viewer/zoom               1.1
/vis/viewer/set/viewpointThetaPhi  35 35
/vis/viewer/set/culling         global false
/vis/drawVolume 
/vis/scene/add/axes      0 0 0 500 mm
/vis/scene/add/text      0 0 0 mm 50 -100 -240   World
/vis/scene/add/scale     10 cm x 1 0 0 

# "Flush the action of all the existing viewers.
/vis/scene/notifyHandlers
/vis/viewer/update

# FOR FUTURE UPDATION
#/vis/viewer/flushAll


# Make the culling on for next visualization
#  Note: You may also use "/vis/viewer/reset" 
#        for this initialization. 
/vis/viewer/set/culling       global true