Skip to content
Snippets Groups Projects
Commit 33641b83 authored by Emily Anne Thompson's avatar Emily Anne Thompson
Browse files

Migrate HVJetMETFilterTool to use DataHandles

parent 626d4f62
6 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!39666Migrate LongLivedParticleDPDMaker to R22
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
// DerivationFramework includes // DerivationFramework includes
#include "DerivationFrameworkInterfaces/ISkimmingTool.h" #include "DerivationFrameworkInterfaces/ISkimmingTool.h"
#include "xAODMissingET/MissingETContainer.h"
#include "StoreGate/ReadHandleKey.h"
namespace DerivationFramework { namespace DerivationFramework {
...@@ -43,12 +45,12 @@ namespace DerivationFramework { ...@@ -43,12 +45,12 @@ namespace DerivationFramework {
virtual bool eventPassesFilter() const; virtual bool eventPassesFilter() const;
private: private:
mutable unsigned int m_ntot; mutable std::atomic<unsigned int> m_ntot;
mutable unsigned int m_npass; mutable std::atomic<unsigned int> m_npass;
std::string m_metSGKey; SG::ReadHandleKey<xAOD::MissingETContainer> m_metSGKey
{ this, "METContainerKey", "MET_RefFinal", ""};
std::string m_metTerm; std::string m_metTerm;
double m_metCut; double m_metCut;
std::string m_jetSGKey; // only needed if we want to cut on dphi(jet,MET)
}; };
......
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
#include "LongLivedParticleDPDMaker/HVJetMETFilterTool.h" #include "LongLivedParticleDPDMaker/HVJetMETFilterTool.h"
#include <vector> #include <vector>
#include <string> #include <string>
#include "xAODMissingET/MissingETContainer.h"
#include "xAODJet/JetContainer.h"
// Constructor // Constructor
DerivationFramework::HVJetMETFilterTool::HVJetMETFilterTool( const std::string& t, DerivationFramework::HVJetMETFilterTool::HVJetMETFilterTool( const std::string& t,
...@@ -19,16 +17,12 @@ DerivationFramework::HVJetMETFilterTool::HVJetMETFilterTool( const std::string& ...@@ -19,16 +17,12 @@ DerivationFramework::HVJetMETFilterTool::HVJetMETFilterTool( const std::string&
AthAlgTool(t,n,p), AthAlgTool(t,n,p),
m_ntot(0), m_ntot(0),
m_npass(0), m_npass(0),
m_metSGKey("MET_RefFinal"),
m_metTerm("Final"), m_metTerm("Final"),
m_metCut(50000.0), m_metCut(50000.0)
m_jetSGKey("AntiKt4LCTopoJets")
{ {
declareInterface<DerivationFramework::ISkimmingTool>(this); declareInterface<DerivationFramework::ISkimmingTool>(this);
declareProperty("METContainerKey", m_metSGKey);
declareProperty("METTerm", m_metTerm); declareProperty("METTerm", m_metTerm);
declareProperty("METCut", m_metCut); declareProperty("METCut", m_metCut);
declareProperty("JetContainerKey", m_jetSGKey);
} }
// Destructor // Destructor
...@@ -39,6 +33,7 @@ DerivationFramework::HVJetMETFilterTool::~HVJetMETFilterTool() { ...@@ -39,6 +33,7 @@ DerivationFramework::HVJetMETFilterTool::~HVJetMETFilterTool() {
StatusCode DerivationFramework::HVJetMETFilterTool::initialize() StatusCode DerivationFramework::HVJetMETFilterTool::initialize()
{ {
ATH_MSG_VERBOSE("initialize() ..."); ATH_MSG_VERBOSE("initialize() ...");
ATH_CHECK(m_metSGKey.initialize());
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
StatusCode DerivationFramework::HVJetMETFilterTool::finalize() StatusCode DerivationFramework::HVJetMETFilterTool::finalize()
...@@ -53,11 +48,9 @@ bool DerivationFramework::HVJetMETFilterTool::eventPassesFilter() const ...@@ -53,11 +48,9 @@ bool DerivationFramework::HVJetMETFilterTool::eventPassesFilter() const
{ {
++m_ntot; ++m_ntot;
const xAOD::MissingETContainer* metContainer(0);
const xAOD::MissingET* met(0); const xAOD::MissingET* met(0);
StatusCode sc=evtStore()->retrieve(metContainer,m_metSGKey); SG::ReadHandle<xAOD::MissingETContainer> metContainer(m_metSGKey);
// met = (*metContainer)[m_metTerm]; if( !metContainer.isValid() ) {
if( sc.isFailure() || !metContainer ) {
msg(MSG::WARNING) << "No MET container found, will skip this event" << endmsg; msg(MSG::WARNING) << "No MET container found, will skip this event" << endmsg;
return false; return false;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment