View on GitHub

Geant4 Zero to Hero

The Definitive Guide for End Users

Docker image Apptainer image YouTube Visualization

The HepRepFile visualization driver is available in any Geant4 installation. It can be used to generate G4Data*.heprep files, which can be viewed using an external program called HepRApp Data Browser in wireframe mode, that is, no surface, only outlines, which sounds primitive, but is one of the best ways to troubleshoot a complicated geometry.

Unfortunately, HepRApp only runs on java version 1.8 (or 8 in short). To use it, you may need to install two versions of java and switch to the older one if needed. This can be done, but the detailed procedure changes with the OS. In case of Windows, simply download java 8 from https://www.java.com/en/download. In case of modern MacOS or Linux distributions, there is no tested working procedure. A Docker image https://hub.docker.com/r/physino/heprapp is create to solve this problem. It can be used in the following way:

  1. download and run Docker Desktop
  2. for Mac and Windows users: run an X11 server (XQuartz for Mac, MobaXterm for Windows)
  3. for Mac and Linux users: run xhost + in a terminal
  4. save compose.yml in a folder that contains the G4Data*.heprep file that you want to view, in that folder, run
docker compose run --rm heprapp

The HepRApp Data Browser should pop up on your desktop.

Visualization in HepRApp Data Browser

: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
# This command add x,y,z axes (right-handed system) in HepRepFile
# HepRApp Data Browser shows an axis as a hexagonal stick + a tetrahedra
# By default, x is shown in red, y in green, z in blue
/vis/scene/add/axes

Views in HepRApp Data Browser

# all /vis/viewer/set commands have NO effort in HepRApp Data Browser
# but they do work in Qt
/vis/viewer/set/upVector 0 1 0 # y points up
/vis/viewer/set/viewpointVector 0 0 1 # view against z (beam view)
/vis/viewer/set/background 0 0.17 0.21 # solarized color: base03