7 #include "GaudiKernel/EventIDRange.h"
9 #include <unordered_map>
23 m_stateMap.insert(std::make_pair(std::string(
"READY"), PixelDCSStateData::DCSModuleState::READY));
24 m_stateMap.insert(std::make_pair(std::string(
"ON"), PixelDCSStateData::DCSModuleState::ON));
26 m_stateMap.insert(std::make_pair(std::string(
"TRANSITION"), PixelDCSStateData::DCSModuleState::TRANSITION));
28 m_stateMap.insert(std::make_pair(std::string(
"DISABLED"), PixelDCSStateData::DCSModuleState::DISABLED));
29 m_stateMap.insert(std::make_pair(std::string(
"LOCKED_OUT"), PixelDCSStateData::DCSModuleState::LOCKED_OUT));
30 m_stateMap.insert(std::make_pair(std::string(
"STANDBY"), PixelDCSStateData::DCSModuleState::STANDBY));
31 m_stateMap.insert(std::make_pair(std::string(
"OFF"), PixelDCSStateData::DCSModuleState::OFF));
33 return StatusCode::SUCCESS;
40 if (writeHandleState.
isValid()) {
41 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.");
42 return StatusCode::SUCCESS;
46 std::unique_ptr<PixelDCSStateData> writeCdoState(std::make_unique<PixelDCSStateData>());
48 const EventIDBase
start{EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, 0, 0, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
49 const EventIDBase
stop {EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
56 if (readCdoState==
nullptr) {
57 ATH_MSG_FATAL(
"Null pointer to the read conditions object (state)");
58 return StatusCode::FAILURE;
61 if (not readHandle.
range(rangeW)) {
63 return StatusCode::FAILURE;
65 ATH_MSG_INFO(
"Size of CondAttrListCollection " << readHandle.
fullKey() <<
" readCdo->size()= " << readCdoState->
size());
69 std::string paramState =
"FSM_state";
70 for (
const auto & attrListState : *readCdoState) {
73 if (
payload.exists(paramState.c_str()) and not
payload[paramState.c_str()].isNull()) {
74 std::string
val =
payload[paramState.c_str()].data<std::string>();
75 std::unordered_map<std::string,PixelDCSStateData::DCSModuleState>::const_iterator iter =
m_stateMap.find(
val);
77 ATH_MSG_WARNING(
"DCS state " <<
val <<
" is not handled (channel=" << channelNumber <<
") settting to NOSTATE");
78 writeCdoState->
setModuleStatus(channelNumber,PixelDCSStateData::DCSModuleState::NOSTATE);
85 ATH_MSG_WARNING(paramState <<
" does not exist for ChanNum " << channelNumber);
86 writeCdoState->
setModuleStatus(channelNumber,PixelDCSStateData::DCSModuleState::NOSTATE);
94 if (writeHandleState.
record(rangeW, std::move(writeCdoState)).isFailure()) {
95 ATH_MSG_FATAL(
"Could not record PixelDCSStateData " << writeHandleState.
key() <<
" with EventRange " << writeHandleState.
getRange() <<
" into Conditions Store");
96 return StatusCode::FAILURE;
98 ATH_MSG_INFO(
"recorded new CDO " << writeHandleState.
key() <<
" with range " << writeHandleState.
getRange() <<
" into Conditions Store");
100 return StatusCode::SUCCESS;