29 return StatusCode::SUCCESS;
42 <<
". In theory this should not be called, but may happen"
43 <<
" if multiple concurrent events are being processed out of order.");
44 return StatusCode::SUCCESS;
48 std::unique_ptr<SCT_TdaqEnabledCondData> writeCdo{std::make_unique<SCT_TdaqEnabledCondData>()};
57 EventIDBase unfilledStart{0, 0, 0, 0};
59 EventIDRange unfilledRange{unfilledStart, unfilledStop};
60 rangeW = unfilledRange;
61 writeCdo->setNoneBad(
true);
62 writeCdo->setFilled(
true);
67 if (readCdo==
nullptr) {
69 return StatusCode::FAILURE;
72 ATH_MSG_INFO(
"Size of CondAttrListCollection readCdo->size()= " << readCdo->
size());
77 for (; attrList!=end; ++attrList) {
81 const std::string &enabled{payload[
"class"].data<std::string>()};
82 const std::string& chanName{readCdo->
chanName(channelNumber)};
87 if ((not enabled.empty()) and (not writeCdo->setGoodRod(rodNumber))) {
91 ATH_MSG_WARNING(
"Names in "<<
m_readKey.key()<<
" should be of the form ROL-SCT-BA-00-210000 this channel, number "<<channelNumber<<
", is: "<<chanName);
95 if (writeCdo->getGoodRods().size()>
s_NRODS) {
96 ATH_MSG_FATAL(
"The number of rods declared as good appears to be greater than the permissible number of rods ("<<
s_NRODS<<
")");
97 writeCdo->setFilled(
false);
98 return StatusCode::FAILURE;
101 long unsigned int nBad{
s_NRODS-writeCdo->getGoodRods().size()};
102 std::string howMany{
inWords(nBad)};
106 writeCdo->setNoneBad(nBad==0);
107 if (writeCdo->isNoneBad()) {
108 writeCdo->setFilled(
true);
112 std::vector<IdentifierHash> tmpIdVec{0};
114 for (
const auto& thisRod : writeCdo->getGoodRods()) {
117 writeCdo->setGoodModules(tmpIdVec);
119 writeCdo->setFilled(
true);
122 if (not readHandle.
range(rangeW)) {
123 ATH_MSG_FATAL(
"Failed to retrieve validity range for " << readHandle.
key());
124 return StatusCode::FAILURE;
128 if (writeHandle.
record(rangeW, std::move(writeCdo)).isFailure()) {
129 ATH_MSG_FATAL(
"Could not record SCT_TdaqEnabledCondData " << writeHandle.
key()
130 <<
" with EventRange " << rangeW
131 <<
" into Conditions Store");
132 return StatusCode::FAILURE;
134 ATH_MSG_INFO(
"recorded new CDO " << writeHandle.
key() <<
" with range " << rangeW <<
" into Conditions Store");
136 return StatusCode::SUCCESS;
142 return StatusCode::SUCCESS;
146 const unsigned int runNumber{ctx.eventID().run_number()};
148 if (noDataExpected)
ATH_MSG_INFO(
"This run occurred before the /TDAQ/EnabledResources/ATLAS/SCT/Robins folder was filled in COOL; assuming the SCT is all ok.");
149 return noDataExpected;
156 const long unsigned int length{chanNameString.size()};
159 std::istringstream iss{chanNameString.substr(
length-6, 6)};
160 iss.exceptions(std::ios_base::badbit|std::ios_base::failbit);
163 }
catch (
const std::ios_base::failure&){
164 std::cerr<<
"Bad conversion of last 6 digits of "<<chanNameString<<
" to a hex number"<<std::endl;
165 throw(std::ios_base::failure(
"stringToInt failure in SCT_TdaqEnabledSvc"));
173 return std::string(
"No SCT rods were");
176 return std::string(
"One SCT rod was");
179 return std::to_string(aNumber) +
" SCT rods were";
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Base class for conditions algorithms.
This class is a collection of AttributeLists where each one is associated with a channel number.
const_iterator end() const
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
const std::string & chanName(ChanNum chanNum) const
find name for particular channel
size_type size() const
number of Chan/AttributeList pairs
ChanAttrListMap::const_iterator const_iterator
coral::AttributeList AttributeList
static bool rodIdInRange(std::uint32_t r)
Is the rod in range?
static unsigned int parseChannelName(const std::string &chanNameString)
static const unsigned int s_modulesPerRod
static const unsigned int s_NRODS
static const unsigned int s_earliestRunForFolder
ToolHandle< ISCT_CablingTool > m_cablingTool
virtual StatusCode execute(const EventContext &ctx) const override final
SG::ReadCondHandleKey< CondAttrListCollection > m_readKey
virtual StatusCode finalize() override final
SCT_TdaqEnabledCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::WriteCondHandleKey< SCT_TdaqEnabledCondData > m_writeKey
virtual StatusCode initialize() override final
bool unfilledRun(const EventContext &ctx) const
static std::string inWords(const unsigned int aNumber)
static const unsigned int s_earliestTimeStampForFolder
bool range(EventIDRange &r)
const std::string & key() const
const std::string & key() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const