8 #include "GaudiKernel/EventIDRange.h"
13 const std::string parameterName{
"temperature"};
29 return StatusCode::SUCCESS;
38 ATH_MSG_DEBUG(
"CondHandle " << writeHandle.
fullKey() <<
" is already valid.. In theory this should not be called, but may happen if multiple concurrent events are being processed out of order.");
39 return StatusCode::SUCCESS;
43 std::unique_ptr<PixelDCSTempData> writeCdo(std::make_unique<PixelDCSTempData>());
46 const EventIDBase
start{EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, 0, 0, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
47 const EventIDBase
stop {EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
51 std::vector<int> channelsOutOfRange{};
52 std::vector<int> channelsWithNoMeasurement{};
58 if (readCdo==
nullptr) {
60 return StatusCode::FAILURE;
63 if (not readHandle.
range(rangeW)) {
65 return StatusCode::FAILURE;
67 ATH_MSG_INFO(
"Size of CondAttrListCollection " << readHandle.
fullKey() <<
" readCdo->size()= " << readCdo->
size());
71 auto outsideValidRange = [] (
const float t){
72 return ( (
t > 100.0
f) or (
t< -80.
f) ) ;
75 countChannels=readCdo->
size();
76 for (
const auto & attrList : *readCdo) {
77 const auto channelNumber{attrList.first};
78 const auto &
payload{attrList.second};
79 if (
payload.exists(parameterName) and not
payload[parameterName].isNull()) {
80 float val =
payload[parameterName].data<
float>();
81 if (outsideValidRange(
val)) {
82 channelsOutOfRange.push_back(channelNumber);
83 val = defaultTemperature;
87 channelsWithNoMeasurement.push_back(channelNumber);
96 if (
const int nInvalid = channelsWithNoMeasurement.size(); nInvalid>0){
97 ATH_MSG_INFO(
"Out of "<<countChannels<<
", "<<nInvalid<<
" channels have no temperature measurement, and were set to "<<defaultTemperature);
99 std::string dbgMsg{
"Enumerating the channel numbers:\n"};
100 for (
auto i:channelsWithNoMeasurement){
107 if (
const int nOutOfRange = channelsOutOfRange.size(); nOutOfRange>0){
108 ATH_MSG_INFO(
"Out of "<<countChannels<<
", "<<nOutOfRange<<
" channels have temperatures outside the range -80 to 100, and were set to "<<defaultTemperature);
110 std::string dbgMsg{
"Enumerating the channel numbers:\n"};
111 for (
auto i:channelsOutOfRange){
119 if (writeHandle.
record(rangeW, std::move(writeCdo)).isFailure()) {
120 ATH_MSG_FATAL(
"Could not record PixelDCSTempData " << writeHandle.
key() <<
" with EventRange "
121 << writeHandle.
getRange() <<
" into Conditions Store");
122 return StatusCode::FAILURE;
124 ATH_MSG_INFO(
"recorded new CDO " << writeHandle.
key() <<
" with range "
125 << writeHandle.
getRange() <<
" into Conditions Store");
127 return StatusCode::SUCCESS;