diff --git a/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvAlg.cxx b/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvAlg.cxx index 9ad9029219a1501730a4441811651b1387c45c52..16db2676d824389364fb3b38bd580f5f35bb957f 100644 --- a/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvAlg.cxx +++ b/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // $Id: EventInfoCnvAlg.cxx 751296 2016-06-01 08:00:25Z krasznaa $ @@ -50,6 +50,7 @@ namespace xAODMaker { m_pileupKey = "Pileup" + m_xaodKey.key(); } + CHECK( m_aodKey.initialize(SG::AllowEmpty) ); CHECK( m_xaodKey.initialize() ); /// FIXME: Should do this only if we have a PileUpEventInfo. @@ -73,10 +74,14 @@ namespace xAODMaker { // Retrieve the AOD object: // FIXME: Use a ReadHandle. const EventInfo* aod = 0; - if( m_aodKey == "" ) { + if( m_aodKey.empty() ) { + // If key has not been set, do a keyless retrieve instead. + // This is not standard behavior, but is for compatibility + // with existing configurations. CHECK( evtStore()->retrieve( aod ) ); } else { - CHECK( evtStore()->retrieve( aod, m_aodKey ) ); + SG::ReadHandle<EventInfo> ei (m_aodKey, ctx); + aod = ei.cptr(); } // Create/record the xAOD object(s): @@ -160,9 +165,20 @@ namespace xAODMaker { // Run the conversion using the execute function: CHECK( execute (Gaudi::Hive::currentContext()) ); } + else { + // Supress warning about use of beginRun(). +#ifdef __GNUC__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + CHECK( Algorithm::beginRun() ); +#ifdef __GNUC__ +# pragma GCC diagnostic pop +#endif + } - // Return gracefully: - return StatusCode::SUCCESS; + // Return gracefully: + return StatusCode::SUCCESS; } } // namespace xAODMaker diff --git a/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvAlg.h b/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvAlg.h index 40781a4634a511151bf2557a5a337d7cc5d731be..39af48ae40d70264106e32d53b44143f2e97ace7 100644 --- a/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvAlg.h +++ b/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvAlg.h @@ -1,7 +1,7 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ // $Id: EventInfoCnvAlg.h 751296 2016-06-01 08:00:25Z krasznaa $ @@ -20,6 +20,7 @@ #include "xAODCnvInterfaces/IEventInfoCnvTool.h" #include "xAODEventInfo/EventInfo.h" #include "xAODEventInfo/EventInfoContainer.h" +#include "EventInfo/EventInfo.h" namespace xAODMaker { @@ -50,8 +51,9 @@ namespace xAODMaker { virtual StatusCode beginRun() override; private: - /// StoreGate key for the input object - std::string m_aodKey; + /// Key for the input object + /// If blank, we do a keyless retrieve from SG instead! + SG::ReadHandleKey<EventInfo> m_aodKey; /// Key for the output object SG::WriteHandleKey<xAOD::EventInfo> m_xaodKey;