Workshop on Geant4 at Roma Tre, Department of Matematic and Physic

Wednesday 13th and Friday 15th June 2018, Aula 57 16:00 - 18:00


Useful links


How to download, compile and run the Geant4 example

Once you have installed Geant4, in a working dir you can download and compile the source code:

git clone 
mkdir anaEx01build
cd anaEx01build
cmake -DGeant4_DIR=G4INSTALLDIR ../AnaEx01

Using the farm at Roma Tre

On the CentOS7 machine
you can find all the software in the directory:
to add the executables to your path and sett all the environmental variables:
source /storage/DATA-05/gridrm3/Geant4/soft/
More information about the cluster

Suggestions on how to install Geant4

tar -xvzf geant4.10.04.p02.tar.gz

this will create geant4.10.04.p02/

mkdir geant4.10.04.p02-build
mkdir geant4.10.04.p02-install
mkdir geant4-data
cd geant4.10.04.p02-build
make -j `nproc`
make install

Add to your .bashrc (~/.bash_profile on a Mac):

export G4DIR=~/geant4.10.04.p02-install

. $G4DIR/bin/

alias g4make='cmake -DGeant4_DIR=$G4DIR'

Prerequisites and suggested packages to compile Geant4 on Debian/Ubuntu:

sudo apt update
sudo apt install build-essential git cmake qt4-default 
qt4-dev-tools libxerces-c-dev

Prerequisites and suggested packages to compile Geant4 on CentOS7:

sudo yum update
sudo yum groupinstall “Development Tools”
sudo yum install xerces-c xerces-c-devel
sudo yum install centos-release-scl-rh
sudo yum install qt qt-x11 qt-devel
sudo yum install emacs
sudo yum install python27 python27-pyhton-pip python27-pyhton-tools python27-numpy 

Add to your ~/.barshrc the line:

. /opt/rh/python27/enable

Suggestions on how to compile CMake on CentOS7

The CMake version available in the CentOS7 repositories is too old to work with Geant4 and ROOT, to install the last stable version:

tar -xvzf cmake-3.11.3.tar.gz
cd cmake-3.11.3/
 ./bootstrap && gmake

Add to ~/.bashrc the line:

export PATH=/home/soft/cmake-3.11.3/bin:$PATH

Prerequisites to compile Geant4 on MacOS:

Install XCode ( and type in a terminal:

xcode-select —install

install XQuartz (

install brew ( and the required libraries:

/usr/bin/ruby -e "$(curl -fsSL"
brew doctor
brew update
brew install cmake xerces-c wget
As some students had problems in installing the Qt from the official brew repository, I prepared a brew receipe to install it. To use it:
brew install carlomt/repo/qt@4

Suggestions on how to compile ROOT

tar -xvzf root_v6.12.06.source.tar.gz
mkdir root-6.12.06-build
mkdir root-6.12.06-install
cd root-6.12.06-build/
cmake  -DCMAKE_INSTALL_PREFIX="../root-6.12.06-install" -Dgdml="ON" -Dgeocad="ON" -Dlibcxx="ON" -Dmathmore="ON" -Dminuit2="ON" -Dpython="ON" -Droofit="ON" -Dtmva="ON" ../root-6.12.06 
make -j `nproc`
make install