From 173b6afdd47100b055ccca702a1e88ce8221fb1a Mon Sep 17 00:00:00 2001 From: scott snyder <snyder@bnl.gov> Date: Wed, 7 Oct 2020 05:14:17 +0200 Subject: [PATCH] Fix warning --- .../src/ByteStreamEventStorageOutputSvc.cxx | 23 +++++++++++++++---- .../src/ByteStreamEventStorageOutputSvc.h | 4 ++-- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageOutputSvc.cxx b/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageOutputSvc.cxx index b19f9a571fd..8caa1610c8c 100644 --- a/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageOutputSvc.cxx +++ b/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageOutputSvc.cxx @@ -125,7 +125,7 @@ ByteStreamEventStorageOutputSvc::initDataWriter(const EventContext* ctx) { : SG::get(m_eventInfoKey, *ctx); if (eventInfo == nullptr) ATH_MSG_WARNING("failed to retrieve EventInfo"); - const ByteStreamMetadata* metaData = getByteStreamMetadata(ctx); + const ByteStreamMetadata* metaData = ctx == nullptr ? getByteStreamMetadata() : getByteStreamMetadata(*ctx); if (metaData == nullptr) ATH_MSG_WARNING("failed to retrieve ByteStreamMetaData"); @@ -289,12 +289,27 @@ ByteStreamEventStorageOutputSvc::io_reinit() { } +const ByteStreamMetadata * +ByteStreamEventStorageOutputSvc::getByteStreamMetadata() +{ + SG::ReadHandle<ByteStreamMetadataContainer> metaDataCont (m_byteStreamMetadataKey); + + if (!metaDataCont.isValid()) return nullptr; + + if (metaDataCont->size() > 1) + ATH_MSG_WARNING("Multiple run parameters in MetaDataStore. " + "Bytestream format only supports one. Arbitrarily " + "choosing first."); + + return metaDataCont->front(); +} + + const ByteStreamMetadata * ByteStreamEventStorageOutputSvc::getByteStreamMetadata( - const EventContext* ctx) + const EventContext& ctx) { - if (!ctx) ctx = &Gaudi::Hive::currentContext(); - SG::ReadHandle<ByteStreamMetadataContainer> metaDataCont (m_byteStreamMetadataKey, *ctx); + SG::ReadHandle<ByteStreamMetadataContainer> metaDataCont (m_byteStreamMetadataKey, ctx); if (!metaDataCont.isValid()) return nullptr; diff --git a/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageOutputSvc.h b/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageOutputSvc.h index cf2bc19a205..0ee70ae110d 100644 --- a/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageOutputSvc.h +++ b/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageOutputSvc.h @@ -174,8 +174,8 @@ class ByteStreamEventStorageOutputSvc: bool initDataWriter(const EventContext* ctx = nullptr); bool initDataWriterContents( const xAOD::EventInfo*, const ByteStreamMetadata*); - const ByteStreamMetadata * getByteStreamMetadata( - const EventContext* ctx = nullptr); + const ByteStreamMetadata * getByteStreamMetadata(); + const ByteStreamMetadata * getByteStreamMetadata(const EventContext& ctx); struct EventCache { inline void releaseEvent() { -- GitLab