diff --git a/PhysicsTools/JetMCAlgos/plugins/GenHFHadronMatcher.cc b/PhysicsTools/JetMCAlgos/plugins/GenHFHadronMatcher.cc index 4cb97a0140f53..5a785eb72b444 100644 --- a/PhysicsTools/JetMCAlgos/plugins/GenHFHadronMatcher.cc +++ b/PhysicsTools/JetMCAlgos/plugins/GenHFHadronMatcher.cc @@ -979,7 +979,8 @@ int GenHFHadronMatcher::findInMothers(int idx, } int pdg_2 = hadMothers[idx2].pdgId(); // Inverting the flavour if bb oscillation detected - if (isHadronPdgId(pdgId, pdg_1) && isHadronPdgId(pdgId, pdg_2) && pdg_1 * pdg_2 < 0) { + if (isHadronPdgId(pdgId, pdg_1) && isHadronPdgId(pdgId, pdg_2) && + ((pdg_1 < 0 && pdg_2 > 0) || (pdg_1 > 0 && pdg_2 < 0))) { pdgId *= -1; if (verbose) printf("######### Inverting flavour of the hadron\n");