diff --git a/AtlasTest/DatabaseTest/AthenaPoolTest/share/DoubleEventSelectorOverlayTest.ref b/AtlasTest/DatabaseTest/AthenaPoolTest/share/DoubleEventSelectorOverlayTest.ref index 8a9fa64902044bb9ce5bfe3e1d3b39f528853450..4919106c2a2a366cadc1881c722f5a10a63f21ba 100644 --- a/AtlasTest/DatabaseTest/AthenaPoolTest/share/DoubleEventSelectorOverlayTest.ref +++ b/AtlasTest/DatabaseTest/AthenaPoolTest/share/DoubleEventSelectorOverlayTest.ref @@ -30,8 +30,8 @@ AddressRemappin... DEBUG Service base class initialized successfully ProxyProviderSvc DEBUG Property update for OutputLevel : new value = 2 ProxyProviderSvc DEBUG Service base class initialized successfully Stream1.Stream1... INFO Initializing Stream1.Stream1Tool - package version AthenaServices-00-00-00 -AthenaPoolAddre... DEBUG Cannot find DataHeader in DetectorStore. -AthenaPoolAddre... DEBUG Cannot find DataHeader in DetectorStore. +AthenaPoolAddre... DEBUG Cannot retrieve DataHeader from DetectorStore. +AthenaPoolAddre... DEBUG Cannot retrieve DataHeader from DetectorStore. Stream1 INFO Found HelperTools = PrivateToolHandleArray([]) Stream1 INFO Data output: OutputRDO.root Stream1 INFO I/O reinitialization... diff --git a/AtlasTest/DatabaseTest/AthenaPoolTest/share/DoubleEventSelectorOverlayTestMT.ref b/AtlasTest/DatabaseTest/AthenaPoolTest/share/DoubleEventSelectorOverlayTestMT.ref index 20241bc9963e945fe25e9bb2a62e5a7a931b5f2a..fb6f5d44703ed2d353fe5ac04798fea882da328b 100644 --- a/AtlasTest/DatabaseTest/AthenaPoolTest/share/DoubleEventSelectorOverlayTestMT.ref +++ b/AtlasTest/DatabaseTest/AthenaPoolTest/share/DoubleEventSelectorOverlayTestMT.ref @@ -32,8 +32,8 @@ AddressRemappingSvc DEBUG Service base class initi ProxyProviderSvc DEBUG Property update for OutputLevel : new value = 2 ProxyProviderSvc DEBUG Service base class initialized successfully Stream1.Stream1Tool 0 INFO Initializing Stream1.Stream1Tool - package version AthenaServices-00-00-00 -AthenaPoolAddressProviderSvcPrimary 0 DEBUG Cannot find DataHeader in DetectorStore. -AthenaPoolAddressProviderSvcSecondary 0 DEBUG Cannot find DataHeader in DetectorStore. +AthenaPoolAddressProviderSvcPrimary 0 DEBUG Cannot retrieve DataHeader from DetectorStore. +AthenaPoolAddressProviderSvcSecondary 0 DEBUG Cannot retrieve DataHeader from DetectorStore. Stream1 0 INFO Found HelperTools = PrivateToolHandleArray([]) Stream1 0 INFO Data output: OutputRDO.root Stream1 0 INFO I/O reinitialization... diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Copy.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Copy.ref index 97beeaf0e3b6c34b7a9b84d8c5c62f9b36a98032..7a319d24ed6c885a0a70a28615aac8b2b7ec0576 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Copy.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Copy.ref @@ -134,7 +134,7 @@ Stream1 DEBUG Found MetaDataStore store. OutputStreamSeq... INFO Initializing OutputStreamSequencerSvc - package version AthenaServices-00-00-00 Stream1.Stream1... DEBUG Property update for OutputLevel : new value = 2 Stream1.Stream1... INFO Initializing Stream1.Stream1Tool - package version AthenaServices-00-00-00 -AthenaPoolAddre... DEBUG Cannot find DataHeader in DetectorStore. +AthenaPoolAddre... DEBUG Cannot retrieve DataHeader from DetectorStore. Stream1.Stream1... DEBUG Property update for OutputLevel : new value = 2 Stream1.Stream1... INFO Initializing Stream1.Stream1_MakeEventStreamInfo - package version OutputStreamAthenaPool-00-00-00 Stream1 INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream1_MakeEventStreamInfo']) diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RCond.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RCond.ref index 40d93c0bb44320fa53bfd50148d3692d75608074..acf58d9b2176e8d89e38df14488b44a6b53546b8 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RCond.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RCond.ref @@ -238,7 +238,7 @@ AlgResourcePool INFO TopAlg list empty. Recovering the one of Application M AthenaEventLoopMgr INFO ===>>> start of run 1 <<<=== AthenaEventLoopMgr INFO ===>>> start processing event #0, run #1 0 events processed so far <<<=== ReadCond DEBUG in execute() -AthenaPoolAddre... DEBUG Cannot find DataHeader in DetectorStore. +AthenaPoolAddre... DEBUG Cannot retrieve DataHeader from DetectorStore. SimplePoolFile4... DEBUG --> Access DbContainer READ [ROOT_Tree] POOLContainer(DataHeader) POOLContainer(D... DEBUG Opening POOLContainer(D... DEBUG attributes# = 1 diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWrite.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWrite.ref index a4dac0d493c3e7a54187524d3588f3a6708aeb35..cdc35fcce073fe7b2ed568bb630c3c46c56603e4 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWrite.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWrite.ref @@ -156,7 +156,7 @@ Stream1 DEBUG Found MetaDataStore store. OutputStreamSeq... INFO Initializing OutputStreamSequencerSvc - package version AthenaServices-00-00-00 Stream1.Stream1... DEBUG Property update for OutputLevel : new value = 2 Stream1.Stream1... INFO Initializing Stream1.Stream1Tool - package version AthenaServices-00-00-00 -AthenaPoolAddre... DEBUG Cannot find DataHeader in DetectorStore. +AthenaPoolAddre... DEBUG Cannot retrieve DataHeader from DetectorStore. Stream1.Stream1... DEBUG Property update for OutputLevel : new value = 2 Stream1.Stream1... INFO Initializing Stream1.Stream1_MakeEventStreamInfo - package version OutputStreamAthenaPool-00-00-00 Stream1 INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream1_MakeEventStreamInfo']) diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteAgain.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteAgain.ref index 57c11355439fbf71703d03e91f62a1a35ef13a2b..415d82fdd35d941f5e0465e60c731a87df38b84b 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteAgain.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteAgain.ref @@ -150,7 +150,7 @@ Stream1 DEBUG Found MetaDataStore store. OutputStreamSeq... INFO Initializing OutputStreamSequencerSvc - package version AthenaServices-00-00-00 Stream1.Stream1... DEBUG Property update for OutputLevel : new value = 2 Stream1.Stream1... INFO Initializing Stream1.Stream1Tool - package version AthenaServices-00-00-00 -AthenaPoolAddre... DEBUG Cannot find DataHeader in DetectorStore. +AthenaPoolAddre... DEBUG Cannot retrieve DataHeader from DetectorStore. Stream1.Stream1... DEBUG Property update for OutputLevel : new value = 2 Stream1.Stream1... INFO Initializing Stream1.Stream1_MakeEventStreamInfo - package version OutputStreamAthenaPool-00-00-00 Stream1 INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream1_MakeEventStreamInfo']) diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteNext.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteNext.ref index ca8f4d2eaf89e26450abcef524cae36c05202653..6ec1257ae95723cb9d72585cc6e919f815d6c3cf 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteNext.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteNext.ref @@ -156,7 +156,7 @@ Stream1 DEBUG Found MetaDataStore store. OutputStreamSeq... INFO Initializing OutputStreamSequencerSvc - package version AthenaServices-00-00-00 Stream1.Stream1... DEBUG Property update for OutputLevel : new value = 2 Stream1.Stream1... INFO Initializing Stream1.Stream1Tool - package version AthenaServices-00-00-00 -AthenaPoolAddre... DEBUG Cannot find DataHeader in DetectorStore. +AthenaPoolAddre... DEBUG Cannot retrieve DataHeader from DetectorStore. Stream1.Stream1... DEBUG Property update for OutputLevel : new value = 2 Stream1.Stream1... INFO Initializing Stream1.Stream1_MakeEventStreamInfo - package version OutputStreamAthenaPool-00-00-00 Stream1 INFO Found HelperTools = PrivateToolHandleArray(['MakeEventStreamInfo/Stream1_MakeEventStreamInfo']) diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WCond.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WCond.ref index ea10d32939afcd7e876254b60d422a1d2df976f4..c57eee7b09685d8918763f7584dac8b5ce3cb766 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WCond.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WCond.ref @@ -163,7 +163,7 @@ ReadData DEBUG Data Deps for ReadData + INPUT ( 'ExampleTrackContainer' , 'StoreGateSvc+MyTracks' ) WriteCond DEBUG Property update for OutputLevel : new value = 2 WriteCond INFO in initialize() -AthenaPoolAddre... DEBUG Cannot find DataHeader in DetectorStore. +AthenaPoolAddre... DEBUG Cannot retrieve DataHeader from DetectorStore. WriteCond DEBUG input handles: 1 WriteCond DEBUG output handles: 0 WriteCond DEBUG Data Deps for WriteCond diff --git a/Database/AthenaPOOL/EventSelectorAthenaPool/src/AthenaPoolAddressProviderSvc.cxx b/Database/AthenaPOOL/EventSelectorAthenaPool/src/AthenaPoolAddressProviderSvc.cxx index 868d8c7d35c5e1852ca4a1fb23667030eb82d0d8..657501d0e321b0b6bee23832f4a4e695c75449f0 100755 --- a/Database/AthenaPOOL/EventSelectorAthenaPool/src/AthenaPoolAddressProviderSvc.cxx +++ b/Database/AthenaPOOL/EventSelectorAthenaPool/src/AthenaPoolAddressProviderSvc.cxx @@ -20,6 +20,8 @@ #include "StoreGate/ActiveStoreSvc.h" #include "StoreGate/StoreGateSvc.h" +#include "StoreGate/ReadHandle.h" +#include "StoreGate/WriteHandle.h" #include "AthenaKernel/IClassIDSvc.h" #include <vector> @@ -93,12 +95,8 @@ StatusCode AthenaPoolAddressProviderSvc::preLoadAddresses(StoreID::type storeID, ATH_MSG_ERROR("Cannot get DetectorStore."); return(StatusCode::FAILURE); } - const DataHandle<DataHeader> dataHeader; - if (!detectorStoreSvc->contains<DataHeader>("CondProxyProvider")) { - ATH_MSG_DEBUG("Cannot find DataHeader in DetectorStore."); - return(StatusCode::SUCCESS); - } - if (!detectorStoreSvc->retrieve(dataHeader, "CondProxyProvider").isSuccess()) { + SG::ReadHandle<DataHeader> dataHeader("CondProxyProvider", detectorStoreSvc->name()); + if (!dataHeader.isValid()) { ATH_MSG_DEBUG("Cannot retrieve DataHeader from DetectorStore."); return(StatusCode::SUCCESS); } @@ -127,6 +125,7 @@ StatusCode AthenaPoolAddressProviderSvc::loadAddresses(StoreID::type storeID, Guid thisFile = Guid::null(); long int oid2 = 0L; + const DataHeader* dataHeader = nullptr; if (m_dataHeaderIterator) { // Get oid2 (event file entry number) from DataHeader proxy const SG::DataProxy* dhProxy = eventStore()->proxy(ClassID_traits<DataHeader>::ID(), m_dataHeaderKey.value()); if (dhProxy != nullptr && dhProxy->address() != nullptr) { @@ -135,27 +134,25 @@ StatusCode AthenaPoolAddressProviderSvc::loadAddresses(StoreID::type storeID, thisFile = token.dbID(); oid2 = token.oid().second; } + SG::ReadHandle<DataHeader> copiedDataHeader(thisFile.toString(), m_metaDataStore->name()); + if (copiedDataHeader.isValid()) { + dataHeader = copiedDataHeader.cptr(); + } } - const DataHandle<DataHeader> dataHeader; - if (thisFile == Guid::null() || oid2 == 0L || thisFile != m_guid) { // New file (or reading DataHeader) - if (!eventStore()->retrieve(dataHeader, m_dataHeaderKey.value()).isSuccess() || !dataHeader.isValid()) { + if (dataHeader == nullptr) { // New file (or reading DataHeader) + SG::ReadHandle<DataHeader> eventDataHeader(m_dataHeaderKey.value(), eventStore()->name()); + if (!eventDataHeader.isValid()) { ATH_MSG_ERROR("Cannot retrieve DataHeader from StoreGate: " << m_dataHeaderKey); return(StatusCode::FAILURE); } + dataHeader = eventDataHeader.cptr(); if (m_dataHeaderIterator) { - const DataHeader* dataHeaderCopy = new DataHeader(*dataHeader.cptr()); - if (m_metaDataStore->record(dataHeaderCopy, thisFile.toString()).isFailure()) { + std::unique_ptr<DataHeader> dataHeaderCopy(new DataHeader(*eventDataHeader.cptr())); + SG::WriteHandle<DataHeader> wh(thisFile.toString(), m_metaDataStore->name()); + if (!wh.record(std::move(dataHeaderCopy)).isSuccess()) { ATH_MSG_WARNING("Can't copy event DataHeader to MetaData store."); } } - } else { - if (m_metaDataStore->retrieve(dataHeader, thisFile.toString()).isFailure()) { - ATH_MSG_WARNING("Can't get event DataHeader from MetaData store."); - if (!eventStore()->retrieve(dataHeader, m_dataHeaderKey.value()).isSuccess() || !dataHeader.isValid()) { - ATH_MSG_ERROR("Cannot retrieve DataHeader from StoreGate: " << m_dataHeaderKey); - return(StatusCode::FAILURE); - } - } } // second data header if (m_attrListKey.value() != "") { diff --git a/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx b/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx index 46fb927a608270020a6995017071d06583b6dbf8..557f55ce494f8facd1208119a743caf5388dd514 100755 --- a/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx +++ b/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx @@ -20,6 +20,8 @@ #include "PoolSvc/IPoolSvc.h" #include "StoreGate/StoreGateSvc.h" #include "StoreGate/ActiveStoreSvc.h" +#include "StoreGate/ReadHandle.h" +#include "StoreGate/WriteHandle.h" #include "AthenaKernel/IAthenaIPCTool.h" #include "AthenaKernel/ICollectionSize.h" @@ -489,24 +491,18 @@ StatusCode EventSelectorAthenaPool::next(IEvtSelector::Context& ctxt) const { delete (char*)tokenStr; tokenStr = nullptr; return(StatusCode::FAILURE); } - // Remove any old AttributeList - if (const AthenaAttributeList* oldAttrList = - eventStore()->tryRetrieve<AthenaAttributeList> (m_attrListKey.value())) - { - if (!eventStore()->removeDataAndProxy(oldAttrList).isSuccess()) { - ATH_MSG_ERROR("Cannot remove old AttributeList from StoreGate."); - return(StatusCode::FAILURE); - } + if (!eventStore()->clearStore().isSuccess()) { + ATH_MSG_WARNING("Cannot clear Store"); } - AthenaAttributeList* athAttrList = new AthenaAttributeList(); - if (!eventStore()->record(athAttrList, m_attrListKey.value()).isSuccess()) { - ATH_MSG_ERROR("Cannot record AttributeList to StoreGate."); + std::unique_ptr<AthenaAttributeList> athAttrList(new AthenaAttributeList()); + athAttrList->extend("eventRef", "string"); + (*athAttrList)["eventRef"].data<std::string>() = std::string((char*)tokenStr); + SG::WriteHandle<AthenaAttributeList> wh(m_attrListKey.value(), eventStore()->name()); + if (!wh.record(std::move(athAttrList)).isSuccess()) { delete (char*)tokenStr; tokenStr = nullptr; - delete athAttrList; athAttrList = nullptr; + ATH_MSG_ERROR("Cannot record AttributeList to StoreGate " << StoreID::storeName(eventStore()->storeID())); return(StatusCode::FAILURE); } - athAttrList->extend("eventRef", "string"); - (*athAttrList)["eventRef"].data<std::string>() = std::string((char*)tokenStr); Token token; token.fromString(std::string((char*)tokenStr)); delete (char*)tokenStr; tokenStr = nullptr; @@ -627,6 +623,9 @@ StatusCode EventSelectorAthenaPool::next(IEvtSelector::Context& ctxt) const { return(StatusCode::FAILURE); } } else { + if (!eventStore()->clearStore().isSuccess()) { + ATH_MSG_WARNING("Cannot clear Store"); + } if (!recordAttributeList().isSuccess()) { ATH_MSG_ERROR("Failed to record AttributeList."); return(StatusCode::FAILURE); @@ -710,8 +709,8 @@ StatusCode EventSelectorAthenaPool::rewind(IEvtSelector::Context& /*ctxt*/) cons StatusCode EventSelectorAthenaPool::createAddress(const IEvtSelector::Context& /*ctxt*/, IOpaqueAddress*& iop) const { std::string tokenStr; - const DataHandle<AthenaAttributeList> attrList; - if (eventStore()->retrieve(attrList, m_attrListKey.value()).isSuccess()) { + SG::ReadHandle<AthenaAttributeList> attrList(m_attrListKey.value(), eventStore()->name()); + if (attrList.isValid()) { try { if (m_refName.value().empty()) { tokenStr = (*attrList)["eventRef"].data<std::string>(); @@ -1004,26 +1003,12 @@ PoolCollectionConverter* EventSelectorAthenaPool::getCollectionCnv(bool throwInc } //__________________________________________________________________________ StatusCode EventSelectorAthenaPool::recordAttributeList() const { - // Remove any old AttributeList - if (const AthenaAttributeList* oldAttrList = - eventStore()->tryRetrieve<AthenaAttributeList> (m_attrListKey.value())) - { - if (!eventStore()->removeDataAndProxy(oldAttrList).isSuccess()) { - ATH_MSG_ERROR("Cannot remove old AttributeList from StoreGate."); - return(StatusCode::FAILURE); - } - } // Get access to AttributeList ATH_MSG_DEBUG("Get AttributeList from the collection"); // MN: accessing only attribute list, ignoring token list const coral::AttributeList& attrList = m_headerIterator->currentRow().attributeList(); ATH_MSG_DEBUG("AttributeList size " << attrList.size()); - AthenaAttributeList* athAttrList = new AthenaAttributeList(attrList); - if (!eventStore()->record(athAttrList, m_attrListKey.value()).isSuccess()) { - ATH_MSG_ERROR("Cannot record AttributeList to StoreGate."); - delete athAttrList; athAttrList = nullptr; - return(StatusCode::FAILURE); - } + std::unique_ptr<AthenaAttributeList> athAttrList(new AthenaAttributeList(attrList)); const pool::TokenList& tokenList = m_headerIterator->currentRow().tokenList(); for (pool::TokenList::const_iterator iter = tokenList.begin(), last = tokenList.end(); iter != last; ++iter) { athAttrList->extend(iter.tokenName(), "string"); @@ -1033,6 +1018,11 @@ StatusCode EventSelectorAthenaPool::recordAttributeList() const { athAttrList->extend("eventRef", "string"); (*athAttrList)["eventRef"].data<std::string>() = m_headerIterator->eventRef().toString(); ATH_MSG_DEBUG("record AthenaAttribute, name = eventRef = " << m_headerIterator->eventRef().toString() << "."); + SG::WriteHandle<AthenaAttributeList> wh(m_attrListKey.value(), eventStore()->name()); + if (!wh.record(std::move(athAttrList)).isSuccess()) { + ATH_MSG_ERROR("Cannot record AttributeList to StoreGate " << StoreID::storeName(eventStore()->storeID())); + return(StatusCode::FAILURE); + } return(StatusCode::SUCCESS); } //__________________________________________________________________________