GEANT4 Introduction

This section aims to provide an informal documented account covering installation and initial usage of the GEANT4 software package and a simple example, including source code.

GEANT4 is a software package owned and maintained by The GEANT4 Collaboration and remains open source. It's purpose is to used Monte Carlo Methods to simulate the passage of particle through matter. It's results can be interpreted through a GUI, direct from the terminal or plotted graphically via the ROOT package.


The source code for GEANT4 can be freely downloaded from the GEANT4 website linked GEANT4 Downloads. Once the download completes, the contents will needed to be extracted from the downloaded zip file to another directory. Once extracted, you should be left with a geant4 directory named something like 'geant4.x.x.x.x', detailing your version number. Next move into this directory.

It's worth noting, the GEANT4 project is a CMAKE project and will require other packages to be installed prior to compiling the source code. These are:

Once these packages are installed, ensure you're in the directory titled 'geant4.x.x.x.x' and create another directory called 'build'. After moving into the build directory, launch the ccmake gui using the command 'ccmake ..', which should launch the ccmake interface and enable you to specify the installation details.

Once launched, press 'c' to begin the configuration, provided there's no errors, ignore the initial warning. From there, specify the following details:

Then, once these details are confirmed, configure your setup by pressing 'c', then generate your install by pressing 'g'. Once this process is complete, you should be able to check the contents of the 'build' directory and see the required elements to begin your installation. Finally, to begin your installation, enter 'make' from inside the 'build' directory to begin. This process make take some time. It may also download some additional software packages so ensure you have a reliable internet connection throughout. Once the 'make' process is complete, enter the 'make install' command to complete the installation.

Once the installation is complete, you should find a new directory under the top level geant4 folder with a naming convention matching 'geant4.x.x.x.x-install'. This provides a single folder in which your installation is held, and can be removed if required to re-install at any point. Finally, to actually use GEANT4, there's a file generate within this Geant4 folder that will need to be referenced, this can be achieved with the following command '. ~/software/geant4/geant.x.x.x.x-ST-install/share/Geant4/geant4make/'.

With these steps completed you should have a working version of Geant4 that you can use to test examples and build your own detectors and colliders. Other pages on this site will demonstrate how to compile and build the Geant4 pre-set examples and provide a demo on how to build a detector from scratch.