Geant4 provides several visualization mechanisms. These are controlled by the artg4Main module paramaters and a vis.mac Geant macro file.

To turn on visualization, you set the following parameters for the artg4Main module. For example,

physics: {
  producers: {
    artg4 : { 
     module_type: artg4Main
     enableVisualization: true
     macroPath: ".:./macros:../macros:../../macros" 
     visMacro: "vis.mac" 
     visualizeSpecificEvents: true
     eventsToDisplay: [1, 4]
     afterEvent: pause  // (ui, pause, pass)


Be sure to set enableVisualization to true if you want visualization. You must specify the search paths and name of the visualization macro.

macroPath and visMacro

If visualization is enabled, you must specify a search path so that the program can find your visualization macro, as well as giving the name of the macro you want to use. Make sure that /run/beamOn isn't in there as a holdover from g2MIGTRACE, as artg4 now controls the Geant4 event loop. An example macro is in gm2ringsim in macros/vis.mac.

The sample visualization macro mentioned above has several options for visualization output. The two that seem to be the best are OpenGL and HepRApp. OpenGL visualization appears in real time when Geant is run (so you can't do this on Fermigrid). HepRapp writes data to visualization files that you can look at after the job is finished with the HepRapp application (download from to your laptop, copy the visualization files there and run it).

Note that are simulation events have geometry significantly complicated that visualization is very slow. Furthermore, if you run HepRApp, you must tell it to increase its memory footprint. For example, do the following

java -jar -mx1000M ~/Downloads/HepRApp.jar


This parameter makes it possible to pause the visualization only after certain events of interest. If it is true, you must specify events to display.


eventsToDisplay is a list (not necessarily in any order) of events of interest. The visualization (if enabled by enableVisualization) will pass, pause, or give you a UI (as specified in afterEvent) only after events in this list. It will still bring up visualizations for the others, but will pass through them rather than forcing you to hit enter after each one.


The afterEvent parameter specifies what to do at the end of each event in order for you to view the visualization (needed for the real-time OpenGL back end). pass says not to stop to vievw. pause asks for the user to press enter to proceed to the next event. ui gives you an interactive Geant prompt that allows you to manipulate the image in real time (only works for the OpenGL backend). Type exit to proceed to the next event.