diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/LongLivedParticleDPDMaker/HVJetMETFilterTool.h b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/LongLivedParticleDPDMaker/HVJetMETFilterTool.h index 522ae0addeeb482f5e04e1ff3579d7237fe1278f..20b66ddceeb0dace4a0704260fdfe93aa4a906dc 100644 --- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/LongLivedParticleDPDMaker/HVJetMETFilterTool.h +++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/LongLivedParticleDPDMaker/HVJetMETFilterTool.h @@ -16,6 +16,8 @@ // DerivationFramework includes #include "DerivationFrameworkInterfaces/ISkimmingTool.h" +#include "xAODMissingET/MissingETContainer.h" +#include "StoreGate/ReadHandleKey.h" namespace DerivationFramework { @@ -43,12 +45,12 @@ namespace DerivationFramework { virtual bool eventPassesFilter() const; private: - mutable unsigned int m_ntot; - mutable unsigned int m_npass; - std::string m_metSGKey; + mutable std::atomic<unsigned int> m_ntot; + mutable std::atomic<unsigned int> m_npass; + SG::ReadHandleKey<xAOD::MissingETContainer> m_metSGKey + { this, "METContainerKey", "MET_RefFinal", ""}; std::string m_metTerm; double m_metCut; - std::string m_jetSGKey; // only needed if we want to cut on dphi(jet,MET) }; diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/src/HVJetMETFilterTool.cxx b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/src/HVJetMETFilterTool.cxx index 16dd62db8b22c8b5313cea3cc6d7c9c3a5e6e4b4..177a75b52e9d116d21cffe83745ed6e25c7fb8b4 100644 --- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/src/HVJetMETFilterTool.cxx +++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/src/HVJetMETFilterTool.cxx @@ -9,8 +9,6 @@ #include "LongLivedParticleDPDMaker/HVJetMETFilterTool.h" #include <vector> #include <string> -#include "xAODMissingET/MissingETContainer.h" -#include "xAODJet/JetContainer.h" // Constructor DerivationFramework::HVJetMETFilterTool::HVJetMETFilterTool( const std::string& t, @@ -19,16 +17,12 @@ DerivationFramework::HVJetMETFilterTool::HVJetMETFilterTool( const std::string& AthAlgTool(t,n,p), m_ntot(0), m_npass(0), - m_metSGKey("MET_RefFinal"), m_metTerm("Final"), - m_metCut(50000.0), - m_jetSGKey("AntiKt4LCTopoJets") + m_metCut(50000.0) { declareInterface<DerivationFramework::ISkimmingTool>(this); - declareProperty("METContainerKey", m_metSGKey); declareProperty("METTerm", m_metTerm); declareProperty("METCut", m_metCut); - declareProperty("JetContainerKey", m_jetSGKey); } // Destructor @@ -39,6 +33,7 @@ DerivationFramework::HVJetMETFilterTool::~HVJetMETFilterTool() { StatusCode DerivationFramework::HVJetMETFilterTool::initialize() { ATH_MSG_VERBOSE("initialize() ..."); + ATH_CHECK(m_metSGKey.initialize()); return StatusCode::SUCCESS; } StatusCode DerivationFramework::HVJetMETFilterTool::finalize() @@ -53,11 +48,9 @@ bool DerivationFramework::HVJetMETFilterTool::eventPassesFilter() const { ++m_ntot; - const xAOD::MissingETContainer* metContainer(0); const xAOD::MissingET* met(0); - StatusCode sc=evtStore()->retrieve(metContainer,m_metSGKey); - // met = (*metContainer)[m_metTerm]; - if( sc.isFailure() || !metContainer ) { + SG::ReadHandle<xAOD::MissingETContainer> metContainer(m_metSGKey); + if( !metContainer.isValid() ) { msg(MSG::WARNING) << "No MET container found, will skip this event" << endmsg; return false; }