Previously Recommended Procedure V6.1

From Wiki OpenGATE
Jump to: navigation, search

The installation of the different software as explained below is a recommended approach for which no super-user privileges are required, and which avoids possible mismatches and dysfunctions between these software. Other approaches are obviously possible for other configurations.

First, you should create a directory that will contain every software required for running Gate (CLHEP, Geant4, Root and Gate). This directory will be later referred to as $GATE_ROOT. It is recommended to download the complete source tree for each software and to compile them so as to have a safe compatibility with your system. So please download all required packages from each website and keep them on hand. The downloaded files should be archive files of gzip type ('.tar.gz', or '.tgz'). Here is a possible non-exhaustive list of these packages:

  • Clhep sources www.cern.ch/clhep
  • Geant4 sources www.cern.ch/geant4
  • Geant4 data files: (see geant4 website)
    • G4ABLA
    • G4EMLOW
    • G4NDL
    • PhotonEvaporation
    • RadioactiveDecay
  • Root sources root.cern.ch
  • Lmf sources (optionnal) (see Gate website)
  • Ecat7 sources (optionnal) (see Gate website)
  • Gate sources [1]


Installing CLHEP

Copy the archive file of the CLHEP sources in the $GATE_ROOT directory, and then extract the files from the archive with the following command:

tar -xvzf clhep-xxx.tgz

Then go to the resulting directory. There is another directory named 'CLHEP' in it. Go to that 'CLHEP' directory and then configure and compile the sources using:

./configure --prefix=$PWD/../
make
make install

It can take some time (about 15 minutes, depending on your processor). Once it is completed, there should be 3 new directories in the clhep directory: bin, include and lib. You can delete the directory 'CLHEP' containing the source files if you want.

The clhep library is now installed!

Installing Geant4

Geant4 helpers

Gate can display 3D graphics using several graphics libraries. The most commonly used library is OpenGL, since it is installed by default on most systems. If you need to install OpenGL, the source for this library is available from the OpenGL homepage OpenGL homepage. Supported graphics libraries also include DAWN tanaka or VRML browser.

Geant4 compilation

Copy the archive file of the Geant4 sources in the $GATE_ROOT directory and extract the files from the archives using the following command:

tar -xvzf geant4.xxx.tar.gz

Then go to the resulting directory and create a directory named 'data'. Copy and uncompress all Geant4 data files in this new 'data' directory. Then go back to the Geant4 directory and compile using:

./Configure -build

You will be prompt some questions about your system and about visualization. Most of the time the default answer is appropriate. Please note that:

  • Concerning the copy of all Geant4 headers in one directory, the answer should be 'yes'.
  • Concerning the clhep directory, you will probably have to give the path to this directory (which is the folder containing the 'bin', 'include' and 'lib' directories).
  • Concerning the visualization, it is your graphics library. If you want to use the OpenGL graphics library, first be sure that you have the appropriate libraries and header files installed and then answer 'yes' when being suggested G4VIS_BUILD_OPENGLX_DRIVER. You will then be prompt to specify the path to the installed library.

The compilation can take some time (about 40 minutes, depending on your processor). Once it is completed and successful, you should install all the headers in one directory and create the environment shell files using the following commands:

./Configure -install
./Configure

The Geant4 package is now installed !

Installing ROOT

Copy the archive file of the root package in the $GATE_ROOT directory and extract the files from the archive using:

tar -xvzf root_xxx.tar.gz

Then go to the resulting directory and configure and compile the sources using:

./configure --prefix=$PWD
make
make install

It can take some time (about 30 minutes, depending on your processor). Once it is completed, the root package is installed!

Installing Gate

Copy the archive file of the gate software in the $GATE_ROOT directory and extract the files from the archive with the following command:

tar -xvzf gate_xxx.tar.gz

Then go to the resulting directory. Before compiling you will have to define some environment variables used by Gate. Open the 'env_gate.csh' file or the 'env_gate.sh' file (depending on the shell you are using) with a text-editor. This file contains the environment variables used by Gate to be set (see next section for more details regarding these files). At the beginning of the file, you will define 4 environment variables:

  • The $GATEHOME variable that defines the absolute path to the Gate software directory.
  • The $G4INSTALL variable that defines the absolute path to the Geant4 package directory.
  • The $G4VERSION varaible that defines the version of the Geant4 library to be used (see below for details).
  • The $ROOTSYS variable that defines the absolute path to the root package directory.

