Project

General

Profile

Actions

Guide to Installing the Hall A C++ Analyzer From Source

General

The C++ Analyzer is a general-purpose data analysis framework built on top of ROOT. Because of the large number of possible combinations of ROOT versions and compilers, which are often not compatible at the binary level, it is often the safest to build the Analyzer from source. (A precompiled version is installed in the Hall A counting house and on the JLab ifarm systems.) Build instructions follow.

System Requirements

  • Linux or macOS.
  • Reasonably powerful hardware (multicore CPU, 2 GB RAM). Less may work, but it won't be fun.
  • 50 MB disk space to build the Analyzer. GBs of disk space for raw data files.

Prerequisites

Ensure the following is installed:

  • ROOT version 6. Latest version recommended.
  • Compilers: gcc/g++ C/C++ compiler 4.8 or higher, or clang 4 or higher, including Apple Clang 5 or higher.
    Important: The installed version of ROOT must have been built with the same compiler!
  • CMake 3.5 or later (3.15 or higher recommended). Alternatively, SCons version 3 or higher.
  • gzip/gunzip.
  • wget or curl (for downloading EVIO)
  • Optional: EVIO version 5.3. The CODA environment variable should point to the location of your installation.

For ROOT, root-config must be in your PATH. Check this:

% which root-config
/opt/ROOT/PRO/bin/root-config

Also, check if you can start ROOT:
% root

If any of these checks fail, investigate. Consult your system administrator.

If you don't have EVIO installed already, the build system will download and build a local version of EVIO for you. You will need Internet connectivity to GitHub for this.

ROOT Installation Guide

Getting the analyzer source code

Source distributions can be downloaded from here. Unpack the archive:

% tar xzf analyzer-1.7.0.tar.gz

The sources will be unpacked into the subdirectory analyzer-Release-170. Go there
% cd analyzer-Release-170

Alternatively, you can clone the GitHub repository:
% git clone --branch Release-170_patches https://github.com/JeffersonLab/analyzer 

Building and Installing

CMake is strongly recommended for building the analyzer, preferably CMake version 3.15 or higher. CMake automatically detects and configures the build environment in portable way. Additionally, it is a good idea to "install" the analyzer in a suitable directory from where it can be run; this allows several versions to be installed in parallel, for example. Each installation is self-contained (except for dependencies like ROOT), so the source directory can be moved, updated, or deleted at any time without affecting the installation. To set the installation location, point the CMake variable CMAKE_INSTALL_PREFIX to the desired top-level directory. For example

% cmake -B build -S . -DCMAKE_INSTALL_PREFIX=~/JLab/Software/Podd/1.7.0
% cmake --build build -j
% cmake --install build

This will put the analyzer in ~/JLab/Software/Podd/1.7.0/{bin,lib,include}. The -j flag instructs make to do a parallel build using all available CPU cores of your machine. This will greatly speed up the build on multicore systems.

The analyzer's CMake build system supports a number of options that can be set at configuration time:
  • WITH_DEBUG: Enables additional debug messages. ON by default.
  • PODD_SET_RPATH: Set RPATH on executables so that there is no need to set (DY)LD_LIBRARY_PATH to run the installed analyzer. ON by default.

On rare occasions, your build may fail with weird error messages. For example, this may happen because ROOT wasn't set up correctly, you switched to a different ROOT version or to a ROOT installation in a different location, or you moved or copied your build directory. In such cases, simply delete the build directory completely (build in the example above).

If this fails, assume that there may be a real problem with the source code. Our releases are tested on RedHat and Ubuntu-based Linux distributions and recent macOS versions, so whatever problem there may be, it is likely due to a quirk of your particular setup. Please contact us with a bug report.

Installation

As already explained above, it is recommended to install the analyzer in a suitable location from where it can be run. Use the cmake --install <build_dir> command to do the installation. If the PODD_SET_RPATH CMake option is enabled (the default), the analyzer will run without further configuration from the installation location. Optionally, one can set a number of environment variables. Assuming CMAKE_INSTALL_PREFIX was set to ~/JLab/Software/Podd/1.7.0, one can set

For bash (Linux default):

% export ANALYZER=~/JLab/Software/Podd/1.7.0
% export PATH=$ANALYZER/bin:$PATH
% export LD_LIBRARY_PATH=$ANALYZER/lib64:$LD_LIBRARY_PATH

For tcsh (JLab CUE default):

% setenv ANALYZER ~/JLab/Software/Podd/1.7.0
% set path = ( ${ANALYZER}/bin $path )
% setenv LD_LIBRARY_PATH ${ANALYZER}/lib64:${LD_LIBRARY_PATH}

You probably want to put these definitions in your login script: ~/.bash_profile or ~/.login.

Running

If the PATH has been set to include $ANALYZER/bin, all you have to do is type

% analyzer

You should see the startup message:
  ************************************************
  *                                              *
  *            W E L C O M E  to  the            *
  *       H A L L A   C++  A N A L Y Z E R       *
  *                                              *
  *  Release     1.7.0               Nov 16 2021 *
  *  Based on ROOT    6.26/02        12 Apr 2022 *
  *                                              *
  *            For information visit             *
  * https://redmine.jlab.org/projects/podd/wiki/ *
  *                                              *
  ************************************************
analyzer [0]

Since the Analyzer is built on top of ROOT, you now have access to all ROOT commands from the Analyzer command prompt. Running the Analyzer is like running ROOT with a bunch of extra classes available. The special Analyzer classes are listed in the Analyzer Class Index.

If you are a new user, you might want to look at the example scripts in the examples/ subdirectory of the distribution. Documentation of them can be found in the Quickstart Guide.

Updated by Ole Hansen over 1 year ago · 7 revisions