Geant4 Usage at CERN

Location of Releases
At CERN  Geant4 installations are located in the CVMFS directories of the  Geant4 project under:

We provide libraries and source code for releases and patch releases. Reference versions are also available without support and without full source code. For release 10.5 and centos7 compiled using gcc63 we have two versions:

And similarly named directories for slc6, and/or other compiler versions. We currently build versions for sequential and multithreading, as marked by the extension -MT, code is optimised, yet debug information is kept. Users have to choose the correct OS  and use a compatible compiler to compile user code. For each architecture the are setup scripts for use with either CMake or GNUmake, CMake-setup or GNUmake-setup. These scripts set all required environment variables used to run an application based on libraries provided, including those for required datasets.

Geant4 data sets are available from


Scripts to Set-up Environment
In each version available, there are scripts to set up the environment to use.  For example, to use Geant4 release 10.5  based on on slc6 and gcc 6.3, you can use the following commands depending on the shell you use:

For sh or bash:

source /cvmfs/ #set up compiler
source /cvmfs/ #set up environment for Geant4
export CXX=`which g++` #tell CMake about compiler used
export CC=`which gcc`

For csh or tcsh:

source /cvmfs/ #set up compiler
source /cvmfs/ #set up environment for Geant4
setenv CXX `which g++` #tell CMake about compiler used
setenv CC `which gcc`


Geant4 examples are available as source code in the directories under:


where G4VERSION and ARCHITECTURE stand for the Geant4 version you want to use and for the OS/compiler version. Each example has a README file with specific details and options. To build and execute one of the examples, for example basic B1, set the environment using the recipe above, and then copy the example,  compile and execute:

cp -R /cvmfs/ $HOME # copy example
mkdir $HOME/B1_build # create directory to compile
cd $HOME/B1_build
cmake -DGeant4_DIR=/cvmfs/ $HOME/B1 # create MakeFiles
make # compile/build using make
./exampleB1 # run the example, using as input file