Software/Geant4/Installation: Difference between revisions

From PBTWiki
Jump to navigation Jump to search
No edit summary
Line 48: Line 48:
** 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>.
** 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>.
** [[/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>.
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.


=== Add Ons ===
=== Add Ons ===
Line 62: Line 64:
* The [[/gMocren|<code>gMocren</code>]] volume visualiser for <code>Geant4</code> medical simulations.
* The [[/gMocren|<code>gMocren</code>]] volume visualiser for <code>Geant4</code> medical simulations.


== Geant4 Installation ==
== Details ==


; Website : http://geant4.web.cern.ch/geant4/
; Website : http://geant4.web.cern.ch/geant4/
; Latest version : 10.0.2 (13 June 2014)
; Source URL : http://geant4.web.cern.ch/geant4/support/download.shtml
; Source tarball : <code>src/geant4/geant4.10.00.p02.tar.gz</code>
; Latest version : 10.2.p01 (26 Feb 2016)
; Source tarball : <code>src/geant4/geant4.10.02.p01.tar.gz</code>
 
== Installation Instructions ==
 
The installation process follows the general process described on the [[Software/Geant4/UCL HEP Cluster|UCL HEP Linux Cluster]] page. 
The basic method used is as follows:
 
# Check that all the prerequisites for building <code>Geant4</code> are installed (see above);
# 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.


All the required software has now been installed, and <code>GEANT4</code> itself can finally be installed.
=== Download and Extract <code>Geant4</code> Source Code ===


Notes:
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. 
* 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. Alternatively, the cmake command below configures with the recommended options.  
 
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 <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).
 
The <code>Geant4</code> source code is normally downloaded as a single gzipped <code>tar</code>-file. 
This needs to be extracted with the following command:
 
<pre>
tar -xvz -f geant4.10.02.p01.tar.gz
</pre>
 
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.
 
=== Configure, Build and Install <code>Geant4</code> ===
 
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.
 
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>:
 
<pre>
cd /unix/pbt/software/build
mkdir geant4
cd geant4
mkdir geant4.10.02.p01-build
cd geant4.10.02.p01-build
</pre>
 
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.
Alternatively, the <code>cmake</code> command below configures with the recommended options
 
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.


Installation commands:
Installation commands:
Line 104: Line 152:
make
make
make install
make install
</pre>
</pre>


Line 132: Line 179:
* 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>
Line 152: Line 199:
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.
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 ======
==== B1 visualisation ====


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

Revision as of 14:53, 24 June 2016

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 version
10.2.p01 (26 Feb 2016)
Source tarball
src/geant4/geant4.10.02.p01.tar.gz

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.

Download and Extract Geant4 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.

Configure, Build and Install Geant4

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