cms-gem-daq-project / gem-plotting-tools

Repository for GEM commissioning plotting tools
GNU General Public License v3.0
1 stars 26 forks source link

New Feature: Routine for Calibrating the CFG_THR_*_DAC of VFAT3 #141

Closed bdorney closed 6 years ago

bdorney commented 6 years ago

Description

Tool for calibrating either the CFG_THR_ARM_DAC or the CFG_THR_ZCC_DAC register of a set of vfat3 ASICs. The user should have taken a set of scurves at varying CFG_THR_X_DAC settings, for X={ARM,ZCC}. Then these scurves are expected to have been analyzed, including fitting, with anaUltraScurve.py. The correct CFG_CAL_DAC calibration must have been used during this analysis.

The input file is expected to be in the Three Column Format with the independent variable being CFG_THR_X_DAC. For each scandate in the input file the scruve gScurveMeanDist_* and gScurveSigmaDist_* TGraphErrors objects for each VFAT, and summary level, will be fit with a Gaussian distribution. The mean of this Gaussian will be plotted against the provided CFG_THR_X_DAC value with the Gaussian's sigma taken as the error on the mean. The resulting scurveMean(Sigma) vs. CFG_THR_X_DAC distribution will be fit with a pol1(pol0) function. The fit function for the scurveMean vs. CFG_THR_X_DAC gives the calibration of the THR DAC in terms of fC while the fit function for the scurveSigma vs. CFG_THR_X_DAC gives the horizontal asymptote of the average ENC across the vfat.

An output table will be produced at the end of the function call which shows the calibration information and ENC by VFAT position and overall (e.g. vfat position = All). Numerically the All case is assigned a value of -1.

Output files will be found $ELOG_PATH. The calFile_CFG_THR_X_DAC_<Det S/N>.txt file will be a text file specifying the CFG_THR_X_DAC calibration parameters (slope and intercept) by vfat position. Additionally all TObjects created during the analysis will be found in calFile_<Det S/N>_CFG_THR_X_DAC.root.

Types of changes

Motivation and Context

Need calibration curve for CFG_THR_*_DAC in terms of fC for channel trimming. Here * = {ARM,ZCC}.

How Has This Been Tested?

Example call

    calibrateThrDac.py listOfScanDates_armCal.txt --fitRange=30,150

Produces calibration file:

% more calFile_CFG_THR_ARM_DAC_GE11-X-S-CERN-0011.txt 
vfatN/I:slope/F:intercept/F
-1  0.178395746337  -0.287064709828
0   0.179763537648  0.369390808056
1   0.181524615855  -0.159686459689
2   0.19687115202   -0.0134673381631
3   0.149039544303  1.05318170867
4   0.178481182001  -0.436071685412
5   0.186343377345  -0.536874569595
6   0.181890838844  -0.345231413165
7   0.155926125592  -0.209782255916
8   0.167392122509  -1.69109322169
9   0.193825678253  -2.05541105605
10  0.194836041499  -2.59696272778
11  0.150843707869  0.969850184472
12  4.70451459671e-07   4.96587651875e-05
13  0.193575733371  0.0691858626541
14  0.188483002694  -0.158586520957
15  4.70451459671e-07   4.96587651875e-05
16  4.70451459671e-07   4.96587651875e-05
17  0.197937228599  -2.50296195169
18  0.180685859684  0.32382070787
19  0.206626382812  -1.80760776576
20  0.206277214998  -0.192224947702
21  0.162042118707  0.227228647092
22  0.165048517191  -0.747531052724
23  0.147337914537  2.97002774175

Note in the above vfat's 12, 15, and 16 have no data due to hardware issues and thus are expected to have bad fit parameters.

Screenshots (if appropriate):

Gaussian fits of scurve mean, example all case:

screen shot 2018-07-23 at 12 02 58

Gaussian fits of scurve sigma, specific vfat case:

screen shot 2018-07-23 at 12 03 35

Derived calibration curve for CFG_THR_ARM_DAC averaging over all vfats:

screen shot 2018-07-23 at 12 04 04

Derived average ENC horizontal asymptote averaging over all vfats:

screen shot 2018-07-23 at 12 03 51

Checklist: