Installation tutorial of GEANT4 under Ubuntu

Time:2021-7-30

Installation tutorial of GEANT4 under Ubuntu

GEANT4 is a particle transport simulation software developed by CERN. It uses Monte Carlo algorithm. Its specialty fields are high-energy physics and nuclear physics, such as photon neutron radiation shielding simulation, particle detector performance research, accelerator simulation, etc. it is used in physics, medicine, biology and other fields. The software is developed in C / C + +, follows the open source protocol, has a high degree of freedom and is free of charge. However, the threshold of GEANT4 programming development is high, and there are certain requirements for C / C + + ability.
I installed GEANT4 under Ubuntu (16.04) system. The installation process is recorded here for reference.

1 install dependent Libraries

The dependency libraries of GEANT4 vary according to the basic functions and optional functions (such as visualization) of GEANT4.

1.1 library required for GEANT4 basic functions

First, introduce the libraries required to install basic functions. For the official introduction of dependent libraries, see(http://geant4.web.cern.ch/gea…), use the Ubuntu library installer apt.
sudo apt-get install build-essential
sudo apt-get install libgl1-mesa-dev
sudo apt-get install libglu1-mesa-dev
sudo apt-get install libxt-dev

To install XMU related libraries, first use apt cache search to search with “XMU” as the keyword:
apt-cache search libxmu
Then install selectively according to the listed items, or install all, for example:
sudo apt-get install libxmuu-de

Install expat related libraries (the same as XMU library installation, retrieve first and then install):
apt-cache search expat

1.2 library required for GEANT4 visualization function

There are many libraries required for visualization functions, including QT, OpenGL and so on. The official instructions can be referred to(http://geant4.web.cern.ch/gea…), of which
GEANT4_USE_QT (DEFAULT : OFF)
GEANT4_USE_OPENGL_X11(DEFAULT : OFF, Unix Only)
GEANT4_USE_RAYTRACER_X11 (DEFAULT : OFF, Unix only)
These are the options for visualization.
OpenGL and raytracer are used here (of course, you can try QT because QT is easier to use).
apt-cache search xerces
sudo apt-get install libxerces-c-dev
sudo apt-get install libxerces-c-doc
sudo apt-get install libxerces-c-samples
sudo apt-get install libxerces-c3.1
The X11 library is already installed in the basic library (libxt DEV)

2 GEANT4 installation

Here, please refer to the official installation process of GEANT4(http://geant4.web.cern.ch/gea…)。 You can also refer to my previous blog “Introduction to GEANT4 installation”(http://littlepascal.lofter.co… )。