SDC: meaning of the `factor` attribute
@acelenta just reported an issue introduced by isnan-guard removed from function combining calibration data from SDC output. Consider following structure (from 2023/ecal.txt
):
# Defaults
runs=8459-9717
factor.ECAL0=0.05 * 100. * 0.6858
factor.ECAL1=0.95 * 100. * 0.6858
# 1st block
runs=8459-9210
columns=name,x,y,peakpos,ledref,factor
ECAL0 0 0 1279 957 3.833
...
# 2nd block
runs=8459-9717
columns=name,x,y,time,timesigma
ECAL0 0 0 -0.75 1.3
...
Now, by requesting for run, say, 9001:
- 1st block gets loaded and provides basic values (with explicit
factor
) - 2nd block gets loaded and provides overriding values.
factor
from defaults gets pulled in from defaults. Withisnan
-guard (removed in MR !454 (merged), after this discussion) we were preventing this by not picking up metadata values only whenpeakpos
was not specified.
If we return the guard, then "per-part specifications" (introduced in MR !347 (merged)) like ones used for HCAL won't work as we used it mostly to make factor a subject of validity ranges.
If we'll introduce some additional internal flag to indicate whether factor
had came from metadata, then following example will behave counter-intuitively.
runs=100-200
columns=name, x, y, peakpos, time, factor
ECAL0 1 2 ...
runs=110-190
factor.ECAL0=...
columns=name, x, y, peakpos, time
ECAL0 1 2 ...
=> requesting run in 110-190 range will result the factor taken from previous block.
To me the major problem is that the global factor.*=...
does not have validity period while we effectively requesting this property. It was not anticipated to have validity for metadata properties. Simplest fix requiring minimal changes, agreeing with the existing design, but a bit tedious (as all our .txt
have to be slightly modified) would be to go for "per-part" specification in all the files:
runs=10-20
columns=name,factor
ECAL0 1.234
ECAL1 2.345
or, to be more explicit, according to Anton's guidelines (I can add asterisk syntax):
runs=10-20
columns=name,x,y,factor
ECAL0 * * 1.234
ECAL1 * * 2.345