HepRepFile
Note: The HepRepFile visualization driver has been removed from Geant4 since version 11.4.0. I keep its source code from Geant4 11.3.2 here and include the compiled shared library
libG4HepRepFile.soin docker images physino/geant4 for Geant4 11.4.0 and newer versions. For Geant4 11.3.2 and older versions, you can use the driver directly from the Geant4 installation.
The HepRepFile visualization driver is used to generate G4Data*.heprep files, which can be viewed using an external program called HepRApp in wireframe mode, that is, no surface, only outlines, which sounds primitive, but is one of the best ways to troubleshoot a complicated geometry.
Preparing Geometry for HepRApp
The following code snippet shows how to prepare your detector geometry written in simple text for HepRApp.
:volu hall BOX 1*m 1*m 1*m G4_AIR
// without specifying color, HepRepFile won't show the volume, but Qt will
:color hall 0.8 0.9 0.1
// use the following to disable visualization in all drivers, w/o color
:vis hall OFF
The following Geant4 macro can be used to add a 3D coordinate system in HepRApp.
# This command add x,y,z axes (right-handed system) in HepRepFile
# HepRApp Data Browser shows an axis as a hexagonal stick + a tetrahedra arrow
# By default, x is shown in red, y in green, z in blue
/vis/scene/add/axes