From 39f0ae9a48c87e39bbbf61e102edafd5964841e1 Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi <andrii.verbytskyi@cern.ch> Date: Fri, 30 Jun 2023 14:37:46 +0200 Subject: [PATCH] Move the isBSM function into TruthUtils Move the isBSM function into TruthUtils --- .../TruthUtils/TruthUtils/HepMCHelpers.h | 27 +++++++++++++++++++ .../MenuTruthThinning.h | 1 - .../src/MenuTruthThinning.cxx | 27 ++----------------- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/Generators/TruthUtils/TruthUtils/HepMCHelpers.h b/Generators/TruthUtils/TruthUtils/HepMCHelpers.h index 37df786ee08f..5bc3df6c077a 100644 --- a/Generators/TruthUtils/TruthUtils/HepMCHelpers.h +++ b/Generators/TruthUtils/TruthUtils/HepMCHelpers.h @@ -122,5 +122,32 @@ namespace MC ); } + + template <class T> inline bool MenuTruthThinning_isBSM(const T& p) { + + int pdg = p->pdg_id(); + + if ( (31<abs(pdg) && abs(pdg)<38) || // BSM Higgs / W' / Z' / etc + abs(pdg)==39 || + abs(pdg)==41 || + abs(pdg)==42 || + abs(pdg)== 7 || // 4th gen beauty + abs(pdg)== 8 || // 4th gen top + (600 < abs(pdg) && abs(pdg) < 607) || // scalar leptoquarks + (1000000<abs(pdg) && abs(pdg)<1000040) || // left-handed SUSY + (2000000<abs(pdg) && abs(pdg)<2000040) || // right-handed SUSY + abs(pdg)==6000005 || // X5/3 + abs(pdg)==6000006 || // T2/3 + abs(pdg)==6000007 || // B-1/3 + abs(pdg)==6000008 || // Y-4/3 + ( (abs(pdg)>=10000100) && (abs(pdg)<=10001000) ) // multi-charged + ) + return true; + + return false; +} + + + } #endif diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/MenuTruthThinning.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/MenuTruthThinning.h index 55362e57d13d..44da4ec4ad32 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/MenuTruthThinning.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/DerivationFrameworkMCTruth/MenuTruthThinning.h @@ -42,7 +42,6 @@ namespace DerivationFramework { bool isLeptonFromTau(const xAOD::TruthParticle*) const; bool isFromTau(const xAOD::TruthParticle*, std::unordered_set<int>& barcode_trace) const; - static bool isBSM(const xAOD::TruthParticle*) ; static bool isttHFHadron(const xAOD::TruthParticle*) ; bool isBoson(const xAOD::TruthParticle*) const; bool isFsrFromLepton(const xAOD::TruthParticle*) const; diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/MenuTruthThinning.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/MenuTruthThinning.cxx index 8fe50aec69e1..7b5c6ad5cf1b 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/MenuTruthThinning.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/src/MenuTruthThinning.cxx @@ -379,7 +379,7 @@ bool DerivationFramework::MenuTruthThinning::isAccepted(const xAOD::TruthParticl ok = true; // BSM particles - if(m_writeBSM && isBSM(p)) + if(m_writeBSM && MC::MenuTruthThinning_isBSM(p)) ok = true; // tt+HF hadrons @@ -409,7 +409,7 @@ bool DerivationFramework::MenuTruthThinning::isAccepted(const xAOD::TruthParticl for(unsigned int itr=0; itr<nIncoming; ++itr) { const xAOD::TruthParticle* incomingParticle = prodVtx->incomingParticle(itr); if (!incomingParticle) continue; - if ((m_writeBSMProducts && isBSM( (incomingParticle) )) || + if ((m_writeBSMProducts && MC::MenuTruthThinning_isBSM( (incomingParticle) )) || (m_writeBosonProducts && isBoson( (incomingParticle) )) || (m_writeTopAndDecays && abs(incomingParticle->pdgId())==6) ){ ok = true; @@ -647,29 +647,6 @@ bool DerivationFramework::MenuTruthThinning::isFromTau(const xAOD::TruthParticle return false; } -bool DerivationFramework::MenuTruthThinning::isBSM(const xAOD::TruthParticle* part) { - - int pdg = part->pdgId(); - - if ( (31<abs(pdg) && abs(pdg)<38) || // BSM Higgs / W' / Z' / etc - abs(pdg)==39 || - abs(pdg)==41 || - abs(pdg)==42 || - abs(pdg)== 7 || // 4th gen beauty - abs(pdg)== 8 || // 4th gen top - (600 < abs(pdg) && abs(pdg) < 607) || // scalar leptoquarks - (1000000<abs(pdg) && abs(pdg)<1000040) || // left-handed SUSY - (2000000<abs(pdg) && abs(pdg)<2000040) || // right-handed SUSY - abs(pdg)==6000005 || // X5/3 - abs(pdg)==6000006 || // T2/3 - abs(pdg)==6000007 || // B-1/3 - abs(pdg)==6000008 || // Y-4/3 - ( (abs(pdg)>=10000100) && (abs(pdg)<=10001000) ) // multi-charged - ) - return true; - - return false; -} bool DerivationFramework::MenuTruthThinning::isttHFHadron(const xAOD::TruthParticle* part) { -- GitLab