12.07.2015 Views

Geant4 User's Guide for Application Developers - Geant4 - CERN

Geant4 User's Guide for Application Developers - Geant4 - CERN

Geant4 User's Guide for Application Developers - Geant4 - CERN

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

VisualizationExample 8.1. Part of a sample .cshrc setup file <strong>for</strong> the Linux plat<strong>for</strong>m.############################################################# Main Environment Variables <strong>for</strong> GEANT4 with Visualization ################################################################ Plat<strong>for</strong>msetenv G4SYSTEM Linux-g++### CLHEP base directorysetenv CLHEP_BASE_DIR /opt/local### OpenGL base directorysetenv OGLHOME /usr/X11R6### G4VIS_BUILD### Incorporation of OpenGL-Xlib and OpenGL-Motif drivers### into <strong>Geant4</strong> libraries.setenv G4VIS_BUILD_OPENGLX_DRIVER 1setenv G4VIS_BUILD_OPENGLXM_DRIVER 1### G4VIS_USE### Incorporation of OpenGL-Xlib and OpenGL-Motif drivers### into <strong>Geant4</strong> executables.setenv G4VIS_USE_OPENGLX 1setenv G4VIS_USE_OPENGLXM 1### Viewer <strong>for</strong> DAWNFILE driver### Default value is "dawn". You can change it to, say,### "david" <strong>for</strong> volume overlapping tests# setenv G4DAWNFILE_VIEWER david### Viewer <strong>for</strong> VRMLFILE driverssetenv G4VRMLFILE_VIEWER vrmlview########## end8.2.4. Visualization ManagerVisualization procedures are controlled by the "Visualization Manager", a class which must inherit fromG4VisManager defined in the visualization category. Most users will find that they can just use the default visualizationmanager, G4VisExecutive. The Visualization Manager accepts users' requests <strong>for</strong> visualization, processesthem, and passes the processed requirements to the abstract interface, i.e., to the currently selected visualizationdriver.8.2.5. How to Write the main() FunctionIn order <strong>for</strong> your <strong>Geant4</strong> executable to per<strong>for</strong>m visualization, you must instantiate and initialize "your" VisualizationManager in the main() function. The core of the Visualization Manager is the class G4VisManager,defined in the visualization category. This class requires that one pure virtual function be implemented, namely,void RegisterGraphicsSystems(). The easiest way to do this is to use G4VisExecutive, as describedabove (but you may write your own class - see above).Example 8.2 shows the <strong>for</strong>m of the main() function.219

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!