Fix truth matching persistency bug
The issue originated from Moore#580 (closed), where @yihou identified anomalies in neutral truth matching. Subsequently, @alobosal confirmed the bug during the HLT2 line development. I suggested using the MCReconstructed
tool to double-check the truth-matching relation table at the DaVinci level. Then, @yihou observed that all candidates had only one truth-matching result, which is uncommon for neutral particles.
The debugging process then began, and thanks a lot to @yihou for all the assistance with debugging! Eventually, the bug was identified. It was due to the recently implemented selective parker, which includes a mechanism to prevent duplicate entries based on the from
candidate in the table. This results in a situation where if one from
candidate is related to multiple to
candidates, only the first entry persists, and the rest are removed by this kill-duplication mechanism. Consequently, the truth-matching table retains only one entry for each candidate (the first one, which, since the table is sorted by weight, corresponds to the worst candidate). This has a minor impact on charged particles, which usually have only one associated candidate, but it is disastrous for neutral particles, which typically have more than one associated candidate and the current implementation will only persist the worst one.
This MR addresses this issue and, so makes MCReconstructed
useful.