View on GitHub

Geant4 Zero to Hero

The Definitive Guide for End Users

Home Analysis Jupyter Docker

ROOT for Geant4 Data Analysis

ROOT is NOT needed to compile or run Geant4. It is not even needed for the analysis of Geant4 output files. Instead, one can use uproot to read a ROOT file using Python or Julia. However, it is very convenient to analyze Geant4 output data in a ROOT interactive session using TTree::Draw. The compilation of ROOT takes a long time. However, installation of pre-compiled ROOT libraries is very easy.

Install Pre-compiled ROOT on Windows

Install Pre-compiled ROOT on MacOS

Homebrew includes a ROOT formula. The easiest way to install ROOT is to run

brew install root

assuming that you already have Homebrew and Xcode installed already.

Install Pre-compiled ROOT on Linux

Please refer to https://root.cern/install/ for detailed instruction. If you use Debian, Ubuntu, or Mint Linux, please watch the following tutorial.

Docker Images

Another way to obtain ROOT is to use a Docker container that has ROOT pre-installed in it. Official ROOT Docker images on https://hub.docker.com/r/rootproject/root only work on linux/amd64 architecture. Dockerfile in this folder is used to create physino/root:latest for multiple architectures, including linux/arm64 for Apple Silicon chips. The usage of these images can be found on https://hub.docker.com/r/physino/root.

For Image Creators

The procedure of creating multi-architecture images is described in detail on https://docs.docker.com/build/building/multi-platform/. The key is to create a customized builder and use it to build and push multiple images together:

# list default builder
docker buildx ls
# create a new builder
docker buildx create --name mybuilder --driver docker-container --bootstrap
# use the new builder
docker buildx use mybuilder
# inspect the new builder
docker buildx inspect
# list all builders again as well as architectures supported
docker buildx ls
# create multiple images
cd /path/to/this/folder
docker build --platform linux/amd64,linux/arm64 -t physino/root:latest --push .

The Dockerfile in this folder uses fedora:latest as its base, which is a rather modern Linux distribution that has ROOT in its package repository.