Download Geant4 User's Guide for Application Developers
Transcript
Getting Started with Geant4 - Running a Simple Example # # Set some default verbose # /control/verbose 2 /control/saveHistory /run/verbose 2 # # Visualization setting /control/execute vis.mac The vis.mac macro defines a minimal setting for drawing volumes and trajectories accumulated for all events of a given run: # Macro file for the visualization setting in the initialization phase # of the B1 example when running in interactive mode # # # Use this open statement to create an OpenGL view: /vis/open OGL 600x600-0+0 # # Draw geometry: /vis/drawVolume # # Specify view angle: /vis/viewer/set/viewpointThetaPhi 90. 180. # # Draw smooth trajectories at end of event, showing trajectory points # as markers 2 pixels wide: /vis/scene/add/trajectories smooth # # To superimpose all of the events from a given run: /vis/scene/endOfEventAction accumulate # # Re-establish auto refreshing and verbosity: /vis/viewer/set/autoRefresh true /vis/verbose warnings # # For file-based drivers, use this to create an empty detector view: #/vis/viewer/flush Also, this example demonstrates that you can read and execute a macro from another macro or interactively: Idle> /control/execute mySubMacro.mac 2.11. How to Visualize the Detector and Events 2.11.1. Introduction This section briefly explains how to perform Geant4 Visualization. The description here is based on the sample program examples/basic/B1. More details are given in Chapter 8 "Visualization". 2.11.2. Visualization Drivers The Geant4 visualization system was developed in response to a diverse set of requirements: 1. 2. 3. 4. 5. Quick response to study geometries, trajectories and hits High-quality output for publications Flexible camera control to debug complex geometries Tools to show volume overlap errors in detector geometries Interactive picking to get more information on visualized objects No one graphics system is ideal for all of these requirements, and many of the large software frameworks into which Geant4 has been incorporated already have their own visualization systems, so Geant4 visualization was designed around an abstract interface that supports a diverse family of graphics systems. Some of these graphics systems use a graphics library compiled with Geant4, such as OpenGL, Qt or OpenInventor, while others involve a separate application, such as HepRApp or DAWN. 53