50 ATH_CHECK(rawChannelsHdl.
record(std::make_unique<LArRawChannelContainer>()));
51 rawChannels=rawChannelsHdl.
ptr();
52 rawChannels->reserve(182468);
58 digits=digitsHdl.
ptr();
64 ATH_CHECK(febHeadersHdl.
record(std::make_unique<LArFebHeaderContainer>()));
65 febHeaders=febHeadersHdl.
ptr();
71 std::map<eformat::SubDetectorGroup, std::vector<const uint32_t*> > rawEventTOC;
72 eformat::helper::build_toc(*fullEvent, rawEventTOC);
73 auto larRobs=rawEventTOC.find(eformat::LAR);
74 if (larRobs==rawEventTOC.end()) {
75 ATH_MSG_DEBUG(
"No LAr data found in this event. Recording empty LArRawChannelContainer");
76 return StatusCode::SUCCESS;
80 std::unique_ptr<LArRodBlockStructure> rodBlock;
81 uint16_t rodMinorVersion=0x0;
82 uint32_t rodBlockType=0x0;
85 for (
const uint32_t* robPtr : larRobs->second) {
87 ATH_MSG_VERBOSE(
"Decoding ROB fragment 0x" << std::hex << rob.rob_source_id () <<
" with " << std::dec << rob.rod_fragment_size_word() <<
" ROB words");
89 if (rob.rod_fragment_size_word() <3) {
91 ATH_MSG_ERROR(
"Encountered corrupt ROD fragment, less than 3 words!");
92 return StatusCode::FAILURE;
96 }
else if(rob.rob_source_id()& 0x1000 ){
100 }
else if(!(rob.rod_source_id()>>12& 0x0F)
101 && !((rob.rod_source_id()>>20) == 4) ){
103 ATH_MSG_WARNING(
"Found not LAr fragment " <<
" event: "<<ctx.eventID().event_number());
105 ATH_MSG_WARNING(
"Rob source id.: 0x"<< std::hex << rob.rob_source_id () <<std::dec <<
" ROD Source id: 0x"<<std::hex<<rob.rod_source_id()<<std::dec<<
" Lvl1ID: "<<eventInfo->extendedLevel1ID());
110 eformat::helper::Version ver(rob.rod_version());
112 if (rodBlock==
nullptr || rodMinorVersion !=ver.minor_version() || rodBlockType!=(rob.rod_detev_type()&0xff)) {
113 rodMinorVersion=ver.minor_version();
114 rodBlockType=rob.rod_detev_type()&0xff;
115 ATH_MSG_VERBOSE(
"Found version " << rodMinorVersion <<
" of Rod Block Type " << rodBlockType);
116 if (rodBlockType==4) {
117 switch(rodMinorVersion) {
127 ATH_MSG_ERROR(
"Found unsupported ROD Block version " << rodMinorVersion
128 <<
" of ROD block type " << rodBlockType <<
". ROD Source id: 0x" <<std::hex<<rob.rod_source_id());
129 return StatusCode::FAILURE;
132 ATH_MSG_WARNING(
"Found unsupported ROD Block version " << rodMinorVersion
133 <<
" of ROD block type " << rodBlockType <<
". ROD Source id: 0x" <<std::hex<<rob.rod_source_id());
138 else if (rodBlockType==2) {
139 switch(rodMinorVersion) {
147 ATH_MSG_WARNING(
"Found unsupported ROD Block version " << rodMinorVersion
148 <<
" of ROD block type " << rodBlockType);
154 const uint32_t* pData=rob.rod_data();
155 const uint32_t nData=rob.rod_ndata();
158 ATH_MSG_ERROR(
"ROD 0x"<<std::hex<<rob.rod_source_id() << std::dec <<
" reports data block size 0");
159 return StatusCode::FAILURE;
162 ATH_MSG_WARNING(
"ROD 0x"<<std::hex<<rob.rod_source_id() << std::dec <<
" reports data block size 0");
167 if (!rodBlock || !rodBlock->setFragment(pData,nData)) {
169 ATH_MSG_ERROR(
"Failed to assign fragment pointer to LArRodBlockStructure");
170 return StatusCode::FAILURE;
173 ATH_MSG_WARNING(
"Failed to assign fragment pointer to LArRodBlockStructure");
179 const uint32_t onsum = rodBlock->onlineCheckSum();
180 const uint32_t offsum = rodBlock->offlineCheckSum();
185 ATH_MSG_ERROR(
"offline checksum = 0x" << MSG::hex << offsum << MSG::dec);
186 return StatusCode::FAILURE;
199 return StatusCode::FAILURE;
205 const int NthisFebChannel=
m_onlineId->channelInSlotMax(fId);
214 while (rodBlock->getNextEnergy(fcNb,energy,time,quality,gain)) {
215 if (fcNb>=NthisFebChannel)
219 uint16_t iquality = 0;
223 iquality = (quality & 0xFFFF);
225 rawChannels->emplace_back(cId, energy, time, iquality, iprovenance, (
CaloGain::CaloGain)gain);
233 std::vector<short> samples;
234 while (rodBlock->getNextRawData(fcNb,samples,gain)) {
235 if (fcNb>=NthisFebChannel)
237 if (samples.size()==0)
continue;
246 std::unique_ptr<LArFebHeader> larFebHeader(
new LArFebHeader(fId));
248 febHeaders->
push_back(std::move(larFebHeader));
251 }
while (rodBlock->nextFEB());
253 return StatusCode::SUCCESS;