Skip to content

From float to double precision

Spyridon Merianos requested to merge smeriano/easyjet:morePrecision into main

During an unrelated investigation I bumped into the following issue.

I ran on the following sample :

bbyy-ntupler /eos/atlas/atlascerngroupdisk/phys-hdbs/diHiggs/Run3/yybb/mc23_13p6TeV.601523.PhPy8EG_PDF4LHC21_ZH125J_Zincl_MINLO_gammagamma.deriv.DAOD_PHYSLITE.e8532_e8528_s4162_s4114_r14622_r14663_p5855/DAOD_PHYSLITE.34976281._000013.pool.root.1 \ --run-config ../easyjet/bbyyAnalysis/share/RunConfig-bbyy-skimming-legacy.yaml --out-file ZH_yybb_PHYSLITE_ntuple.root

And observed that the SumOfWeightsAlg (which currently is used for the calculation of SOW of samples with Dalitz events) underestimates the total sum of weights :

root [1] CutBookkeeper_601523_410000_NOSYS->GetBinContent(2)
(double) 67165.914 # THIS SHOWS THE TOTAL SOW
root [2] SumOfWeights->GetBinContent(2)
(double) 67112.180 # THIS SHOWS THE TOTAL SOW
root [3] CutBookkeeper_601523_410000_NOSYS->GetBinContent(1)
(double) 80000.000 #THIS SHOWS THE TOTAL NUM OF EVENTS
root [4] SumOfWeights->GetBinContent(1)
(double) 80000.000 #THIS SHOWS THE TOTAL NUM OF EVENTS

You can see that for the same number of events, SumOfWeights->GetBinContent(2) results to lower result than expected. This is due to the initalization with {0.f} here. The algorithm responsible for the creation of histos such as CutBookkeeper_*_*_* fills the bin contents with double values.

With the changes of this M.R. you can see that the results match :

root [1] CutBookkeeper_601523_410000_NOSYS->GetBinContent(2)
(double) 67165.914 # THIS SHOWS THE TOTAL SOW
root [2] SumOfWeights->GetBinContent(2)
(double) 67165.914 # THIS SHOWS THE TOTAL SOW
root [3] CutBookkeeper_601523_410000_NOSYS->GetBinContent(1)
(double) 80000.000 #THIS SHOWS THE TOTAL NUM OF EVENTS
root [4] SumOfWeights->GetBinContent(1)
(double) 80000.000 #THIS SHOWS THE TOTAL NUM OF EVENTS

The reason why I ran om a sample with no Dalitz Events is to cross check the precision.

Cases like double w_counter{0.f}; do not affect the precision of the measurement but are changed to double w_counter{0.0}; for clarity.

Tagging : @tstreble @lderamo @alwang @gdigrego

Edited by Spyridon Merianos

Merge request reports