View on GitHub

Geant4 Zero to Hero

The Definitive Guide for End Users

UI

Geant4 Macro Commands

Geant4 provides many built-in commands for users to control their simulation. They can be executed one by one through various Geant4 UI, or grouped in a file, called macro, to be executed as a bundle.

The usage of these commands can be found online here, or generated locally using the macro file, generateManuals.mac:

gears generateManuals.mac

assuming that GEARS (or any Geant4 example is available in your system. The command generates a list of macro commands in HTML format in a sub-folder cmds/, as well as built-in colors, materials, particles, processes and units.

NOTE generateManuals.mac uses some commands that are only available on Linux/WSL/Mac. If you are on Windows, the generated HTML files will stay in the current folder. Lists of colors, materials, particles, processes and units can be printed out using the following commands:

gears listColors.mac
gears listMaterials.mac
gears listParticles.mac
gears listProcesses.mac
gears listUnits.mac

All macro files can be found on https://github.com/jintonic/geant4/tree/main/UI/macro.

Another way for Windows users to list useful information is to use a GUI menu defined in gui.mac, which is called by generateManuals.mac. Simply run gears in this folder and open generateManuals.mac through the GUI and you should be able to see some more menus showing up in the GUI. Select one of them to see the output on the GUI.