Skip to content

Fix crashes in ParticleJetTools::childrenRemoved function

John Derek Chapman requested to merge jchapman/athena:ATLPHYSVAL-960_main into main

In the sample production for ATLPHYSVAL-960 we observed crashes in ParticleJetTools::childrenRemoved when called from ParticleJetGhostLabelTool: https://gitlab.cern.ch/atlas/athena/-/blob/main/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/Root/ParticleJetGhostLabelTool.cxx#L47-50 The issue seems to occur when the same vector is used for both the parents and children inputs to the function. Then when a sufficient number of particles are removed from the children vector so that the ip variable overshoots the end of the parents vector.

The minimal fix is to replace != with < in the definition of the loop over parents (first commit), but a more robust implementation is to make a copy of parents in the case that both inputs are references to the same object, and then use the copy in the function.

NB It should be noted that something must have changed in the inputs used to create the xAOD::Truth objects in order to show up this issue in ParticleJetTools::childrenRemoved. That still needs to be understood.

Tagging @dguest, @gcallea, @wbalunas, @turra, @mbandier, @tlari, @schaarsc

Merge request reports