diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDCSCondStateAlg.cxx b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDCSCondStateAlg.cxx index 20d9d36983950006747b5a53a16b3763fc17e967..66d213198d55533daf9ff96132bc18141ec1fbb0 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDCSCondStateAlg.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDCSCondStateAlg.cxx @@ -8,7 +8,7 @@ #include <memory> PixelDCSCondStateAlg::PixelDCSCondStateAlg(const std::string& name, ISvcLocator* pSvcLocator): - ::AthAlgorithm(name, pSvcLocator), + ::AthReentrantAlgorithm(name, pSvcLocator), m_condSvc("CondSvc", name) { } @@ -34,103 +34,101 @@ StatusCode PixelDCSCondStateAlg::initialize() { return StatusCode::SUCCESS; } -StatusCode PixelDCSCondStateAlg::execute() { +StatusCode PixelDCSCondStateAlg::execute(const EventContext& ctx) const { ATH_MSG_DEBUG("PixelDCSCondStateAlg::execute()"); //=========== // FSM_STATE //=========== - SG::WriteCondHandle<PixelDCSConditionsData> writeHandleState(m_writeKeyState); + SG::WriteCondHandle<PixelDCSConditionsData> writeHandleState(m_writeKeyState, ctx); if (writeHandleState.isValid()) { ATH_MSG_DEBUG("CondHandle " << writeHandleState.fullKey() << " is already valid.. In theory this should not be called, but may happen if multiple concurrent events are being processed out of order."); - return StatusCode::SUCCESS; + }else{ + SG::ReadCondHandle<CondAttrListCollection> readHandleState(m_readKeyState, ctx); + const CondAttrListCollection* readCdoState(*readHandleState); + if (readCdoState==nullptr) { + ATH_MSG_FATAL("Null pointer to the read conditions object (state)"); + return StatusCode::FAILURE; + } + // Get the validitiy range (state) + EventIDRange rangeState; + if (not readHandleState.range(rangeState)) { + ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandleState.key()); + return StatusCode::FAILURE; + } + ATH_MSG_INFO("Size of CondAttrListCollection " << readHandleState.fullKey() << " readCdo->size()= " << readCdoState->size()); + ATH_MSG_INFO("Range of state input is " << rangeState); + + // Construct the output Cond Object and fill it in + std::unique_ptr<PixelDCSConditionsData> writeCdoState(std::make_unique<PixelDCSConditionsData>()); + + // Read state info + std::string paramState = "FSM_state"; + for (CondAttrListCollection::const_iterator attrListState=readCdoState->begin(); attrListState!=readCdoState->end(); ++attrListState) { + const CondAttrListCollection::ChanNum &channelNumber = attrListState->first; + const CondAttrListCollection::AttributeList &payload = attrListState->second; + if (payload.exists(paramState.c_str()) and not payload[paramState.c_str()].isNull()) { + std::string val = payload[paramState.c_str()].data<std::string>(); + writeCdoState -> setValue(channelNumber, val); + } + else { + ATH_MSG_WARNING(paramState << " does not exist for ChanNum " << channelNumber); + writeCdoState -> setValue(channelNumber, "NO_DATA"); + } + } + + if (writeHandleState.record(rangeState, std::move(writeCdoState)).isFailure()) { + ATH_MSG_FATAL("Could not record PixelDCSConditionsData " << writeHandleState.key() << " with EventRange " << rangeState << " into Conditions Store"); + return StatusCode::FAILURE; + } + ATH_MSG_INFO("recorded new CDO " << writeHandleState.key() << " with range " << rangeState << " into Conditions Store"); } - SG::ReadCondHandle<CondAttrListCollection> readHandleState(m_readKeyState); - const CondAttrListCollection* readCdoState(*readHandleState); - if (readCdoState==nullptr) { - ATH_MSG_FATAL("Null pointer to the read conditions object (state)"); - return StatusCode::FAILURE; - } - // Get the validitiy range (state) - EventIDRange rangeState; - if (not readHandleState.range(rangeState)) { - ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandleState.key()); - return StatusCode::FAILURE; - } - ATH_MSG_INFO("Size of CondAttrListCollection " << readHandleState.fullKey() << " readCdo->size()= " << readCdoState->size()); - ATH_MSG_INFO("Range of state input is " << rangeState); - - // Construct the output Cond Object and fill it in - std::unique_ptr<PixelDCSConditionsData> writeCdoState(std::make_unique<PixelDCSConditionsData>()); - - // Read state info - std::string paramState = "FSM_state"; - for (CondAttrListCollection::const_iterator attrListState=readCdoState->begin(); attrListState!=readCdoState->end(); ++attrListState) { - CondAttrListCollection::ChanNum channelNumber = attrListState->first; - CondAttrListCollection::AttributeList payload = attrListState->second; - if (payload.exists(paramState.c_str()) and not payload[paramState.c_str()].isNull()) { - std::string val = payload[paramState.c_str()].data<std::string>(); - writeCdoState -> setValue(channelNumber, val); - } - else { - ATH_MSG_WARNING(paramState << " does not exist for ChanNum " << channelNumber); - writeCdoState -> setValue(channelNumber, "NO_DATA"); - } - } - - if (writeHandleState.record(rangeState, std::move(writeCdoState)).isFailure()) { - ATH_MSG_FATAL("Could not record PixelDCSConditionsData " << writeHandleState.key() << " with EventRange " << rangeState << " into Conditions Store"); - return StatusCode::FAILURE; - } - ATH_MSG_INFO("recorded new CDO " << writeHandleState.key() << " with range " << rangeState << " into Conditions Store"); - //============ // FSM_STATUS //============ - SG::WriteCondHandle<PixelDCSConditionsData> writeHandleStatus(m_writeKeyStatus); + SG::WriteCondHandle<PixelDCSConditionsData> writeHandleStatus(m_writeKeyStatus, ctx); if (writeHandleStatus.isValid()) { ATH_MSG_DEBUG("CondHandle " << writeHandleStatus.fullKey() << " is already valid.. In theory this should not be called, but may happen if multiple concurrent events are being processed out of order."); - return StatusCode::SUCCESS; + }else{ + SG::ReadCondHandle<CondAttrListCollection> readHandleStatus(m_readKeyStatus, ctx); + const CondAttrListCollection* readCdoStatus(*readHandleStatus); + if (readCdoStatus==nullptr) { + ATH_MSG_FATAL("Null pointer to the read conditions object (state)"); + return StatusCode::FAILURE; + } + // Get the validitiy range (state) + EventIDRange rangeStatus; + if (not readHandleStatus.range(rangeStatus)) { + ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandleStatus.key()); + return StatusCode::FAILURE; + } + ATH_MSG_INFO("Size of CondAttrListCollection " << readHandleStatus.fullKey() << " readCdo->size()= " << readCdoStatus->size()); + ATH_MSG_INFO("Range of state input is " << rangeStatus); + + // Construct the output Cond Object and fill it in + std::unique_ptr<PixelDCSConditionsData> writeCdoStatus(std::make_unique<PixelDCSConditionsData>()); + + // Read state info + std::string paramStatus = "FSM_status"; + for (CondAttrListCollection::const_iterator attrListStatus=readCdoStatus->begin(); attrListStatus!=readCdoStatus->end(); ++attrListStatus) { + const CondAttrListCollection::ChanNum &channelNumber = attrListStatus->first; + const CondAttrListCollection::AttributeList &payload = attrListStatus->second; + if (payload.exists(paramStatus.c_str()) and not payload[paramStatus.c_str()].isNull()) { + std::string val = payload[paramStatus.c_str()].data<std::string>(); + writeCdoStatus -> setValue(channelNumber, val); + } + else { + ATH_MSG_WARNING(paramStatus << " does not exist for ChanNum " << channelNumber); + writeCdoStatus -> setValue(channelNumber, "NO_DATA"); + } + } + + if (writeHandleStatus.record(rangeStatus, std::move(writeCdoStatus)).isFailure()) { + ATH_MSG_FATAL("Could not record PixelDCSConditionsData " << writeHandleStatus.key() << " with EventRange " << rangeStatus << " into Conditions Store"); + return StatusCode::FAILURE; + } + ATH_MSG_INFO("recorded new CDO " << writeHandleStatus.key() << " with range " << rangeStatus << " into Conditions Store"); } - SG::ReadCondHandle<CondAttrListCollection> readHandleStatus(m_readKeyStatus); - const CondAttrListCollection* readCdoStatus(*readHandleStatus); - if (readCdoStatus==nullptr) { - ATH_MSG_FATAL("Null pointer to the read conditions object (state)"); - return StatusCode::FAILURE; - } - // Get the validitiy range (state) - EventIDRange rangeStatus; - if (not readHandleStatus.range(rangeStatus)) { - ATH_MSG_FATAL("Failed to retrieve validity range for " << readHandleStatus.key()); - return StatusCode::FAILURE; - } - ATH_MSG_INFO("Size of CondAttrListCollection " << readHandleStatus.fullKey() << " readCdo->size()= " << readCdoStatus->size()); - ATH_MSG_INFO("Range of state input is " << rangeStatus); - - // Construct the output Cond Object and fill it in - std::unique_ptr<PixelDCSConditionsData> writeCdoStatus(std::make_unique<PixelDCSConditionsData>()); - - // Read state info - std::string paramStatus = "FSM_status"; - for (CondAttrListCollection::const_iterator attrListStatus=readCdoStatus->begin(); attrListStatus!=readCdoStatus->end(); ++attrListStatus) { - CondAttrListCollection::ChanNum channelNumber = attrListStatus->first; - CondAttrListCollection::AttributeList payload = attrListStatus->second; - if (payload.exists(paramStatus.c_str()) and not payload[paramStatus.c_str()].isNull()) { - std::string val = payload[paramStatus.c_str()].data<std::string>(); - writeCdoStatus -> setValue(channelNumber, val); - } - else { - ATH_MSG_WARNING(paramStatus << " does not exist for ChanNum " << channelNumber); - writeCdoStatus -> setValue(channelNumber, "NO_DATA"); - } - } - - if (writeHandleStatus.record(rangeStatus, std::move(writeCdoStatus)).isFailure()) { - ATH_MSG_FATAL("Could not record PixelDCSConditionsData " << writeHandleStatus.key() << " with EventRange " << rangeStatus << " into Conditions Store"); - return StatusCode::FAILURE; - } - ATH_MSG_INFO("recorded new CDO " << writeHandleStatus.key() << " with range " << rangeStatus << " into Conditions Store"); - return StatusCode::SUCCESS; } diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDCSCondStateAlg.h b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDCSCondStateAlg.h index 92be61b01c2a589a4db169421b64ea2de8dac4c3..546f92d4e5b24a860694aee9873e027b8e48f18b 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDCSCondStateAlg.h +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDCSCondStateAlg.h @@ -5,7 +5,7 @@ #ifndef PIXELDCSCONDSTATEALG #define PIXELDCSCONDSTATEALG -#include "AthenaBaseComps/AthAlgorithm.h" +#include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "StoreGate/ReadCondHandleKey.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" @@ -16,13 +16,13 @@ #include "GaudiKernel/ICondSvc.h" #include "GaudiKernel/Property.h" -class PixelDCSCondStateAlg : public AthAlgorithm { +class PixelDCSCondStateAlg : public AthReentrantAlgorithm { public: PixelDCSCondStateAlg(const std::string& name, ISvcLocator* pSvcLocator); virtual ~PixelDCSCondStateAlg() = default; virtual StatusCode initialize() override; - virtual StatusCode execute() override; + virtual StatusCode execute(const EventContext& ctx) const override; virtual StatusCode finalize() override; private: diff --git a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/CacheCreator.cxx b/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/CacheCreator.cxx index 96e139890f52e038fb445308563b7955e552a547..ee0748889c00a8bdd8a412118f11d062729202ca 100644 --- a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/CacheCreator.cxx +++ b/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/CacheCreator.cxx @@ -66,8 +66,12 @@ namespace InDet{ StatusCode CacheCreator::execute (const EventContext& ctx) const { - if(!m_disableWarning && isInsideView(ctx)){ - ATH_MSG_WARNING("CacheCreator is running inside a view, this is probably a misconfiguration"); + if(!m_disableWarning){ + if(isInsideView(ctx)){ + ATH_MSG_ERROR("CacheCreator is running inside a view, this is probably a misconfiguration"); + return StatusCode::FAILURE; + } + m_disableWarning = true; //only check once } if(!m_disableTRT) ATH_CHECK(createContainer(m_rioContainerCacheKey, m_pTRTHelper->straw_layer_hash_max(), ctx)); diff --git a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/CacheCreator.h b/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/CacheCreator.h index d18484bcfbebf31c9c3bd8fcd6ffae48119bd8d6..16cc736a0568c03b297c0a81fe85b9825156e2b6 100644 --- a/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/CacheCreator.h +++ b/InnerDetector/InDetRecAlgs/InDetPrepRawDataFormation/src/CacheCreator.h @@ -51,7 +51,7 @@ namespace InDet{ SG::WriteHandleKey<SCT_RDO_Cache> m_SCTRDOCacheKey; SG::WriteHandleKey<PixelRDO_Cache> m_PixRDOCacheKey; bool m_disableTRT; - bool m_disableWarning; + mutable bool m_disableWarning; //Temporary workarounds for problem in scheduler - remove later SG::ReadCondHandleKey<PixelCalib::PixelOfflineCalibData> m_condKey5{ this, "PixelOfflineCalibData", "PixelOfflineCalibData", "" }; SG::ReadCondHandleKey<DetectorSpecialPixelMap> m_condKey12{ this, "SpecialPixelMap", "SpecialPixelMap", "" }; diff --git a/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.cxx b/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.cxx index f13d808a4c4420d8c2de5a7db80cac6a46d5d7a8..b55dc1ff486748e11997163b8ea21ea643266cc4 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.cxx +++ b/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.cxx @@ -37,8 +37,12 @@ bool MuonCacheCreator::isInsideView(const EventContext& context) const StatusCode MuonCacheCreator::execute (const EventContext& ctx) const { - if(!m_disableWarning && isInsideView(ctx)){ - ATH_MSG_WARNING("CacheCreator is running inside a view, this is probably a misconfiguration"); + if(!m_disableWarning){ + if(isInsideView(ctx)){ + ATH_MSG_ERROR("CacheCreator is running inside a view, this is probably a misconfiguration"); + return StatusCode::FAILURE; + } + m_disableWarning = true; //only check once } // Create the MDT cache container auto maxHashMDTs = m_mdtIdHelper->stationNameIndex("BME") != -1 ? diff --git a/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.h b/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.h index c3908ac00b8b3e67ad2b486260c87fc101d1d252..9a78b8520d0eb134dca194fae98136c1ed60f420 100644 --- a/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.h +++ b/MuonSpectrometer/MuonCnv/MuonByteStream/src/MuonCacheCreator.h @@ -34,7 +34,7 @@ protected: /// ID helpers const MdtIdHelper* m_mdtIdHelper = 0; - bool m_disableWarning = false; + mutable bool m_disableWarning = false; bool isInsideView(const EventContext&) const; };//class MuonCacheCreator