Geant4 Guide

Geant4 is under /sw/geant4. For example, folder /sw/geant4/10.02p01_gcc48-MT is version 10.02p01 build with gcc4.8 with multi-threading support. /sw/geant4/10.02p01_gcc48 is the same version of geant4 without multi-threading.

Build an example

You can find examples in the gean4 source tree.

If you are using 10.02p01, the examples can be found in /sw/geant4/10.02p01_gcc48/share/Geant4-10.2.1/examples/.

To build the example basic/B4:

  1. Load the environment variables:

    $ source /sw/geant4/10.02p01_gcc48/bin/geant4.sh
    
  2. Create the build directory for the example. It can be created anywhere you have write permission:

    $ mkdir B4-build
    

The name of the directory is arbitrary.

  1. Invoke cmake to create the Makefile:

    $ cd B4-build
    $ cmake /sw/geant4/10.02p01_gcc48/share/Geant4-10.2.1/examples/basic/B4
    
  2. Build the example:

    $ make
    
  3. The compiled programs are under directory B4a, B4b, B4c, and B4d.

You can also read the document at https://geant4.web.cern.ch/support for more help.