From fea115f37ac2bd19d12577c92c83d24877ac3375 Mon Sep 17 00:00:00 2001 From: Matthew Basso <matthew.joseph.basso@cern.ch> Date: Wed, 9 Dec 2020 22:55:23 +0100 Subject: [PATCH] Remove keyless EventInfo retrieval in EventQualityFilterAlg, migrate to ReadHandles --- .../EventUtils/src/EventQualityFilterAlg.cxx | 24 +++++++++++++------ .../EventUtils/src/EventQualityFilterAlg.h | 4 ++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/PhysicsAnalysis/AnalysisCommon/EventUtils/src/EventQualityFilterAlg.cxx b/PhysicsAnalysis/AnalysisCommon/EventUtils/src/EventQualityFilterAlg.cxx index 86e11806ff2..6e312add239 100644 --- a/PhysicsAnalysis/AnalysisCommon/EventUtils/src/EventQualityFilterAlg.cxx +++ b/PhysicsAnalysis/AnalysisCommon/EventUtils/src/EventQualityFilterAlg.cxx @@ -1,9 +1,9 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - + +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + // EventQualityFilterAlg.cxx // Implementation file for class EventQualityFilterAlg // Author: Karsten Koeneke <karsten.koeneke@cern.ch> @@ -16,6 +16,10 @@ // EDM includes #include "xAODEventInfo/EventInfo.h" +// FrameWork includes +#include "AsgDataHandles/ReadHandle.h" +#include "AsgTools/CurrentContext.h" + /////////////////////////////////////////////////////////////////// // Public methods: @@ -62,6 +66,7 @@ StatusCode EventQualityFilterAlg::initialize() ATH_MSG_DEBUG( "Using: " << m_useSCTError ); ATH_MSG_DEBUG( "Using: " << m_useCoreError ); // ATH_MSG_DEBUG( "Using: " << m_useTileTripReader ); + ATH_CHECK(m_eventInfo.initialize()); return StatusCode::SUCCESS; } @@ -79,10 +84,15 @@ StatusCode EventQualityFilterAlg::execute() { ATH_MSG_DEBUG ("Executing " << name() << "..."); + const EventContext& ctx = Gaudi::Hive::currentContext(); // Get the EventInfo object - const xAOD::EventInfo* eventInfo = nullptr; - ATH_CHECK( evtStore()->retrieve(eventInfo) ); + SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfo, ctx); + if (!eventInfo.isValid()) { + ATH_MSG_ERROR("Could not retrieve EventInfo!"); + return StatusCode::FAILURE; + } + // Only do the event vetoing on data diff --git a/PhysicsAnalysis/AnalysisCommon/EventUtils/src/EventQualityFilterAlg.h b/PhysicsAnalysis/AnalysisCommon/EventUtils/src/EventQualityFilterAlg.h index b62e0516700..f38e3b77781 100644 --- a/PhysicsAnalysis/AnalysisCommon/EventUtils/src/EventQualityFilterAlg.h +++ b/PhysicsAnalysis/AnalysisCommon/EventUtils/src/EventQualityFilterAlg.h @@ -17,6 +17,7 @@ // FrameWork includes #include "AthenaBaseComps/AthFilterAlgorithm.h" +#include "AsgDataHandles/ReadHandleKey.h" @@ -69,6 +70,9 @@ class EventQualityFilterAlg // /// Flag to turn on/off checking of tile trip information // BooleanProperty m_useTileTripReader; + /// EventInfo read handle + SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo {this, "EventInfo", "EventInfo", "EventInfo key"}; + }; -- GitLab