Project

General

Profile

Documentation of libsbsdig » History » Version 70

Eric Fuchey, 09/15/2020 05:50 PM

1 1 Eric Fuchey
h1. Documentation of libsbsdig
2
3 70 Eric Fuchey
{{toc}}
4
5 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:
6
https://redmine.jlab.org/projects/sbs-software/wiki/Old_Doc_libsbsdig
7
8 1 Eric Fuchey
h2. Overview
9
10 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.
11 1 Eric Fuchey
12
h2. Purpose
13
14 52 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.
15 37 Eric Fuchey
It is a standalone program which can run with a limited number of outputs (see section on usage).
16 52 Eric Fuchey
These produce files which can be analyzed with SBS-offline [https://hallaweb.jlab.org/wiki/index.php/Documentation_of_SBS-offline].
17 1 Eric Fuchey
18
h2. Getting the code and building the program
19
20
h3. Prerequisites
21
22 54 Eric Fuchey
* Working ROOT [https://root.cern.ch/drupal/] installation. ROOT 6 is strongly recommended.
23
* Working G4SBS [https://hallaweb.jlab.org/wiki/index.php/Documentation_of_g4sbs] installation.
24 1 Eric Fuchey
25
h3. Downloading the repository
26
27
The code is hosted on a github repository owned by JLab. To clone via ssh (preferred method on JLab batch farm), do: 
28 5 Eric Fuchey
29 1 Eric Fuchey
bq. git clone git@github.com:JeffersonLab/libsbsdig.git
30
31
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.)
32
33 51 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_.
34 36 Eric Fuchey
To obtain the new version of the code currently being developped on the "sbsdig_lw" branch, do
35
36
bq. git checkout sbsdig_lw
37 1 Eric Fuchey
38
h3. Building and installing the library
39
40 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). 
41
You also need to have setup an installation path e.g. /path/to/libsbsdig-install
42
*NB*: similarly to the build directory, the /path/to/libsbsdig-install directory shall '''not''' be the same as the source directory!
43
_The following instructions assume that "build" is parallel to "libsbsdig":_
44 9 Eric Fuchey
If successful, the libsbsdig library and several other files and folders will be created in the "build" and the "install" directory.
45 1 Eric Fuchey
46 2 Eric Fuchey
To build and install, the procedure needs to be completed. From scratch:
47
48
bq. mkdir build
49
cd build
50
cmake -DCMAKE_INSTALL_PREFIX=/path/to/libsbsdig-install ../libsbsdig
51
make install
52 1 Eric Fuchey
53 3 Eric Fuchey
Then, the following line should be added in the OS login configuration file to take advantage of this functionality:
54
* source /path/to/libsbsdig-install/bin/sbsdigenv.sh (or source /path/to/g4sbs_install/bin/sbsdigenv.csh on the batch farm)
55 1 Eric Fuchey
56 13 Eric Fuchey
h2. How to use the digitization library
57 1 Eric Fuchey
58 37 Eric Fuchey
When sbsdig is installed in your machine, you can run the program using up to 4 arguments:
59 1 Eric Fuchey
60 37 Eric Fuchey
bq. sbsdig gmn13.5_elastic_prod.txt 100000 gmn13.5_beambkgd_prod.txt 15
61 33 Eric Fuchey
62 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.
63 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.
64 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.
65 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.
66 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.
67 25 Eric Fuchey
68 1 Eric Fuchey
h2. Root output documentation
69 39 Eric Fuchey
70
The new digitization library will expand the TTree object from the input file to add ADC and TDC values.
71 55 Eric Fuchey
The input tree structure from G4SBS has already been described in detail in the G4SBS documentation [https://hallaweb.jlab.org/wiki/index.php/Documentation_of_g4sbs#ROOT_Tree_Structure].
72 56 Eric Fuchey
The basic idea is that for each detector in the input tree, a set of branches will be added.
73
74
There are several types of detectors in G4SBS (GEM, CAL, RICH), but there is not always a defined extension for a G4SBS detector type.
75
(NB: I'm voluntarilly omitting ECAL, 
76
For the purpose of the digitization, it is more convenient to define the following types of detectors:
77
* GEM: GEM trackers. Corresponds unambiguously to GEM detector type in G4SBS. Read out by MPD (sampling ADC) modules.
78
* Cher: Cherenkov detectors (example: GRINCH). Corresponds unambiguously to RICH detector type in G4SBS. Read out by TDC modules (with optional ADCs).
79
* Scint: Scintillator timing detectors (example: Timing Hodoscope). Corresponds to CAL detector type in G4SBS. Read out by TDC modules (with optional ADCs).
80
* Cal: Calorimeter (example: BBPS, BBSH). Corresponds to CAL detector type in G4SBS. Read out by ADC modules.
81
* HCal: Hadron Calorimeter. Corresponds to CAL detector type in G4SBS. Read out by FADC (sampling ADC) modules with TDCs.
82 57 Eric Fuchey
83 62 Eric Fuchey
h4. (proposed) data structure extension for "Cal" detector types:
84 57 Eric Fuchey
85
* nchan (int): number of channels (firing?)
86 66 Eric Fuchey
* chan (std::vector<int>) channel number
87 57 Eric Fuchey
* adc (std::vector<int>) unencoded pedestal subtracted ADC value
88
89 62 Eric Fuchey
h4. (proposed) data structure extension for "Scint", "Cher" detector types:
90 57 Eric Fuchey
91
* nchan (int): number of channels (firing?)
92 66 Eric Fuchey
* chan (std::vector<int>) channel number
93 57 Eric Fuchey
* adc (std::vector<int>) unencoded pedestal subtracted ADC value
94
* tdc_l (std::vector<int>) unencoded leading TDC value
95
* tdc_t (std::vector<int>) unencoded trailing TDC value
96
97 61 Eric Fuchey
h4. (proposed) data structure extension for "HCal" detector types:
98 57 Eric Fuchey
99
* nchan (int): number of channels (firing?)
100 66 Eric Fuchey
* chan (std::vector<int>) channel number
101 67 Eric Fuchey
* adc_i (i = 0 -> 19) (std::vector<int>) unencoded pedestal subtracted ADC values for sample i
102 57 Eric Fuchey
* tdc (std::vector<int>) unencoded TDC value
103 62 Eric Fuchey
104 57 Eric Fuchey
h4. (proposed) data structure extension for "GEMs" detector types (one per GEM plane):
105 1 Eric Fuchey
106 66 Eric Fuchey
* nstrips (int) number of strips (firing?)
107
* strips (std::vector<int>) strip number
108 69 Eric Fuchey
* adc_i (i = 0 -> 5) (std::vector<int>) unencoded pedestal subtracted ADC values for sample i