Installation Guide¶
Dependencies¶
GRAS-06-00 requires an existing installation of some packages:
Geant4 10.7(.p03) and its related data files [http://geant4.cern.ch/] (mandatory)
CMAKE (Cross-platform make) is also needed to compile and install the code.
Geant4 installation - with GDML¶
To install Geant4, please follow the detailed instructions on the Geant4 web pages. See also the remark on GDML installation below. After the installation of Geant4 you should be sure that the file geant4.sh in the installation bin directory of Geant4 is properly sourced in your shell configure script. This is mandatory for cmake to find the Geant4 libraries and configuration options. If this script is correctly source you should be able to run the script geant4-config from any directory in a shell.
Use of the Geometry Data Markup Language (GDML) in GRAS¶
The Geometry Data Markup Language is a XML-like geometry format based on Geant4 geometry structure that can be used in Geant4 for geometry persistency. It means that instead of C++ coding of your geometry and recompilation of a Geant4 code after any geometry modification, the geometry is provided as an input XML file and can be changed from simulation case to simulation case.
GDML is distributed within Geant4 and will be used in GRAS provided that
you have installed Geant4 with the GDML option. This is activated with
the CMake additional option -DGEANT4_USE_GDML=ON
. For detailed
instructions please refer to the Geant4 installation guide. The installation procedure of GRAS based on
CMAKE will check if Geant4 has been compiled with the GDML option. The
use of the GDML capability is mandatory for compiling GRAS. Many
GRAS examples are based on the use of GDML.
Use of the Multi Threaded (MT) capabilities in GRAS¶
Geant4 supports multithreading in Unix systems. In order to have MT
support in GRAS an MT enabled installation of Geant4 is needed, thus it
is recommended to build Geant4 with the additional option
-DGEANT4_BUILD_MULTITHREADED=ON
.
Installation¶
GRAS is configured and installed by using CMAKE on all platforms (Linux, Mac, and Windows). This allows to have similar installation procedure on different platforms and operating systems.
Details on the procedure are provided in the following sections.
In addition, step-by-step instructions are also provided for installation on Ubuntu (20.04 and 18.04, native or installed inside a Windows machine, through Windows Subsystem for Linux, WSL), for CentOS (7) and for Windows (10).
Installation of GRAS-06-00 with CMAKE for Linux and Mac-OS¶
To install GRAS-06-00 on Linux and or Mac-OS you should do the following:
download the GRAS-06-00 tar package and un-tar it
create a build directory where GRAS should be compiled. It is recommended to set this directory different than the gras directory of the GRAS distribution.
move to the gras build directory
run cmake by using the command:
cmake [options] path_to_the_gras_directory
possible options:
-DSTATIC_BUILD=OFF(ON) to create a dynamic/static gras library and executable
-DGRAS_INSTALL_PREFIX=a_directory defines the directory where the executables and libraries will be installed
by default GRAS_INSTALL_PREFIX is set to the gras_build directory.
A typical cmake command line is the following:
cmake -DCMAKE_BUILD_TYPE=Release -DGRAS_INSTALL_PREFIX=/usr/local/gras/GRAS-06-00 -DSTATIC_BUILD=OFF ../GRAS-06-00
compile the code by typing
make -jN
with N
being the number of processors to be used in parallel for
compilation
Install the code by typing
make install
Finally in order to run GRAS from any directory and to add the directory where the gras library is located to the list of directories were dynamic libraries are looked for at run time, you should add the following line in your shell configuration script (.bashrc,…)
source GRAS_INSTALL_PREFIX/bin/gras-env.sh (.csh for cshell)
with GRAS_INSTALL_PREFIX defining the directory where the code is installed (by default the gras build directory)
After the correct compilation and installation of the code the following files are installed:
in
GRAS_INSTALL_PREFIX/bin
: - gras : the executable of the code - gras-env.sh(csh) : a bash(cshell) file to source in order to add the bin directory to the path and set the lib directory in the dynamic library path - gras-config : unix type config file for gras - *.sh, *.py Bash and python scripts related to the GRAS test suitein
GRAS_INSTALL_PREFIX/lib
: - libgras* : the gras library to link with external Geant4 applications that would use the GRAS analysis modules and physics listsin
GRAS_INSTALL_PREFIX/lib/GRAS
: - GRASConfig.cmake : cmake file declaring the GRAS installation characteristic in cmakein
GRAS_INSTALL_PREFIX/lib/python3.6/site-packages/gras/
: - *.py : python utility libraries for the test suite of GRASin
GRAS_INSTALL_PREFIX/include/gras/
: - *.hh : header files for GRASin
GRAS_INSTALL_PREFIX/share/data/
: - *.csv : data files needed by analysis modules of GRASin
GRAS_INSTALL_PREFIX/share/examples/
: - * : example folders for GRASin
GRAS_INSTALL_PREFIX/share/styles/
: - gras.css : style file needed for tests report generationin
GRAS_INSTALL_PREFIX/share/tests/
: - * : test folders for GRAS
Step-by-step example installation instructions for specific platforms¶
Step-by-step installation instructions are provided from the links below, as example or starting point for installing pre-requirement packages, Geant4 and GRAS
Linking of external Geant4 applications with GRAS for Linux and Mac-OS¶
The two examples N01_with_GRAS and NO4_with_GRAS located in the directory gras/examples/gras_in_external_application illustrate how existing Geant4 applications can be modified to be linked with the GRAS library (analysis modules, physics list, primary generator). These examples are extensions of the novice examples N01 and N04 distributed within Geant4. The modifications of the initial novice examples consists into:
Removing the declaration of the user physics list and primary generation action to the run manager in the main. The physics list and primary generator action provided with GRAS will be used.
Modification of the CMakeLists.txt file provided with the Geant4 examples in order to compile correctly the examples and link their executable with the gras library.
The following steps should be done in order to compile an example :
source the
GRAS_INSTALL_PREFIX/bin/gras-env.sh(csh)
file (if not already done in bash(csh) configure scripts). This is mandatory for CMAKE to find the GRAS packagecreate an example_build directory where to build the example
from this directory type: - cmake path_to_the_example_directory - make
After the compilation the executable of the example is located in the example_build directory.
Un-installation procedure of GRAS¶
The installation of GRAS can be removed by doing the following
From the gras build directory type:
make clean
Remove the gras build directory
GRAS/trunk/r2242