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

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

Slides

Useful links

Examples:

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 https://github.com/carlomt/AnaEx01.git 
mkdir anaEx01build
cd anaEx01build
cmake -DGeant4_DIR=G4INSTALLDIR ../AnaEx01
make

Using the farm at Roma Tre

On the CentOS7 machine

ui7-01.roma3.infn.it
you can find all the software in the directory:
/storage/DATA-05/gridrm3/Geant4/soft/
to add the executables to your path and sett all the environmental variables:
source /storage/DATA-05/gridrm3/Geant4/soft/setup.sh
More information about the cluster

Suggestions on how to install Geant4

wget http://cern.ch/geant4-data/releases/geant4.10.04.p02.tar.gz
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
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DGEANT4_INSTALL_DATA=ON -DGEANT4_INSTALL_DATADIR=../geant4-data  -DGEANT4_BUILD_MULTITHREADED=ON -DGEANT4_USE_GDML=ON -DGEANT4_USE_QT=ON -DGEANT4_BUILD_CXXSTD=c++11 -DCMAKE_INSTALL_PREFIX=../geant4.10.04.p02-install ../geant4.10.04.p02
make -j `nproc`
make install

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


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

. $G4DIR/bin/geant4.sh

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:

wget https://cmake.org/files/v3.11/cmake-3.11.3.tar.gz
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 (https://developer.apple.com/xcode/) and type in a terminal:


xcode-select —install

install XQuartz (https://www.xquartz.org/)

install brew (https://brew.sh/) and the required libraries:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
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

wget https://root.cern.ch/download/root_v6.12.06.source.tar.gz
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