Skip to content
Maurik Holtrop edited this page Jul 5, 2021 · 6 revisions

hps-analysis

This is some C++ code that creates ROOT files from slcio (output of the HPS reconstruction and simulation codes) files. Please see the Documentation section on how to use the resulting ROOT files.

Building the code.

Required Components:

  • cmake version 3
    • Available for all Linux and Mac versions. On some systems you need to specify "cmake3" instead of just "cmake". Check your version with "cmake --version".
  • c++17 compiler: gcc 7+, clang
    • I recommend you use at least gcc 9.3 (on MacOS, clang 11), which has far better support for lambda functions.
    • Ubuntu 20.04 LTS comes with gcc 9.3 pre-installed.
  • ROOT version 6.18 or better. I recommend 6.25 or better.
    • The RDataFrame component of ROOT is rather new and still seeing active development and bug fixes. I would recommend using 6.25, or the master branch from git.
    • You need to compile ROOT with the C++17 option: -Dcxx17=ON
  • LCIO
    • Since we are converting LCIO to ROOT we need to be able to read the LCIO.
    • The original repository of LCIO is at their GitHub repository: LCIO and contains detailed the installation instructions. Unfortunately, as of August 2020, the master and v02-14-x versions of LCIO have very serious memory leaks for simple event loops, making this branch of the code useless.
    • HPS has been using the older v02.07.05 version of LCIO, because that one is still Java compatible. For this code, you need a c++17 capable version of LCIO. You can find Omar's version 2.7.5 of LCIO which is made c++17 compatible: Omar's LCIO. A fork of that version is also MacOS compatible, and attempts to clean all the issues with c++17 compilation is also available at Maurik's LCIO. You should use the default branch: v02-07-05-cxx17.

Pre-requisite: ROOT

You will need a function version of ROOT, preferably version 6.22 or later. You can find installation instruction on the ROOT Website After installation, make sure you have executed the ROOT startup script before continuing, eg:

source <path-to-root>/bin/thisroot.sh

Pre-requisite: Building LCIO

This code is not standalone. You will first need to install a copy of LCIO. With HPS we do not use the master branch, instead we use a modified V2.07.05 version, which you can install with the instructions below. First go to a directory where below which you want to build this code, and then execute:

git clone https://github.com/JeffersonLab/hps-lcio.git
cd hps-lcio
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/data/HPS ..
make
make install

Note that you need to adjust the /data/HPS path to your own installation loation.

Building MiniDST:

Again, go to a location below which you want to build this code, and execute the commands below:

git clone https://github.com/JeffersonLab/hps-analysis.git
cd hps-analysis
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/tmp -DLCIO_DIR=/location/of/lcio/installation ..
make
make install

Note that you need to adjust the /tmp path to your own installation location and /location/of/lcio/installation to the location where LCIO was installed in the previous step. That second argument is not needed if the CMAKE_INSTALL_PREFIX is the same in both steps.

At JLAB

At JLab, there is a 9.2.0 version of gcc available using "module", however there is no pre-installed ROOT version that is C++17 compatible. This situation is currently resolved by building a "master" version (6.23.99) of ROOT with 9.2.0 and C++17 compatibility. To use this:

module use /group/clas12/packages/local/etc/modulefiles
module use /apps/modulefiles
module load cmake/3.5.1
module load gcc/9.2.0
source /home/holtrop/root/bin/thisroot.sh

You will find pre-compiled libraries for LCIO and MiniDst in /home/holtrop/lib


Using the executable make_mini_dst.

The make_mini_dst program, which will be installed in bin in the installation step, is used to transform an LCIO file to a ROOT file. Simple usage:

make_mini_dst infile.slcio  -o my_root_file.root

There are several options to fine tune the ROOT file creation, which are shown when you execute the code with the "-h" switch.

Clone this wiki locally