diff --git a/Generators/TruthUtils/TruthUtils/AtlasPID.h b/Generators/TruthUtils/TruthUtils/AtlasPID.h index 265d768cd30ba3509abfbabfd00bf3c3cec204ff..813da0c8a41c6f68d8fec371969984572874675a 100644 --- a/Generators/TruthUtils/TruthUtils/AtlasPID.h +++ b/Generators/TruthUtils/TruthUtils/AtlasPID.h @@ -473,6 +473,15 @@ template<class T> inline bool isCharmMeson(const T& p) { return leadingQuark(p) template<class T> inline bool isBottomMeson(const T& p) { return leadingQuark(p) == BQUARK && isMeson(p); } template<class T> inline bool isTopMeson(const T& p) { return leadingQuark(p) == TQUARK && isMeson(p); } +template<class T> inline bool isCCbarMeson(const T& p) { return isCCbarMeson(p->pdg_id());} +template<> inline bool isCCbarMeson(const DecodedPID& p) { return leadingQuark(p) == CQUARK && isMeson(p) && p(1) == CQUARK && p(2) == CQUARK; } +template<> inline bool isCCbarMeson(const int& p) { return isCCbarMeson(DecodedPID(p)); } + +template<class T> inline bool isBBbarMeson(const T& p){ return isBBbarMeson(p->pdg_id());} +template<> inline bool isBBbarMeson(const DecodedPID& p) { return leadingQuark(p) == BQUARK && isMeson(p) && p(1) == BQUARK && p(2) == BQUARK; } +template<> inline bool isBBbarMeson(const int& p) { return isCCbarMeson(DecodedPID(p)); } + + template<class T> inline bool isLightBaryon(const T& p) { auto lq = leadingQuark(p); return (lq == DQUARK || lq == UQUARK||lq == SQUARK) && isBaryon(p); } template<class T> inline bool isHeavyBaryon(const T& p) { auto lq = leadingQuark(p); return (lq == CQUARK || lq == BQUARK || lq == TQUARK) && isBaryon(p); } template<class T> inline bool isStrangeBaryon(const T& p) { return leadingQuark(p) == SQUARK && isBaryon(p); } diff --git a/PhysicsAnalysis/MCTruthClassifier/Root/MCTruthClassifierGen.cxx b/PhysicsAnalysis/MCTruthClassifier/Root/MCTruthClassifierGen.cxx index 9f3d27d329a65b6136244f0aa75e9f1ab27a7cbb..0eef6c03f9bcf49583353226aaf637d5c4100f41 100644 --- a/PhysicsAnalysis/MCTruthClassifier/Root/MCTruthClassifierGen.cxx +++ b/PhysicsAnalysis/MCTruthClassifier/Root/MCTruthClassifierGen.cxx @@ -1823,7 +1823,6 @@ MCTruthClassifier::defOrigOfNeutrino(const xAOD::TruthParticleContainer* mcTruth return convHadronTypeToOrig(pType, motherPDG); } -//--------------------------------------------------------------------------------- ParticleOrigin MCTruthClassifier::convHadronTypeToOrig(ParticleType pType, int motherPDG) { @@ -1840,19 +1839,11 @@ MCTruthClassifier::convHadronTypeToOrig(ParticleType pType, int motherPDG) if (pType == LightMesonPart) return LightMeson; return NonDefined; } -//--------------------------------------------------------------------------------- + ParticleOrigin MCTruthClassifier::defHadronType(int pdg) { - //--------------------------------------------------------------------------------- - // Special case if (abs(pdg) == MC::JPSI) return JPsi; - - int q1 = (pdg / 1000) % 10; - int q2 = (pdg / 100) % 10; - int q3 = (pdg / 10) % 10; - - if (q1 == 0 && MC::BQUARK == q2 && MC::BQUARK == q3) return BBbarMeson; - if (q1 == 0 && MC::CQUARK == q3 && MC::CQUARK == q2) return CCbarMeson; - // Now just use the central helper functions + if (MC::isBBbarMeson(pdg)) return BBbarMeson; + if (MC::isCCbarMeson(pdg)) return CCbarMeson; if (MC::isBottomMeson(pdg)) return BottomMeson; if (MC::isCharmMeson(pdg)) return CharmedMeson; if (MC::isBottomBaryon(pdg)) return BottomBaryon; @@ -1864,18 +1855,9 @@ ParticleOrigin MCTruthClassifier::defHadronType(int pdg) { return NonDefined; } -//--------------------------------------------------------------------------------- ParticleType MCTruthClassifier::defTypeOfHadron(int pdg) { - // Note that this differs from the above by return type -- should we be more clear? - int q1 = (abs(pdg) / 1000) % 10; - int q2 = (abs(pdg) / 100) % 10; - int q3 = (abs(pdg) / 10) % 10; - // di quark - // if( q3 == 0 && q2 >=q3 ) cout<<"di quark"<<endl; - // First two do not have obvious helpers in MCUtils - if (q1 == 0 && MC::BQUARK == q2 && MC::BQUARK == q3) return BBbarMesonPart; - if (q1 == 0 && MC::CQUARK == q3 && MC::CQUARK == q2) return CCbarMesonPart; - // Now just use the central helper functions + if (MC::isBBbarMeson(pdg)) return BBbarMesonPart; + if (MC::isCCbarMeson(pdg)) return CCbarMesonPart; if (MC::isBottomMeson(pdg)) return BottomMesonPart; if (MC::isCharmMeson(pdg)) return CharmedMesonPart; if (MC::isBottomBaryon(pdg)) return BottomBaryonPart; @@ -1887,7 +1869,6 @@ ParticleType MCTruthClassifier::defTypeOfHadron(int pdg) { return Unknown; } -//--------------------------------------------------------------------------------- const xAOD::TruthParticle* MCTruthClassifier::getMother(const xAOD::TruthParticle* thePart) const { ATH_MSG_DEBUG("executing getMother"); @@ -2162,4 +2143,3 @@ MCTruthClassifier::checkOrigOfBkgElec(const xAOD::TruthParticle* theEle, Info* i info->bkgElecMother = thePart; return part; } -