#######################################################################
#  MACRO FILE NAME: exN03Vis0.mac                                     #
#                                                                     #
#  AUTHOR(S): Satoshi Tanaka                                          #
#                                                                     #
#  DATE: November 10, 1999                                            #
#                                                                     #
#  CONTENTS: A simplest macro to demonstrate visualization of         #
#            detector geometry and events                             #
#                                                                     #
#  USAGE:  % $G4BINDIR/exampleN03  exN03Vis0.mac                      #
#                                                                     #
#  REQUIRED PLATFORMS & SOFTWARES: Unix, X-window, OpenGL,            #
#                                  DAWN (version 3.80 of after)       #
#                                  Ghostview, Tcl/Tk                  #
#                                                                     #
#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION:               #
#  (See geant4/source/visualization/README for details.)              #
#                                                                     #
#    % setenv OGLHOME     ... (e.g. /usr/local)                       #
#    % setenv G4VIS_BUILD_OPENGLX_DRIVER   1                          # 
#    % setenv G4VIS_BUILD_DAWNFILE_DRIVER  1                          #
#                                                                     #
#  ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION:                #
#  (See geant4/source/visualization/README for details.)              #
#                                                                     #
#    % setenv G4VIS_USE_OPENGLX            1                          #
#    % setenv G4VIS_USE_DAWNFILE           1                          #
#                                                                     #
#  Addional Notes:                                                    #
#                                                                     #
#######################################################################

#####################################
# Visualization of detector geometry 
#  with the OGLSX driver
#####################################

# Create "scene-0" 
/vis/scene/create

# Invoke the OGLIX driver
/vis/sceneHandler/create OGLIX
/vis/viewer/create

# Add volume to scene-0
/vis/scene/add/volume

# Set camera parameters
/vis/camera/reset 
/vis/camera/viewpoint 70 20

# Visualize detector geometry
#  * Command /vis/viewer/update is omittable in the OpenGL drivers,
#    but it is harmless to execute it.
/vis/scene/notifyHandlers
/vis/viewer/update

#########################################################
# Visualization of events with the DAWNFILE driver
#
#  * The visualized view is saved to a file "g4.eps"  
#    with the "vectorized" PostScript format.
#
#  * In order to make the file "g4.eps" printable, 
#    append the "showpage" PostScript command to the file. 
#    You can do it with the 4th page of the DAWN GUI panel 
#    or by editing the file by hand.
#
#  * Set as follows to skip DAWN GUI.
#    % setenv G4DAWNFILE_VIEWER "dawn -d"
##########################################################

# Create "scene-1" 
/vis/scene/create

# Invoke the DAWNFILE driver
/vis/sceneHandler/create DAWNFILE
/vis/viewer/create

# Add volume to scene-1
/vis/scene/add/volume

# Set camera parameters
/vis/camera/reset 
/vis/camera/zoom      1.2
/vis/camera/viewpoint 20 70

# Visualize one event
# * Command "/vis/scene/notifyHandlers" is written in 
#   ExN03RunAction::BeginOfRunAction()
# * Command "/vis/viewer/update" is written in 
#   ExN03RunAction::EndOfRunAction()
/tracking/storeTrajectory 1
/run/beamOn 10
