Project

General

Profile

Installation » History » Version 6

Ole Hansen, 08/26/2022 12:15 PM

1 6 Ole Hansen
h1. Guide to Installing the Hall A C++ Analyzer From Source
2 1 Ole Hansen
3
h2. General
4
5 6 Ole Hansen
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.
6 1 Ole Hansen
7
h2. System Requirements
8
9 2 Ole Hansen
* Linux or macOS.
10 6 Ole Hansen
* Reasonably powerful hardware (multicore CPU, 2 GB RAM). Less may work, but it won't be fun.
11 2 Ole Hansen
* 50 MB disk space to build the Analyzer. GBs of disk space for raw data files.
12 1 Ole Hansen
13
h2. Prerequisites
14
15 6 Ole Hansen
Ensure the following is installed:
16 1 Ole Hansen
17 6 Ole Hansen
* "ROOT":https://root.cern version 6. Latest version recommended.
18
* Compilers: "gcc/g++":http://gcc.gnu.org C/C++ compiler 4.8 or higher, or "clang":https://clang.llvm.org 4 or higher, including Apple Clang 5 or higher.
19
Important: The installed version of ROOT must have been built with the same compiler!
20
* "CMake":https://cmake.org 3.5 or later (3.15 or higher recommended). Alternatively, "SCons":https://scons.org version 3 or higher.
21 1 Ole Hansen
* gzip/gunzip.
22
* wget or curl (for downloading EVIO)
23 6 Ole Hansen
* Optional: "EVIO":https://coda.jlab.org/drupal/content/event-io-evio version 5.3. The <code>CODA</code> environment variable should point to the location of your installation.
24 1 Ole Hansen
25 6 Ole Hansen
For ROOT, <code>root-config</code> must be in your <code>PATH</code>. Check this:
26 1 Ole Hansen
<pre>
27
% which root-config
28
/opt/ROOT/PRO/bin/root-config
29
</pre>
30
Also, check if you can start ROOT:
31
<pre>
32
% root
33
</pre>
34
If any of these checks fail, investigate. Consult your system administrator.
35
36
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":https://github.com/JeffersonLab/hallac_evio for this.
37
38 6 Ole Hansen
[[ROOT Installation Guide]] 
39 1 Ole Hansen
40 6 Ole Hansen
h2. Getting the analyzer source code
41 1 Ole Hansen
42 6 Ole Hansen
Source distributions can be downloaded from "here":https://github.com/JeffersonLab/analyzer/releases. Unpack the archive:
43 1 Ole Hansen
<pre>
44 6 Ole Hansen
% tar xzf analyzer-1.7.0.tar.gz
45 1 Ole Hansen
</pre>
46 6 Ole Hansen
The sources will be unpacked into the subdirectory <code>analyzer-Release-170</code>. Go there
47 1 Ole Hansen
<pre>
48 6 Ole Hansen
% cd analyzer-Release-170
49 1 Ole Hansen
</pre>
50 6 Ole Hansen
Alternatively, you can clone the GitHub repository:
51 1 Ole Hansen
<pre>
52 6 Ole Hansen
% git clone --branch Release-170_patches https://github.com/JeffersonLab/analyzer 
53 1 Ole Hansen
</pre>
54
55 6 Ole Hansen
h2. Building and Installing
56
57
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 <code>CMAKE_INSTALL_PREFIX</code> to the desired top-level directory. For example
58 1 Ole Hansen
<pre>
59 6 Ole Hansen
% cmake -B build -S . -DCMAKE_INSTALL_PREFIX=~/JLab/Software/Podd/1.7.0
60
% cmake --build build -j
61
% cmake --install build
62 1 Ole Hansen
</pre>
63
64 6 Ole Hansen
This will put the analyzer in <code>~/JLab/Software/Podd/1.7.0/{bin,lib,include}</code>. The <code>-j</code> 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.
65 1 Ole Hansen
66 6 Ole Hansen
The analyzer's CMake build system supports a number of options that can be set at configuration time:
67
* <code>WITH_DEBUG</code>: Enables additional debug messages. ON by default.
68
* <code>PODD_SET_RPATH</code>: Set RPATH on executables so that there is no need to set <code>(DY)LD_LIBRARY_PATH</code> to run the installed analyzer. ON by default.
69 1 Ole Hansen
70 6 Ole Hansen
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 (<code>build</code> in the example above).
71 1 Ole Hansen
72 6 Ole Hansen
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.
73
74 1 Ole Hansen
h2. Installation
75
76 6 Ole Hansen
As already explained above, it is recommended to install the analyzer in a suitable location from where it can be run. Use the <code>cmake --install <build_dir></code> command to do the installation. If the <code>PODD_SET_RPATH</code> 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 <code>CMAKE_INSTALL_PREFIX</code> was set to <code>~/JLab/Software/Podd/1.7.0</code>, one can set
77 1 Ole Hansen
78
For bash (Linux default):
79
<pre>
80 6 Ole Hansen
% export ANALYZER=~/JLab/Software/Podd/1.7.0
81
% export PATH=$ANALYZER/bin:$PATH
82
% export LD_LIBRARY_PATH=$ANALYZER/lib64:$LD_LIBRARY_PATH
83 1 Ole Hansen
</pre>
84
85
For tcsh (JLab CUE default):
86
<pre>
87 6 Ole Hansen
% setenv ANALYZER ~/JLab/Software/Podd/1.7.0
88
% set path = ( ${ANALYZER}/bin $path )
89
% setenv LD_LIBRARY_PATH ${ANALYZER}/lib64:${LD_LIBRARY_PATH}
90 1 Ole Hansen
</pre>
91
You probably want to put these definitions in your login script: ~/.bash_profile or ~/.login.
92
93
h2. Running
94
95 6 Ole Hansen
If the <code>PATH</code> has been set to include <code>$ANALYZER/bin</code>, all you have to do is type
96 1 Ole Hansen
<pre>
97
% analyzer
98
</pre>
99
You should see the startup message:
100
<pre>
101
  ************************************************
