From 0d5aae70d5ff1336d71e479fbcae7c391d38b7ba Mon Sep 17 00:00:00 2001 From: Maarten Van Veghel <maarten.vanveghel@cern.ch> Date: Mon, 29 Jul 2024 18:48:35 +0200 Subject: [PATCH 1/2] fix overlap check for neutrals --- Phys/ParticleCombiners/include/CombKernel/ParticleCombiner.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Phys/ParticleCombiners/include/CombKernel/ParticleCombiner.h b/Phys/ParticleCombiners/include/CombKernel/ParticleCombiner.h index 136c2460b07..7a07d867e57 100644 --- a/Phys/ParticleCombiners/include/CombKernel/ParticleCombiner.h +++ b/Phys/ParticleCombiners/include/CombKernel/ParticleCombiner.h @@ -197,7 +197,8 @@ namespace Combiner { // We should only perform a track comparison with non-null track pointers, // else we will determine neutrals to overlap with each other (they have nullptr tracks) // to avoid this it's enough to check one proto for nullptr track - return ( proto1 == proto2 ) || ( proto1->track() && ( proto1->track() == proto2->track() ) ); + return ( proto1 == proto2 ) || ( proto1->track() && ( proto1->track() == proto2->track() ) ) || + ( proto1->neutralPID() && ( proto1->neutralPID() == proto2->neutralPID() ) ); } /** -- GitLab From 851e4e862d53021eea527516ed1f5f33412d6fae Mon Sep 17 00:00:00 2001 From: Maarten Van Veghel <maarten.vanveghel@cern.ch> Date: Wed, 31 Jul 2024 13:17:16 +0200 Subject: [PATCH 2/2] ensure neutral uniqueness --- Phys/RelatedInfoTools/src/WeightedRelationTable.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Phys/RelatedInfoTools/src/WeightedRelationTable.cpp b/Phys/RelatedInfoTools/src/WeightedRelationTable.cpp index f7c21bdf5a6..0b2f405a949 100644 --- a/Phys/RelatedInfoTools/src/WeightedRelationTable.cpp +++ b/Phys/RelatedInfoTools/src/WeightedRelationTable.cpp @@ -124,6 +124,8 @@ struct Projection { LHCb::Track const* track() const { return ( p && p->proto() ) ? p->proto()->track() : nullptr; } + LHCb::NeutralPID const* neutralPID() const { return ( p && p->proto() ) ? p->proto()->neutralPID() : nullptr; } + int pid() const { return p->particleID().pid(); } SmartRefVector<LHCb::CaloHypo> const& calo() const { @@ -155,7 +157,9 @@ namespace { LHCb::Particle::Selection selectionFromProjectionVector( std::vector<Projection>& wparts ) { std::sort( wparts.begin(), wparts.end() ); auto end = std::unique( wparts.begin(), wparts.end(), []( const auto& lhs, const auto& rhs ) { - return lhs.track() && ( lhs.track() == rhs.track() ) && lhs.pid() == rhs.pid(); + return ( ( lhs.track() && ( lhs.track() == rhs.track() ) ) || + ( lhs.neutralPID() && ( lhs.neutralPID() == rhs.neutralPID() ) ) ) && + lhs.pid() == rhs.pid(); } ); LHCb::Particle::Selection output; -- GitLab