Geant4 Installation
Giada Petringa
Laboratori Nazionali del Sud (LNS-INFN)
Geant4 Beginners Course (TUM - Munich) 1
Installation process
1)Check that you meet all the requirements
2)Download Geant4 source code
3)Configure the build using CMake
4)Make & install
5)Configure your environment to use Geant4
Geant4 Beginners Course (TUM - Munich) 2
① Supported platforms & requirements
Virtual Ma
ch
• Operating system CentOS 7 ine:
with gcc 4.
8.5
– “recent” Linux (e.g. CentOS 7), best support
– macOS 10.10+
– Windows 7+ (limited support, not recommended)
• Compilers
– C++11 compliance
– such as GCC 4.8.5+, clang 3.6+, Visual C++ 14.0 (2015)
• CMake (configuration generation tool) 3.3+
• System libraries (as development packages):
– expat, xerces-c
These may or may not be necessary. Just keep this in mind when compilation fails.
Geant4 Beginners Course (TUM - Munich) 3
CMake installation (if not provided)
• Depending on the OS installation, CMake may not be
installed by default. In that case you have to install it:
– Linux: it is recommended to use the CMake provided by the
package management system of your distribution.
If version 3.3+ is not available:
1. download the latest version (http://www.cmake.org/)
2. unzip the tar-ball
3. ./bootstrap, make, make install
– macOS: install it using the Darwin64 dmg installerpackage
– Windows: install it using the Win64/32 exe installerpackage
Note: You may also want to install ccmake and/or cmake-gui tools for user-friendly configuration
Geant4 Beginners Course (TUM - Munich) 4
Optional libraries
• X11 for simple graphical user interface and
ray-tracing
• OpenGL for visualization
• Qt4 or Qt5 for graphical user interface
• ROOT for data analysis (even inside Geant4)
Less frequently used libraries/tools:
Motif, OpenInventor, DAWN, RayTracer X11,
HepRApp, WIRED JAS Plug-in, AIDA, VRML browser,
(external) CLHEP, Wt...
Geant4 Beginners Course (TUM - Munich) 5
and now…. we can proceed
Geant4 Beginners Course (TUM University - Munich)
Geant4 Installation
Download the code
http
s ://ge
ant4
.web
.c ern.
ch/g
ean
t4/
Extract the file
$ cd Downloads
$ tar -xzf geant4.10.04.tar.gz
Geant4 Beginners Course (TUM - Munich) 7
Geant4 Installation
Geant4 Beginners Course (TUM - Munich) 8
Geant4 Installation
Choose a path for your installation
$ cd Desktop
Create a new directory
$ mkdir Geant4
$ cd Geant4
Copy the source code in the new directory
$ cd /home/user/Downloads
$ cp -r geant4.10.04/home/user/Desktop/Geant4
Geant4 Beginners Course (TUM - Munich) 9
Geant4 Installation
Choose a path for your installation
$ cd Desktop
Create a new directory
$ mkdir Geant4
$ cd Geant4
Copy the source code in the new directory
$ cd /home/user/Downloads
$ cp -r geant4.10.04 /home/user/Desktop/Geant4
What? Where?
Geant4 Beginners Course (TUM - Munich) 10
Geant4 Installation
Choose a path for your installation
$ cd Desktop
Create a new directory
$ mkdir Geant4
Geant4 Beginners Course (TUM - Munich) 11
Geant4 Installation
Create the folder build
$ cd /home/user/Desktop/Geant4
$ ls
$ mkdir geant4.10.04-build
$ cd geant4.10.04-build
$ cmake -DCMAKE_INSTALL_PREFIX=/home/user/Desktop/
Geant4/geant4.10.04-install
-DGEANT4_INSTALL_DATA=ON
-DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_QT=ON
/home/user/Desktop/Geant4/geant4.10.04
Geant4 Beginners Course (TUM - Munich) 12
Geant4 Installation
the additional
the directory under which
external data
the Geant4 libraries,
libraries are
set the install headers and support files
automatically
directory will be installed.
downloaded
$ cmake -DCMAKE_INSTALL_PREFIX=/home/user/Desktop/
Geant4/geant4.10.04-install -DGEANT4_INSTALL_DATA=ON
-DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_QT=ON
/home/user/Desktop/Geant4/geant4.10.04
build the X11 OpenGL build the Qt visualization driver
visualization driver
Geant4 Beginners Course (TUM - Munich) 13
Other Options
Important options:
-DCMAKE_INSTALL_PREFIX= … installation_path
-DGEANT4_INSTALL_DATA=ON/OFF
-DGEANT4_BUILD_MULTITHREADED=ON/OFF
Further options:
-DGEANT4_USE_OPENGL_X11=ON/OFF
-DGEANT4_USE_QT=ON/OFF
……
Geant4 Beginners Course (TUM - Munich) 14
Geant4 Installation
Start the Geant4 installation
$ make -jN
$ make install
and
wait….
each time you open a new shell remember to source the
geant4.sh script before executing an application !!!
Geant4 Beginners Course (TUM - Munich) 15
Geant4 Beginners Course (TUM - Munich) 16