Hall A C++ Analyzer Hands-On Tutorial
Ole Hansen (ole@jlab.org)
11 April 2016

This is a small replay setup for an optics calibration run of the
Hall A GMp experiment that ran in the spring of 2016.

The replay assumes that you have ROOT set up. On JLab CUE machines, you
can do so easily with the following commands:

source /apps/root/PRO/setroot_CUE

You will need to build the included analyzer version 1.6.0-beta1 as follows:

tar xzf analyzer-1.6.0-beta1.tar.gz
cd analyzer-1.6.0
make -j
cd ..

To set up various required environment variables, run the included setup
script:

source setup.csh

(or setup.sh if you are using bash, e.g. on Linux or MacOSX)

Next, you need to obtain the raw data file to be replayed. On JLab
CUE systems, you can easily do so by making a symbolic link:

ln -s /work/halla/gmp12/ole/raw  data

Alternatively, you can restore one or more files from tape, for example:

mkdir data
cd data
jget /mss/halla/gmp12/raw/gmp_21960.dat.0 .
jget /mss/halla/gmp12/raw/gmp_22110.dat.0 .
cd ..

See the Hall A electronic logbook at logbooks.jlab.org for some details about
these runs.

If you are offsite or on a non-CUE workstation/laptop, you'll need to copy
the file(s) to your machine. The size is about 2GB per file.

Now, find some disk space for the output files, for example on /volatile, and
create a link to that area 

ln -s /volatile/halla/<experiment>/<user>/rootfiles  rootfiles

Next, go to the replay directory, run the analysis and plot some
results using the included example scripts:

cd replay
analyzer
analyzer [0] .x replay.C
(give the number of the run to be replayed)
(answer -1 to replay all events)
analyzer [1] .x plot.C
analyzer [2] .x plot2.C

You may find it interesting to inspect the scripts in detail, the input 
files replay.odef and replay.cdef in the replay directory, as well as
the database files in the DB directory.

The tutorial talk given at the analysis workshop can be found at

http://hallaweb.jlab.org/podd/download/Podd-Tutorial-2016-04-11.pdf

Feel free to email me with any questions you have.
