diff --git a/Event/xAOD/xAODTruth/Root/TruthParticle_v1.cxx b/Event/xAOD/xAODTruth/Root/TruthParticle_v1.cxx index 33ed93820354e2f383da618031041d50e002cef4..cc6b8de596ab3e37542de5a8e3d858d156e3ad5d 100644 --- a/Event/xAOD/xAODTruth/Root/TruthParticle_v1.cxx +++ b/Event/xAOD/xAODTruth/Root/TruthParticle_v1.cxx @@ -297,6 +297,7 @@ namespace xAOD { MC_PID_HELPER( bool, isHiggs ) MC_PID_HELPER( bool, isResonance ) MC_PID_HELPER( bool, isGenSpecific ) + MC_PID_HELPER( bool, isBSM ) // Forget about this macro: #undef MC_PID_HELPER diff --git a/Event/xAOD/xAODTruth/xAODTruth/versions/TruthParticle_v1.h b/Event/xAOD/xAODTruth/xAODTruth/versions/TruthParticle_v1.h index a6f65a248f015e9784c684df8965ae82b1f51299..5f778273d230dd7055b39afa85ea393c8c84e8ff 100644 --- a/Event/xAOD/xAODTruth/xAODTruth/versions/TruthParticle_v1.h +++ b/Event/xAOD/xAODTruth/xAODTruth/versions/TruthParticle_v1.h @@ -281,6 +281,8 @@ namespace xAOD { bool isResonance() const; /// Check if this is a generator specific (non-physical) particle bool isGenSpecific() const; + /// Check if this is a BSM particle + bool isBSM() const; /// @} diff --git a/PhysicsAnalysis/CommonTools/ExpressionEvaluation/ExpressionEvaluation/SGxAODProxyLoader.h b/PhysicsAnalysis/CommonTools/ExpressionEvaluation/ExpressionEvaluation/SGxAODProxyLoader.h index 1101c0042ee9a10b88e959a4237ab179d5ba316b..5d1fd65f374b58503570ccac3944ee6ac6da4c3a 100644 --- a/PhysicsAnalysis/CommonTools/ExpressionEvaluation/ExpressionEvaluation/SGxAODProxyLoader.h +++ b/PhysicsAnalysis/CommonTools/ExpressionEvaluation/ExpressionEvaluation/SGxAODProxyLoader.h @@ -255,41 +255,6 @@ namespace ExpressionParsing { }; - class BSMParticleVariableLoader : public BaseVectorVariableLoader { - public: - BSMParticleVariableLoader(StoreGateSvc_t &evtStore, - const std::string &containerName, - const std::string &propertyName) - : BaseVectorVariableLoader(evtStore,containerName,propertyName), - m_isBSM(propertyName=="isBSM") - { - } - - static BaseVariableLoader *tryCreation(StoreGateSvc_t &evtStore, - const std::string &containerName, - const std::string &methodName); - - virtual IProxyLoader::VariableType variableType() - { - if (!m_initialised) { - m_initialised = true; - updateProxyLoader(); - if (m_isBSM) m_variableType=m_vectorProxyLoader->variableTypeFromString("pdgId"); - else m_variableType=m_vectorProxyLoader->variableTypeFromString(m_propertyName); - } - return m_variableType; - } - - virtual std::vector<int> getVectorIntValue(); - - private: - virtual void updateProxyLoader(); - - private: - bool m_isBSM; - }; - - public: SGxAODProxyLoader(StoreGateSvc_t &evtStore) : m_evtStore(evtStore) { } virtual ~SGxAODProxyLoader(); diff --git a/PhysicsAnalysis/CommonTools/ExpressionEvaluation/src/SGxAODProxyLoader.cxx b/PhysicsAnalysis/CommonTools/ExpressionEvaluation/src/SGxAODProxyLoader.cxx index 55eff1d33c9a63b96057268951df9c36a2ead32d..a819dcc58b1f19881f092504845f6558899b67d4 100644 --- a/PhysicsAnalysis/CommonTools/ExpressionEvaluation/src/SGxAODProxyLoader.cxx +++ b/PhysicsAnalysis/CommonTools/ExpressionEvaluation/src/SGxAODProxyLoader.cxx @@ -28,11 +28,6 @@ STORE_VARIABLE_LOADER; \ } while (0) -#define TRY_BSM_PARTICLE_CONTAINER do { \ - variableLoader = BSMParticleVariableLoader::tryCreation(m_evtStore, containerName, methodName); \ - STORE_VARIABLE_LOADER; \ -} while (0) - #define TRY_VECTOR(CONTAINER) do { \ variableLoader = VectorVariableLoader<CONTAINER>::tryCreation(m_evtStore, containerName, methodName); \ STORE_VARIABLE_LOADER; \ @@ -114,33 +109,6 @@ namespace ExpressionParsing { m_elementProxyLoader->setData(metElement); } - SGxAODProxyLoader::BaseVariableLoader *SGxAODProxyLoader::BSMParticleVariableLoader::tryCreation(StoreGateSvc_t &evtStore, const std::string &containerName, const std::string &methodName) - { - if (!(evtStore->contains<xAOD::TruthParticleContainer>(containerName))) return NULL; - return new BSMParticleVariableLoader(evtStore, containerName, methodName); - } - - void SGxAODProxyLoader::BSMParticleVariableLoader::updateProxyLoader() - { - if (!m_vectorProxyLoader) { - m_vectorProxyLoader = new xAODVectorProxyLoader(); - } - - const xAOD::TruthParticleContainer *container = m_evtStore->retrieve<const xAOD::TruthParticleContainer>(m_containerName); - m_vectorProxyLoader->setData(container); - } - - std::vector<int> SGxAODProxyLoader::BSMParticleVariableLoader::getVectorIntValue() - { - updateProxyLoader(); - if (!m_isBSM) return m_vectorProxyLoader->loadVecIntVariableFromString(m_propertyName); - // We know which one this is... - std::vector<int> results = m_vectorProxyLoader->loadVecIntVariableFromString("pdgId"); - // Now change the PDG IDs into isBSM answers - for (size_t i=0;i<results.size();++i) results[i]=MC::PID::isBSM(results[i]); - return results; - } - // End helper classes @@ -189,11 +157,9 @@ namespace ExpressionParsing { // e.g. "MET_RefFinal[Final].met" (quotation marks around Final are optional, method name could be anything) TRY_MET_CONTAINER; - // Special handling for TruthParticles.isBSM - TRY_BSM_PARTICLE_CONTAINER; - // End specific workarounds + TRY_VECTOR(xAOD::TruthParticleContainer); TRY_VECTOR(xAOD::ElectronContainer); TRY_VECTOR(xAOD::PhotonContainer); TRY_VECTOR(xAOD::MuonContainer); diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/TruthDerivationTools.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/TruthDerivationTools.py index 2f566020f6507530da0242979b0f37b524041e06..c941cf9438756000304c7dff3033a5537aefb861 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/TruthDerivationTools.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/python/TruthDerivationTools.py @@ -55,7 +55,7 @@ ToolSvc += DFCommonTruthBosonTool DFCommonTruthBSMTool = DerivationFramework__TruthCollectionMaker(name = "DFCommonTruthBSMTool", NewCollectionName = "TruthBSM", - ParticleSelectionString = "( (31<abs(TruthParticles.pdgId) && abs(TruthParticles.pdgId)<38) || abs(TruthParticles.pdgId)==39 || abs(TruthParticles.pdgId)==41 || abs(TruthParticles.pdgId)==42 || abs(TruthParticles.pdgId)== 7 || abs(TruthParticles.pdgId)== 8 || abs(TruthParticles.pdgId)==17 || abs(TruthParticles.pdgId)==18 || abs(TruthParticles.pdgId)==55 || (1000000<abs(TruthParticles.pdgId) && abs(TruthParticles.pdgId)<1000040) || (2000000<abs(TruthParticles.pdgId) && abs(TruthParticles.pdgId)<2000040) )", + ParticleSelectionString = "(TruthParticles.isBSM)", Do_Compress = True) ToolSvc += DFCommonTruthBSMTool