Project

General

Profile

Actions

Installation » History » Revision 2

« Previous | Revision 2/7 (diff) | Next »
Ole Hansen, 03/03/2018 11:35 AM


Hall A C++ Analyzer Installation Guide

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 easiest and least prone to error to build the Analyzer from source. (A precompiled version is installed in the Hall A counting house, however.) To build the Analyzer, please download the latest source distribution and follow the instructions below.

System Requirements

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

Prerequisites

The following software must be installed and set up prior to unpacking and compiling the analyzer:

  • ROOT 5 or 6. Release 6.12/06 or higher recommended.
  • Compilers: gcc/g++ C/C++ compiler 4.0 or higher, or clang 2.8 or higher, including Apple clang.
    Important: this compiler must produce code that is binary-compatible with the installed version of ROOT!
  • SCons 2.1 or later, or GNU make 3.76 or later
  • gzip/gunzip.
  • wget or curl (for downloading EVIO)
  • Optional: EVIO (any version). Make sure that the CODA environment variable points to the location of your installation.

Getting the analyzer source code

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

% tar xzf analyzer-1.6-beta3.tar.gz

The sources will be unpacked into the subdirectory "analyzer-1.6". Go there
% cd analyzer-1.6

Compilation

First, ensure that ROOT is properly set up. 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.

To build the analyzer, you can either use the traditional make system or the new SCons system. With make, Linux and macOS platforms should be detected and configured automatically. On these platforms, simply run

% make -j

(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 modern systems. You can omit the "-j" if you prefer. Please see the make documentation for more information.)

On other Unices (e.g. Solaris), you will have to provide an appropriate "ARCH" section in these two Makefiles:

Makefile
hana_decode/Makefile

SCons builds should in principle work on all Unix-like platforms where SCons is available. Note that SCons requires python >= 2.7. First, ensure that SCons is installed:

% which scons

If this returns nothing, you will have to install the appropriate package via your package manager (on Linux) or by some other means. SCons for macOS is available via Homebrew (recommended), MacPorts or as a standalone graphical installer. You will need at least version 2.1. You can check the version with
% scons --version

To build with SCons, do

% scons -j

Build problems

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, try building again with a clean slate:

% find . -name '*.d' -exec rm {} \;
% make realclean
% make

or
% scons -c
% scons

Only 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

To run the analyzer in an arbitrary directory, a number of environment variables need to be set up. Assuming you built the Analyzer in ~/analyzer-1.6, the setup would be as follows:

For bash (Linux default):

% export LD_LIBRARY_PATH=~/analyzer-1.6:$ROOTSYS/lib
% export DB_DIR=~/analyzer-1.6/DB
% export PATH=~/analyzer-1.6:$PATH

For tcsh (JLab CUE default):

% setenv LD_LIBRARY_PATH ~/analyzer-1.6:${ROOTSYS}/lib
% setenv DB_DIR ~/analyzer-1.6/DB
% set path = ( ~/analyzer-1.6 $path )

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

Running

Go to your working directory and type:

% analyzer

or, if you did not modify the PATH:
% ./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.6.0-beta3         Dec 10 2015 *
  *  Based on ROOT  5.34/32          Jun 23 2015 *
  *                                              *
  *            For information visit             *
  *        http://hallaweb.jlab.org/podd/        *
  *                                              *
  ************************************************

CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
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.

Debugging (advanced)

Advanced users may be interested in creating a debug build. To do so with the make system, you need to edit the top-level Makefile and uncomment the following line

#export DEBUG=1

Also, ensure that WITH_DEBUG=1 is set. This will enable compilation of additional code sections that help with interactive debugging, such as extra error messages. This variable is set by default.

Once the Makefile has been updated, do

% make clean
% make -j

You might also want to use a debug-compiled version of ROOT or install an appropriate debuginfo package (e.g. root-debuginfo on RedHat systems using EPEL). Also, be sure to install glibc-debuginfo and glibc-debuginfo-common to get debug support for STL classes and other standard library features. None of these extra steps are necessary on Mac OSX, where the relevant bundles come with the required symbol tables included.

With the SCons system, creating a debug build is easier. Nothing needs to be edited, simply run

% scons -j debug=1

Of course, the same considerations regarding ROOT and glibc debuginfo apply as described above for make builds.

The recommended debugger is gdb on Linux (and older macOS such as 10.6) and lldb on newer macOS versions. To avoid problems with macOS's System Integrity Protection when using lldb, do not use /usr/bin/lldb directly, but instead create an alias to the command-line tools version, which isn't a specially-protected executable:

alias lldb='/Library/Developer/CommandLineTools/usr/bin/lldb'

Updated by Ole Hansen about 6 years ago · 2 revisions