9#include "CoralBase/Blob.h"
10#include "CoralBase/AttributeList.h"
23 return StatusCode::SUCCESS;
34 return StatusCode::SUCCESS;
42 return StatusCode::FAILURE;
52 const coral::Blob& bls = chanIt->second[
"SourceIDs"].data<coral::Blob>();
53 unsigned nLat=bls.size()/
sizeof(uint32_t);
54 std::unique_ptr<LArLATOMEMapping> latomeMap=std::make_unique<LArLATOMEMapping>(nLat);
56 for (;chanIt!=chanIt_e;++chanIt) {
58 const coral::AttributeList& attr = chanIt->second;
59 const coral::Blob& blobsourceId=attr[
"SourceIDs"].data<coral::Blob>();
60 unsigned nLatome=blobsourceId.size()/
sizeof(uint32_t);
61 const coral::Blob& blobonlineId=attr[
"OnlineIDs"].data<coral::Blob>();
62 unsigned nChan=blobonlineId.size()/blobsourceId.size();
63 const uint32_t* pblobsourceId=
static_cast<const uint32_t*
>(blobsourceId.startingAddress());
64 const uint32_t* pblobonlineId=
static_cast<const uint32_t*
>(blobonlineId.startingAddress());
67 ATH_MSG_ERROR(
"Number of channels read from DB (" << nChan <<
") does not match expected "
69 return StatusCode::FAILURE;
72 for (
unsigned i=0;i<nLatome;++i) {
73 const unsigned sid=pblobsourceId[i];
75 std::pair<unsigned, std::vector<HWIdentifier> > entry{sid,{}};
80 entry.second.push_back(hwid);
82 entry.second.push_back(latomeMap->m_hwidEmpty);
85 latomeMap->m_map.insert(std::move(entry));
91 if(writeHandle.
record(std::move(latomeMap)).isFailure()) {
92 ATH_MSG_ERROR(
"Could not record LArLATOMEMapping object with "
94 <<
" with EventRange " << writeHandle.
getRange()
95 <<
" into Conditions Store");
96 return StatusCode::FAILURE;
98 ATH_MSG_INFO(
"recorded new " << writeHandle.
key() <<
" with range " << writeHandle.
getRange() <<
" into Conditions Store");
100 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
Helper class for offline supercell identifiers.
#define N_LATOME_CHANNELS
fixed number of channels on one LATOME board
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.
ChanAttrListMap::const_iterator const_iterator
bool is_valid() const
Check if id is in a valid state.
virtual StatusCode execute(const EventContext &ctx) const override
SG::WriteCondHandleKey< LArLATOMEMapping > m_writeKey
virtual StatusCode initialize() override
SG::ReadCondHandleKey< CondAttrListCollection > m_readKey
const std::string & key() const
void addDependency(const EventIDRange &range)
const EventIDRange & getRange() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED