|
|
|
## Geant4 Installation on Ubuntu 24.04 LTS
|
|
|
|
|
|
|
|
[[_TOC_]]
|
|
|
|
|
|
|
|
In this tutorial we will use Geant4 version 11.3.2, compiled with the support of multithreading, GDML and Qt5 based Gui.
|
|
|
|
|
|
|
|
The repository scripts was updated for Geant4 version 11.3.2,
|
|
|
|
but if you have version 11.3.1 it will work also.
|
|
|
|
|
|
|
|
On Linux systems we use a compiled version of Geant4 and a binary distribution for ROOT installations.
|
|
|
|
|
|
|
|
Below we provide detailed instructions for the installation on Ubuntu 22.04.
|
|
|
|
The installation for other Debian and Ubuntu like Linux'es will be similar but the names of libraries can be slightly different. On Linux you can use GNU *c++*, *clang* or Intel *icc* compilers, we describe only the GNU *g++* installation.
|
|
|
|
|
|
|
|
The installation was tested Windows 11 WLS2 *Ubuntu* application and gcc 13.3.
|
|
|
|
|
|
|
|
## Ubuntu 24.04 Requirements
|
|
|
|
|
|
|
|
* Ubuntu 24.04 LTS Server or Desktop installation
|
|
|
|
* *build-essential*, *curl*, *g++*, *git* and *cmake* packages
|
|
|
|
* A Bourne-compatible shell for installation (e.g. *bash* or *zsh*)
|
|
|
|
* `sudo` for library installation and directory creation under `/usr/local`
|
|
|
|
|
|
|
|
## External Dependencies Installation
|
|
|
|
|
|
|
|
Generally we follow the installation rules for ROOT described here:
|
|
|
|
https://root.cern/install/dependencies/
|
|
|
|
|
|
|
|
Some dependencies like kerberos and mysql were dropped because we do not use these features in the tutorial.
|
|
|
|
The libraries which we need for Geant4 compilation need to be installed first. For this, the `ubuntu24_deps.sh` script is provided for the Ubuntu 24.04 machine.
|
|
|
|
|
|
|
|
This script must be executed only once.
|
|
|
|
|
|
|
|
See below the code snippet:
|
|
|
|
|
|
|
|
```
|
|
|
|
apt install -y qtbase5-dev qtbase5-dev-tools qt5-qmake
|
|
|
|
apt install -y qttools5-dev
|
|
|
|
apt install -y libxerces-c-dev
|
|
|
|
|
|
|
|
apt install -y gfortran
|
|
|
|
apt install -y python3-dev python3-numpy-dev
|
|
|
|
|
|
|
|
apt install -y libxpm-dev libxft-dev libxmu-dev
|
|
|
|
apt install -y libssl-dev
|
|
|
|
apt install -y qt3d5-dev qt3d5-dev-tools
|
|
|
|
|
|
|
|
apt-get install -y libpcre3-dev xlibmesa-glu-dev \
|
|
|
|
libglew1.5-dev libftgl-dev libfftw3-dev libcfitsio-dev \
|
|
|
|
graphviz-dev libxml2-dev libgsl0-dev
|
|
|
|
|
|
|
|
apt install -y libfreetype6-dev
|
|
|
|
|
|
|
|
```
|
|
|
|
**N.B. Upgrade you system before installation:**
|
|
|
|
```
|
|
|
|
sudo apt update
|
|
|
|
sudo apt upgrade
|
|
|
|
```
|
|
|
|
|
|
|
|
> On Ubuntu 20.04 all qt dependencies can be installed via qt-defaults package, > use the `ubuntu20_deps.sh` script to install dependencies.
|
|
|
|
|
|
|
|
## ROOT Installation
|
|
|
|
|
|
|
|
The ROOT installation is required for some exercises in this tutorial.
|
|
|
|
|
|
|
|
The tar files with precompiled ROOT binaries for Ubuntu-24.04 can be downloaded from
|
|
|
|
https://root.cern/download/:
|
|
|
|
|
|
|
|
`curl -SLO https://root.cern/download/root_v6.34.08.Linux-ubuntu24.04-x86_64-gcc13.3.tar.gz`
|
|
|
|
|
|
|
|
We will install both ROOT and Geant4 into /usr/local directory:
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo tar zxf root_v6.34.08.Linux-ubuntu24.04-x86_64-gcc13.3.tar.gz -C /usr/local
|
|
|
|
|
|
|
|
sudo chown -R `id -un`:`id -gn` /usr/local/root
|
|
|
|
chmod +x /usr/local/root/bin/thisroot.*
|
|
|
|
```
|
|
|
|
|
|
|
|
All installation steps are summarized in the `install-root-ubuntu24.sh` script.
|
|
|
|
|
|
|
|
ROOT is installed in _relocatable_ mode.
|
|
|
|
To use ROOT, you must set its environment sourcing the *thisroot.sh* script from
|
|
|
|
the ROOT installation directory:
|
|
|
|
|
|
|
|
`source /usr/local/root/bin/thisroot.sh`
|
|
|
|
|
|
|
|
Visit http://root.cern.ch for more information about ROOT.
|
|
|
|
|
|
|
|
## Geant4 Installation
|
|
|
|
|
|
|
|
Install development tools and compilers packages _build-essential_, _cmake_:
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo apt install -y build-essential
|
|
|
|
sudo install -y cmake
|
|
|
|
```
|
|
|
|
|
|
|
|
This is already done if you have used the _ubuntu20_deps.sh_ script to install dependencies.
|
|
|
|
|
|
|
|
Do not forget to install your favorite editor, e.g _Emacs_ :
|
|
|
|
|
|
|
|
`sudo apt install -y emacs`
|
|
|
|
|
|
|
|
<!--
|
|
|
|
You can install the precompiled version of Geant4 provided for this tutorial. You can download the tar file with precompiled Geant4 `geant4_v11.1.1.Linux-ubuntu20-x86_64-gcc9.4.tar.gz` from `llrnbox.in2p3.fr` server. The script `install-geant4-ubuntu.sh` can be used for downloading and installation of Geant4.
|
|
|
|
|
|
|
|
The link to tar.gz file with Geant4 11.3.2 binaries for Ubuntu 24.04
|
|
|
|
|
|
|
|
https://llrnbox.in2p3.fr/index.php/s/jNJcK7jHTmX3g97
|
|
|
|
|
|
|
|
The md5 sum file:
|
|
|
|
|
|
|
|
https://llrnbox.in2p3.fr/index.php/s/Y5yD3CZxYgGZxGA
|
|
|
|
|
|
|
|
N.B. You need to install Geant4 into `/usr/local/geant4/11.3.2`.
|
|
|
|
|
|
|
|
If you install the precompiled version you can skip **Build Geant4** section and go directly to **Environment**.
|
|
|
|
-->
|
|
|
|
|
|
|
|
## Build Geant4
|
|
|
|
|
|
|
|
You can download the Geant4 sources from https://geant4.web.cern.ch/support/download
|
|
|
|
or clone Geant4 repository. We use `git clone ...` in the instructions below.
|
|
|
|
|
|
|
|
In the Terminal window type the commands:
|
|
|
|
|
|
|
|
```
|
|
|
|
git clone https://gitlab.cern.ch/geant4/geant4.git
|
|
|
|
cd geant4/
|
|
|
|
git checkout v11.3.2
|
|
|
|
This will create a clone of the Geant4 11.3.2 release on your local disk.
|
|
|
|
|
|
|
|
The ROOT and Geant4 are installed with the current user as owner.
|
|
|
|
You need to create a target directory owned by my current user:
|
|
|
|
|
|
|
|
`sudo mkdir -p /usr/local/geant4/11.3.2`
|
|
|
|
|
|
|
|
`sudo chown -R `id -un`:`id -gn` /usr/local/geant4`
|
|
|
|
```
|
|
|
|
|
|
|
|
Make build configuration files with cmake:
|
|
|
|
|
|
|
|
```
|
|
|
|
mkdir geant4-build
|
|
|
|
cd geant4-build
|
|
|
|
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/geant4/11.3.2 \
|
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo [ -DGEANT4_BUILD_MULTITHREADED=ON ] \
|
|
|
|
-DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_GDML=ON -DGEANT4_USE_QT=ON \
|
|
|
|
-DGEANT4_USE_OPENGL_X11=ON [-DGEANT4_USE_FREETYPE=ON] ../geant4
|
|
|
|
```
|
|
|
|
|
|
|
|
The multithreading enabled by default and FREETYPE was optional component
|
|
|
|
|
|
|
|
Now you can comile binaries and install Geant4:
|
|
|
|
|
|
|
|
```
|
|
|
|
cmake --build . --target install -- -j8
|
|
|
|
```
|
|
|
|
|
|
|
|
Geant4 is now installed in the `/usr/local/geant4/11.3.2` directory.
|
|
|
|
|
|
|
|
The installation script `build-geant4-ubuntu.sh` will do all these steps.
|
|
|
|
|
|
|
|
## Environment
|
|
|
|
|
|
|
|
In order to use Geant4 you need to define the environment variables pointing to the Geant4 datasets locations. This can be done by sourcing the _geant4.sh_ script.
|
|
|
|
|
|
|
|
In the git repository you can find the bash script `setup_env.sh` with setup both for ROOT and Geant4.
|
|
|
|
|
|
|
|
See below the code snippet:
|
|
|
|
```
|
|
|
|
# ROOT 6
|
|
|
|
if [ -x /usr/local/root/bin/thisroot.sh ]; then
|
|
|
|
. /usr/local/root/bin/thisroot.sh
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Geant4
|
|
|
|
if [ -x /usr/local/geant4/11.3.2/bin/geant4.sh ]; then
|
|
|
|
. /usr/local/geant4/11.3.2/bin/geant4.sh
|
|
|
|
fi
|
|
|
|
```
|
|
|
|
|
|
|
|
You can source this script before starting to work with your Geant4 project or
|
|
|
|
add these lines in your .bash_profile to get the environment set automatically when you log in.
|
|
|
|
|
|
|
|
## Testing of installation
|
|
|
|
|
|
|
|
### 1. Open new Terminal window
|
|
|
|
|
|
|
|
### 2. Source `setup_env.sh` if not done with `.bash_profile`
|
|
|
|
- `source ~/setup_env.sh`
|
|
|
|
|
|
|
|
### 3. Test ROOT Installation
|
|
|
|
|
|
|
|
|
|
|
|
Start the ROOT interactive session:
|
|
|
|
```
|
|
|
|
$ root
|
|
|
|
------------------------------------------------------------------
|
|
|
|
| Welcome to ROOT 6.34.08 https://root.cern |
|
|
|
|
| (c) 1995-2024, The ROOT Team; conception: R. Brun, F. Rademakers |
|
|
|
|
| Built for linuxx8664gcc on Apr 07 2025, 20:24:19 |
|
|
|
|
| From tags/v6-34-08@v6-34-08 |
|
|
|
|
| With c++ (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0 |
|
|
|
|
| Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' |
|
|
|
|
------------------------------------------------------------------
|
|
|
|
```
|
|
|
|
|
|
|
|
and type `.demo` after the ROOT prompt:
|
|
|
|
```
|
|
|
|
root [0] .demo
|
|
|
|
```
|
|
|
|
|
|
|
|
You will see the ROOT demo bar and can run some demos by clicking on the demo menu.
|
|
|
|
You need to go from up to down in the menu, some demos depend on the previous demos results.
|
|
|
|
|
|
|
|
To quit ROOT type .q on the ROOT prompt
|
|
|
|
```
|
|
|
|
root [1] .q
|
|
|
|
|
|
|
|
Taking a break from ROOT? Hope to see you back!
|
|
|
|
|
|
|
|
$
|
|
|
|
```
|
|
|
|
|
|
|
|
### 4. Test Geant4 installation
|
|
|
|
|
|
|
|
You can try to compile and run one of the Geant4 examples.
|
|
|
|
|
|
|
|
E.g. basic B1 example.
|
|
|
|
```
|
|
|
|
$ cd ~/tmp
|
|
|
|
$ mkdir B1-build
|
|
|
|
$ cd B1-build
|
|
|
|
$ cmake /usr/local/geant4/11.3.2/share/Geant4/examples/basic/B1
|
|
|
|
```
|
|
|
|
|
|
|
|
You should see something like the output below. Watch for eventual configuration errors.
|
|
|
|
```
|
|
|
|
-- The C compiler identification is GNU 13.3.0
|
|
|
|
-- The CXX compiler identification is GNU 13.3.0
|
|
|
|
-- Detecting C compiler ABI info
|
|
|
|
-- Detecting C compiler ABI info - done
|
|
|
|
-- Check for working C compiler: /usr/bin/cc - skipped
|
|
|
|
-- Detecting C compile features
|
|
|
|
-- Detecting C compile features - done
|
|
|
|
-- Detecting CXX compiler ABI info
|
|
|
|
-- Detecting CXX compiler ABI info - done
|
|
|
|
-- Check for working CXX compiler: /usr/bin/c++ - skipped
|
|
|
|
-- Detecting CXX compile features
|
|
|
|
-- Detecting CXX compile features - done
|
|
|
|
-- Found EXPAT: /usr/lib/x86_64-linux-gnu/libexpat.so (found suitable version "2.6.1", minimum required is "2.6.1")
|
|
|
|
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
|
|
|
|
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
|
|
|
|
-- Found Threads: TRUE
|
|
|
|
-- Found XercesC: /usr/lib/x86_64-linux-gnu/libxerces-c.so (found suitable version "3.2.4", minimum required is "3.2.4")
|
|
|
|
-- Found Freetype: /usr/lib/x86_64-linux-gnu/libfreetype.so (found suitable version "2.13.2", minimum required is "2.13.2")
|
|
|
|
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
|
|
|
|
-- Found X11: /usr/include
|
|
|
|
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
|
|
|
|
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
|
|
|
|
-- Looking for gethostbyname
|
|
|
|
-- Looking for gethostbyname - found
|
|
|
|
-- Looking for connect
|
|
|
|
-- Looking for connect - found
|
|
|
|
-- Looking for remove
|
|
|
|
-- Looking for remove - found
|
|
|
|
-- Looking for shmat
|
|
|
|
-- Looking for shmat - found
|
|
|
|
-- Looking for IceConnectionNumber in ICE
|
|
|
|
-- Looking for IceConnectionNumber in ICE - found
|
|
|
|
-- Found Geant4: /usr/local/geant4/11.3.2/lib/cmake/Geant4/Geant4Config.cmake (found version "11.3.2")
|
|
|
|
-- Configuring done (10.5s)
|
|
|
|
-- Generating done (0.0s)
|
|
|
|
-- Build files have been written to: /home/semenjuk/tmp/B1-build
|
|
|
|
```
|
|
|
|
Now you can build the application with `make -j8` where -j8 is the number of parallel make processes.
|
|
|
|
|
|
|
|
```
|
|
|
|
$ make -j8
|
|
|
|
[ 12%] Building CXX object CMakeFiles/exampleB1.dir/exampleB1.cc.o
|
|
|
|
[ 25%] Building CXX object CMakeFiles/exampleB1.dir/src/ActionInitialization.cc.o
|
|
|
|
[ 37%] Building CXX object CMakeFiles/exampleB1.dir/src/DetectorConstruction.cc.o
|
|
|
|
[ 50%] Building CXX object CMakeFiles/exampleB1.dir/src/EventAction.cc.o
|
|
|
|
[ 62%] Building CXX object CMakeFiles/exampleB1.dir/src/PrimaryGeneratorAction.cc.o
|
|
|
|
[ 75%] Building CXX object CMakeFiles/exampleB1.dir/src/SteppingAction.cc.o
|
|
|
|
[ 87%] Building CXX object CMakeFiles/exampleB1.dir/src/RunAction.cc.o
|
|
|
|
[100%] Linking CXX executable exampleB1
|
|
|
|
[100%] Built target exampleB1
|
|
|
|
```
|
|
|
|
|
|
|
|
Now you can run the executable:
|
|
|
|
```
|
|
|
|
./exampleB1
|
|
|
|
```
|
|
|
|
|
|
|
|
This will open an interactive QT GUI window.
|
|
|
|
To generate N events type in the Session window:
|
|
|
|
To generate N events type in the Session window:
|
|
|
|
```
|
|
|
|
/run/beamOn N
|
|
|
|
```
|
|
|
|
|
|
|
|
To quit application type:
|
|
|
|
```
|
|
|
|
exit
|
|
|
|
```
|
|
|
|
|
|
|
|
See below the expected program output in the terminal.
|
|
|
|
*You should not see a crash dump!*
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
$ ./exampleB1
|
|
|
|
Available UI session types: [ Qt, tcsh, csh ]
|
|
|
|
|
|
|
|
**************************************************************
|
|
|
|
Geant4 version Name: geant4-11-03-patch-01 [MT] (21-March-2025)
|
|
|
|
<< in Multi-threaded mode >>
|
|
|
|
Copyright : Geant4 Collaboration
|
|
|
|
References : NIM A 506 (2003), 250-303
|
|
|
|
: IEEE-TNS 53 (2006), 270-278
|
|
|
|
: NIM A 835 (2016), 186-225
|
|
|
|
WWW : http://geant4.org/
|
|
|
|
**************************************************************
|
|
|
|
|
|
|
|
<<< Reference Physics List QBBC
|
|
|
|
|
|
|
|
...
|
|
|
|
<snip>
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
|
|
================== Deleting memory pools ===================
|
|
|
|
Pool ID '20G4NavigationLevelRep', size : 0.00288 MB
|
|
|
|
Pool ID '24G4ReferenceCountedHandleIvE', size : 0.000961 MB
|
|
|
|
Pool ID '17G4DynamicParticle', size : 0.000961 MB
|
|
|
|
Pool ID '24G4ClonedSmoothTrajectory', size : 0.000961 MB
|
|
|
|
Pool ID '29G4ClonedSmoothTrajectoryPoint', size : 0.000961 MB
|
|
|
|
Pool ID '15G4CountedObjectIvE', size : 0.000961 MB
|
|
|
|
Number of memory pools allocated: 6; of which, static: 0
|
|
|
|
Dynamic pools deleted: 6 / Total memory freed: 0.0077 MB
|
|
|
|
============================================================
|
|
|
|
G4Allocator objects are deleted.
|
|
|
|
UImanager deleted.
|
|
|
|
StateManager deleted.
|
|
|
|
RunManagerKernel is deleted. Good bye :)
|
|
|
|
RunManager is deleted.
|
|
|
|
```
|
|
|
|
|
|
|
|
## Tips ##
|
|
|
|
|
|
|
|
- Root
|
|
|
|
|
|
|
|
- ROOT comes with a web-based browser, which is now being started. Revert to TBrowser by setting "Browser.Name: TRootBrowser" in rootrc file. Or starting "root --web=off"
|
|
|
|
- libtbb must beinstalled `sudo apt install -y libtbb12`
|
|
|
|
|
|
|
|
- Geant4
|
|
|
|
- You check the Geant4 datasets installation using the command:
|
|
|
|
`geant4-config --check-datasets`
|
|
|
|
- `geant4-config --help` also shows the Geant4 features (configuration options)
|
|
|
|
|
|
|
|
Visit Geant4 installation Guide for more info:
|
|
|
|
http://geant4-userdoc.web.cern.ch/geant4-userdoc/UsersGuides/InstallationGuide/html/
|
|
|
|
|
|
|
|
- zsh
|
|
|
|
- If you use zsh you need to use .zprofile instead of .bash_profile
|
|
|
|
- Use *source* not *.* to source setup scripts
|
|
|
|
|
|
|
|
- git
|
|
|
|
- for latest git enable repository before installing git
|
|
|
|
|
|
|
|
`sudo add-apt-repository ppa:git-core/ppa` |
|
|
|
## Geant4 Installation on Ubuntu 24.04 LTS
|
|
|
|
|
|
|
|
[[_TOC_]]
|
|
|
|
|
|
|
|
In this tutorial we will use Geant4 version 11.3.2, compiled with the support of multithreading, GDML and Qt5 based Gui.
|
|
|
|
|
|
|
|
The repository scripts was updated for Geant4 version 11.3.2,
|
|
|
|
but if you have version 11.3.1 it will work also.
|
|
|
|
|
|
|
|
On Linux systems we use a compiled version of Geant4 and a binary distribution for ROOT installations.
|
|
|
|
|
|
|
|
Below we provide detailed instructions for the installation on Ubuntu 22.04.
|
|
|
|
The installation for other Debian and Ubuntu like Linux'es will be similar but the names of libraries can be slightly different. On Linux you can use GNU *c++*, *clang* or Intel *icc* compilers, we describe only the GNU *g++* installation.
|
|
|
|
|
|
|
|
The installation was tested Windows 11 WLS2 *Ubuntu* application and gcc 13.3.
|
|
|
|
|
|
|
|
## Ubuntu 24.04 Requirements
|
|
|
|
|
|
|
|
* Ubuntu 24.04 LTS Server or Desktop installation
|
|
|
|
* *build-essential*, *curl*, *g++*, *git* and *cmake* packages
|
|
|
|
* A Bourne-compatible shell for installation (e.g. *bash* or *zsh*)
|
|
|
|
* `sudo` for library installation and directory creation under `/usr/local`
|
|
|
|
|
|
|
|
## External Dependencies Installation
|
|
|
|
|
|
|
|
Generally we follow the installation rules for ROOT described here:
|
|
|
|
https://root.cern/install/dependencies/
|
|
|
|
|
|
|
|
Some dependencies like kerberos and mysql were dropped because we do not use these features in the tutorial.
|
|
|
|
The libraries which we need for Geant4 compilation need to be installed first. For this, the `ubuntu24_deps.sh` script is provided for the Ubuntu 24.04 machine.
|
|
|
|
|
|
|
|
This script must be executed only once.
|
|
|
|
|
|
|
|
See below the code snippet:
|
|
|
|
|
|
|
|
```
|
|
|
|
apt install -y qtbase5-dev qtbase5-dev-tools qt5-qmake
|
|
|
|
apt install -y qttools5-dev
|
|
|
|
apt install -y libxerces-c-dev
|
|
|
|
|
|
|
|
apt install -y gfortran
|
|
|
|
apt install -y python3-dev python3-numpy-dev
|
|
|
|
|
|
|
|
apt install -y libxpm-dev libxft-dev libxmu-dev
|
|
|
|
apt install -y libssl-dev
|
|
|
|
apt install -y qt3d5-dev qt3d5-dev-tools
|
|
|
|
|
|
|
|
apt-get install -y libpcre3-dev xlibmesa-glu-dev \
|
|
|
|
libglew1.5-dev libftgl-dev libfftw3-dev libcfitsio-dev \
|
|
|
|
graphviz-dev libxml2-dev libgsl0-dev
|
|
|
|
|
|
|
|
apt install -y libmotif-dev
|
|
|
|
|
|
|
|
apt install -y libfreetype6-dev
|
|
|
|
|
|
|
|
```
|
|
|
|
**N.B. Upgrade you system before installation:**
|
|
|
|
```
|
|
|
|
sudo apt update
|
|
|
|
sudo apt upgrade
|
|
|
|
```
|
|
|
|
|
|
|
|
> On Ubuntu 20.04 all qt dependencies can be installed via qt-defaults package, > use the `ubuntu20_deps.sh` script to install dependencies.
|
|
|
|
|
|
|
|
## ROOT Installation
|
|
|
|
|
|
|
|
The ROOT installation is required for some exercises in this tutorial.
|
|
|
|
|
|
|
|
The tar files with precompiled ROOT binaries for Ubuntu-24.04 can be downloaded from
|
|
|
|
https://root.cern/download/:
|
|
|
|
|
|
|
|
`curl -SLO https://root.cern/download/root_v6.34.08.Linux-ubuntu24.04-x86_64-gcc13.3.tar.gz`
|
|
|
|
|
|
|
|
We will install both ROOT and Geant4 into /usr/local directory:
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo tar zxf root_v6.34.08.Linux-ubuntu24.04-x86_64-gcc13.3.tar.gz -C /usr/local
|
|
|
|
|
|
|
|
sudo chown -R `id -un`:`id -gn` /usr/local/root
|
|
|
|
chmod +x /usr/local/root/bin/thisroot.*
|
|
|
|
```
|
|
|
|
|
|
|
|
All installation steps are summarized in the `install-root-ubuntu24.sh` script.
|
|
|
|
|
|
|
|
ROOT is installed in _relocatable_ mode.
|
|
|
|
To use ROOT, you must set its environment sourcing the *thisroot.sh* script from
|
|
|
|
the ROOT installation directory:
|
|
|
|
|
|
|
|
`source /usr/local/root/bin/thisroot.sh`
|
|
|
|
|
|
|
|
Visit http://root.cern.ch for more information about ROOT.
|
|
|
|
|
|
|
|
## Geant4 Installation
|
|
|
|
|
|
|
|
Install development tools and compilers packages _build-essential_, _cmake_:
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo apt install -y build-essential
|
|
|
|
sudo install -y cmake
|
|
|
|
```
|
|
|
|
|
|
|
|
This is already done if you have used the _ubuntu20_deps.sh_ script to install dependencies.
|
|
|
|
|
|
|
|
Do not forget to install your favorite editor, e.g _Emacs_ :
|
|
|
|
|
|
|
|
`sudo apt install -y emacs`
|
|
|
|
|
|
|
|
<!--
|
|
|
|
You can install the precompiled version of Geant4 provided for this tutorial. You can download the tar file with precompiled Geant4 `geant4_v11.1.1.Linux-ubuntu20-x86_64-gcc9.4.tar.gz` from `llrnbox.in2p3.fr` server. The script `install-geant4-ubuntu.sh` can be used for downloading and installation of Geant4.
|
|
|
|
|
|
|
|
The link to tar.gz file with Geant4 11.3.2 binaries for Ubuntu 24.04
|
|
|
|
|
|
|
|
https://llrnbox.in2p3.fr/index.php/s/jNJcK7jHTmX3g97
|
|
|
|
|
|
|
|
The md5 sum file:
|
|
|
|
|
|
|
|
https://llrnbox.in2p3.fr/index.php/s/Y5yD3CZxYgGZxGA
|
|
|
|
|
|
|
|
N.B. You need to install Geant4 into `/usr/local/geant4/11.3.2`.
|
|
|
|
|
|
|
|
If you install the precompiled version you can skip **Build Geant4** section and go directly to **Environment**.
|
|
|
|
-->
|
|
|
|
|
|
|
|
## Build Geant4
|
|
|
|
|
|
|
|
You can download the Geant4 sources from https://geant4.web.cern.ch/support/download
|
|
|
|
or clone Geant4 repository. We use `git clone ...` in the instructions below.
|
|
|
|
|
|
|
|
In the Terminal window type the commands:
|
|
|
|
|
|
|
|
```
|
|
|
|
git clone https://gitlab.cern.ch/geant4/geant4.git
|
|
|
|
cd geant4/
|
|
|
|
git checkout v11.3.2
|
|
|
|
This will create a clone of the Geant4 11.3.2 release on your local disk.
|
|
|
|
|
|
|
|
The ROOT and Geant4 are installed with the current user as owner.
|
|
|
|
You need to create a target directory owned by my current user:
|
|
|
|
|
|
|
|
`sudo mkdir -p /usr/local/geant4/11.3.2`
|
|
|
|
|
|
|
|
`sudo chown -R `id -un`:`id -gn` /usr/local/geant4`
|
|
|
|
```
|
|
|
|
|
|
|
|
Make build configuration files with cmake:
|
|
|
|
|
|
|
|
```
|
|
|
|
mkdir geant4-build
|
|
|
|
cd geant4-build
|
|
|
|
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/geant4/11.3.2 \
|
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo [ -DGEANT4_BUILD_MULTITHREADED=ON ] \
|
|
|
|
-DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_GDML=ON -DGEANT4_USE_QT=ON \
|
|
|
|
-DGEANT4_USE_OPENGL_X11=ON [-DGEANT4_USE_FREETYPE=ON] ../geant4
|
|
|
|
```
|
|
|
|
|
|
|
|
The multithreading enabled by default and FREETYPE was optional component
|
|
|
|
|
|
|
|
Now you can comile binaries and install Geant4:
|
|
|
|
|
|
|
|
```
|
|
|
|
cmake --build . --target install -- -j8
|
|
|
|
```
|
|
|
|
|
|
|
|
Geant4 is now installed in the `/usr/local/geant4/11.3.2` directory.
|
|
|
|
|
|
|
|
The installation script `build-geant4-ubuntu.sh` will do all these steps.
|
|
|
|
|
|
|
|
## Environment
|
|
|
|
|
|
|
|
In order to use Geant4 you need to define the environment variables pointing to the Geant4 datasets locations. This can be done by sourcing the _geant4.sh_ script.
|
|
|
|
|
|
|
|
In the git repository you can find the bash script `setup_env.sh` with setup both for ROOT and Geant4.
|
|
|
|
|
|
|
|
See below the code snippet:
|
|
|
|
```
|
|
|
|
# ROOT 6
|
|
|
|
if [ -x /usr/local/root/bin/thisroot.sh ]; then
|
|
|
|
. /usr/local/root/bin/thisroot.sh
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Geant4
|
|
|
|
if [ -x /usr/local/geant4/11.3.2/bin/geant4.sh ]; then
|
|
|
|
. /usr/local/geant4/11.3.2/bin/geant4.sh
|
|
|
|
fi
|
|
|
|
```
|
|
|
|
|
|
|
|
You can source this script before starting to work with your Geant4 project or
|
|
|
|
add these lines in your .bash_profile to get the environment set automatically when you log in.
|
|
|
|
|
|
|
|
## Testing of installation
|
|
|
|
|
|
|
|
### 1. Open new Terminal window
|
|
|
|
|
|
|
|
### 2. Source `setup_env.sh` if not done with `.bash_profile`
|
|
|
|
- `source ~/setup_env.sh`
|
|
|
|
|
|
|
|
### 3. Test ROOT Installation
|
|
|
|
|
|
|
|
|
|
|
|
Start the ROOT interactive session:
|
|
|
|
```
|
|
|
|
$ root
|
|
|
|
------------------------------------------------------------------
|
|
|
|
| Welcome to ROOT 6.34.08 https://root.cern |
|
|
|
|
| (c) 1995-2024, The ROOT Team; conception: R. Brun, F. Rademakers |
|
|
|
|
| Built for linuxx8664gcc on Apr 07 2025, 20:24:19 |
|
|
|
|
| From tags/v6-34-08@v6-34-08 |
|
|
|
|
| With c++ (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0 |
|
|
|
|
| Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' |
|
|
|
|
------------------------------------------------------------------
|
|
|
|
```
|
|
|
|
|
|
|
|
and type `.demo` after the ROOT prompt:
|
|
|
|
```
|
|
|
|
root [0] .demo
|
|
|
|
```
|
|
|
|
|
|
|
|
You will see the ROOT demo bar and can run some demos by clicking on the demo menu.
|
|
|
|
You need to go from up to down in the menu, some demos depend on the previous demos results.
|
|
|
|
|
|
|
|
To quit ROOT type .q on the ROOT prompt
|
|
|
|
```
|
|
|
|
root [1] .q
|
|
|
|
|
|
|
|
Taking a break from ROOT? Hope to see you back!
|
|
|
|
|
|
|
|
$
|
|
|
|
```
|
|
|
|
|
|
|
|
### 4. Test Geant4 installation
|
|
|
|
|
|
|
|
You can try to compile and run one of the Geant4 examples.
|
|
|
|
|
|
|
|
E.g. basic B1 example.
|
|
|
|
```
|
|
|
|
$ cd ~/tmp
|
|
|
|
$ mkdir B1-build
|
|
|
|
$ cd B1-build
|
|
|
|
$ cmake /usr/local/geant4/11.3.2/share/Geant4/examples/basic/B1
|
|
|
|
```
|
|
|
|
|
|
|
|
You should see something like the output below. Watch for eventual configuration errors.
|
|
|
|
```
|
|
|
|
-- The C compiler identification is GNU 13.3.0
|
|
|
|
-- The CXX compiler identification is GNU 13.3.0
|
|
|
|
-- Detecting C compiler ABI info
|
|
|
|
-- Detecting C compiler ABI info - done
|
|
|
|
-- Check for working C compiler: /usr/bin/cc - skipped
|
|
|
|
-- Detecting C compile features
|
|
|
|
-- Detecting C compile features - done
|
|
|
|
-- Detecting CXX compiler ABI info
|
|
|
|
-- Detecting CXX compiler ABI info - done
|
|
|
|
-- Check for working CXX compiler: /usr/bin/c++ - skipped
|
|
|
|
-- Detecting CXX compile features
|
|
|
|
-- Detecting CXX compile features - done
|
|
|
|
-- Found EXPAT: /usr/lib/x86_64-linux-gnu/libexpat.so (found suitable version "2.6.1", minimum required is "2.6.1")
|
|
|
|
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
|
|
|
|
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
|
|
|
|
-- Found Threads: TRUE
|
|
|
|
-- Found XercesC: /usr/lib/x86_64-linux-gnu/libxerces-c.so (found suitable version "3.2.4", minimum required is "3.2.4")
|
|
|
|
-- Found Freetype: /usr/lib/x86_64-linux-gnu/libfreetype.so (found suitable version "2.13.2", minimum required is "2.13.2")
|
|
|
|
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
|
|
|
|
-- Found X11: /usr/include
|
|
|
|
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
|
|
|
|
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
|
|
|
|
-- Looking for gethostbyname
|
|
|
|
-- Looking for gethostbyname - found
|
|
|
|
-- Looking for connect
|
|
|
|
-- Looking for connect - found
|
|
|
|
-- Looking for remove
|
|
|
|
-- Looking for remove - found
|
|
|
|
-- Looking for shmat
|
|
|
|
-- Looking for shmat - found
|
|
|
|
-- Looking for IceConnectionNumber in ICE
|
|
|
|
-- Looking for IceConnectionNumber in ICE - found
|
|
|
|
-- Found Geant4: /usr/local/geant4/11.3.2/lib/cmake/Geant4/Geant4Config.cmake (found version "11.3.2")
|
|
|
|
-- Configuring done (10.5s)
|
|
|
|
-- Generating done (0.0s)
|
|
|
|
-- Build files have been written to: /home/semenjuk/tmp/B1-build
|
|
|
|
```
|
|
|
|
Now you can build the application with `make -j8` where -j8 is the number of parallel make processes.
|
|
|
|
|
|
|
|
```
|
|
|
|
$ make -j8
|
|
|
|
[ 12%] Building CXX object CMakeFiles/exampleB1.dir/exampleB1.cc.o
|
|
|
|
[ 25%] Building CXX object CMakeFiles/exampleB1.dir/src/ActionInitialization.cc.o
|
|
|
|
[ 37%] Building CXX object CMakeFiles/exampleB1.dir/src/DetectorConstruction.cc.o
|
|
|
|
[ 50%] Building CXX object CMakeFiles/exampleB1.dir/src/EventAction.cc.o
|
|
|
|
[ 62%] Building CXX object CMakeFiles/exampleB1.dir/src/PrimaryGeneratorAction.cc.o
|
|
|
|
[ 75%] Building CXX object CMakeFiles/exampleB1.dir/src/SteppingAction.cc.o
|
|
|
|
[ 87%] Building CXX object CMakeFiles/exampleB1.dir/src/RunAction.cc.o
|
|
|
|
[100%] Linking CXX executable exampleB1
|
|
|
|
[100%] Built target exampleB1
|
|
|
|
```
|
|
|
|
|
|
|
|
Now you can run the executable:
|
|
|
|
```
|
|
|
|
./exampleB1
|
|
|
|
```
|
|
|
|
|
|
|
|
This will open an interactive QT GUI window.
|
|
|
|
To generate N events type in the Session window:
|
|
|
|
To generate N events type in the Session window:
|
|
|
|
```
|
|
|
|
/run/beamOn N
|
|
|
|
```
|
|
|
|
|
|
|
|
To quit application type:
|
|
|
|
```
|
|
|
|
exit
|
|
|
|
```
|
|
|
|
|
|
|
|
See below the expected program output in the terminal.
|
|
|
|
*You should not see a crash dump!*
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
$ ./exampleB1
|
|
|
|
Available UI session types: [ Qt, tcsh, csh ]
|
|
|
|
|
|
|
|
**************************************************************
|
|
|
|
Geant4 version Name: geant4-11-03-patch-01 [MT] (21-March-2025)
|
|
|
|
<< in Multi-threaded mode >>
|
|
|
|
Copyright : Geant4 Collaboration
|
|
|
|
References : NIM A 506 (2003), 250-303
|
|
|
|
: IEEE-TNS 53 (2006), 270-278
|
|
|
|
: NIM A 835 (2016), 186-225
|
|
|
|
WWW : http://geant4.org/
|
|
|
|
**************************************************************
|
|
|
|
|
|
|
|
<<< Reference Physics List QBBC
|
|
|
|
|
|
|
|
...
|
|
|
|
<snip>
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
|
|
================== Deleting memory pools ===================
|
|
|
|
Pool ID '20G4NavigationLevelRep', size : 0.00288 MB
|
|
|
|
Pool ID '24G4ReferenceCountedHandleIvE', size : 0.000961 MB
|
|
|
|
Pool ID '17G4DynamicParticle', size : 0.000961 MB
|
|
|
|
Pool ID '24G4ClonedSmoothTrajectory', size : 0.000961 MB
|
|
|
|
Pool ID '29G4ClonedSmoothTrajectoryPoint', size : 0.000961 MB
|
|
|
|
Pool ID '15G4CountedObjectIvE', size : 0.000961 MB
|
|
|
|
Number of memory pools allocated: 6; of which, static: 0
|
|
|
|
Dynamic pools deleted: 6 / Total memory freed: 0.0077 MB
|
|
|
|
============================================================
|
|
|
|
G4Allocator objects are deleted.
|
|
|
|
UImanager deleted.
|
|
|
|
StateManager deleted.
|
|
|
|
RunManagerKernel is deleted. Good bye :)
|
|
|
|
RunManager is deleted.
|
|
|
|
```
|
|
|
|
|
|
|
|
## Tips ##
|
|
|
|
|
|
|
|
- Root
|
|
|
|
|
|
|
|
- ROOT comes with a web-based browser, which is now being started. Revert to TBrowser by setting "Browser.Name: TRootBrowser" in rootrc file. Or starting "root --web=off"
|
|
|
|
- libtbb must beinstalled `sudo apt install -y libtbb12`
|
|
|
|
|
|
|
|
- Geant4
|
|
|
|
- You check the Geant4 datasets installation using the command:
|
|
|
|
`geant4-config --check-datasets`
|
|
|
|
- `geant4-config --help` also shows the Geant4 features (configuration options)
|
|
|
|
|
|
|
|
Visit Geant4 installation Guide for more info:
|
|
|
|
http://geant4-userdoc.web.cern.ch/geant4-userdoc/UsersGuides/InstallationGuide/html/
|
|
|
|
|
|
|
|
- zsh
|
|
|
|
- If you use zsh you need to use .zprofile instead of .bash_profile
|
|
|
|
- Use *source* not *.* to source setup scripts
|
|
|
|
|
|
|
|
- git
|
|
|
|
- for latest git enable repository before installing git
|
|
|
|
|
|
|
|
`sudo add-apt-repository ppa:git-core/ppa` |