It is assumed that each of the students bring their own laptop with
Geant4 and ROOT installed.
These tools are necessary in order to perform the analysis of the
data obtained during the practices and so to prepare the reports.
Windows
If you use windows it is a bit complicated, the best way to work is install the Linux Kernel in
windows (Ubuntu 20.04) and use a display manager (VcXsrv). Please DON’T use the ROOT or
Geant4 version for windows.
1) Write in Windows browser “Turn Windows features on or off” and mark: Hyper-V,
Virtual machine platform, Windows Subsystem for Linux. Then click ok and let it
install and reboot after.
2) Follow this link https://learn.microsoft.com/en-us/windows/wsl/install-manual and
jump to step 4, download the WSL2 kernel update package and install it.
3) Open the Microsoft Store and find Ubuntu 20.04 LTS, install it.
4) Open Ubuntu “app” and it will ask you for username and pass (if everything is ok).
5) To update all write: sudo apt update && sudo apt upgrade -y
6) Then try to install kate: sudo apt install kate-y
Now we have to install X server for windows, that let us use programs that have
graphical interface.
1) Download and install VcXsrv: https://sourceforge.net/projects/vcxsrv/
2) Close Ubuntu (if you didn’t before) and open VcXsrv.
3) 1st window click next, 2nd window click next, 3rd window add the tick mark to
“Disable access control” and click next, then finish (you can save the config if you
want).
4) X Server will stay opened in your task bar, now open Ubuntu and write “kate”, if the
graphical interface of the text editor pop-out… Succeed!!
5) Now install ROOT and Geant4 following the steps detailed in Linux section
respectively.
How to install ROOT
Reference: https://root.cern/install/
Recommended release: 6.26/06
MacOS
By far, the best way to install ROOT on yor MacOS is using Homebrew package manager:
1) Install Homebrew, just paste the command that you can find in the web
(https://brew.sh/) into a macOS terminal.
2) Then write: brew install root. (https://formulae.brew.sh/formula/root#default)
3) To check your installation type: root, in your terminal.
4) Then try: new TBrowser. If a window appears with a list of folders on the left side
and a white square on the right side, you’re done!
You could also install root inside your conda environment, I recommend you to use
miniforge. But if you have any other conda like: miniconda, anaconda or mambaforge is ok,
just skip step 1.
1) Install miniforge following the steps listed on it’s web: https://github.com/conda-
forge/miniforge. You can install it also using Homebrew but I don’t recommend you
to do that.
2) Then, open a new terminal inside your conda environment and write: conda
install root=6.26.06 . If you are using another conda, like miniconda use: conda
install -c conda-forge root=6.26.06 .
3) To check your installation type: root, in your terminal.
4) Then try: new TBrowser. If a window appears with a list of folders on the left side
and a white square on the right side, you’re done!
Linux
Using linux I recommend you follow the steps listed in the root cern web -> install ->
Download a precompiled binary distribution:
1) Click this link https://root.cern/install/ and go to Download a precompiled binary
distribution section (the first one).
2) Step 1 ask you to install al the required dependencies
(https://root.cern/install/dependencies/), you have to find your linux distribution
and copy-paste the command lines that they suggest you. Please install the required
packages and also the optional packages. If anyone of the packages can’t be installed
it use to be because the name of the packages change, just read the error and
modify the list of packages.
3) Then download the correct release version: 6.26.06, unpack it and use the command
source that you can find in the link provided. You can add the source command to
your bashrc file.
5) To check your installation type: root, in your terminal.
6) Then try: new TBrowser. If a window appears with a list of folders on the left side
and a white square on the right side, you’re done!
You can also install root inside your conda environment, I recommend you to use
miniforge. But if you have any other conda like: miniconda, anaconda or mambaforge is ok,
just skip step 1.
5) Install miniforge following the steps listed on it’s web: https://github.com/conda-
forge/miniforge.
6) Then, open a new terminal inside your conda environment and write: conda
install root=6.26.06 . If you are using another conda, like miniconda use: conda
install -c conda-forge root=6.26.06 .
7) To check your installation type: root, in your terminal.
8) Then try: new TBrowser. If a window appears with a list of folders on the left side
and a white square on the right side, you’re done!
How to install Geant4
Reference: https://geant4-userdoc.web.cern.ch/UsersGuides/InstallationGuide/html/
Recommended release: 11.1
Please CHECK YOUR INSTALLATION when you finish (last section)
Linux
1) Prerequisites:
Before the installing Geant4, the user must check that is system has installed:
- A C++ compiler with Standard Library supporting the C++11 Standard
- CMake (version 3.8 or higher)
- Git
In most Ubuntu distributions these packages are already installed, if that is not the case
execute (sudo apt install g++ cmake git) to download them.
In addition, the following packages are also required:
- Qt5 development libraries
- OpenGL/MesaGL development libraries
- X11 development libraries
- Motif development libraries
- Xerces-C++ development libraries
These items can be installed by running ( sudo apt install qtbase5-dev libgl1-mesa-
dev libx11-dev libxmu-dev libmotif-dev libxerces-c-dev).
2) Downloading, building and installing
Open the terminal and from the home directory navigate to the directory where you want
to instal geant4. Once in this directory type the following comands:
git clone https://gitlab.cern.ch/geant4/geant4.git
cd geant4
mkdir build
cd build
cmake -DGEANT4_INSTALL_DATA=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -
DGEANT4_USE_GDML=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_XM=ON -
DGEANT4_USE_QT=ON -DGEANT4_BUILD_MULTITHREADED=ON ../
make -jX ; where X is the number of cores that you want to dedicate.
sudo make install
3-Sourcing
After the installation, we must specify the path of installation of the geant4.sh file. To do this
open a new terminal in your home directory and access the .bashrc file and add the source.
cd
nano .bashrc
source /Geant4installpath/bin/geant4.sh
replacing /Geant4installpath with the Geant4 installation path (typically /usr/local).
So you added to your .bashrc a line like: source /usr/local/bin/geant4.sh
Then press ctrl + X, y, enter to leave the nano editor.
MacOS
Follow the steps in this guide: http://geant4-dna.in2p3.fr/styled-6/styled-12/index.html
Just some notes about the steps on the link above:
- You can skip the ROOT installation if you already installed it.
- Take into account that words or routes in pink and purple depends on the user
software and versions.
- At the moment that we wrote this guide:
o Geant4: 11.1.0
o Qt5: 5.15.8
o Xerces-c: 3.2.4
If you take those versions into account we will use those commands in:
Step A7:
export PKG_CONFIG_PATH=/opt/homebrew/Cellar/qt@5/5.15.8/lib/pkgconfig/
export PATH=/opt/homebrew/Cellar/qt@5/5.15.8/bin:$PATH
Step A10:
cd
git clone https://gitlab.cern.ch/geant4/geant4.git
cd geant4
git checkout v11.1.0
cd ..
Step A11:
cmake -DCMAKE_INSTALL_PREFIX=/Users/YOURNAME/geant4-v11.1.0-install -
DCMAKE_BUILD_TYPE=RelWithDebInfo -DGEANT4_USE_GDML=ON -
DGEANT4_BUILD_MULTITHREADED=ON -
DXERCESC_ROOT_DIR=/opt/homebrew/Cellar/xerces-c/3.2.4 -DGEANT4_USE_QT=ON -
DGEANT4_INSTALL_EXAMPLES=ON -DGEANT4_INSTALL_DATA=ON -
DGEANT4_USE_SYSTEM_EXPAT=OFF -DGEANT4_BUILD_TLS_MODEL=auto ../geant4
Please dont forget to change YOURNAME for your computer user.
Step B1:
#
#Qt5
#
export PKG_CONFIG_PATH=/opt/homebrew/Cellar/qt@5/5.15.8/lib/pkgconfig/
export PATH=/opt/homebrew/Cellar/qt@5/5.15.8/bin:$PATH
#
#
#Geant4
#
cd /Users/YOURNAME/geant4-v11.1.0-install/bin
source geant4.sh
export G4COMP=/Users/YOURNAME/geant4-v11.1.0-install/lib/Geant4-11.1.0
export CMAKE_PREFIX_PATH=$G4COMP
alias comp='cmake -DGeant4_DIR=$G4COMP -DGEANT4_BUILD_MULTITHREADED=ON'
#
cd
Sometimes it give us error if you source thisroot.sh when you install root from this way, so
you can comment that line if needed.
Now you can go to check your installation
Check your installation
1) Go to your Geant4 installation folder, then: cd examples/basic/B1
2) Create the build directory: mkdir build
3) Then type the following commands:
cd build
cmake ..
make -j8
./exampleB1
4) If you see a window with the graphical setup of the example, you are done!