diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/src/TruthDecoratorHelpers.cxx b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/src/TruthDecoratorHelpers.cxx index 15b0a222fbeb0ceb7b63d2b4a628f6393f28a564..377b09b3249778a0a8c60e0e85be9bb827ed7a2c 100644 --- a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/src/TruthDecoratorHelpers.cxx +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/src/TruthDecoratorHelpers.cxx @@ -65,6 +65,7 @@ namespace FlavorTagDiscriminants { } for (unsigned int p = 0; p < truth_particle->nParents(); p++) { const auto parent = truth_particle->parent(p); + if(parent == truth_particle) continue;// avoid infinite recursion const auto parent_hadron = get_parent_hadron(parent, false); if ( parent_hadron != nullptr ) { return parent_hadron; @@ -147,4 +148,4 @@ namespace FlavorTagDiscriminants { return seen_vertices.size(); } } -} \ No newline at end of file +} diff --git a/PhysicsAnalysis/TrackingID/InDetTrackSystematicsTools/Root/InDetTrackTruthOriginTool.cxx b/PhysicsAnalysis/TrackingID/InDetTrackSystematicsTools/Root/InDetTrackTruthOriginTool.cxx index 705b78b051adf75e4ede87fdddae35124cdc6fcd..f9a2c23c67c8d82ef080f149e5e1a08dd40f468e 100644 --- a/PhysicsAnalysis/TrackingID/InDetTrackSystematicsTools/Root/InDetTrackTruthOriginTool.cxx +++ b/PhysicsAnalysis/TrackingID/InDetTrackSystematicsTools/Root/InDetTrackTruthOriginTool.cxx @@ -202,8 +202,10 @@ namespace InDet { if( flav == 15 && abs(truth->pdgId()) == 15 ) return true; + for(unsigned int p=0; p<truth->nParents(); p++) { const xAOD::TruthParticle* parent = truth->parent(p); + if(parent == truth ) continue ; // avoid infinite recursion if( isFrom(parent, flav) ) return true; }