Software/Geant4/Installation: Difference between revisions

From PBTWiki
Jump to navigation Jump to search
(Created page with "== Installation of Geant4 and supporting packages in UCL PBT environment on HEP Linux servers == This document describes the steps taken to install Geant4 and related software w...")
 
No edit summary
 
(36 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Installation of Geant4 and supporting packages in UCL PBT environment on HEP Linux servers ==
== Installation Of Geant4 And Supporting Packages ==


This document describes the steps taken to install Geant4 and related software within the PBT environment on the UCL HEP Linux servers.
The [http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/InstallationGuide/html/index.html CERN Geant4 Installation Guide] provides extensive instructions on installing Geant4. 
This provides an overview of the installation procedure, as well as a list of prerequisites and additional software that need to be installed alongside Geant4.


* Title: Installation of Geant4 and supporting packages in UCL PBT environment on HEP Linux servers
In addition, information is given on the installation procedure for this additional software and the location the software is installed on the [[Software/Geant4/UCL HEP Cluster|UCL HEP Linux Cluster]].
* Author: Matt Easton
* Date created: 07/08/2014
* Version: 0.29
* Date modified: 30/09/2014


The <code>environment</code> described here is the combination of files, folders, settings and user interface that allow users to make use of <code>Geant4</code> and related software packages for particle beam therapy simulations.
The <code>environment</code> described here is the combination of files, folders, settings and user interface that allow users to make use of <code>Geant4</code> and related software packages for particle beam therapy simulations.
Line 15: Line 12:
* Terminal access to run simulations.
* Terminal access to run simulations.
* A visualisation engine such as OpenGL on X (''optional'').
* A visualisation engine such as OpenGL on X (''optional'').
* setting environment variables to point to installed software and scripts.
* Setting environment variables to point to installed software and scripts.
 
Two separate environments are provide for PBT simulations: the <code>production</code> environment for general use and the <code>development</code> environment for testing changes or updates to the code.
 
== Folder structure ==
 
=== Disk ===
 
There is a separate (large) disk for PBT work mounted on the Linux system at <code>/unix/pbt</code>.
 
=== Software ===
 
All software is enclosed in a folder at <code>/unix/pbt/software</code>.
 
=== Production and development environments ===
 
The production and development environments are kept in separate folders:
* <code>/unix/pbt/software/prod</code>
* <code>/unix/pbt/software/dev</code>
 
=== Source code ===
 
Source code for building and installing software packages is kept in a separate folder at <code>/unix/pbt/software/src</code>.
 
=== GNU Stow ===
 
Software is installed using the <code>GNU Stow</code> package for separating package code and linking to standard folders.
 
At installation time, each software package will be installed into a holding folder (such as <code>/unix/pbt/software/dev/stow/geant4-10.00.p02</code>) with subfolders under this holding folder for the usual Linux software folders such as <code>bin</code> and <code>lib</code>.
 
The <code>GNU Stow</code> package then handles linking of the software from the holding folders into the main folders of the relevant system.
For example, the file <code>/unix/pbt/software/dev/bin/geant4-config</code> is a soft link to <code>/unix/pbt/software/dev/stow/geant4-10.00.p02/bin/geant4-config</code>.
 
Links are added by calling <code>stow</code>, deleted by calling <code>stow -D</code>, and checked by calling <code>chkstow</code>.
See <code>GNU Stow</code> package documentation for more details.
 
== Scripts ==
 
Access to the PBT production and development environments is implemented by two scripts, <code>pbt.sh</code> and <code>pbt-dev.sh</code>.
These scripts are located in the <code>bin</code> folders of the production and development environments, respectively, and should be called directly by the user to set up all paths and environment variables required to make use of <code>Geant4</code> and related packages.
 
Aliases can be set up by the users to simplify running the scripts, such as: &gt; <code>alias pbt='source /unix/pbt/software/prod/bin/pbt.sh'</code> &gt; <code>alias pbt-dev='source /unix/pbt/software/dev/bin/pbt-dev.sh'</code>
 
Two other scripts are required as functions used by the setup scripts.
 
=== /unix/pbt/software/prod/bin/pbt.sh ===
 
This is a simple script that launches a new shell (using the Developer Toolset 2) and calls the setup script <code>pbt.bashrc</code>.
 
The Developer Toolset 2 (<code>devtoolset-2</code>) is a Linux software collection providing various tools for developers, most notably including a newer version of <code>GCC</code> (the '''GNU Compiler Collection''').
 
=== /unix/pbt/software/prod/bin/pbt.bashrc ===
 
This is a <code>bash</code> startup script that sets various environment variables and other settings so that all PBT software is available to use.
 
Steps taken:
# Run the user's own .bashrc
# Add locations to path variables
# Define colours for scripts, prompt, etc
# Greeting with information for users
# Notify user on exiting environment
# Modify prompt to show environment name
# Run <code>Geant4</code> setup script and set additional settings
# Remove duplicates from path variables
 
=== /unix/pbt/software/prod/bin/definecolours.sh ===
 
This script defines various variables to represent colours for printing to the terminal and to file.
 
=== /unix/pbt/software/prod/bin/checkversions.sh ===
 
This script checks the versions (and optionally the paths/locations) of important software packages used in the PBT environment.
 
== Installations ==
 
For each software package, the installation information is listed below.
The basic method used is as follows:
# Download the source tarball latest version to the <code>/unix/pbt/software/src</code> folder.
# Extract the tarball to a subfolder within the <code>src</code> folder using <code>tar -xvzf &lt;filename&gt;.tar.gz</code>.
# Create a build folder at <code>/unix/pbt/software/build</code> and set the working directory here.
# Run the specific configure, build and install steps for the package.
# Remove the build folder and extracted source folder, but keep the source tarball.
 
The configure, build and install steps may be different for each package, and this is described per package below.
However, in most cases the steps follow the general steps below:
# Change working directory to the build folder.
# Run the configuration script from the source folder to set the build options, including the customised installation prefix.
# Build the code.
# Install the code to the sandbox folder.
# Link to the sandboxed files using <code>GNU Stow</code>.


The order of installation is important, as some packages depend on having the other packages first.
The order of installation is important, as some packages depend on having the other packages first.
Line 110: Line 18:
The order of packages described below is the order in which these packages were installed into the PBT environment.
The order of packages described below is the order in which these packages were installed into the PBT environment.


=== GNU Stow ===
== Required Software ==
 
The list of required software is split into 2 categories:


; Website : http://www.gnu.org/software/stow/
* [[#Prerequisites|Prerequisites]] are those components that are required in order for some part of <code>Geant4</code> or the resulting simulation visualisations to function correctly;
; Latest version : 2.2.0 (18 February 2012)
* [[#Add Ons|Add Ons]] are optional pieces of software &mdash; normally visualisation software &mdash; that are installed on the [[Software/Geant4/UCL HEP Cluster|UCL HEP Linux Cluster]].
; Source tarball : <code>src/stow/stow-2.2.0.tar.gz</code>


Installation commands:
See the individually linked pages for information on building each of the components that do not ship by default.


<pre>
=== Prerequisites ===
cd /unix/pbt/software/build
../src/stow-2.2.0/configure --prefix=/unix/pbt/software/prod
make
make install prefix=/unix/pbt/software/prod/stow/stow-2.2.0
</pre>


Note that as <code>GNU Stow</code> is not yet installed, it cannot be used to stow itself...
The [http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/InstallationGuide/html/index.html CERN Geant4 Installation Guide] provides extensive information on
Hence this part has to be done manually.
[http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/InstallationGuide/html/ch01s02.html software that must be installed to compile Geant4 itself] and software required in order to
This is much easier when no other software has yet been installed, as in the commands below.
[http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/InstallationGuide/html/ch01s03.html compile optional components of Geant4].


The hidden file <code>.stow</code> informs <code>GNU Stow</code> that the <code>stow</code> folder is a special folder and should not be altered by the software.
These are:


Stow commands:
* A C++11 compatible compiler: on Linux, this is [https://gcc.gnu.org <code>GCC</code>: the GNU Compiler Collection] which is installed by default.
* [[/CMake|<code>CMake</code>]] required for building the various <code>Geant4</code> simulations through <code>cmake</code> files.
* The [[/CLHEP|<code>CLHEP</code> Class Library]] that provides a range of foundation and utility classes needed for <code>Geant4</code> simulations.


<pre>
* [https://www.opengl.org <code>OpenGL</code> headers and libraries] to provide support for <code>OpenGL</code> graphics (graphics card specific; installed by default on most Operating Systems).
cd /unix/pbt/software/prod
* [https://en.wikipedia.org/wiki/X_Window_System <code>X11</code>] headers and libraries to provide support for the <code>X</code>-Window system (installed by default on <nowiki>*</nowiki>nix systems
ln -s stow/stow-2.2.0/* .
* [[/Qt|<code>Qt4</code> or <code>Qt5</code> headers and libraries]] to provide support for the Qt user interface and visualisation.
touch stow/.stow
* [[/Xerces-C|<code>Xerces-C++</code> headers and libraries]] compiled against the C++11 standard to provide support for GDML geometry descriptions.
</pre>
* [http://www.opengroup.org/openmotif <code>Motif</code>] and X11 headers and libraries to provide support for the Motif user interface and visualisation (installed by default on Linux)
* [[/Coin3D|<code>Coin3D</code>]] for Open Inventor visualisation (<code>Coin3D</code> is a free implementation of Open Inventor).  This requires the following libraries to be installed:
** The [[/Coin3D#simage|<code>simage</code>]] library with image format loaders and front-ends to common import libraries. <code>simage</code> is meant for use with applications which read image files as textures. '''<code>simage</code> must be installed before <code>Coin3D</code>'''.
** The [[/Coin3D#SoXt|<code>SoXt</code>]] open source InventorXt library, which is a GUI binding for using Open Inventor with Xt/Motif. <code>SoXt</code> must be installed after <code>Coin3D</code>.
** [[/Coin3D#SoQt|<code>SoQt</code>]] open source <code>Qt</code> GUI component toolkit library for <code>Coin3D</code>. <code>SoQt</code> must be installed after <code>Coin3D</code>.


=== Qt4 ===
By default some of these will ship pre-installed with most modern Linux distributions: however the <code>expat</code> and <code>mesa</code> generally need to be installed alongside the software listed above.


; Website : http://qt-project.org
=== Add Ons ===
; Latest version : 4.8.6 (24 April 2014)
; Source tarball : <code>src/geant4-prerequisites/qt/qt-everywhere-opensource-src-4.8.6.tar.gz</code>


Notes:
The [http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/InstallationGuide/html/index.html CERN Geant4 Installation Guide] provides a range of
* <code>Qt5</code> version 5.3.1 is available but not officially supported by <code>Geant4</code>.
[http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/InstallationGuide/html/ch01s04.html software suggested for use with <code>Geant4</code>].
* For installation, <code>Qt4</code> does not support installation into a sandbox directory (i.e. there are no options <code>prefix</code> or <code>DESTDIR</code> defined for command <code>make install</code>). This has to be managed manually as can be seen in the installation and stow commands.
While none of these need to be installed for <code>Geant4</code> to compile and run, they are useful for visualising the resulting simulations.
* The tarball extracts to a rather long folder name. To follow the installation commands below, rename this to <code>src/qt-4.8.6</code>.


Installation commands:
The following subset is installed on the [[Software/Geant4/UCL HEP Cluster|UCL HEP Cluster]]:


<pre>
* The [[/DAWN|<code>DAWN</code>]] postscript renderer to support the DAWN visualisation driver.
cd /unix/pbt/software/build
* The [[/HepRApp|<code>HepRApp</code>]] Browser for use with the [http://www.slac.stanford.edu/~perl/heprep/ HepRep] visualisation driver.
../src/qt-4.8.6/configure -prefix /unix/pbt/software/prod -prefix-install -docdir /unix/pbt/software/prod/share/doc/qt4 -plugindir /unix/pbt/software/prod/share/qt-4.8.6/plugins -importdir /unix/pbt/software/prod/share/qt-4.8.6/imports -datadir /unix/pbt/software/prod/share/qt-4.8.6/data -translationdir /unix/pbt/software/prod/share/qt-4.8.6/translations -examplesdir /unix/pbt/software/prod/share/qt-4.8.6/examples -demosdir /unix/pbt/software/prod/share/qt-4.8.6/demos -release -opensource -optimized-qmake -opengl
* The [[/Java Analysis Studio|<code>Java Analysis Studio</code>]] (<code>JAS3</code>), along with the [[/Java Analysis Studio#WIRED4|<code>WIRED4 JAS Plug-IN</code>]] for use with the [http://www.slac.stanford.edu/~perl/heprep/ HepRep] visualisation driver.
make
* The [[/gMocren|<code>gMocren</code>]] volume visualiser for <code>Geant4</code> medical simulations.
make install
</pre>


Stow commands:
== Details ==


<pre>
; Website : http://geant4.web.cern.ch/geant4/
cd /unix/pbt/software/prod
; Source URL : http://geant4.web.cern.ch/geant4/support/download.shtml
mkdir -p stow/qt-4.8.6/bin
; Latest Production version : 10.2.p01 (26 Feb 2016)
mv bin/assistant bin/designer bin/lconvert bin/linguist bin/lrelease bin/lupdate bin/moc bin/pixeltool bin/q* bin/rcc bin/uic* bin/xml* stow/qt-4.8.6/bin/
; Source tarball : <code>src/geant4/geant4.10.02.p01.tar.gz</code>
mv include stow/qt-4.8.6/
; Latest Development version : 10.3.02.p02 (20 October 2017)
mkdir -p stow/qt-4.8.6/lib
; Central Repository : https://github.com/Geant4/geant4
mv lib/libQt* lib/pkgconfig stow/qt-4.8.6/lib/
mkdir -p stow/qt-4.8.6/share/doc
mv share/doc/qt4 stow/qt-4.8.6/share/doc/
mv share/qt-4.8.6 stow/qt-4.8.6/share/
mv tests stow/qt-4.8.6/share/
cd /unix/pbt/software/prod/stow
stow qt-4.8.6
</pre>


=== Xerces-C ===
== Installation Instructions ==


; Website : http://xerces.apache.org/xerces-c/
The installation process follows the general process described on the [[Software/Geant4/UCL HEP Cluster|UCL HEP Linux Cluster]] page.
; Latest version : 3.1.1 (27 April 2010)
The basic method used is as follows:
; Source tarball : <code>src/geant4-prerequisites/xerces-c/xerces-c-3.1.1.tar.gz</code>


Notes:
# Check that all the prerequisites for building <code>Geant4</code> are installed (see above);
* Version 3.0 is installed on the server, but some applications need the later version.
# Download the latest version of the source code;
# Extract the source code from the downloaded tarball;
# Create a build folder;
# Configure, build and install <code>Geant4</code> from within the build folder.


Installation commands:
=== Configure, Build and Install <code>Geant4</code> ===


<pre>
==== Installation from Central Repository ====
cd /unix/pbt/software/build
../src/xerces-c-3.1.1/configure --prefix=/unix/pbt/software/prod
make
make install prefix=/unix/pbt/software/prod/stow/xerces-c-3.1.1
</pre>


Stow commands:
After the latest version has been pulled from its [https://github.com/Geant4/geant4 central repository] and placed within /unix/pbt/software/src/geant4, create a build directory within the PBT software directory from which you can compile the code:  


<pre>
<pre>
cd /unix/pbt/software/prod/stow
cd /unix/pbt/software/build/
stow xerces-c-3.1.1
mkdir geant4
cd geant4
</pre>
</pre>


=== Coin3D ===
CMake can then be used to configure and install <code>Geant4</code>.
 
; Website : http://bitbucket.org/Coin3D/coin/wiki/Home
; Latest version : 3.1.3 (13 February 2012)
; Source tarball : <code>src/geant4-prerequisites/coin3d/Coin3d-3.1.3.tar.gz</code>
 
Notes:
* There are a number of programming errors in the Coin3D code. Most can be ignored and skipped over by adding the compiler flag <code>fpermissive</code> at the configuration step.
* One error needs to be fixed in the source code - the file <code>src/fonts/freetype.cpp</code> needs two lines inserted before the line <code>#include fonts/freetype.h</code>: <code>#include &lt;cstdlib&gt;</code> <code>#include &lt;cmath&gt;</code> This fix needs to be carried out (manually) using the <code>nano</code> editor, if the exact installation commands below are being used.
 
Installation commands:


<pre>
<pre>
cd /unix/pbt/software/build
cmake ../../src/geant4/
nano ../src/Coin-3.1.3/src/fonts/freetype.cpp
ccmake .
../src/Coin-3.1.3/configure --prefix=/unix/pbt/software/prod CXXFLAGS=-fpermissive
make
make install prefix=/unix/pbt/software/prod/stow/coin-3.1.3
</pre>
</pre>


Stow commands:
The command <code>ccmake .</code> opens an interactive GUI that can be used to specify installation options. From within this you can define your installation directory and configure any other options as required. On the PBT cluster it is required that the software is installed to the development directory and certain options are set, and so the configuration is defined as follows:


<pre>
<pre>
cd /unix/pbt/software/prod/stow
CMAKE_INSTALL_PREFIX            /unix/pbt/dev/geant-4.10.3.p02
stow coin-3.1.3
CMAKE_INSTALL_CONFIG_NAME        RelWithDebInfo
GEANT4_BUILD_MULTITHREADED      OFF
GEANT4_INSTALL_DATA              ON
GEANT4_BUILD_EXAMPLES            OFF
GEANT4_BUILD_TESTS              OFF
GEANT4_BUILD_STORE_TRAJECTORY    ON
GEANT4_BUILD_VERBOSE_CODE        ON
GEANT4_USE_G3TOG4                ON
GEANT4_USE_GDML                  ON
GEANT4_USE_INVENTOR              ON
GEANT4_USE_NETWORKDAWN          ON
GEANT4_USE_NETWORKVRML          ON
GEANT4_USE_OPENGL_X11            ON
GEANT4_USE_QT                    ON
GEANT4_USE_RAYTRACER_X11        ON
GEANT4_USE_SYSTEM_CLHEP          ON
GEANT4_USE_SYSTEM_EXPAT          ON
GEANT4_USE_SYSTEM_ZLIB          ON
GEANT4_USE_XM                    ON
</pre>
</pre>


=== SoXt library ===
'''Note:''' The option <code>GEANT4_BUILD_MULTITHREADED</code> is set to <code>OFF</code> to allow compatibility with <code>BDSIM</code>.  
 
; Website : http://bitbucket.org/Coin3D/soxt
; Latest version : 1.3.0 (2 March 2010)
; Source tarballs : <code>src/geant4-prerequisites/coin3d/SoXt-1.3.0.tar.gz</code> and <code>src/geant4-prerequisites/coin3d/sogui-2011-12-03.tar.gz</code>
 
Notes:
* This library is used by <code>Coin3D</code> and is in fact the link between <code>Geant4</code> and <code>Coin3D</code>.
* <code>Coin3D</code> must be installed before <code>SoXt</code>.
* <code>Geant4</code> must be installed after <code>SoXt</code>.
* There are a number of programming errors here as well. Again, the compiler flag <code>fpermissive</code> is required at the configuration step.
* The configuration tool cannot find the libraries it needs unless the environment variable <code>LD_RUN_PATH</code> is manually set to include <code>/unix/pbt/software/prod/lib</code>
* Part of the code required for compilation has been removed to a separate project called <code>SoGUI</code>. This GUI code needs to incorporated into the library code before compilation. The <code>SoGUI</code> source code is available in a separate tarball, <code>src/geant4-prerequisites/coin3d/sogui-2011-12-03.tar.gz</code>.
* Both tarballs extract to rather long folder names. To follow the installation commands below, rename these to <code>src/soxt</code> and <code>src/sogui</code> before starting the installation.
 
Installation commands:


<pre>
*''c'' to configure
cd /unix/pbt/software/build
mv ../src/sogui ../src/soxt/src/Inventor/Xt/common
export LD_RUN_PATH=/unix/pbt/software/prod/lib
../src/soxt/configure --prefix=/unix/pbt/software/prod CXXFLAGS=-fpermissive
make
make install prefix=/unix/pbt/software/prod/stow/soxt-1.3.0
unset LD_RUN_PATH
</pre>


Stow commands:
At this point, often the configuration is interrupted as the system cannot find all the necessary prerequisites. Enter any required base directories manually, e.g.


<pre>
<pre>
cd /unix/pbt/software/prod/stow
CLHEP_BASE_DIR                  /unix/pbt/software/dev/clhep-2.3.4.5
stow soxt-1.3.0
</pre>
</pre>


=== DAWN ===
*''c'' to configure
 
*''g'' to generate and exit
; Website : http://geant4.kek.jp/~tanaka/DAWN/About_DAWN.html
; Latest version : 3.90b (1 September 2010)
; Source tarball : <code>src/geant4-addons/dawn/dawn_3_90b.tar.gz</code>
 
Notes:
* DAWN uses a different type of configure script, and it is not possible to build the software in separate directory from the source. The configure script must be run inside the source directory.
* The configure script does not accept the installation prefix as a command-line parameter, but this can be set at the interactive prompt in the configure script.
* The makefile also does not accept an installation prefix to give the stow directory. This means that the four files installed for DAWN need to be moved manually after installation, and then stowed properly.


Options for configure script interactive prompt:
The software can then be installed using the usual commands:  
* Compiler name: <code>g++</code>
* Optimisation option: <code>-O2</code>
* Window shell name: <code>wish</code>
* Directory to install executable files: <code>/unix/pbt/software/prod/bin</code>
 
Installation commands:


<pre>
<pre>
./configure
make  
make
make install
make install
</pre>
</pre>  
 
Stow commands:
 
<pre>
cd /unix/pbt/software/prod
mkdir -p stow/dawn-3.90b/bin
mv bin/dawn stow/dawn-3.90b/bin/
mv bin/DAWN_GUI stow/dawn-3.90b/bin/
mv bin/dawnunixd stow/dawn-3.90b/bin/
mv bin/dawninetd stow/dawn-3.90b/bin/
cd stow
stow dawn-3.90b
</pre>


=== HepRApp ===
==== Installation from source code ====


; Website : http://www.slac.stanford.edu/~perl/HepRApp/
The <code>Geant4</code> source code can be downloaded from the [http://geant4.web.cern.ch/geant4/support/download.shtml Geant4 Download Page] of the [http://geant4.web.cern.ch/geant4/ Geant4 website] given above.
; Latest version : 3.15.0 (30 March 2007)
; Source file: <code>src/geant4-addons/heprapp/HepRApp.jar</code>


Note that this is a Java program and is very simply installed by copying the <code>.jar</code> file.
Unless there is a '''very''' good reason for not doing so, it is always recommended to use the latest version: each version features incremental improvements and bug fixes over earlier version and normally also features superior physics modelling.


Installation commands:
Alongside the <code>Geant4</code> download, there are also a number of data files available for modelling particular processes. 
These do not need to be downloaded separately as they can be added during <code>Geant4</code> installation by setting the <code>-DGEANT4_INSTALL_DATA=ON</code> compilation flag when running <code>cmake</code> (see below).


<pre>
The <code>Geant4</code> source code is normally downloaded as a single gzipped <code>tar</code>-file.
cd /unix/pbt/software
This needs to be extracted with the following command:
mkdir -p prod/stow/heprapp-3.15.0/bin
cp src/geant4-addons/heprapp/HepRApp.jar prod/stow/heprapp-3.15.0/bin
</pre>
 
Stow commands:


<pre>
<pre>
cd /unix/pbt/software/prod/stow
tar -xvz -f geant4.10.02.p01.tar.gz
stow heprapp-3.15.0
</pre>
</pre>


=== Java Analysis Studio 3 (Jas3) ===
This will extract the <code>Geant4</code> source code into a directory alongside the <code>tar</code>-file. 
This directory can be renamed: it does not need to be kept the same for the installation described below to work, although the correct directory name should be substituted for the default name used below.


; Website : http://jas.freehep.org/jas3/
Once the source code has been extracted, a <code>build</code> directory should be created alongside the <code>src</code> to hold the compiled <code>Geant4</code> files before they are moved to their final installation location.
; Latest version : 3.0.12 (30 July 2014) Installed version: 3.0.9
; Source tarball : <code>src/geant4-addons/wired4/jas-assembly-3.0.9-distribution.tar.gz</code>


Notes:
On the [[Software/Geant4/UCL HEP Cluster|UCL HEP Linux Cluster]], the <code>build</code> directory should be created in <code>/unix/pbt/software/build</code>:
* This is also a Java program, but with multiple files and a library subfolder.
* The files <code>jas3.*</code> are not needed on our Linux system, and can be omitted for clarity in the <code>bin</code> folder.
* As the program does not require compilation, the stowed folder can be copied directly from the development environment to the production environment.
* Installing a new version in the development environment will simply require copying the <code>jas3</code> executable and the <code>lib</code> folder into a new stow folder.
* The latest version has not yet been tested, hence installing version 3.0.9 in the production environment.
* Version 3.0.11 was tested and found to crash repeatedly, hence version 3.0.12 will need to be tested in the development environment to see if this has been fixed.
 
Installation commands:


<pre>
<pre>
cd /unix/pbt/software
cd /unix/pbt/software/build
cp dev/stow/jas-assembly-3.0.9 prod/stow/
mkdir geant4
cd geant4
mkdir geant4.10.02.p01-build
cd geant4.10.02.p01-build
</pre>
</pre>


Stow commands:
Unlike other software installed on the [[Software/Geant4/UCL HEP Cluster|UCL HEP Linux Cluster]], there are a number of ways to configure the software before building.
 
Using the <code>ccmake</code> command, each configuration option can be set interactively.
<pre>
Alternatively, the <code>cmake</code> command below configures with the recommended options.
cd /unix/pbt/software/prod/stow
stow jas-assembly-3.0.9
</pre>
 
==== WIRED 4 plugin ====
 
; Website : http://wired.freehep.org
; Latest version : 4.3.6
 
This is a plugin for <code>Java Analysis Studio 3</code>.
It is downloaded and installed through the plugin manager.
 
Installation instructions:
# From within the PBT environment, run <code>Java Analysis Studio 3</code> by typing <code>jas3</code>.
# From the <code>View</code> menu, select <code>Plugin Manager</code>.
# If the plugin is already installed, it will be visible in the <code>Installed</code> tab of the plugin manager, filed in the <code>system</code> group.
# If the plugin is not installed, it can be found in the <code>Available</code> tab, filed under  <code>hep &gt; visualisation</code>.
# Select the <code>WIRED 4</code> plugin and choose the option <code>Install in system extension directory</code>.
# Click <code>Install selected plugins</code>.
# All required dependencies will be installed automatically.
 
Note that installing plugins will create, or change the contents of, the <code>extensions</code> folder relative to the <code>jas3</code> executable.
These changes will normally be picked up without needing to re-stow the folder.
 
=== gMocren ===
 
; Website : http://geant4.kek.jp/gMocren/
; Latest version : unknown Installed version: 4.2 (29 September 2011)
; Source tarball : <code>src/geant4-addons/gmocren/gMocren4-slc5.7-64bit-20110929.tar.gz</code>


This specialist medical physics software is only available on request from the developers.
Note that the <code>-DCMAKE_INSTALL_PREFIX="/unix/pbt/software/prod-sl6"</code> flag specifies that the resulting <code>Geant4</code> should be installed in the directory <code>/unix/pbt/software/prod-sl6</code> after compilation: this should be changed to suit the particular installation in question.
The tarball contains compiled binaries for the Scientific Linux 5 servers, rather than source code, so installation on other machines will need a different version to be requested from the developers.
 
As the software is already compiled, installation only requires moving these files (extracted from the tarball) to the right place.


Installation commands:
Installation commands:


<pre>
<pre>
cd /unix/pbt/software
cd /unix/pbt/software/build/geant4/geant4.10.02.p01-prod-sl6
mkdir -p prod/stow/gmocren-4.2
mv src/gMocren4 prod/stow/gmocren-4.2/bin
</pre>


Stow commands:
cmake \
-DCMAKE_INSTALL_PREFIX="/unix/pbt/software/prod-sl6" \
-DCMAKE_INSTALL_CONFIG_NAME="ReleaseWithDebInfo" \
-DGEANT4_BUILD_MULTITHREADED=ON \
-DGEANT4_INSTALL_DATA=ON \
-DGEANT4_BUILD_EXAMPLES=OFF \
-DGEANT4_BUILD_TESTS=OFF \
-DGEANT4_ENABLE_TESTING=OFF \
-DGEANT4_BUILD_STORE_TRAJECTORY=ON \
-DGEANT4_BUILD_VERBOSE_CODE=ON \
-DGEANT4_USE_G3TOG4=ON \
-DGEANT4_USE_GDML=ON \
-DGEANT4_USE_INVENTOR=ON \
-DGEANT4_USE_NETWORKDAWN=ON \
-DGEANT4_USE_NETWORKVRML=ON \
-DGEANT4_USE_OPENGL_X11=ON \
-DGEANT4_USE_QT=ON \
-DGEANT4_USE_RAYTRACER_X11=ON \
-DGEANT4_USE_SYSTEM_CLHEP=ON \
-DGEANT4_USE_SYSTEM_EXPAT=ON \
-DGEANT4_USE_SYSTEM_ZLIB=ON \
-DGEANT4_USE_XM=ON \
/unix/pbt/software/src/geant4/geant4.10.02.p01-source


<pre>
cd /unix/pbt/software/prod/stow
stow gmocren-4.2
</pre>
=== Geant4 ===
; Website : http://geant4.web.cern.ch/geant4/
; Latest version : 10.0.2 (13 June 2014)
; Source tarball : <code>src/geant4/geant4.10.00.p02.tar.gz</code>
All the required software has now been installed, and <code>GEANT4</code> itself can finally be installed.
Notes:
* There are a number of ways to configure the software before building. The simplest is <code>cmake</code>, where each configuration option can be seen clearly and set individually. The command below bypasses this to use an explicit set of options.
* The makefile doesn't support <code>make install prefix</code>, and so <code>DESTDIR</code> must be used instead, and the files moved after installation.
Installation commands:
<pre>
cmake -DCMAKE_INSTALL_PREFIX=&quot;/unix/pbt/software/prod&quot; -DCMAKE_INSTALL_CONFIG_NAME=&quot;Release&quot; -DGEANT4_BUILD_MULTITHREADED=ON -DGEANT4_INSTALL_DATA=ON -DGEANT4_BUILD_EXAMPLES=OFF -DGEANT4_BUILD_TESTS=OFF -DGEANT4_ENABLE_TESTING=OFF -DGEANT4_BUILD_STORE_TRAJECTORY=ON -DGEANT4_BUILD_VERBOSE_CODE=ON -DGEANT4_USE_G3TOG4=ON -DGEANT4_USE_GDML=ON -DGEANT4_USE_INVENTOR=ON -DGEANT4_USE_NETWORKDAWN=ON -DGEANT4_USE_NETWORKVRML=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_QT=ON -DGEANT4_USE_RAYTRACER_X11=ON -DGEANT4_USE_SYSTEM_CLHEP=OFF -DGEANT4_USE_SYSTEM_EXPAT=ON -DGEANT4_USE_SYSTEM_ZLIB=OFF -DGEANT4_USE_USOLIDS=OFF -DGEANT4_USE_WT=OFF -DGEANT4_USE_XM=ON -DINVENTOR_INCLUDE_DIR=/unix/pbt/software/prod/include -DINVENTOR_LIBRARY=/unix/pbt/software/prod/lib/libCoin.so -DINVENTOR_SOXT_INCLUDE_DIR=/unix/pbt/software/prod/include -DINVENTOR_SOXT_LIBRARY=/unix/pbt/software/prod/lib/libSoXt.so -DQT_QMAKE_EXECUTABLE=/unix/pbt/software/prod/bin/qmake -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=OFF -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_USE_RELATIVE_PATHS=OFF -DCMAKE_VERBOSE_MAKEFILE=OFF ../src/geant4.10.00.p02
make
make
make install DESTDIR=/unix/pbt/software/prod/stow/geant4-10.0.2
make install
</pre>
 
Stow commands:
 
<pre>
cd /unix/pbt/software/prod/stow
mv geant4-10.0.2/unix/pbt/software/prod/* geant4-10.0.2/
rm -r geant4-10.0.2/unix
stow geant4-10.0.2
</pre>
</pre>


Line 442: Line 234:
Notes:
Notes:
* The examples can be built at installation time using the command <code>-DGEANT4_BUILD_EXAMPLES=ON</code>, but this throws up a number of problems because not all installation requirements are met. It is easier to build and run the examples after the installation is complete.
* The examples can be built at installation time using the command <code>-DGEANT4_BUILD_EXAMPLES=ON</code>, but this throws up a number of problems because not all installation requirements are met. It is easier to build and run the examples after the installation is complete.
* Environment variable <code>G4SHARE</code> is defined in the environment scripts <code>pbt.bashrc</code> and <code>pbt-dev.bashrc</code>, along with the variable <code>G4VERSION</code>. For the current installation, the location stored in this variable is <code>/unix/pbt/software/prod/share/Geant4-10.0.2</code>
* Environment variable <code>G4SHARE</code> is defined in the environment scripts <code>pbt.bashrc</code> and <code>pbt-dev.bashrc</code>, along with the variable <code>G4VERSION</code>. For the current installation, the location stored in this variable is <code>/unix/pbt/software/dev/share/Geant4-10.0.2</code>


The following errors and warnings were seen while configuring examples:
The following errors and warnings were seen while configuring examples:
Line 451: Line 243:
* Cannot find <code>GCCXML</code> These packages are optional, but some of the examples are designed to demonstrate the connection with these packages. Note that some filetypes, such as <code>AIDA</code> and <code>HBOOK</code>, do in fact have viewers installed in the PBT environments, but these are not available to the <code>GEANT4</code> system. This what the errors are reporting.
* Cannot find <code>GCCXML</code> These packages are optional, but some of the examples are designed to demonstrate the connection with these packages. Note that some filetypes, such as <code>AIDA</code> and <code>HBOOK</code>, do in fact have viewers installed in the PBT environments, but these are not available to the <code>GEANT4</code> system. This what the errors are reporting.


==== Basic examples ====
=== Basic examples ===


===== B1 =====
==== B1 ====


<pre>
<pre>
cp -r ${G4SHARE}/examples/basic/B1 . mkdir build cd build cmake ../B1 make ./exampleB1 exampleB1.in | tee exampleB1.new.out grep -B0 -A3 &quot;End of Global Run&quot; exampleB1.out &gt; exampleB1.old.results grep -B0 -A3 &quot;End of Global Run&quot; exampleB1.new.out &gt; exampleB1.new.results diff exampleB1.old.results exampleB1.new.results
cp -r ${G4SHARE}/examples/basic/B1 .  
 
mkdir build  
cd build  
cmake ../B1  
make  
./exampleB1 exampleB1.in | tee exampleB1.new.out  
grep -B0 -A3 &quot;End of Global Run&quot; exampleB1.out &gt; exampleB1.old.results  
grep -B0 -A3 &quot;End of Global Run&quot; exampleB1.new.out &gt; exampleB1.new.results  
diff exampleB1.old.results exampleB1.new.results
</pre>
</pre>


There seem to be significant differences in the simulation results compared to the included <code>exampleB1.out</code> file.
The newly generated simulation results contain similar but not identical values to those in the included <code>exampleB1.out</code> file.
The reason for these differences is unclear.
This is due to the fact that the results depend on the initial state of the random number generator. The random seed used to generate the example output is unknown.
 
==== B1 visualisation ====
 
The example, when run without arguments, opens in interactive mode using the visualisation driver selected in the file vis.mac:
 
<pre>
./exampleB1
</pre>
 
The various visualisation packages can be tested by editing vis.mac to select the appropriate package. Some drivers create an interactive view of the simulation geometry. Others write to a file which can be viewed using an external software package e.g. DAWN - see the [http://geant4.web.cern.ch/geant4/G4UsersDocuments/UsersGuides/ForApplicationDeveloper/html/Visualization/introduction.html geant manual] for details.
 
Most packages are listed in the file in lines beginning <code>/vis/open</code> and can be uncommented to select, e.g.
 
<pre>
/vis/open OGL 600x600-0+0
</pre>
 
RayTracerX is not listed in the file but can be enabled by uncommenting the other /vis/open lines and adding the following line:
 
<pre>
/vis/open RayTracerX
</pre>

Latest revision as of 10:48, 20 October 2017

Installation Of Geant4 And Supporting Packages

The CERN Geant4 Installation Guide provides extensive instructions on installing Geant4. This provides an overview of the installation procedure, as well as a list of prerequisites and additional software that need to be installed alongside Geant4.

In addition, information is given on the installation procedure for this additional software and the location the software is installed on the UCL HEP Linux Cluster.

The environment described here is the combination of files, folders, settings and user interface that allow users to make use of Geant4 and related software packages for particle beam therapy simulations.

Accessing the environment requires the following:

  • Access to the filesystem and required folders.
  • Terminal access to run simulations.
  • A visualisation engine such as OpenGL on X (optional).
  • Setting environment variables to point to installed software and scripts.

The order of installation is important, as some packages depend on having the other packages first. In some cases, installations will be successful if carried out in the wrong order, but some features will be disabled that should be enabled. The order of packages described below is the order in which these packages were installed into the PBT environment.

Required Software

The list of required software is split into 2 categories:

  • Prerequisites are those components that are required in order for some part of Geant4 or the resulting simulation visualisations to function correctly;
  • Add Ons are optional pieces of software — normally visualisation software — that are installed on the UCL HEP Linux Cluster.

See the individually linked pages for information on building each of the components that do not ship by default.

Prerequisites

The CERN Geant4 Installation Guide provides extensive information on software that must be installed to compile Geant4 itself and software required in order to compile optional components of Geant4.

These are:

  • A C++11 compatible compiler: on Linux, this is GCC: the GNU Compiler Collection which is installed by default.
  • CMake required for building the various Geant4 simulations through cmake files.
  • The CLHEP Class Library that provides a range of foundation and utility classes needed for Geant4 simulations.
  • OpenGL headers and libraries to provide support for OpenGL graphics (graphics card specific; installed by default on most Operating Systems).
  • X11 headers and libraries to provide support for the X-Window system (installed by default on *nix systems
  • Qt4 or Qt5 headers and libraries to provide support for the Qt user interface and visualisation.
  • Xerces-C++ headers and libraries compiled against the C++11 standard to provide support for GDML geometry descriptions.
  • Motif and X11 headers and libraries to provide support for the Motif user interface and visualisation (installed by default on Linux)
  • Coin3D for Open Inventor visualisation (Coin3D is a free implementation of Open Inventor). This requires the following libraries to be installed:
    • The simage library with image format loaders and front-ends to common import libraries. simage is meant for use with applications which read image files as textures. simage must be installed before Coin3D.
    • The SoXt open source InventorXt library, which is a GUI binding for using Open Inventor with Xt/Motif. SoXt must be installed after Coin3D.
    • SoQt open source Qt GUI component toolkit library for Coin3D. SoQt must be installed after Coin3D.

By default some of these will ship pre-installed with most modern Linux distributions: however the expat and mesa generally need to be installed alongside the software listed above.

Add Ons

The CERN Geant4 Installation Guide provides a range of software suggested for use with Geant4. While none of these need to be installed for Geant4 to compile and run, they are useful for visualising the resulting simulations.

The following subset is installed on the UCL HEP Cluster:

Details

Website
http://geant4.web.cern.ch/geant4/
Source URL
http://geant4.web.cern.ch/geant4/support/download.shtml
Latest Production version
10.2.p01 (26 Feb 2016)
Source tarball
src/geant4/geant4.10.02.p01.tar.gz
Latest Development version
10.3.02.p02 (20 October 2017)
Central Repository
https://github.com/Geant4/geant4

Installation Instructions

The installation process follows the general process described on the UCL HEP Linux Cluster page. The basic method used is as follows:

  1. Check that all the prerequisites for building Geant4 are installed (see above);
  2. Download the latest version of the source code;
  3. Extract the source code from the downloaded tarball;
  4. Create a build folder;
  5. Configure, build and install Geant4 from within the build folder.

Configure, Build and Install Geant4

Installation from Central Repository

After the latest version has been pulled from its central repository and placed within /unix/pbt/software/src/geant4, create a build directory within the PBT software directory from which you can compile the code:

cd /unix/pbt/software/build/
mkdir geant4
cd geant4

CMake can then be used to configure and install Geant4.

cmake ../../src/geant4/
ccmake .

The command ccmake . opens an interactive GUI that can be used to specify installation options. From within this you can define your installation directory and configure any other options as required. On the PBT cluster it is required that the software is installed to the development directory and certain options are set, and so the configuration is defined as follows:

CMAKE_INSTALL_PREFIX             /unix/pbt/dev/geant-4.10.3.p02
CMAKE_INSTALL_CONFIG_NAME        RelWithDebInfo
GEANT4_BUILD_MULTITHREADED       OFF
GEANT4_INSTALL_DATA              ON
GEANT4_BUILD_EXAMPLES            OFF
GEANT4_BUILD_TESTS               OFF
GEANT4_BUILD_STORE_TRAJECTORY    ON
GEANT4_BUILD_VERBOSE_CODE        ON
GEANT4_USE_G3TOG4                ON
GEANT4_USE_GDML                  ON
GEANT4_USE_INVENTOR              ON
GEANT4_USE_NETWORKDAWN           ON
GEANT4_USE_NETWORKVRML           ON
GEANT4_USE_OPENGL_X11            ON
GEANT4_USE_QT                    ON
GEANT4_USE_RAYTRACER_X11         ON
GEANT4_USE_SYSTEM_CLHEP          ON
GEANT4_USE_SYSTEM_EXPAT          ON
GEANT4_USE_SYSTEM_ZLIB           ON
GEANT4_USE_XM                    ON

Note: The option GEANT4_BUILD_MULTITHREADED is set to OFF to allow compatibility with BDSIM.

  • c to configure

At this point, often the configuration is interrupted as the system cannot find all the necessary prerequisites. Enter any required base directories manually, e.g.

CLHEP_BASE_DIR                   /unix/pbt/software/dev/clhep-2.3.4.5
  • c to configure
  • g to generate and exit

The software can then be installed using the usual commands:

make 
make install

Installation from source code

The Geant4 source code can be downloaded from the Geant4 Download Page of the Geant4 website given above.

Unless there is a very good reason for not doing so, it is always recommended to use the latest version: each version features incremental improvements and bug fixes over earlier version and normally also features superior physics modelling.

Alongside the Geant4 download, there are also a number of data files available for modelling particular processes. These do not need to be downloaded separately as they can be added during Geant4 installation by setting the -DGEANT4_INSTALL_DATA=ON compilation flag when running cmake (see below).

The Geant4 source code is normally downloaded as a single gzipped tar-file. This needs to be extracted with the following command:

tar -xvz -f geant4.10.02.p01.tar.gz

This will extract the Geant4 source code into a directory alongside the tar-file. This directory can be renamed: it does not need to be kept the same for the installation described below to work, although the correct directory name should be substituted for the default name used below.

Once the source code has been extracted, a build directory should be created alongside the src to hold the compiled Geant4 files before they are moved to their final installation location.

On the UCL HEP Linux Cluster, the build directory should be created in /unix/pbt/software/build:

cd /unix/pbt/software/build
mkdir geant4
cd geant4
mkdir geant4.10.02.p01-build
cd geant4.10.02.p01-build

Unlike other software installed on the UCL HEP Linux Cluster, there are a number of ways to configure the software before building. Using the ccmake command, each configuration option can be set interactively. Alternatively, the cmake command below configures with the recommended options.

Note that the -DCMAKE_INSTALL_PREFIX="/unix/pbt/software/prod-sl6" flag specifies that the resulting Geant4 should be installed in the directory /unix/pbt/software/prod-sl6 after compilation: this should be changed to suit the particular installation in question.

Installation commands:

cd /unix/pbt/software/build/geant4/geant4.10.02.p01-prod-sl6

cmake \
-DCMAKE_INSTALL_PREFIX="/unix/pbt/software/prod-sl6" \
-DCMAKE_INSTALL_CONFIG_NAME="ReleaseWithDebInfo" \
-DGEANT4_BUILD_MULTITHREADED=ON \
-DGEANT4_INSTALL_DATA=ON \
-DGEANT4_BUILD_EXAMPLES=OFF \
-DGEANT4_BUILD_TESTS=OFF \
-DGEANT4_ENABLE_TESTING=OFF \
-DGEANT4_BUILD_STORE_TRAJECTORY=ON \
-DGEANT4_BUILD_VERBOSE_CODE=ON \
-DGEANT4_USE_G3TOG4=ON \
-DGEANT4_USE_GDML=ON \
-DGEANT4_USE_INVENTOR=ON \
-DGEANT4_USE_NETWORKDAWN=ON \
-DGEANT4_USE_NETWORKVRML=ON \
-DGEANT4_USE_OPENGL_X11=ON \
-DGEANT4_USE_QT=ON \
-DGEANT4_USE_RAYTRACER_X11=ON \
-DGEANT4_USE_SYSTEM_CLHEP=ON \
-DGEANT4_USE_SYSTEM_EXPAT=ON \
-DGEANT4_USE_SYSTEM_ZLIB=ON \
-DGEANT4_USE_XM=ON \
/unix/pbt/software/src/geant4/geant4.10.02.p01-source

make
make install

Testing

Software package tests

GEANT4 built-in tests

The GEANT4 software includes some system tests, which can be included in the installation command via the options -DGEANT4_BUILD_TESTS=ON -DGEANT4_ENABLE_TESTING=ON. However, these tests are only used for testing of the system, and are not included in the distributed source tarballs, nor supported for use by end-users. Therefore, these cannot easily be used for validation of the production system installation.

GEANT4 examples

One test of the GEANT4 software after installation is to make sure that all examples can be run and produce the expected results.

Notes:

  • The examples can be built at installation time using the command -DGEANT4_BUILD_EXAMPLES=ON, but this throws up a number of problems because not all installation requirements are met. It is easier to build and run the examples after the installation is complete.
  • Environment variable G4SHARE is defined in the environment scripts pbt.bashrc and pbt-dev.bashrc, along with the variable G4VERSION. For the current installation, the location stored in this variable is /unix/pbt/software/dev/share/Geant4-10.0.2

The following errors and warnings were seen while configuring examples:

  • Cannot find AIDA package
  • Cannot find HBOOK package
  • Cannot find HepMC package
  • Cannot find Pythia6 package
  • Cannot find GCCXML These packages are optional, but some of the examples are designed to demonstrate the connection with these packages. Note that some filetypes, such as AIDA and HBOOK, do in fact have viewers installed in the PBT environments, but these are not available to the GEANT4 system. This what the errors are reporting.

Basic examples

B1

cp -r ${G4SHARE}/examples/basic/B1 . 

mkdir build 
cd build 
cmake ../B1 
make 
./exampleB1 exampleB1.in | tee exampleB1.new.out 
grep -B0 -A3 "End of Global Run" exampleB1.out > exampleB1.old.results 
grep -B0 -A3 "End of Global Run" exampleB1.new.out > exampleB1.new.results 
diff exampleB1.old.results exampleB1.new.results

The newly generated simulation results contain similar but not identical values to those in the included exampleB1.out file. This is due to the fact that the results depend on the initial state of the random number generator. The random seed used to generate the example output is unknown.

B1 visualisation

The example, when run without arguments, opens in interactive mode using the visualisation driver selected in the file vis.mac:

./exampleB1

The various visualisation packages can be tested by editing vis.mac to select the appropriate package. Some drivers create an interactive view of the simulation geometry. Others write to a file which can be viewed using an external software package e.g. DAWN - see the geant manual for details.

Most packages are listed in the file in lines beginning /vis/open and can be uncommented to select, e.g.

/vis/open OGL 600x600-0+0

RayTracerX is not listed in the file but can be enabled by uncommenting the other /vis/open lines and adding the following line:

/vis/open RayTracerX