Project

General

Profile

Documentation of libsbsdig » History » Version 49

Eric Fuchey, 08/18/2020 11:35 PM

1 1 Eric Fuchey
h1. Documentation of libsbsdig
2
3 36 Eric Fuchey
This page concerns the new version of libsbsdig which is currently being developped. The documentation for the old version of libsbsdig has been saved at:
4
https://redmine.jlab.org/projects/sbs-software/wiki/Old_Doc_libsbsdig
5
6 1 Eric Fuchey
h2. Overview
7
8 41 Eric Fuchey
This page is maintained by the UConn group (Eric Fuchey + Andrew Puckett) and as of February 14, 2020 is specific to the *sbsdig_lw* branch of libsbsdig on github.
9 1 Eric Fuchey
10
h2. Purpose
11
12 49 Eric Fuchey
This page documents the libsbsdig code, which purpose is to process the Monte Carlo simulations of the SBS experiments produced by G4SBS {https://hallaweb.jlab.org/wiki/index.php/Documentation_of_g4sbs} to produce ADCs or TDCs.
13 37 Eric Fuchey
It is a standalone program which can run with a limited number of outputs (see section on usage).
14 1 Eric Fuchey
These produce files which can be analyzed with [https://hallaweb.jlab.org/wiki/index.php/Documentation_of_SBS-offline SBS-offline].
15
16
h2. Getting the code and building the program
17
18
h3. Prerequisites
19
20
*Working [https://root.cern.ch/drupal/ ROOT] installation. '''libsbsdig is compatible with ROOT version 5 and ROOT version 6'''. '''''ROOT 6 is strongly recommended'''''
21 36 Eric Fuchey
*Working [https://hallaweb.jlab.org/wiki/index.php/Documentation_of_g4sbs G4SBS] installation. 
22 1 Eric Fuchey
23
h3. Downloading the repository
24
25
The code is hosted on a github repository owned by JLab. To clone via ssh (preferred method on JLab batch farm), do: 
26 5 Eric Fuchey
27 1 Eric Fuchey
bq. git clone git@github.com:JeffersonLab/libsbsdig.git
28
29
For this method to work, the ssh public key on the machine where you want to get the code must be added to your github account (see [https://help.github.com/articles/generating-ssh-keys/ Guide] to generating ssh keys and adding to your github.com account.)
30
31 36 Eric Fuchey
Cloning the repository defaults to the "master" branch. '''As of August, 18th, 2020, the master branch still contains the old version of the code'''.
32
To obtain the new version of the code currently being developped on the "sbsdig_lw" branch, do
33
34
bq. git checkout sbsdig_lw
35 1 Eric Fuchey
36
h3. Building and installing the library
37
38 2 Eric Fuchey
Create a "build" directory that is parallel to the "libsbsdig" source directory (this is not strictly required, but the build directory must be separate from the "SBS-offline" directory in any case). 
39
You also need to have setup an installation path e.g. /path/to/libsbsdig-install
40
*NB*: similarly to the build directory, the /path/to/libsbsdig-install directory shall '''not''' be the same as the source directory!
41
_The following instructions assume that "build" is parallel to "libsbsdig":_
42 9 Eric Fuchey
If successful, the libsbsdig library and several other files and folders will be created in the "build" and the "install" directory.
43 1 Eric Fuchey
44 2 Eric Fuchey
To build and install, the procedure needs to be completed. From scratch:
45
46
bq. mkdir build
47
cd build
48
cmake -DCMAKE_INSTALL_PREFIX=/path/to/libsbsdig-install ../libsbsdig
49
make install
50 1 Eric Fuchey
51 3 Eric Fuchey
Then, the following line should be added in the OS login configuration file to take advantage of this functionality:
52
* source /path/to/libsbsdig-install/bin/sbsdigenv.sh (or source /path/to/g4sbs_install/bin/sbsdigenv.csh on the batch farm)
53 1 Eric Fuchey
54 13 Eric Fuchey
h2. How to use the digitization library
55 1 Eric Fuchey
56 37 Eric Fuchey
When sbsdig is installed in your machine, you can run the program using up to 4 arguments:
57 1 Eric Fuchey
58 37 Eric Fuchey
bq. sbsdig gmn13.5_elastic_prod.txt 100000 gmn13.5_beambkgd_prod.txt 15
59 33 Eric Fuchey
60 37 Eric Fuchey
These arguments have to come in this sequence, and while not all arguments are mandatory to provide, one cannot skip an argument unless they want to skip all following arguments.
61 38 Eric Fuchey
*The first argument is a list of "signal" files to digitize. It is mandatory to provide. An example is provided in the files attached.
62 37 Eric Fuchey
*The second argument is the number of process. It has a default value of "-1" (=2^64-1) so it can be left unprovided, unless one wants to provide argument 3 and 4.
63 38 Eric Fuchey
*The third argument is a list of "background" files (usually min-bias beam-on-target) to superimpose to the signal to digitize. It can be ignored if one seeks to digitize signal with no background. An example is provided in the files attached.
64 37 Eric Fuchey
*The fourth argument is the number of "background" files to superimposeto the signal to digitize. It's default value is zero, so it can be ignored if one seeks to digitize signal with no background.
65 25 Eric Fuchey
66 1 Eric Fuchey
h2. Root output documentation
67 39 Eric Fuchey
68
The new digitization library will expand the TTree object from the input file to add ADC and TDC values.
69
The input tree structure from G4SBS has already been described in detail [https://hallaweb.jlab.org/wiki/index.php/Documentation_of_g4sbs#ROOT_Tree_Structure here].