In external trigger mode

This procedure is made to extract the pedestal value for each channel as well as the memory-cell offsets.  Typically, the input for this program is from a LED scan with 0 mV voltage. These kind of runs is what we call as pedestal runs. For every channel, a specific distribution is saved. A gaussian-like distribution centered in 200-300 ADC ticks (depends on the prototype) created mainly by dark rate and electronic noise. Here is a typical example of a pedestal run: 

For data files obtained with the HDMI/USB based single layer Labview

The root file needs to be obtained from convert_root_eventbuilding software!

For data files obtained in testbeam

This is for slcio files obtained from testbeam during LED scans!

This is slightly different as files are obtained from the multi-layer HDMI DAQ and the data format is saved in slcio. One has to convert the "raw" slcio file into the correct root file format. For this Marlin needs to be used to convert the slcio to root.

You will need these files:

Modify the input and output in the steering file and then you can run the conversion with

./myMarlin steering.xml

The output rootfile will have the needed format for the pedestal extraction.

The program pedestal_memcell takes a root file as input and provide a .tsv file as output containing the Mean/RMS pedestal with all memory cells (from 1 to 16) as also the relative shift of memory cells compared to the 2nd memory, starting from 1, not from 0. For the data obtained with the USB DAQ, the memory cells order is inverted, so the offset is calculated with respect memory cell 15 (the previous to the last one).


The program needs a input file (root file) and the output folder (where a text file with all pedestal offsets is written).

To compile the program and run it: 

cd YourDestinationFolderName/Extraction_Pedestal 

./bin/pedestal_memcell InputFilePath OutputDirectoryPath (HG/LG(0) or HG/TDC(1)) (External trigger(0) Autotrigger(1))

The main output file (pedestal_offsets_in.tsv) looks like: 

#pedestal positions & memory cell dependent offsets (tpedOffsetcellX = tpedOffsetcell2 - tpedOffsetcellX) from file "/home/airqui/AFS/HBU_setup_TokyoApril2016/Rootfiles/Vscan_first_LED0000_2016-04-04.root"
#format: the ordering of memory cells is inverted for DAQ HBU
#chip chn pedposall pedwidthall pedOffsetcell1 pedOffsetcell2 pedOffsetcell3 ... pedOffsetcell16"

193     0       230.633 6.03161 -5.33352        0       2.31612 5.63341 -1.19706        4.58673 -2.11284        2.01089 -4.77171        2.81487 -2.6499 4.12378 -1.35646        4.23672 -1.6403 231.128
193     1       233.762 5.81631 3.14922 0       3.71844 -9.13052        -0.212337       -1.65904        -5.77079        -1.0121 -0.200168       4.23524 -5.34121        -3.79015        -3.16202        -0.44851
        1.0539  232.799

A second file, Plots_comp.root, is saved. It contains the pedestal distributions for all channels, chips and memory cells. 

Depending of your input data format, the memory cells are ordered in one way or the other. In LED external trigger scans, the first memory cell is always zero (known bug of Spiroc 2b). If we using the USB Labview, the first memory cell filled with data is the last one sent to the PC, so is the last one in the output file shown above (you can see that last written memory cell has an offset of ~230). Using the HDMI Labview, the memory cell output is well sorted. Therefore, to calculate the offset, we have to chose as a reference one memory cell that always works, in this case memory cell 2nd (15th in USB labview) over 16th which is always filled.

Pedestal offset correction

The output file of the pedestal calculation, pedestal_offsets_in.tsv, is used to perform pedestal offset correction. This is very important, especially for the gain calibration measurements since we want to see the single pixel spectrum and measure the distance between pixels (in ADC). If the pedestal offset correction is not performed, the single pixel spectra peaks are wider since every memory cell noise average is a bit shifted with respect to the others. This shift is not always in the same direction.

In auto-trigger mode

Physics data needs to be used here. There is a difference between external/autotrigger pedestals! AT Pedestal extraction described in section MIP Calibration