diff --git a/Control/AthenaKernel/AthenaKernel/IDataShare.h b/Control/AthenaKernel/AthenaKernel/IDataShare.h index d3921bccf338be6f88b3ffd506134ad2bb9581f4..81c244bdd7d4357cbe882b82c4ac0d4647b1831b 100644 --- a/Control/AthenaKernel/AthenaKernel/IDataShare.h +++ b/Control/AthenaKernel/AthenaKernel/IDataShare.h @@ -49,7 +49,7 @@ public: /** * @brief Read the data */ - virtual StatusCode readData() const = 0; + virtual StatusCode readData() = 0; }; diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/IAthenaPoolCnvSvc.h b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/IAthenaPoolCnvSvc.h index 99284d0f00301af32b2db10adfdfe179fd9bdf50..3ba23ed770231a06eb50d27e006dcad354a1980a 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/IAthenaPoolCnvSvc.h +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/AthenaPoolCnvSvc/IAthenaPoolCnvSvc.h @@ -54,7 +54,7 @@ public: /// @param obj [OUT] pointer to the Data Object. /// @param token [IN] string token of the Data Object for which a Pool Ref is filled. - virtual void setObjPtr(void*& obj, const Token* token) const = 0; + virtual void setObjPtr(void*& obj, const Token* token) = 0; /// @return a boolean for using detailed time and size statistics. virtual bool useDetailChronoStat() const = 0; diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx index 6ee02a6d051705c79a097931c87ffe7437ac773c..51518beb0b8e2e606c9035ca0ac1d3604c3f71a9 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.cxx @@ -846,11 +846,16 @@ Token* AthenaPoolCnvSvc::registerForWrite(Placement* placement, const void* obj, return(token); } //______________________________________________________________________________ -void AthenaPoolCnvSvc::setObjPtr(void*& obj, const Token* token) const { +void AthenaPoolCnvSvc::setObjPtr(void*& obj, const Token* token) { ATH_MSG_VERBOSE("Requesting object for: " << token->toString()); if (m_doChronoStat) { m_chronoStatSvc->chronoStart("cObjR_ALL"); } + if (m_makeStreamingToolClient.value() > 0 && !m_inputStreamingTool.empty() && !m_inputStreamingTool->isServer() && !m_inputStreamingTool->isClient()) { + if (!makeClient(-m_makeStreamingToolClient.value()).isSuccess()) { + ATH_MSG_ERROR("Could not make AthenaPoolCnvSvc a Share Client"); + } + } if (!m_outputStreamingTool.empty() && m_streamServer < m_outputStreamingTool.size() && m_outputStreamingTool[m_streamServer]->isServer()) { if (token->dbID() == Guid::null()) { @@ -940,6 +945,12 @@ StatusCode AthenaPoolCnvSvc::createAddress(long svcType, ATH_MSG_ERROR("createAddress: svcType != POOL_StorageType " << svcType << " " << POOL_StorageType); return(StatusCode::FAILURE); } + if (m_makeStreamingToolClient.value() > 0 && !m_inputStreamingTool.empty() && !m_inputStreamingTool->isServer() && !m_inputStreamingTool->isClient()) { + if (!makeClient(-m_makeStreamingToolClient.value()).isSuccess()) { + ATH_MSG_ERROR("Could not make AthenaPoolCnvSvc a Share Client"); + return(StatusCode::FAILURE); + } + } Token* token = nullptr; if (par[0].substr(0, 3) == "SHM") { token = new Token(); @@ -1103,7 +1114,7 @@ StatusCode AthenaPoolCnvSvc::makeClient(int num) { return(m_inputStreamingTool->makeClient(num)); } //________________________________________________________________________________ -StatusCode AthenaPoolCnvSvc::readData() const { +StatusCode AthenaPoolCnvSvc::readData() { if (m_inputStreamingTool.empty()) { return(StatusCode::FAILURE); } diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.h b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.h index 630766b5b972b8be53234925947df356cb49e18a..ff4e651dddae0b276b3e99f2431793193fa3d2b8 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.h +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/src/AthenaPoolCnvSvc.h @@ -99,7 +99,7 @@ public: /// @param obj [OUT] pointer to the Data Object. /// @param token [IN] string token of the Data Object for which a Pool Ref is filled. - void setObjPtr(void*& obj, const Token* token) const; + void setObjPtr(void*& obj, const Token* token); /// @return a boolean for using detailed time and size statistics. bool useDetailChronoStat() const; @@ -152,7 +152,7 @@ public: virtual StatusCode makeClient(int num); /// Read the next data object - virtual StatusCode readData() const; + virtual StatusCode readData(); /// Send abort to SharedWriter clients if the server quits on error /// @param client_n [IN] number of the current client, -1 if no current diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolAuxContainerCnv_test.cxx b/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolAuxContainerCnv_test.cxx index ff8d44c2bd68904ffebbf7cd6ab10c5a370e9789..c82597113a1b805e9072796011beda6025b8959a 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolAuxContainerCnv_test.cxx +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolAuxContainerCnv_test.cxx @@ -49,7 +49,7 @@ public: m_pers2 (nullptr) {} - virtual void setObjPtr(void*& obj, const Token* /*token*/) const override + virtual void setObjPtr(void*& obj, const Token* /*token*/) override { if (m_pers2) { obj = new YAuxCont_v2 (*m_pers2); diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolTPCnvCnv_test.cxx b/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolTPCnvCnv_test.cxx index ac964f1fb8fe4281a87b7b9ca9c476a23819b139..a75b13c22154cdf0f8bda9abeca35cef5fb22753 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolTPCnvCnv_test.cxx +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolTPCnvCnv_test.cxx @@ -44,7 +44,7 @@ public: m_pers2 (nullptr) {} - virtual void setObjPtr(void*& obj, const Token* /*token*/) const override + virtual void setObjPtr(void*& obj, const Token* /*token*/) override { if (m_pers2) { obj = new XCont_p2 (*m_pers2); diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolViewVectorCnv_test.cxx b/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolViewVectorCnv_test.cxx index 03d9e441712982d54c83594399a62cb27a11ed3b..ba57e7647d90f74693da766fff1838ab2adde096 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolViewVectorCnv_test.cxx +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolViewVectorCnv_test.cxx @@ -100,7 +100,7 @@ public: m_pers_old (nullptr) {} - virtual void setObjPtr(void*& obj, const Token* token) const override + virtual void setObjPtr(void*& obj, const Token* token) override { if (m_pers) { auto vvb = new ViewVector<DataVector<Y_v2> > (*m_pers); diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolxAODCnv_test.cxx b/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolxAODCnv_test.cxx index 8c85da607c8af48f46874f67383c92b98fd9929a..ad32a48ed6950af9d0c971245eba06c6c0db8f65 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolxAODCnv_test.cxx +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/test/T_AthenaPoolxAODCnv_test.cxx @@ -47,7 +47,7 @@ public: m_pers2 (nullptr) {} - virtual void setObjPtr(void*& obj, const Token* /*token*/) const override + virtual void setObjPtr(void*& obj, const Token* /*token*/) override { if (m_pers2) { DataVector<Y_v2>* v = new DataVector<Y_v2>; diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/test/TestCnvSvcBase.icc b/Database/AthenaPOOL/AthenaPoolCnvSvc/test/TestCnvSvcBase.icc index 8b9cdf0739a9551160b434548e1eb496cca56e41..6a820b1c01c7ff6889f31bd4bd95e10667c21272 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/test/TestCnvSvcBase.icc +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/test/TestCnvSvcBase.icc @@ -105,7 +105,7 @@ public: { std::abort(); } virtual StatusCode connectOutput(const std::string& /*outputFile*/) override { std::abort(); } - virtual StatusCode readData() const override + virtual StatusCode readData() override { std::abort(); } virtual const std::string& name() const override { return m_name; } diff --git a/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx b/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx index 03ea3fae542cdd26813e12df03dcc72a331d2e6d..1496c4d919f41c3ccc1cd826b16cd6d049f2b96b 100644 --- a/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx +++ b/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx @@ -166,6 +166,11 @@ StatusCode EventSelectorAthenaPool::initialize() { if (!m_eventStreamingTool.empty() && !m_eventStreamingTool.retrieve().isSuccess()) { ATH_MSG_FATAL("Cannot get " << m_eventStreamingTool.typeAndName() << ""); return(StatusCode::FAILURE); + } else if (m_makeStreamingToolClient.value() == -1) { + if (!m_eventStreamingTool->makeClient(m_makeStreamingToolClient.value()).isSuccess()) { + ATH_MSG_ERROR("Could not make AthenaPoolCnvSvc a Share Client"); + return(StatusCode::FAILURE); + } } // Ensure the xAODCnvSvc is listed in the EventPersistencySvc @@ -478,6 +483,15 @@ StatusCode EventSelectorAthenaPool::createContext(IEvtSelector::Context*& ctxt) StatusCode EventSelectorAthenaPool::next(IEvtSelector::Context& ctxt) const { std::lock_guard<CallMutex> lockGuard(m_callLock); if (!m_eventStreamingTool.empty() && m_eventStreamingTool->isClient()) { + if (m_makeStreamingToolClient.value() == -1) { + StatusCode sc = m_eventStreamingTool->lockEvent(m_evtCount); + while (sc.isRecoverable()) { + usleep(1000); + sc = m_eventStreamingTool->lockEvent(m_evtCount); + } + } + // Increase event count + ++m_evtCount; void* tokenStr = nullptr; unsigned int status = 0; if (!m_eventStreamingTool->getLockedEvent(&tokenStr, status).isSuccess()) { diff --git a/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.h b/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.h index b04379fd2cc361c19bd189b209a66697df9352c7..6f340f063b12123fdbea363468c1c7054d81d0ca 100644 --- a/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.h +++ b/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.h @@ -209,6 +209,8 @@ private: // properties ToolHandleArray<IAthenaSelectorTool> m_helperTools{this}; ToolHandle<IAthenaSelectorTool> m_counterTool{this, "CounterTool", "", ""}; ToolHandle<IAthenaIPCTool> m_eventStreamingTool{this, "SharedMemoryTool", "", ""}; + /// Make this instance a Streaming Client during first iteration automatically + IntegerProperty m_makeStreamingToolClient{this,"MakeStreamingToolClient",0}; /// The following are included for compatibility with McEventSelector and are not really used. /// However runNo, oldRunNo and overrideRunNumberFromInput are used to reset run number for