Patch for bbyy crash
The problem
It was reported that when running on a file with bypass
set to true, for example with this command:
bbyy-ntupler /eos/user/a/atishelm/ntuples/SHbbyy/examples/mc20_13TeV.800904.Py8EG_A14NNPDF23LO_XHS_X170_S030_HyySbb.deriv.DAOD_PHYS.e8531_a907_r14859_p6026/DAOD_PHYS.37663611._000002.pool.root.1 --run-config bbyyAnalysis/RunConfig-Resonant-Default.yaml --out-file analysis-variables-SHbbyy.root --e 200
or
bbyy-ntupler /eos/user/a/atishelm/ntuples/SHbbyy/examples/mc20_13TeV.800904.Py8EG_A14NNPDF23LO_XHS_X170_S030_HyySbb.deriv.DAOD_PHYS.e8531_a907_r14859_p6026/DAOD_PHYS.37663611._000002.pool.root.1 --run-config bbyyAnalysis/share/RunConfig-bbyy-skimming-loose.yaml --out-file analysis-variables-SHbbyy.root --e 200
the following error is produced:
BaselineVarsbbyyAlg FATAL Standard std::exception is caught
BaselineVarsbbyyAlg ERROR SG::ExcBadAuxVar: Attempt to retrieve nonexistent aux data item `::selected_ph_NOSYS' (1207).
I found in particular, this error would occur for an event which had three photons, none of which passed passPhoton_TightID_NonIsoWP
or passPhoton_LooseID_IsoWP
.
The reason
I think a bug was introduced in !681 (merged) , as far as being compatible with the current logic of bbyyAnalysis/src/BaselineVarsbbyyAlg.cxx
, as in bbyySelectorAlg.cxx
, m_selected_ph
is forced to have a max of two photons. However in bbyyAnalysis/src/BaselineVarsbbyyAlg.cxx
, the condition if (m_selected_ph.get(*photon, sys))
will fail if the two photons don't pass passPhoton_TightID_NonIsoWP || passPhoton_LooseID_IsoWP
. This means ph1
and ph2
may not be set, and if photons
is > 2, it will try to access a photon which was never set in m_selected_ph
.
The solution
Based on Thomas' suggestion, a decoration was added for all objects in the photons collection. In the selector, added a loop over all photons to set the decoration to false.