Software/Geant4/Installation: Difference between revisions

From PBTWiki
Jump to navigation Jump to search
Line 154: Line 154:
====== 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 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.
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.
Most packages are listed in the file in lines beginning <code>/vis/open</code> and can be uncommented to select, e.g.

Revision as of 02:28, 7 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.

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:

Geant4 Installation

Website
http://geant4.web.cern.ch/geant4/
Latest version
10.0.2 (13 June 2014)
Source tarball
src/geant4/geant4.10.00.p02.tar.gz

All the required software has now been installed, and GEANT4 itself can finally be installed.

Notes:

  • 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.

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

There are significant differences in the simulation results compared to 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