102
  *                                              *
103
  *            W E L C O M E  to  the            *
104
  *       H A L L A   C++  A N A L Y Z E R       *
105
  *                                              *
106 6 Ole Hansen
  *  Release     1.7.0               Nov 16 2021 *
107
  *  Based on ROOT    6.26/02        12 Apr 2022 *
108 1 Ole Hansen
  *                                              *
109
  *            For information visit             *
110 6 Ole Hansen
  * https://redmine.jlab.org/projects/podd/wiki/ *
111 1 Ole Hansen
  *                                              *
112
  ************************************************
113
analyzer [0]
114
</pre>
115
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":http://hallaweb.jlab.org/podd/doc/html_v16/ClassIndex.html.
116
117
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":http://hallaweb.jlab.org/podd/doc/quickstart.html.
118
119
h2. Debugging (advanced)
120
121 6 Ole Hansen
The build type ("Release", "Debug", etc.) can be set via the CMake variable CMAKE_BUILD_TYPE. Please consult the "CMake documentation":https://cmake.org/cmake/help/latest for more information.
122
123 1 Ole Hansen
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
124
<pre>
125 6 Ole Hansen
export DEBUG=1
126 1 Ole Hansen
</pre>
127
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.
128
129
Once the Makefile has been updated, do
130
<pre>
131
% make clean
132
% make -j
133
</pre>
134
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.
135
136
With the SCons system, creating a debug build is easier. Nothing needs to be edited, simply run
137
<pre>
138
% scons -j debug=1
139
</pre>
140
Of course, the same considerations regarding ROOT and glibc debuginfo apply as described above for make builds.
141
142
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:
143
<pre>
144
alias lldb='/Library/Developer/CommandLineTools/usr/bin/lldb'
145
</pre>