Skip to content

MdtCalibAlg - Introduce new json format

Johannes Junggeburth requested to merge jojungge/athena:MdtCalibJson into main

Hi everybody,

this MR is an attempt to turn the quite convoluted RT & T0 calibration blobs into a more human readable format. Currently a blob is structured into 2 parts, a header and a payload part:

304668672,100
0.086799,0,0.236,0.457844,7.53673,0.216,0.754035,15.0735,0.202,1.07732,22.6102,0.187,1.42652,30.1469,0.173,1.79323,37.6836,0.16,2.16816,45.2204,0.148,2.54325,52.7571,0.137,2.91221,60.2938,0.127,3.2704,67.8305,0.119,3.61471,75.3673,0.112,3.94323,82.904,0.106,4.25515,90.4407,0.101,4.55045,97.9775,0.096,4.82971,105.514,0.093,5.09391,113.051,0.089,5.34424,120.588,0.087,5.58199,128.124,0.084,5.80842,135.661,0.082,6.02473,143.198,0.081,6.23201,150.735,0.079,6.43122,158.271,0.078,6.62317,165.808,0.076,6.80854,173.345,0.075,6.98791,180.881,0.074,7.16176,188.418,0.074,7.33048,195.955,0.073,7.49443,203.492,0.072,7.65391,211.028,0.071,7.80919,218.565,0.071,7.96055,226.102,0.07,8.10826,233.639,0.07,8.25254,241.175,0.069,8.39363,248.712,0.069,8.53175,256.249,0.068,8.6671,263.785,0.068,8.79985,271.322,0.068,8.93017,278.859,0.067,9.05818,286.396,0.067,9.184,293.932,0.067,9.30772,301.469,0.067,9.42942,309.006,0.066,9.54917,316.543,0.066,9.66703,324.079,0.066,9.78307,331.616,0.066,9.89735,339.153,0.066,10.0099,346.689,0.065,10.121,354.226,0.065,10.2304,361.763,0.065,10.3385,369.3,0.065,10.4451,376.836,0.065,10.5505,384.373,0.065,10.6547,391.91,0.065,10.7577,399.447,0.065,10.8595,406.983,0.064,10.9602,414.52,0.064,11.0599,422.057,0.064,11.1584,429.593,0.064,11.2559,437.13,0.064,11.3522,444.667,0.064,11.4476,452.204,0.064,11.5419,459.74,0.064,11.6351,467.277,0.064,11.7274,474.814,0.064,11.8188,482.351,0.064,11.9094,489.887,0.064,11.9992,497.424,0.064,12.0883,504.961,0.064,12.1768,512.497,0.064,12.2647,520.034,0.064,12.3519,527.571,0.064,12.4387,535.108,0.064,12.5247,542.644,0.064,12.61,550.181,0.064,12.6947,557.718,0.064,12.7786,565.255,0.064,12.8617,572.791,0.064,12.9441,580.328,0.064,13.0256,587.865,0.064,13.1066,595.401,0.064,13.1868,602.938,0.064,13.2666,610.475,0.064,13.3459,618.012,0.064,13.4246,625.548,0.064,13.5029,633.085,0.064,13.5806,640.622,0.064,13.6576,648.159,0.064,13.7337,655.695,0.064,13.809,663.232,0.065,13.8834,670.769,0.065,13.9569,678.305,0.065,14.0296,685.842,0.065,14.1001,693.379,0.065,14.1703,700.916,0.065,14.2395,708.452,0.065,14.3078,715.989,0.066,14.3751,723.526,0.066,14.4414,731.063,0.066,14.5068,738.599,0.066,14.5713,746.136,0.066,

The payload encodes the calib Identifier and the number of data points in the RT graph. The payload is a sequence of triplets consisting of (radius, time & resolution). The idea is to restructure the data into a JSON, where each chamber channel has the following structure

rtChannelEntry = {
  "station" : "BIS",
  "eta": 1,
  "phi": 6,
  "ml": 1,
  "layer": 1,  ## Might not be needed
  "tube": 1,   ### Might not be needed
  "appliedRT": True, 
   "radii" : [0.,0.1,0.2,....],
   "times" : [10.,20.,30.,...],
   "resolutions": [0.03, 0.02,0.01,...]
}

The fields radii, times and resolutions are required to have the same length. The algorithm turns the legacy payload into a list of such JSON objects which are then translated back into the calibration conditions objects. If the JSON format flag is set to true, the JSON is file assumed to have the proposed format.

Similarly for the T0 calibration, the following JSON layout is introduced

t0ChannelEntry = {
  "station" : "BIS",
  "eta": 1,
  "phi": 6,
  "appliedT0": True,
  "calibConstants" : [ {"ml":1, "layer": 2, "tube":3,"t0":0.51, "meanAdc": 0.4,"status": 2},
                       {"ml":1, "layer": 2, "tube":4,"t0":0.532, "meanAdc": 0.414,"status": 4}, ...
                     ]

}

Tagging: @formica, @diehl, @cheidegg

Edited by Johannes Junggeburth

Merge request reports