To do that (for cshell version):

setenv GATEHOME /path/to/the/gate/software/directory setenv G4INSTALL /path/to/the/geant4/package/directory setenv G4VERSION 9.1 setenv ROOTSYS /path/to/the/root/package/directory

Or for the bash version:

export GATEHOME=/path/to/the/gate/software/directory export G4INSTALL=/path/to/the/geant4/package/directory export G4VERSION=9.1 export ROOTSYS=/path/to/the/root/package/directory

Save your file and, source this environment file by typing (while still being in the gate software directory):

source env_gate.csh   (or env_gate.sh)

You can then compile the Gate software with the following command:

make

It can take some time (about 15 minutes, depending on your processor). Once it is completed, the Gate software is now yours !

Some hints

By default, the clhep and the root packages produce dynamic libraries. When Gate is running, it has to know where to find these libraries. So you have to set the native $LD_LIBRARY_PATH environment variable by adding the absolute paths to the corresponding directories. Add the following line in the 'env_gate.csh' or 'env_gate.sh' file:

For cshell version:

setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${ROOTSYS}/lib:/path/to/the/clhep/package/directory/lib

Or for bash version:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOTSYS/lib:/path/to/the/clhep/package/directory/lib


To be able to run Gate or ROOT from any directory, you have to add the absolute path of each binary to the native $PATH environment variable. To do so, add the following line in the 'env_gate.csh' or 'env_gate.sh' file:

For cshell version:

setenv PATH ${PATH}:${ROOTSYS}/bin:${GATEHOME}/bin/${G4SYSTEM}

Or for bash version:

export PATH=$PATH:$ROOTSYS/lib:$GATEHOME/bin/$G4SYSTEM


Each time you want to use Gate, just open your command prompt window, then source from any directory the 'env_gate.csh' or 'env_gate.sh' file, and you can run Gate from any directory.

You can also customize your native environment file ('.basrc' or '.cshrc', ...) depending on your Linux system to define all needed variables and to add paths.

Gate configuration script

Basics

The Gate C shell configuration script env_gate.csh or env_gate.sh performs 2 tasks:

  • it looks for and runs the Geant4 configuration script env.csh or env.sh, to make sure that all Geant4 environment variables are properly set
  • it sets a number of environment variables needed by Gate. Most of them are meant to define the various data output options.

There are 3 prerequisites for this script to work properly:

  • You must define the environment variable G4INSTALL so that it points to the directory where Geant4 is installed;
  • You must make sure that this directory contains a Geant4 configuration script env.csh or env.sh;
  • You must define the environment variable G4VERSION so that it points to the release number of Geant4.

For instance, if you use Geant4 release 8.1, patch-02, G4VERSION should be set to 8.1.

If any of these conditions is not met, the script will not know how to configure the Geant4 environment variables and will abort.

The following Geant4 releases are supported:

  • 4.0 to 4.1
  • 5.0 to 5.2
  • 6.0 to 6.2
  • 7.0 to 7.1
  • 8.0 to 8.1
  • 9.0 Any other release is not supported and will make the script to abort.

Assuming that the three conditions are met, the script is ready to be used. However, you may wish to tune the Gate configuration variables before you run it. This is explained in the next section.

Gate environment variables

The Gate configuration script tries to set a number of data output options according to what is installed on your system. Each option is enabled by a line similar to the one below :


setenv G4ANALYSIS_USE 1

