Setting up the environment for RAT
Method 1 (easiest) - the RAT container
The easiest way to both build and run RAT locally is now through the docker container.
Full documentation, instructions, and explanation of what a container is are available at the GitHub repository.
From the repo:
Singularity and Docker recipes to build a SNO+ environment for RAT.
For regular usage, simply download the pre-built container with the following instructions for your container platform of choice.
FEATURES
- Full RAT-compatible environment, including ROOT 5 (or ROOT 6 if desired), GEANT4, and SCons
- Can build any version of RAT
- GUI output support on all operating systems
- TensorFlow and CppFlow (CPU-only for the time being)
- Singularity and Docker compatibility
- Cluster-compatible
Method 2 (advanced) - manual installation of dependencies
The traditional way to install RAT is to build the dependenices and RAT individually.
To do this, ensure that you have a C++11 compliant compiler.
See here for more details on compiler requirements.
Install the primary dependencies
-
FFTW
- If you have admin access, install the packages (Debian/Ubuntu: fftw3, libfftw3-dev; RHEL/CentOS/SL/Fedora: fftw, fftw-devel)
- If not, download from https://www.fftw.org/download.html and build with the --with-pic option enabled when configuring; you will then need to point ROOT to the location of the FFTW libraries with the --with-fftw3-incdir and --with-fftw-libdir options when configuring.
-
GSL
- If you have admin access, install the packages (Debian/Ubuntu: libgsl0-dev; RHEL/CentOS/SL/Fedora: gsl, gsl-devel)
- If not, download from https://www.gnu.org/software/gsl/ and build with the --with-pic option enabled when configuring; you will then need to point ROOT to the location of the GSL libraries with the --with-gsl-incdir and --with-gsl-libdir options when configuring.
-
ROOT
- Get the ROOT source tarball:
https://root.cern.ch/download/root_v5.34.38.source.tar.gz
- Untar somewhere, rename the directory if you like, then build it (adding extra library location options if FFTW and GSL are not installed to default locations):
$ tar zxvf root_v5.34.38.source.tar.gz
$ cd root
$ ./configure --enable-minuit2 --enable-python --enable-mathmore --enable-cxx11
$ make # Use -jN for N parallel jobs
- Source the ROOT environment: source /PATH/TO/ROOT/bin/thisroot.sh
- Note that ROOT 5 will not compile with GCC ≥ 9 (see this forum post).
-
GEANT4
- Get the source:
https://cern.ch/geant4-data/releases/geant4.10.00.p04.tar.gz
- Untar, create a CMake build directory, and build:
$ tar zxvf geant4.10.00.p04.tar.gz
$ mkdir geant4.10.00.p04-build
$ cd geant4.10.00.p04-build
$ cmake -DGEANT4_INSTALL_DATA=ON \
-DGEANT4_BUILD_CXXSTD=c++11 \
-DCMAKE_INSTALL_PREFIX=/PATH/TO/geant4.10.00.p04 \
/PATH/TO/geant4.10.00.p04
$ make
$ make install
- Source the environment: source /PATH/TO/geant4.10.00.p04/bin/geant4.sh
- Source the development script: source /PATH/TO/geant4.10.00.p04/share/Geant4-10.0.4/geant4make/geant4make.sh
-
cURL
- If you have admin access, install the packages (Debian/Ubuntu: curl, libcurl3; RHEL/CentOS/SL/Fedora: curl, curl-devel)
- If not, download from https://curl.haxx.se/download.html and build, and change RAT's config/EXTERNAL.scons to point to the correct location.
-
bzip2
- If you have admin access, install the packages (Debian/Ubuntu: bzip2, libbz2-1.0; RHEL/CentOS/SL/Fedora: bzip2, bzip2-devel)
- If not, download from https://sourceware.org/bzip2/index.html and build, and change RAT's config/EXTERNAL.scons to point to the correct location.
-
SCons
- Download SCons from https://sourceforge.net/projects/scons/files/scons/3.1.2/scons-3.1.2.tar.gz
- Extract SCons to a desired location and install:
Installation against ROOT 6
The installation follows closely the instructions above.
For RAT 6.18.1 and older, both ROOT 6 and GEANT4 must be compiled with GCC 4.8.5.
Newer versions of GCC were not compatible with the construction of RAT ROOT.
However, for newer versions of RAT greater than or equal to 6.18.2,
this restriction on the compiler version no longer applies.
Note that it is discouraged to use ROOT 6 with older RAT versions,
both due to this limitation and other bugs which were present.
First, get the ROOT source tarball. Alternatively, you may be able to download and unpack a binary from ROOT for your system if it is supported.
Untar the source somewhere and create a build directory (adding extra library location options if FFTW and GSL are not installed to default locations):
$ tar zxvf root_v6.22.08.source.tar.gz
$ mkdir root-build
$ cd root-build
$ cmake -DCMAKE_CXX_STANDARD=11 \
-Dminuit2=ON -Dpython=ON -Dmathmore=ON -Droofit=ON \
-Dfortran=OFF -Dfftw3=ON -Dgsl_shared=ON -Dgdml=ON \
/PATH/TO/root
$ make # Use -jN for N parallel jobs
Note that the options provided to CMake above are required to run RAT.
More build options can optionally be added.
For more information, see some of the links below.
Building and installing RAT
Obtain the source code and build RAT
After all dependencies are installed, clone RAT, configure the environment, and compile:
$ git clone git@github.com:snoplus/rat
$ cd rat
$ ./configure
$ source env.sh
$ scons
Along the way we set a lot of environment variables for various dependencies, which must always be set to build and run RAT. To make this easier, create a script to do it:
# rat_env.sh
source /PATH/TO/root/bin/thisroot.sh
source /PATH/TO/geant4/bin/geant4.sh
source /PATH/TO/RAT/env.sh
Then, you can run source rat_env.sh and RAT is ready to go.
Update RAT
RAT is git managed code; therefore, you must fetch and merge the code to update it manually before running SCons to rebuild, i.e.
$ git fetch
$ git merge
$ scons
SCons build options
There a few custom options that can be passed to SCons.
These can disable/enable dependencies, decrease/increase verbosity levels, and add custom C++ defines.
Options include:
- scons profile=1, default 0, to turn on the profiling CFLAGS
- scons debug=1, default 0, to turn on the debug CFLAGS
- scons opt=0, default 1, to turn off the optimisation CFLAGS
- scons zmq=0, default 1, to turn off the zmq dependence (packed dispatcher requires zmq).
- scons xercesc=0, default 0, to turn off the xerces-c dependence (viewer GDML visualisation requires xerces-c).
- scons g4vis=0, default 1, to turn off all visualisation.
- scons verbose=1 or 2, default 0, to enable more RAT verbosity.
- scons sconsverbose=1, default 0, to print full build commands.
- scons define=DEF1,...,DEFN to set user defines to activate specific code sections useful for active development.
- scons isystem=1, default depends on compiler (1 for GCC and Clang), to treat external dependency headers (e.g., ROOT) as system headers. Primarily used to supress warnings.
Home