From ea51f75f4bcf351079f6f4bb5c773c1d1bfbc4a3 Mon Sep 17 00:00:00 2001 From: Peter van Gemmeren <gemmeren@anl.gov> Date: Fri, 10 Jul 2020 19:26:12 -0500 Subject: [PATCH] Take run parameters from metadata, if available. Fix for taking beam data from TagInfo. --- .../src/ByteStreamEventStorageOutputSvc.cxx | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageOutputSvc.cxx b/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageOutputSvc.cxx index 6e8b751ca496..84d10073ffcc 100644 --- a/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageOutputSvc.cxx +++ b/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageOutputSvc.cxx @@ -134,10 +134,10 @@ ByteStreamEventStorageOutputSvc::stop() const ByteStreamMetadataContainer* metaDataCont = 0; const ByteStreamMetadata* metaData = 0; ServiceHandle<StoreGateSvc> mds("StoreGateSvc/MetaDataStore", name()); - StatusCode status = mds.retrieve(); - if (!status.isFailure()) { - StatusCode stat = mds->retrieve(metaDataCont, "ByteStreamMetadata"); - if (stat.isSuccess()) metaData = *(metaDataCont->begin()); + if (mds.retrieve().isFailure()) { + ATH_MSG_WARNING("Cannot get MetaDataStore"); + } else { + if (mds->retrieve(metaDataCont, "ByteStreamMetadata").isSuccess()) metaData = *(metaDataCont->begin()); } // Try to write metadata to file dWok = initDataWriterContents(0, metaData); @@ -175,8 +175,16 @@ ByteStreamEventStorageOutputSvc::initDataWriter() ATH_MSG_ERROR("Cannot retrieve EventInfo"); return(false); } + const ByteStreamMetadataContainer* metaDataCont = 0; + const ByteStreamMetadata* metaData = 0; + ServiceHandle<StoreGateSvc> mds("InputMetaDataStore", name()); + if (mds.retrieve().isFailure()) { + ATH_MSG_WARNING("Cannot get InputMetaDataStore"); + } else { + if (mds->retrieve(metaDataCont, "ByteStreamMetadata").isSuccess()) metaData = *(metaDataCont->begin()); + } // Now try to write metadata to file - return initDataWriterContents(evtInfo, 0); + return initDataWriterContents(evtInfo, metaData); } @@ -258,10 +266,13 @@ ByteStreamEventStorageOutputSvc::initDataWriterContents( ATH_MSG_DEBUG("Cannot retrieve TagInfo"); } else { std::string tagName, tagValue; - if (metaData == 0) { // FIXME: Set TriggerType, BeamType? - tagName = "beam_energy"; + if (metaData == 0) { + tagName = "beam_type"; tagInfo->findTag(tagName, tagValue); runPara.beam_type = atof(tagValue.c_str()); + tagName = "beam_energy"; + tagInfo->findTag(tagName, tagValue); + runPara.beam_energy = atof(tagValue.c_str()); } tagName = "GeoAtlas"; tagInfo->findTag(tagName, tagValue); -- GitLab