This line defines an environment variable, which is passed to the compiler by the Gate makefile. This enables the compilation of some specific sections of the Gate source codes. To disable this option, you simply need to comment out the configuration line (with #).

When this is done, the relevant codes are no longer compiled, so that the data output option is completely removed from the Gate program. Below is the list of Gate environment variables and how they are set :


G4ANALYSIS_USE

This variable enables the use of the data output and analysis features by Gate and always is set by default. Unsetting it disables all data output modules: the simulation gets somewhat faster, but there is no data output whatsoever.


G4ANALYSIS_USE_FILE

This variable enables the use of the ASCII file data output. This output is simple and works on all platforms. However, the resulting output files may be quite large. While this variable is set by default, you can unset it if you do not plan to use the ASCII data files.


G4ANALYSIS_USE_ROOT

This variable enables the use of the features based on the ROOT libraries. These features include the ROOT data output and the real-time plotter. These features are powerful, but they require the ROOT librairies to be installed on your platform. As a security, this variable is set only if the script detects that ROOT is installed. To do so, the ROOTSYS environment variable should point to the home directory of ROOT. Even if ROOT is installed on your system, you may wish to unset this variable if you do not plan to use the ROOT output file or the real-time plotter.


G4ANALYSIS_USE_ROOT_PLOTTER

This variable enables the use of the ROOT-based real-time plotter. As a security, this variable is set only if the script detects that ROOT is installed. As the real-time plotter uses the X protocol, there may be a computation speed penalty in using this option, especially when running on a distant machine. Even if ROOT is installed, you may wish to unset this variable if you do not need real-time plots (batch runs).


G4ANALYSIS_USE_LMF

This variable enables the use of the LMF file data output. As a security, this variable is set only if the script detects that the LMF libraries are installed on your system. Even if these libraries are installed, you may wish to unset this variables if you do not plan to use the LMF output file.


G4ANALYSIS_USE_ECAT7

This variable enables the use of the ECAT7 file data output. As a security, this variable is set only if the script detects that the ECAT7 libraries are installed on your system. Even if these libraries are installed, you may wish to unset this variables if you do not plan to use the ECAT7 output file.


GATE_USE_OPTICAL

This variable enables the use of the optical transport features in GATE. When this variable is switched on, it is possible to generate and track optical photons. In order to compile GATE with this feature, it is necessary to have the libXML2 development packages (libxml2-dev) installed on your system. As a security, this variable is unset when the program xml2-config is not found on the system. This program should have been installed with the aforementioned package. You may want to unset this variable when you do not want to use the optical transport feature.

Installing Gate on OSX Panther-Tiger

Preliminary remarks

Mac OSX is a supported platform for the Geant4 Collaboration and for the OpenGATE collaboration.

Platform tested

Hardware: Mac G5 and Mac Intel, Operating System: OSX 10.5.x

Prerequisite

  • Apple Developper Tools (Xcode, current version 3.1.1 (1/06/2009) includes gcc 4.0.1)
  • X11 (available in Mac OS installation disk)

Manual installation of the required packages

Several packages are needed to run GATE on your MacOS X platform. You first need to install them before installing GATE.

clhep2

Several options are available: directly download precompiled library from http://proj-clhep.web.cern.ch/ or download source from the web page and install the packages:

cd /to/directory/where/you/placed/CLHEP/sources

./configure --prefix=/a/location/you/choose/
make
make install

ROOT

You can get precompiled binaries for your system. Be careful that you must download the ones that correspond to your system (gcc4.0/Intel or gcc4.0/PPC).

Alternatively, you can get and compile the source. To do so, please follow the installation process:

set ROOTSYS to 'root' directory

cd ROOTSYS
./configure --prefix=/a/location/you/choose
make && make install

Installing Geant

Geant4 current working version is 9.0p01

Set G4INSTALL variable to your GEANT4 directory

Then install Geant with:

./configure --build

Remarks

CLHEP variable should be set to the location of your CLHEP tree. X11 is in /usr/X11R6

There may be some warnings, but you can still proceed. You will be later encouraged to run the examples to check the integrity of the installation.

After installation is complete, you can generate env.csh et env.sh by typing

./configure


At this stage, it is recommended that you test the integrity of your Geant installation, by compiling and running somes examples. The novice example could be a good start.

Installing Gate

Download Gate sources from the Gate web site

Modify env_gate.csh and set GATEHOME and G4VERSION

Build Gate:

source env_gate.csh

make >& make.log (allows to keep a log).


You can usually ignore the warnings if any. The integrity of the Gate installation will be later checked by running the benchmarks.

Remarks

Global variables set in our install (given as an example - please modify the path accordingly...):

G4INSTALL=/Users/manu/projets/Geant/geant4.9.0.p01
ROOTSYS=/Users/manu/projets/root 
DYLD_LIBRARY_PATH=/Users/manu/projets/root/lib 
LD_LIBRARY_PATH=/Users/manu/projets/root/lib

Make sure that both X11 and X11sdk are installed (there are 2 files to download and install)

Check the compiler version: cc -v (current answer: gcc version 4.0.1 (Apple Computer, Inc. build 5367))