41 std::set<unsigned> fts;
43 fts.insert({0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31});
46 fts.insert({0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24});
59 ATH_MSG_INFO(
"Adding feedthrough Barrel/Endcap=" << iBE <<
" pos/neg=" << iPN <<
" FT=" << iFT
61 <<
" " << std::hex << finalFTId << std::dec <<
")");
70 std::set<HWIdentifier> subcaloFTs;
74 subcaloFTs.insert(
m_onlineId->feedthrough_Id(febid));
82 subcaloFTs.insert(
m_onlineId->feedthrough_Id(febid));
89 subcaloFTs.insert(
m_onlineId->feedthrough_Id(febid));
95 return StatusCode::FAILURE;
101 if (subcaloFTs.find(*it)==subcaloFTs.end())
107 ATH_MSG_WARNING(
"Apparently inconistent configuration of FT preselections. No preselection left after intersecting 'SubCaloPreselection' with 'PosNeg/BE/FT' preselection");
119 return StatusCode::SUCCESS;
129 ATH_CHECK(rawChannelsHdl.
record(std::make_unique<LArRawChannelContainer>()));
130 rawChannels=rawChannelsHdl.
ptr();
131 rawChannels->reserve(182468);
137 digits=digitsHdl.
ptr();
143 ATH_CHECK(febHeadersHdl.
record(std::make_unique<LArFebHeaderContainer>()));
144 febHeaders=febHeadersHdl.
ptr();
150 std::map<eformat::SubDetectorGroup, std::vector<const uint32_t*> > rawEventTOC;
151 eformat::helper::build_toc(*fullEvent, rawEventTOC);
152 auto larRobs=rawEventTOC.find(eformat::LAR);
153 if (larRobs==rawEventTOC.end()) {
154 ATH_MSG_DEBUG(
"No LAr data found in this event. Recording empty LArRawChannelContainer");
155 return StatusCode::SUCCESS;
159 std::unique_ptr<LArRodBlockStructure> rodBlock;
160 uint16_t rodMinorVersion=0x0;
161 uint32_t rodBlockType=0x0;
164 for (
const uint32_t* robPtr : larRobs->second) {
166 ATH_MSG_VERBOSE(
"Decoding ROB fragment 0x" << std::hex << rob.rob_source_id () <<
" with " << std::dec << rob.rod_fragment_size_word() <<
" ROB words");
168 if (rob.rod_fragment_size_word() <3) {
170 ATH_MSG_ERROR(
"Encountered corrupt ROD fragment, less than 3 words!");
171 return StatusCode::FAILURE;
175 }
else if(rob.rob_source_id()& 0x1000 ){
179 }
else if(!(rob.rod_source_id()>>12& 0x0F)
180 && !((rob.rod_source_id()>>20) == 4) ){
182 ATH_MSG_WARNING(
"Found not LAr fragment " <<
" event: "<<ctx.eventID().event_number());
184 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());
189 eformat::helper::Version ver(rob.rod_version());
191 if (rodBlock==
nullptr || rodMinorVersion !=ver.minor_version() || rodBlockType!=(rob.rod_detev_type()&0xff)) {
192 rodMinorVersion=ver.minor_version();
193 rodBlockType=rob.rod_detev_type()&0xff;
194 ATH_MSG_VERBOSE(
"Found version " << rodMinorVersion <<
" of Rod Block Type " << rodBlockType);
195 if (rodBlockType==4) {
196 switch(rodMinorVersion) {
206 ATH_MSG_ERROR(
"Found unsupported ROD Block version " << rodMinorVersion
207 <<
" of ROD block type " << rodBlockType <<
". ROD Source id: 0x" <<std::hex<<rob.rod_source_id());
208 return StatusCode::FAILURE;
211 ATH_MSG_WARNING(
"Found unsupported ROD Block version " << rodMinorVersion
212 <<
" of ROD block type " << rodBlockType <<
". ROD Source id: 0x" <<std::hex<<rob.rod_source_id());
217 else if (rodBlockType==2) {
218 switch(rodMinorVersion) {
226 ATH_MSG_WARNING(
"Found unsupported ROD Block version " << rodMinorVersion
227 <<
" of ROD block type " << rodBlockType);
233 const uint32_t* pData=rob.rod_data();
234 const uint32_t nData=rob.rod_ndata();
237 ATH_MSG_ERROR(
"ROD 0x"<<std::hex<<rob.rod_source_id() << std::dec <<
" reports data block size 0");
238 return StatusCode::FAILURE;
241 ATH_MSG_WARNING(
"ROD 0x"<<std::hex<<rob.rod_source_id() << std::dec <<
" reports data block size 0");
246 if (!rodBlock || !rodBlock->setFragment(pData,nData)) {
248 ATH_MSG_ERROR(
"Failed to assign fragment pointer to LArRodBlockStructure");
249 return StatusCode::FAILURE;
252 ATH_MSG_WARNING(
"Failed to assign fragment pointer to LArRodBlockStructure");
258 const uint32_t onsum = rodBlock->onlineCheckSum();
259 const uint32_t offsum = rodBlock->offlineCheckSum();
264 ATH_MSG_ERROR(
"offline checksum = 0x" << MSG::hex << offsum << MSG::dec);
265 return StatusCode::FAILURE;
278 return StatusCode::FAILURE;
286 const auto ftId=
m_onlineId->feedthrough_Id(fId);
288 ATH_MSG_DEBUG(
"Feedthrough with id " << MSG::hex << ftId << MSG::dec <<
" not in preselection. Ignored.");
291 ATH_MSG_DEBUG(
"Feedthrough with id " << MSG::hex << ftId << MSG::dec <<
" is preselected.");
295 const int NthisFebChannel=
m_onlineId->channelInSlotMax(fId);
304 while (rodBlock->getNextEnergy(fcNb,energy,time,quality,gain)) {
305 if (fcNb>=NthisFebChannel)
309 uint16_t iquality = 0;
313 iquality = (quality & 0xFFFF);
315 rawChannels->emplace_back(cId, energy, time, iquality, iprovenance, (
CaloGain::CaloGain)gain);
323 std::vector<short> samples;
324 while (rodBlock->getNextRawData(fcNb,samples,gain)) {
325 if (fcNb>=NthisFebChannel)
327 if (samples.size()==0)
continue;
336 std::unique_ptr<LArFebHeader> larFebHeader(
new LArFebHeader(fId));
338 febHeaders->
push_back(std::move(larFebHeader));
341 }
while (rodBlock->nextFEB());
343 return StatusCode::SUCCESS;