ATLAS Offline Software
Loading...
Searching...
No Matches
LArLATOMEDecoder.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#define DETAIL_DUMP_ON false
6#define ADC_DUMP_ON false
7#define VALIDATE_DUMP_ON false
8
10
11#include <byteswap.h>
12
14#include "GaudiKernel/MsgStream.h"
16#include "LArByteStream/Mon.h"
19
20static const InterfaceID IID_ILArLATOMEDecoder("LArLATOMEDecoder", 1, 0);
21
22using namespace OFFLINE_FRAGMENTS_NAMESPACE;
23
24LArLATOMEDecoder::LArLATOMEDecoder(const std::string& type, const std::string& name, const IInterface* parent)
25 : AthAlgTool(type, name, parent), m_sc2ccMappingTool("CaloSuperCellIDTool") {
26 declareInterface<LArLATOMEDecoder>(this);
27}
28
29const InterfaceID& LArLATOMEDecoder::interfaceID() {
31}
32
34
35 ATH_CHECK(detStore()->retrieve(m_onlineId, "LArOnline_SuperCellID"));
36
37 ATH_CHECK(m_sc2ccMappingTool.retrieve());
38 ATH_CHECK(m_cablingKeySC.initialize());
39
40 return StatusCode::SUCCESS;
41}
42
43StatusCode LArLATOMEDecoder::convert(const RawEvent* re, const LArLATOMEMapping* map, const LArOnOffIdMapping* onoffmap, const LArCalibLineMapping* clmap,
45 LArLATOMEHeaderContainer* header_coll) const {
46
47 if(!re) return StatusCode::FAILURE;;
48 bool ret = false;
49 // Check fragment validity:
50 try {
51 ret = re->check();
52 } catch (eformat::Issue& ex) {
53 ATH_MSG_WARNING("Exception while checking eformat fragment validity: " << ex.what());
54 ret = false;
55 }
56 if (!ret) {
57 ATH_MSG_ERROR("Got invalid RawEvent fragment");
58 return StatusCode::FAILURE;
59 }
60 // Build TOC
61 std::map<eformat::SubDetectorGroup, std::vector<const uint32_t*> > robIndex;
62 eformat::helper::build_toc(*re, robIndex);
63 for (const auto& mapit : robIndex)
64 ATH_MSG_DEBUG("Rob Index subdetgroup is " << std::hex << mapit.first);
65 std::map<eformat::SubDetectorGroup, std::vector<const uint32_t*> >::const_iterator robIt = robIndex.find(eformat::LAR);
66 if (robIt != robIndex.end()) {
67 const std::vector<const uint32_t*>& robs = robIt->second;
68 for (const uint32_t* pRob : robs) {
69 try {
70 ROBFragment robFrag(pRob);
72 uint32_t latomeSourceID = robFrag.rod_source_id();
73 if (!(latomeSourceID & 0x1000)) {
74 ATH_MSG_DEBUG(" discarding non latome source ID " << std::hex << latomeSourceID);
75 continue;
76 }
77 ATH_MSG_DEBUG(" found latome source ID " << std::hex << latomeSourceID);
78 }
79 EventProcess ev(this, 0, 0, 0, 0, accdigits, caccdigits, header_coll);
80 ev.fillCollection(&robFrag, map, onoffmap, clmap);
81 } catch (eformat::Issue& ex) {
82 ATH_MSG_WARNING(" exception thrown by ROBFragment, badly corrupted event. Abort decoding ");
83 if (accdigits)
84 accdigits->clear();
85 if (caccdigits)
86 caccdigits->clear();
87 if (header_coll)
88 header_coll->clear();
89 break;
90 }
91 } // end loop over robs
92 } // end if got LAr-RODs
93
94 return StatusCode::SUCCESS;
95}
96
97StatusCode LArLATOMEDecoder::convert(const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& robFrags, const LArLATOMEMapping* map,
98 LArDigitContainer* adc_coll, LArDigitContainer* adc_bas_coll, LArRawSCContainer* et_coll, LArRawSCContainer* et_id_coll,
99 LArLATOMEHeaderContainer* header_coll) const {
100
101 // Check fragment validity:
102 // Build TOC
103 if (robFrags.size() > 0) {
104 for (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment* pRob : robFrags) {
105 try {
106 if (m_protectSourceId) {
107 uint32_t latomeSourceID = pRob->rod_source_id();
108 if (!(latomeSourceID & 0x1000)) {
109 ATH_MSG_DEBUG(" discarding non latome source ID " << std::hex << latomeSourceID);
110 continue;
111 }
112 ATH_MSG_DEBUG(" found latome source ID " << std::hex << latomeSourceID);
113 }
114 EventProcess ev(this, adc_coll, adc_bas_coll, et_coll, et_id_coll, 0, 0, header_coll);
115 ev.fillCollection(pRob, map, nullptr, nullptr);
116 } catch (eformat::Issue& ex) {
117 ATH_MSG_WARNING(" exception thrown by ROBFragment, badly corrupted event. Abort decoding ");
118 if (adc_coll)
119 adc_coll->clear();
120 if (adc_bas_coll)
121 adc_bas_coll->clear();
122 if (et_coll)
123 et_coll->clear();
124 if (et_id_coll)
125 et_id_coll->clear();
126 if (header_coll)
127 header_coll->clear();
128 break;
129 }
130 } // end loop over robs
131 } // end if got LAr-RODs
132 return StatusCode::SUCCESS;
133}
134
136 LArRawSCContainer* et_coll, LArRawSCContainer* et_id_coll, LArAccumulatedDigitContainer* accdigits,
138 : AthMessaging(Gaudi::svcLocator()->service<IMessageSvc>("MessageSvc"), "LArLATOMEDecoder::EventProcess"),
139 m_decoder(decoderInput),
140 m_adc_coll(adc_coll),
141 m_adc_bas_coll(adc_bas_coll),
142 m_et_coll(et_coll),
143 m_et_id_coll(et_id_coll),
144 m_accdigits(accdigits),
145 m_caccdigits(caccdigits),
146 m_header_coll(header_coll) {
147 m_latomeID = 0;
148 m_l1ID = 0;
149 m_ROBFragSize = 0;
150 m_nPackets = 0;
151 m_iPacket = 0;
153 m_monHeaderSize = 0;
154 m_region = 0;
155 m_nStreams = 0;
156 m_streamNumber = 0;
161 m_at0nBC = 0;
162 m_at1nBC = 0;
163 m_at0BC = 0;
164 m_at1BC = 0;
165 m_activeSC = 0;
166 m_nsc1 = 0;
167 m_nsc2 = 0;
168 m_nsc3 = 0;
169 m_nsc4 = 0;
170 m_nsc5 = 0;
171 m_nsc6 = 0;
172 m_headerDecoded = false;
173
174 m_nBC_rawADC = 0;
175 m_nBC_ADC = 0;
176 m_nBC_E = 0;
177 m_nBC_EID = 0;
178
179 m_nBC_Averaged = 0;
180
181 m_BC_rawADC = 0;
182 m_BC_ADC = 0;
183 m_BC_E = 0;
184 m_BC_EID = 0;
185
186 m_hasRawAdc = false;
187 m_hasAdc = false;
188 m_hasE = false;
189 m_hasEID = false;
190
191 m_isAveraged = (m_caccdigits != 0);
192 m_isAutoCorr = (m_accdigits != 0);
193
194 if (!m_isAveraged && !m_isAutoCorr) {
196 } else {
199 }
200}
201
202bool LArLATOMEDecoder::EventProcess::compareOrSet(Word& param, Word value, bool compare) {
203 if (!compare) {
204 param = value;
205 return true;
206 }
207 return param == value;
208}
209
210unsigned int LArLATOMEDecoder::EventProcess::decodeTrailer(const uint32_t* p, unsigned int offset) {
212 if (bswap_32(p[offset]) != 0xc0ffee00 || bswap_32(p[offset + 1] != 0xaaaaaaaa)) {
213 ATH_MSG_WARNING("Problem in trailer at packet " << m_iPacket << " words " << std::hex << bswap_32(p[offset]) << ", " << bswap_32(p[offset + 1])
214 << std::dec);
215 }
217 return offset + m_monTrailerSize;
218}
219
220unsigned int LArLATOMEDecoder::EventProcess::decodeHeader(const uint32_t* p, unsigned int offset) {
221
223 int monheadererror = 0;
224 int monheadererrorbit = 0;
225 if (!compareOrSet(m_latomeID, bswap_32(p[0 + offset]), m_headerDecoded))
226 monheadererror |= (1 << monheadererrorbit++);
227 Word l1IDtmp = m_l1ID;
228 if (!compareOrSet(l1IDtmp, bswap_32(p[1 + offset]), m_headerDecoded))
229 monheadererror |= (1 << monheadererrorbit++);
230 if (l1IDtmp != m_l1ID) {
231 ATH_MSG_DEBUG("Mon header L1ID " << l1IDtmp << " different from rod header L1ID " << m_l1ID);
232 }
233 ATH_MSG_DEBUG(" latomeID: " << m_latomeID << " l1ID: " << m_l1ID);
234
235 Word monHeaderMarker = bswap_32(p[2 + offset]);
236 Word monCheckPoint = bswap_32(p[4 + offset]);
237 if (s_monHeaderMarker != monHeaderMarker) {
238 monheadererror |= (1 << monheadererrorbit++);
239 ATH_MSG_WARNING("Problem in monHeaderMarker: " << monHeaderMarker);
240 }
241 if (s_monCheckPoint != monCheckPoint) {
242 monheadererror |= (1 << monheadererrorbit++);
243 ATH_MSG_WARNING("Problem in monCheckPoint: " << monCheckPoint);
244 }
245
246 if (!compareOrSet(m_nPackets, bswap_32(p[3 + offset]) >> 24, m_headerDecoded))
247 monheadererror |= (1 << monheadererrorbit++);
248
249 if (m_nPackets == 0xFF) {
250 m_nPackets = 1;
251 m_iPacket = 0;
252 m_nWordsPerPacket = (bswap_32(p[3 + offset]) & 0xffffff) / 4.;
253 } else {
254 if (m_headerDecoded)
255 ++m_iPacket;
256 else
257 m_iPacket = 0;
258 if (!compareOrSet(m_iPacket, (bswap_32(p[3 + offset]) >> 16) & 0xf, m_headerDecoded))
259 monheadererror |= (1 << monheadererrorbit++);
260 m_nWordsPerPacket = (bswap_32(p[3 + offset]) & 0xffff) / 4.;
261 }
262
263 if (!compareOrSet(m_monHeaderSize, bswap_32(p[5 + offset]), m_headerDecoded))
264 monheadererror |= (1 << monheadererrorbit++);
265
268 if (m_monHeaderSize < 18) {
269 ATH_MSG_WARNING(" Mon header size should not be less that 18 : =" << m_monHeaderSize << " are you reading old data file?");
270 return 0;
271 }
272
273 ATH_MSG_DEBUG(" nPackets: " << m_nPackets << " iPacket: " << m_iPacket << " nWordsPerPacket: " << m_nWordsPerPacket << " monHeaderSize: " << m_monHeaderSize);
274
276 if (!compareOrSet(m_at0typeRec, bswap_32(p[9 + offset]), m_headerDecoded))
277 monheadererror |= (1 << monheadererrorbit++);
278 if (!compareOrSet(m_at1typeRec, bswap_32(p[12 + offset]), m_headerDecoded))
279 monheadererror |= (1 << monheadererrorbit++);
280 monheadererrorbit += 2;
281
282 if (!compareOrSet(m_at0nBC, bswap_32(p[10 + offset]), m_headerDecoded))
283 monheadererror |= (1 << monheadererrorbit++);
284 if (!compareOrSet(m_at1nBC, bswap_32(p[13 + offset]), m_headerDecoded))
285 monheadererror |= (1 << monheadererrorbit++);
286 if (!compareOrSet(m_at0BC, bswap_32(p[11 + offset]), m_headerDecoded))
287 monheadererror |= (1 << monheadererrorbit++);
288 if (!compareOrSet(m_at1BC, bswap_32(p[14 + offset]), m_headerDecoded))
289 monheadererror |= (1 << monheadererrorbit++);
290 if (!compareOrSet(m_activeSC, bswap_32(p[15 + offset]), m_headerDecoded))
291 monheadererror |= (1 << monheadererrorbit++);
292 if (!compareOrSet(m_nsc1, bswap_32(p[16]) >> 24, m_headerDecoded))
293 monheadererror |= (1 << monheadererrorbit++);
294 if (!compareOrSet(m_nsc2, (bswap_32(p[16]) >> 16) & 0xff, m_headerDecoded))
295 monheadererror |= (1 << monheadererrorbit++);
296 if (!compareOrSet(m_nsc3, (bswap_32(p[16]) >> 8) & 0xff, m_headerDecoded))
297 monheadererror |= (1 << monheadererrorbit++);
298 if (!compareOrSet(m_nsc4, (bswap_32(p[16])) & 0xff, m_headerDecoded))
299 monheadererror |= (1 << monheadererrorbit++);
300 if (!compareOrSet(m_nsc5, bswap_32(p[17]) >> 24, m_headerDecoded))
301 monheadererror |= (1 << monheadererrorbit++);
302 if (!compareOrSet(m_nsc6, (bswap_32(p[17]) >> 16) & 0xff, m_headerDecoded))
303 monheadererror |= (1 << monheadererrorbit++);
304
305 ATH_MSG_DEBUG(" at0type " << m_at0typeRec << " at1type " << m_at1typeRec << " at0nBC " << m_at0nBC << " at1nBC " << m_at1nBC << " at0BC " << m_at0BC
306 << " at1BC " << m_at1BC << " nsc1 " << m_nsc1 << " nsc2 " << m_nsc2 << " nsc3 " << m_nsc3 << " nsc4 " << m_nsc4 << " nsc5 "
307 << m_nsc5 << " nsc6 " << m_nsc6);
308
309 if (monheadererror) {
310 ATH_MSG_WARNING(" consistency error in mon checker at packet " << m_iPacket << " errorbits " << std::hex << monheadererror << std::dec);
311 }
312
313 m_headerDecoded = true;
314 return m_monHeaderSize + m_nWordsPerPacket + offset;
315}
316
318
319 if (energy & (1 << 17))
320 return energy - pow(2, 18);
321 else
322 return energy;
323}
324
326 unsigned int b = 0;
327 if (at0 == MonDataType::Averaged || at0 == MonDataType::AutoCorr)
328 return 8;
329
331 if (at0 != MonDataType::Invalid)
332 b += 2;
333 if (at1 != MonDataType::Invalid)
334 b += 2;
336 ++b;
337 return b;
338}
339
341 ++wordshift;
342 if (m_packetEnd[m_iPacket] == wordshift) {
343 ++m_iPacket;
344 wordshift += (m_monHeaderSize + m_monTrailerSize);
345 ATH_MSG_DEBUG("switch packet " << m_iPacket << " " << wordshift);
346 }
347}
348
349void LArLATOMEDecoder::EventProcess::increaseByteShift(unsigned int& wordshift, unsigned int& byteshift) {
350 ++byteshift;
351 if (byteshift == 4) {
352 increaseWordShift(wordshift);
353 byteshift = 0;
354 }
355}
356
357void LArLATOMEDecoder::EventProcess::decodeByte(unsigned int& byte, unsigned int wordshift, unsigned int byteshift, const uint32_t* p) {
358 byte = ((bswap_32(p[wordshift])) >> (8 * (4 - 1 - byteshift))) & 0xff;
359}
360
361void LArLATOMEDecoder::EventProcess::decodeWord(unsigned int& word, unsigned int& wordshift, unsigned int& byteshift, const uint32_t* p) {
362 unsigned int msb = 0;
363 unsigned int lsb = 0;
364 decodeByte(msb, wordshift, byteshift, p);
365 increaseByteShift(wordshift, byteshift);
366 decodeByte(lsb, wordshift, byteshift, p);
367 increaseByteShift(wordshift, byteshift);
368 word = lsb | (msb << 8);
369}
370
371void LArLATOMEDecoder::EventProcess::decodeChannel(unsigned int& wordshift, unsigned int& byteshift, const uint32_t* p, MonDataType at0, MonDataType at1,
372 unsigned int& at0Data, unsigned int& at1Data, unsigned int& saturation, bool& at0val, bool& at1val) {
373
374 // the structure of data is always consisting of 2,3,4 or 5 bytes depending on the recipe.
375 // If there is an energy it means there is the quality/saturation byte thus odd number of bytes. Otherwise ADC or Energy spans <mostly> over 2 bytes.
376 // avoid vectors and loops and bitsets to make it faster (can change later if needed but there is only few configurations so no need to make it infinitely
377 // flexible. use unsigned int everywhere for now since we have 18 bits for energy which does not fit in short, cast later.
378 unsigned int nbytesPerChannel = bytesPerChannel(at0, at1);
379 bool satByte = nbytesPerChannel % 2; // do we have satbyte
380
381 at0val = false;
382 at1val = false;
383 at0Data = 0;
384 at1Data = 0;
385 unsigned int satData = 0;
386 saturation = 0;
387
388 unsigned int word1 = 0;
389 unsigned int word2 = 0;
390 decodeWord(word1, wordshift, byteshift, p);
391 if (nbytesPerChannel > 3) {
392 decodeWord(word2, wordshift, byteshift, p);
393 }
394 at0Data = word1 & 0x7fff;
395 at0val = word1 & 0x8000;
396 if (nbytesPerChannel > 3) {
397 at1Data = word2 & 0x7fff;
398 at1val = word2 & 0x8000;
399 }
400 if (satByte) {
401 decodeByte(satData, wordshift, byteshift, p);
402 increaseByteShift(wordshift, byteshift);
403 }
404
408
410 at0Data = (at0Data << 3) | (satData & 0x7);
411 at1Data = (at1Data << 3) | ((satData & 0x70) >> 4);
412 saturation = ((satData & 0x88) == 0x88);
413 } else if (at1 == MonDataType::Energy && at0 == MonDataType::SelectedEnergy) {
414 at0Data = (at0Data << 3) | ((satData & 0x70) >> 4);
415 at1Data = (at1Data << 3) | (satData & 0x7);
416 saturation = ((satData & 0x88) == 0x88);
417 } else {
419 at0Data = (at0Data << 3) | (satData & 0x7);
420 saturation = (satData & 0x20);
421 }
423 at1Data = (at1Data << 3) | (satData & 0x7);
424 saturation = (satData & 0x20);
425 }
426 }
427}
428
430 const LArCalibLineMapping* clmap) {
431 // Mon* mon = new Mon;
432
434 // const unsigned int rod_Size_words = robFrag->rod_ndata();
435 // const unsigned int rob_Size_words = robFrag->payload_size_word();
436 const unsigned int sourceID = robFrag->rob_source_id();
437 // const unsigned int rod_fragment_size_word = robFrag->rod_fragment_size_word();
438 // const unsigned int rod_header_size_word = robFrag->rod_header_size_word();
439 // const unsigned int rod_trailer_size_word = robFrag->rod_trailer_size_word();
440 // const unsigned int rod_bc_id = robFrag->rod_bc_id();
441 // const unsigned int rod_nstatus = robFrag->rod_nstatus();
442 // const unsigned int rod_status_position = robFrag->rod_status_position();
443 // const uint32_t* rod_start = robFrag->rod_start();
444 m_l1ID = robFrag->rod_lvl1_id();
445 m_ROBFragSize = robFrag->rod_ndata();
446 const uint32_t* p = robFrag->rod_data();
447 const unsigned int n = robFrag->rod_ndata();
448 if (0 == n) {
450 ATH_MSG_DEBUG("Empty fragment, skip ");
451 return;
452 }
453 m_latomeBCID = robFrag->rod_bc_id();
454 const uint32_t* rod_status = robFrag->rod_status();
455 const unsigned int rod_nstatus = robFrag->rod_nstatus();
456 if (rod_nstatus != 27) {
457 ATH_MSG_WARNING("Inconsistent number of rod header status elements: nstatus= " << rod_nstatus);
458 return;
459 }
460 if (rod_nstatus > 8) {
461 uint32_t status8 = rod_status[8];
462 m_at0type = status8 & 0x3;
463 m_at1type = (status8 >> 2) & 0x3;
464 }
465 m_nthLATOME = robFrag->rod_source_id();
466 m_LATOMEFW = rod_status[3] & 0x0fff;
467
468 LatomeCalibPatterns pat1, pat2, pat3;
469 pat1.DAC = rod_status[9];
470 pat1.delay = rod_status[10];
471 pat1.patterns.resize(4);
472 for (unsigned int i = 0; i < 4; ++i)
473 pat1.patterns[i] = rod_status[i + 11];
474
475 pat2.DAC = rod_status[15];
476 pat2.delay = rod_status[16];
477 pat2.patterns.resize(4);
478 for (unsigned int i = 0; i < 4; ++i)
479 pat2.patterns[i] = rod_status[i + 17];
480
481 pat3.DAC = rod_status[21];
482 pat3.delay = rod_status[22];
483 pat3.patterns.resize(4);
484 for (unsigned int i = 0; i < 4; ++i)
485 pat3.patterns[i] = rod_status[i + 23];
486
487 m_latomeCalibPatternsInEvent = {std::move(pat1), std::move(pat2), std::move(pat3)};
488
489 const HWIdentifier hwidEmpty;
490
492
493 unsigned int offset = decodeHeader(p, 0);
494 if (offset > m_ROBFragSize) {
495 ATH_MSG_WARNING("Data corruption, offset found at pos 0 (" << offset << ") is larger than the ROB fragment size (" << m_ROBFragSize << "). Ignoring data.");
496 return;
497 }
498
499 if (m_isAveraged) {
500 m_at0type = m_at0typeRec >> 24;
502 if (m_at0type != (int)MonDataType::Averaged) {
503 ATH_MSG_WARNING(" inconsistant data type with requested averaged decoding at0 type " << m_at0type << " " << m_at0typeRec << " " << std::hex << m_l1ID
504 << " " << sourceID << std::dec);
505 return;
506 }
507 }
508 if (m_isAutoCorr) {
509 m_at0type = m_at0typeRec >> 24;
511 if (m_at0type != (int)MonDataType::AutoCorr) {
512 ATH_MSG_WARNING(" inconsistant data type with requested averaged decoding at0 type " << m_at0type << " " << m_at0typeRec << " " << std::hex << m_l1ID
513 << " " << sourceID << std::dec);
514 return;
515 }
516 }
517
518 m_packetEnd.push_back(offset);
519 offset = decodeTrailer(p, offset);
522 for (unsigned int ip = 1; ip < m_nPackets; ++ip) {
523 if (offset > m_ROBFragSize) {
524 ATH_MSG_WARNING("Data corruption, offset found at pos 0 (" << offset << ") is larger than the ROB fragment size (" << m_ROBFragSize << "). Ignoring data.");
525 return;
526 }
527 offset = decodeHeader(p, offset);
528 if (offset > m_ROBFragSize) {
529 ATH_MSG_WARNING("Data corruption, offset found at pos 0 (" << offset << ") is larger than the ROB fragment size (" << m_ROBFragSize << "). Ignoring data.");
530 return;
531 }
532 m_packetEnd.push_back(offset);
533 offset = decodeTrailer(p, offset);
534 }
535
536 ATH_MSG_DEBUG(" end of header check computed offset=" << std::dec << offset << " nwords in payload=" << n);
537
539 m_iPacket = 0;
540 if (m_nPackets==0) {
541 ATH_MSG_WARNING("Data corruption, nPackets=0");
542 return;
543 }
544
545 if (m_nPackets>m_packetEnd.size()) {
546 ATH_MSG_WARNING("Data corruption, nPackets " << m_nPackets << " exceeds size " << m_packetEnd.size());
547 return;
548 }
549
550 if (m_packetEnd[m_nPackets - 1] + m_monTrailerSize != n) {
551 ATH_MSG_WARNING("problem in packet size loop " << m_packetEnd[m_nPackets - 1] << " != " << n);
552 }
553
554 std::vector<unsigned int> timeslot_nsc = {m_nsc1, m_nsc2, m_nsc3, m_nsc4, m_nsc5, m_nsc6};
555 std::vector<unsigned int> bc_size;
558
559 short nBC = 0;
560 short nBC1 = 0;
561 short startBC1 = 0;
564
565 if (m_isAveraged || m_isAutoCorr) {
566 nBC = m_at0nBC;
567 nBC1 = m_at1nBC;
568 m_nBC_Averaged = nBC;
569 startBC1 = 0;
570 type0 = static_cast<MonDataType>(m_at0type);
571 type1 = static_cast<MonDataType>(m_at1type);
572 for (auto& val : m_averagedRawValuesInEvent) {
573 val.sum.resize(m_nBC_Averaged);
574 val.sumSq.resize(m_nBC_Averaged);
575 val.nTrigValid.resize(m_nBC_Averaged);
576 val.latomeChannel = 99999;
577 }
578 } else {
579 if (m_at1nBC == 0) {
581 }
582
584 if (m_at0nBC >= m_at1nBC) {
585 nBC = m_at0nBC;
586 nBC1 = m_at1nBC;
587 startBC1 = m_at1BC - m_at0BC;
588 type0 = static_cast<MonDataType>(m_at0type);
589 type1 = static_cast<MonDataType>(m_at1type);
590 } else {
591 nBC1 = m_at0nBC;
592 nBC = m_at1nBC;
593 startBC1 = m_at0BC - m_at1BC;
594 type1 = static_cast<MonDataType>(m_at0type);
595 type0 = static_cast<MonDataType>(m_at1type);
596 }
597 } else if (m_at0type != (Word)MonDataType::Invalid) {
598 nBC = m_at0nBC;
599 type0 = static_cast<MonDataType>(m_at0type);
600 } else if (m_at1type != (Word)MonDataType::Invalid) {
601 nBC = m_at1nBC;
602 type0 = static_cast<MonDataType>(m_at1type);
603 } else {
604 ATH_MSG_ERROR("No valid data type in Mon Header");
605 return;
606 }
607
608 switch (type0) {
610 m_hasRawAdc = true;
611 m_nBC_rawADC = nBC;
612 break;
613 case MonDataType::ADC:
614 m_hasAdc = true;
615 m_nBC_ADC = nBC;
616 break;
618 m_hasE = true;
619 m_nBC_E = nBC;
620 break;
622 m_hasEID = true;
623 m_nBC_EID = nBC;
624 break;
626 break;
627 default:
628 ATH_MSG_ERROR("wrong mux0 value " << (Word)type0);
629 return;
630 }
631
632 switch (type1) {
634 m_hasRawAdc = true;
635 m_nBC_rawADC = nBC1;
636 m_BC_rawADC = startBC1;
637 break;
638 case MonDataType::ADC:
639 m_hasAdc = true;
640 m_nBC_ADC = nBC1;
641 m_BC_ADC = startBC1;
642 break;
644 m_hasE = true;
645 m_nBC_E = nBC1;
646 m_BC_E = startBC1;
647 break;
649 m_hasEID = true;
650 m_nBC_EID = nBC1;
651 m_BC_EID = startBC1;
652 break;
654 break;
655 default:
656 ATH_MSG_ERROR("wrong mux1 value " << (Word)type1);
657 return;
658 }
659
660 for (auto& val : m_rawValuesInEvent) {
661 if (m_hasRawAdc)
662 val.adc.resize(m_nBC_rawADC);
663 if (m_hasAdc)
664 val.adc_bas.resize(m_nBC_ADC);
665 if (m_hasE)
666 val.et.resize(m_nBC_E);
667 if (m_hasEID)
668 val.et_id.resize(m_nBC_EID);
669 if (m_hasEID || m_hasE) {
670 val.saturation.resize(std::max(m_nBC_EID, m_nBC_E));
671 }
672
673 val.latomeChannel = 99999;
674 }
675 }
676
677 m_BCIDsInEvent.resize(nBC);
678
679 unsigned int s = m_monHeaderSize;
680 unsigned int bcid = s_nBunches;
681
682 for (short iBC = 0; iBC < nBC; ++iBC) {
683 MonDataType at0 = type0;
684 MonDataType at1 = type1;
685 if (type1 != MonDataType::Invalid) {
686 if (iBC < startBC1 || iBC >= startBC1 + nBC1)
688 }
689 unsigned int nbytesPerChannel = bytesPerChannel(at0, at1);
690
691 int nsc = 0;
692 unsigned int oldipacket = 0;
693 for (unsigned int itimeslot = 0; itimeslot < 6; ++itimeslot) {
694 unsigned int l_bcid = (bswap_32(p[s]))>>16;
695 if(itimeslot!=0){
696 if(l_bcid!=bcid){
697 ATH_MSG_WARNING( "ERROR: inconsistent BCID between time slots" );
698 }
699 }
700 else{
701 if(bcid!=s_nBunches){
703 unsigned int bcid_c = bcid+1;
704 if(bcid_c==s_nBunches){
705 bcid=0;
706 bcid_c = 0;
707 }
708 if(bcid_c != l_bcid){
709 ATH_MSG_WARNING( "ERROR: BCID not increasing properly between samples, sourceId: " << m_nthLATOME << " L1ID is: " << m_l1ID << ", BCID is from payload: " << l_bcid << ", expected BCID is: " << bcid_c << ", LATOME channel is: " << nsc );
710 }
711 }
712 m_BCIDsInEvent[iBC] = l_bcid;
713 }
714 bcid=l_bcid;
715
716 unsigned int mux = ((bswap_32(p[s])) >> 8) & 0xff;
720 if (s >= n)
721 break;
722
723 unsigned int timeslotsize = timeslot_nsc[itimeslot];
724 unsigned int nbytes = timeslotsize * nbytesPerChannel;
725 unsigned int n64word = nbytes / 8;
726 if (nbytes % 8)
727 ++n64word;
728 ATH_MSG_DEBUG(" at BC " << iBC << " timeslot " << itimeslot << " " << bcid << " " << mux << " n64word " << n64word << " at0 " << (int)at0 << " at1 "
729 << (int)at1 << " l_bcid " << bcid);
730
731 unsigned int wordshift = s;
732 unsigned int byteshift = 0;
733
735 oldipacket = m_iPacket;
736 for (unsigned int ichan = 0; ichan < timeslotsize; ++ichan) {
737 unsigned int at0Data = 0, at1Data = 0, satData = 0;
738 bool at0val = false, at1val = false;
739
740 // protection against corrupted bytestream data
741 if (nsc > N_LATOME_CHANNELS - 1) {
742 break;
743 // FIXME: should fill some default data to all channels, because clearly this block is corrupted
744 }
745 if (!m_isAveraged && !m_isAutoCorr) {
746 decodeChannel(wordshift, byteshift, p, at0, at1, at0Data, at1Data, satData, at0val, at1val);
747 ATH_MSG_DEBUG(" wordshift " << wordshift << " byteshift " << byteshift << " at0data " << at0Data << " at1Data " << at1Data << " satData " << satData
748 << " at0val " << at0val << " at1val " << at1val << " nsc " << nsc);
749
751 const auto SCID = map ? map->getChannelID(m_nthLATOME, nsc) : hwidEmpty;
752 if (SCID == hwidEmpty) {
753 ATH_MSG_DEBUG("No mapping for ch: " << std::dec << nsc);
754 }
755 int RAWValue0 = -999;
756 if (!at0val && SCID != hwidEmpty && at0 != MonDataType::Invalid) {
757 ATH_MSG_DEBUG("at0 bad quality bit for SC:" << nsc << " BC " << iBC << " latome " << robFrag->rod_source_id());
758 } else {
760 RAWValue0 = at0Data;
761 }
762 int defaultADCValue = -1;
763 int defaultEValue = -99999;
764 auto& rawValuesInEvent = m_rawValuesInEvent[nsc];
765 switch (at0) {
767 if ((unsigned)iBC < rawValuesInEvent.adc.size()) {
768 rawValuesInEvent.adc[iBC] = (at0val) ? RAWValue0 : defaultADCValue;
769 }
770 break;
771 case MonDataType::ADC:
772 if ((unsigned)iBC < rawValuesInEvent.adc_bas.size()) {
773 rawValuesInEvent.adc_bas[iBC] = (at0val) ? RAWValue0 : defaultADCValue;
774 }
775 break;
777 if ((unsigned)iBC < rawValuesInEvent.et.size()) {
778 rawValuesInEvent.et[iBC] = (at0val) ? signEnergy(RAWValue0) : defaultEValue;
779 rawValuesInEvent.saturation[iBC] = satData;
780 }
781 break;
783 if ((unsigned)iBC < rawValuesInEvent.et_id.size()) {
784 rawValuesInEvent.et_id[iBC] = (at0val) ? signEnergy(RAWValue0) : defaultEValue;
785 rawValuesInEvent.saturation[iBC] = satData;
786 }
787 break;
789 break;
790 default:
791 ATH_MSG_ERROR("wrong at0 value " << (Word)at0);
792 return;
793 }
794
795 int RAWValue1 = -999;
796 if (!at1val && SCID != hwidEmpty && at1 != MonDataType::Invalid) {
797 ATH_MSG_DEBUG("at1 bad quality bit for SC:" << nsc << " BC " << iBC << " latome " << robFrag->rod_source_id());
798 } else {
800 RAWValue1 = at1Data;
801 }
802
803 const size_t BCidx = iBC - startBC1;
804 switch (at1) {
806 if (BCidx < rawValuesInEvent.adc.size()) {
807 rawValuesInEvent.adc[BCidx] = (at1val) ? RAWValue1 : defaultADCValue;
808 }
809 break;
810 case MonDataType::ADC:
811 if (BCidx < rawValuesInEvent.adc_bas.size()) {
812 rawValuesInEvent.adc_bas[BCidx] = (at1val) ? RAWValue1 : defaultADCValue;
813 }
814 break;
816 if (BCidx < rawValuesInEvent.et.size()) {
817 rawValuesInEvent.et[BCidx] = (at1val) ? signEnergy(RAWValue1) : defaultEValue;
818 rawValuesInEvent.saturation[BCidx] = satData;
819 }
820 break;
822 if (BCidx < rawValuesInEvent.et_id.size()) {
823 m_rawValuesInEvent[nsc].et_id[BCidx] = (at1val) ? signEnergy(RAWValue1) : defaultEValue;
824 m_rawValuesInEvent[nsc].saturation[BCidx] = satData;
825 }
826 break;
828 break;
829 default:
830 ATH_MSG_ERROR("wrong at1 value " << (Word)at1);
831 return;
832 }
833
834 m_rawValuesInEvent[nsc].latomeChannel = nsc;
835
836 } else {
837 if (wordshift % 2) {
838 ATH_MSG_ERROR("inconsistant wordshift in decoding everaged data");
839 return;
840 }
841 unsigned int averageword = bswap_32(p[wordshift]);
842 wordshift += 1;
843 unsigned int sumSq = bswap_32(p[wordshift]);
844 wordshift += 1;
845 unsigned long long sumsqMSB = averageword >> 28;
846 sumsqMSB = sumsqMSB << 32;
847
848 m_averagedRawValuesInEvent[nsc].sum[iBC] = averageword & 0xFFFFF;
849 m_averagedRawValuesInEvent[nsc].sumSq[iBC] = sumSq | sumsqMSB;
850 m_averagedRawValuesInEvent[nsc].nTrigValid[iBC] = (averageword >> 20) & 0xFF;
851 m_averagedRawValuesInEvent[nsc].latomeChannel = nsc;
852 }
853
854 ++nsc;
855
856 }
857
859 if(byteshift!=0){
860 increaseWordShift(wordshift);
861 byteshift=0;
862 }
863 ATH_MSG_DEBUG("wordshift before: " << wordshift << ", s: " << s);
864 if ((wordshift - s) % 2)
865 increaseWordShift(wordshift);
866 ATH_MSG_DEBUG("wordshift after : " << wordshift << ", s: " << s);
867 if ((wordshift - s - ((m_iPacket - oldipacket) * (m_monHeaderSize + m_monTrailerSize))) != n64word * 2) {
868 ATH_MSG_WARNING(" ERROR: time slice end is not padded properly " << (wordshift - s - m_iPacket * (m_monHeaderSize + m_monTrailerSize))
869 << "!=" << n64word * 2 << " m_ipacket " << m_iPacket);
870 }
871 s = wordshift;
872 oldipacket = m_iPacket;
873 }
874
875 }
876
877 if (!m_isAveraged && !m_isAutoCorr) {
878 fillRaw(map);
879 } else {
880 if (onoffmap && clmap) {
881 fillCalib(map, onoffmap, clmap);
882 } else {
883 ATH_MSG_ERROR("Do not have mapping !!!");
884 }
885 }
886 fillHeader();
887}
888
890
892 uint32_t DAC_value=0;
893 uint16_t delay_value=0;
894 uint16_t isPulsed_value=false;
895 std::unique_ptr<LArCalibParams> calibParams1;
896 std::unique_ptr<LArCalibParams> calibParams2;
897
898 int pattype = m_nthLATOME >> 16;
899 const LArOnOffIdMapping* cabling = 0;
900 if (m_caccdigits) {
901 m_caccdigits->setDelayScale(25. / 240.);
902
903 SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_decoder->m_cablingKeySC};
904 cabling = {*cablingHdl};
905 if (!cabling) {
906 ATH_MSG_ERROR("Do not have mapping object " << m_decoder->m_cablingKeySC.key());
907 return;
908 }
909
910 calibParams1=std::make_unique<LArCalibParams>();
911 calibParams2=std::make_unique<LArCalibParams>();
912
913 if (pattype > 0x48) {
914 StatusCode sc1 = calibParams1->initialize();
915 StatusCode sc2 = calibParams2->initialize();
916 if (sc1 != StatusCode::SUCCESS || sc2 != StatusCode::SUCCESS) {
917 ATH_MSG_WARNING("could not initialize LArCalibParams, acc calib will not be filled ");
918 return;
919 }
920 if (pattype == 0x49 || pattype == 0x4a) {
921
923
925 } else {
926
928
930 }
931 } else {
932 StatusCode sc1 = calibParams1->initialize();
933 if (sc1 != StatusCode::SUCCESS) {
934 ATH_MSG_WARNING("could not initialize LArCalibParams, acc calib will not be filled ");
935 return;
936 }
938 }
939 }
940
941 const HWIdentifier hwidEmpty;
942 unsigned nWarnings = 0;
943 for (SuperCell ch = 0; ch < N_LATOME_CHANNELS; ++ch) {
944 LArCalibParams* calibParams = 0;
945 auto SCID = map ? map->getChannelID(m_nthLATOME, ch) : hwidEmpty;
946 if (SCID == hwidEmpty) {
947 ATH_MSG_DEBUG("No mapping for ch: " << std::dec << ch);
948 continue;
949 }
950 if (m_decoder->m_ignoreBarrelChannels && m_decoder->m_onlineId->barrel_ec(SCID) == 0)
951 continue;
952 if (m_decoder->m_ignoreEndcapChannels && m_decoder->m_onlineId->barrel_ec(SCID) == 1)
953 continue;
954
955 std::vector<uint64_t> sum;
956 std::vector<uint64_t> sum2;
957 unsigned int ntmin = 9999999;
959 for (auto nt : m_averagedRawValuesInEvent[ch].nTrigValid) {
960 if (nt < ntmin) {
961 ntmin = nt;
962 }
963 }
964 sum.resize(m_averagedRawValuesInEvent[ch].sum.size());
965 sum2.resize(m_averagedRawValuesInEvent[ch].sum.size());
966
967 if (ntmin > 0) {
968 for (unsigned int is = 0; is < m_averagedRawValuesInEvent[ch].sum.size(); ++is) {
969 double fsum = (double)m_averagedRawValuesInEvent[ch].sum[is] / m_averagedRawValuesInEvent[ch].nTrigValid[is] * ntmin;
970 double fsum2 = (double)m_averagedRawValuesInEvent[ch].sumSq[is] / m_averagedRawValuesInEvent[ch].nTrigValid[is] * ntmin;
971 sum[is] = round(fsum);
972 sum2[is] = round(fsum2);
973 }
974 } else {
975 std::fill(sum.begin(), sum.end(), 0);
976 std::fill(sum2.begin(), sum2.end(), 0);
977 if (++nWarnings < 64) {
978 ATH_MSG_WARNING("No valid triggers for supercell " << SCID.getString());
979 }
980 }
981 if (m_accdigits) {
982 LArAccumulatedDigit* accdigi = new LArAccumulatedDigit(SCID, gain, sum, sum2, ntmin);
983 m_accdigits->push_back(accdigi);
984 }
985 if (m_caccdigits) {
986 if (pattype == 0x49 || pattype == 0x4a) {
987 if (m_decoder->m_onlineId->barrel_ec(SCID) == 0) {
988 calibParams = calibParams1.get();
989 } else {
990 calibParams = calibParams2.get();
991 }
992 } else if (pattype == 0x4b || pattype == 0x4c) {
993 if (m_decoder->m_onlineId->isHECchannel(SCID)) {
994 calibParams = calibParams1.get();
995 } else {
996 calibParams = calibParams2.get();
997 }
998 } else {
999 calibParams = calibParams1.get();
1000 }
1001 unsigned int eventNb = 0;
1002 unsigned int numCL = 0;
1003 unsigned int numPulsedLeg = 0;
1004 std::vector<Identifier> ccellIds(0);
1005 Identifier myofflineID = cabling->cnvToIdentifier(SCID);
1006 ccellIds = m_decoder->m_sc2ccMappingTool->superCellToOfflineID(myofflineID);
1007 for (Identifier id : ccellIds) { // loop cells in sc
1008 HWIdentifier cellLegHWID = cablingLeg->createSignalChannelID(id);
1009 const std::vector<HWIdentifier>& calibLineLeg = clcabling->calibSlotLine(cellLegHWID);
1010 numCL += calibLineLeg.size();
1011 for (HWIdentifier calibLineHWID : calibLineLeg) { // loop legacy calib lines
1012 if (calibParams->isPulsed(eventNb, calibLineHWID)) {
1013 numPulsedLeg += 1;
1014 }
1015 }
1016 }
1017
1018 isPulsed_value = true;
1019 if (numPulsedLeg != numCL) {
1020 if (m_decoder->m_keepPulsed)
1021 continue;
1022 isPulsed_value = false;
1023 }
1024 DAC_value = calibParams->DAC(eventNb, SCID) * numPulsedLeg;
1025 // Here we want to change the DAC value to reflect the incorrect factors applied in HEC, where some of the cells are much smaller yet have DAC2MeV factors
1026 // which came from averaging over many cells
1027 int ft = m_decoder->m_onlineId->feedthrough(SCID);
1028 int slot = m_decoder->m_onlineId->slot(SCID);
1029 int channel = m_decoder->m_onlineId->channel(SCID);
1030 if (m_decoder->m_onlineId->barrel_ec(SCID) == 1 && (ft == 3 || ft == 10 || ft == 16 || ft == 22)) {
1031 // if it's HEC
1032 if (slot == 1) {
1033 if (channel >= 16 && channel <= 31) { // eta 1.65 bin
1034 //DAC_value = DAC_value / 1.363; // measured value
1035 DAC_value = DAC_value / 1.2; // computed from geometry
1036 m_decoder->msg(MSG::DEBUG) << "Multiplying DAC for channel " << SCID << "by 1/1.2" << endmsg;
1037 } else if (channel >= 32 && channel <= 47) { // eta 1.75 bin
1038 //DAC_value = DAC_value / 1.206; // measured value
1039 DAC_value = DAC_value * 7. / 8.; // computed from geometry
1040 m_decoder->msg(MSG::DEBUG) << "Multiplying DAC for channel " << SCID << "by 7./8." << endmsg;
1041 }
1042 }
1043 }
1044
1045 delay_value = calibParams->Delay(eventNb, SCID);
1046 LArAccumulatedCalibDigit* accdigi = new LArAccumulatedCalibDigit(SCID, gain, sum, sum2, ntmin, DAC_value, delay_value, isPulsed_value);
1047
1048 m_caccdigits->push_back(accdigi);
1049 }
1050
1051 }
1052 if (nWarnings > 16) {
1053 ATH_MSG_WARNING("Found " << nWarnings << " supercells with no valid triggers");
1054 }
1055}
1056
1057// Pass ADC values from an event
1059 // const CaloGain::CaloGain dummyGain = CaloGain::LARHIGHGAIN;
1060 const HWIdentifier hwidEmpty;
1061 for (SuperCell ch = 0; ch < N_LATOME_CHANNELS; ++ch) {
1062 const auto SCID = map ? map->getChannelID(m_nthLATOME, ch) : hwidEmpty;
1063 if (SCID == hwidEmpty) {
1064 ATH_MSG_DEBUG("No mapping for ch: " << std::dec << ch);
1065 continue;
1066 }
1067 if (m_decoder->m_ignoreBarrelChannels && m_decoder->m_onlineId->barrel_ec(SCID) == 0)
1068 continue;
1069 if (m_decoder->m_ignoreEndcapChannels && m_decoder->m_onlineId->barrel_ec(SCID) == 1)
1070 continue;
1071
1072 std::vector<short> adcValues_inChannel_inEvent;
1073
1074 if (m_hasRawAdc) {
1075 adcValues_inChannel_inEvent = m_rawValuesInEvent[ch].adc;
1076 }
1077
1078 if (m_hasRawAdc && m_adc_coll) {
1081
1082 std::vector<unsigned short> bcid_in_event;
1083 for (short b = m_BC_rawADC; b < m_BC_rawADC + m_nBC_rawADC; ++b) {
1084 bcid_in_event.push_back(m_BCIDsInEvent[b]);
1085 }
1086
1087 LArSCDigit* scDigit = new LArSCDigit(SCID, m_rawValuesInEvent[ch].latomeChannel, m_nthLATOME, adcValues_inChannel_inEvent, bcid_in_event);
1088 m_adc_coll->push_back(scDigit);
1089 }
1090
1091 if (m_hasAdc && m_adc_bas_coll) {
1092 std::vector<unsigned short> bcid_in_event;
1093 if (m_nBC_ADC == (short)m_BCIDsInEvent.size()) {
1094 bcid_in_event = m_BCIDsInEvent;
1095 } else {
1096 for (short b = m_BC_ADC; b < m_BC_ADC + m_nBC_ADC; ++b) {
1097 bcid_in_event.push_back(m_BCIDsInEvent[b]);
1098 }
1099 }
1100 LArSCDigit* scDigit = new LArSCDigit(SCID, m_rawValuesInEvent[ch].latomeChannel, m_nthLATOME, m_rawValuesInEvent[ch].adc_bas, bcid_in_event);
1101 m_adc_bas_coll->push_back(scDigit);
1102 }
1103
1104 if (m_hasE && m_et_coll) {
1105 std::vector<unsigned short> bcid_in_event;
1106 if (m_nBC_E == (unsigned short)m_BCIDsInEvent.size()) {
1107 bcid_in_event = m_BCIDsInEvent;
1108 } else {
1109 for (short b = m_BC_E; b < m_BC_E + m_nBC_E; ++b) {
1110 bcid_in_event.push_back(m_BCIDsInEvent[b]);
1111 }
1112 }
1113 LArRawSC* scDigit =
1114 new LArRawSC(SCID, m_rawValuesInEvent[ch].latomeChannel, m_nthLATOME, m_rawValuesInEvent[ch].et, bcid_in_event, m_rawValuesInEvent[ch].saturation);
1115 m_et_coll->push_back(scDigit);
1116 }
1117
1118 if (m_hasEID && m_et_id_coll) {
1119 std::vector<unsigned short> bcid_in_event;
1120 if (m_nBC_EID == (short)m_BCIDsInEvent.size()) {
1121 bcid_in_event = m_BCIDsInEvent;
1122 } else {
1123 for (short b = m_BC_EID; b < m_BC_EID + m_nBC_EID; ++b) {
1124 bcid_in_event.push_back(m_BCIDsInEvent[b]);
1125 }
1126 }
1127 LArRawSC* scDigit =
1128 new LArRawSC(SCID, m_rawValuesInEvent[ch].latomeChannel, m_nthLATOME, m_rawValuesInEvent[ch].et_id, bcid_in_event, m_rawValuesInEvent[ch].saturation);
1129 m_et_id_coll->push_back(scDigit);
1130 }
1131 }
1132}
1133
const boost::regex re(r_e)
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Tool to get LATOME SC and SCID mapping file and fill std::map variable with it.
static const InterfaceID IID_ILArLATOMEDecoder("LArLATOMEDecoder", 1, 0)
Byte stream converter of LATOME.
MonDataType
#define N_LATOME_CHANNELS
Tool to store LATOME mon header and footer data.
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition RawEvent.h:37
constexpr int pow(int base, int exp) noexcept
C++23-compatible byteswap()
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
void clear()
Erase all the elements in the collection.
Container class for LArAccumulatedCalibDigit.
Data class for calibration ADC samples preprocessed by the DSP.
Container class for LArAccumulatedDigit.
Data class for ADC samples and autocorr preprocessed by the DSP.
const std::vector< HWIdentifier > & calibSlotLine(const HWIdentifier id) const
unsigned Delay(const unsigned event, const HWIdentifier calibLineID) const
bool isPulsed(const unsigned event, const HWIdentifier calibLineID) const
unsigned DAC(const unsigned event, const HWIdentifier calibLineID) const
Container class for LArDigit.
int signEnergy(unsigned int energy)
static const Word m_monTrailerSize
some cached info to ease processing reading from data header
std::vector< LatomeCalibPatterns > m_latomeCalibPatternsInEvent
unsigned int Word
this should be the same as how we get the data, otherwise we will have bugs.
LArLATOMEHeaderContainer * m_header_coll
EventProcess(const LArLATOMEDecoder *decoderInput, LArDigitContainer *adc_coll, LArDigitContainer *adc_bas_coll, LArRawSCContainer *et_coll, LArRawSCContainer *et_id_coll, LArAccumulatedDigitContainer *accdigits, LArAccumulatedCalibDigitContainer *caccdigits, LArLATOMEHeaderContainer *header_coll)
void decodeChannel(unsigned int &wordshift, unsigned int &byteshift, const uint32_t *p, MonDataType at0, MonDataType at1, unsigned int &at0Data, unsigned int &at1Data, unsigned int &satData, bool &at0val, bool &at1val)
void decodeByte(unsigned int &byte, unsigned int wordshift, unsigned int byteshift, const uint32_t *p)
void fillCalib(const LArLATOMEMapping *map, const LArOnOffIdMapping *onoffmap, const LArCalibLineMapping *clmap)
LArAccumulatedDigitContainer * m_accdigits
const LArLATOMEDecoder * m_decoder
unsigned int bytesPerChannel(MonDataType at0, MonDataType at1)
LArAccumulatedCalibDigitContainer * m_caccdigits
bool compareOrSet(Word &param, Word value, bool compare)
void fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment *pROB, const LArLATOMEMapping *map, const LArOnOffIdMapping *onoffmap=nullptr, const LArCalibLineMapping *clmap=nullptr)
Execute decoding for an event.
void fillRaw(const LArLATOMEMapping *map)
Pass ADC values from an event.
static const Word s_monHeaderMarker
this is fixed and not read from data
std::vector< LatomeRawData > m_rawValuesInEvent
std::vector< LatomeAveragedRawData > m_averagedRawValuesInEvent
unsigned int decodeHeader(const uint32_t *p, unsigned int offset)
std::vector< unsigned short > m_BCIDsInEvent
void increaseByteShift(unsigned int &wordshift, unsigned int &byteshift)
void decodeWord(unsigned int &word, unsigned int &wordshift, unsigned int &byteshift, const uint32_t *p)
void increaseWordShift(unsigned int &wordshift)
unsigned int decodeTrailer(const uint32_t *p, unsigned int offset)
std::vector< unsigned int > patterns
static const InterfaceID & interfaceID()
StatusCode convert(const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &robFrags, const LArLATOMEMapping *map, LArDigitContainer *adc_coll, LArDigitContainer *adc_bas_coll, LArRawSCContainer *et_coll, LArRawSCContainer *et_id_coll, LArLATOMEHeaderContainer *header_coll) const
Converter.
LArLATOMEDecoder(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
virtual StatusCode initialize()
Initialize the converter.
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKeySC
const LArOnline_SuperCellID * m_onlineId
static const int s_nBunches
Maximum value of BCID.
ToolHandle< ICaloSuperCellIDTool > m_sc2ccMappingTool
BooleanProperty m_protectSourceId
Container class for LArLATOMEHeader.
Holds information from the LATOME Header.
class to provide SC mapping
HWIdentifier createSignalChannelID(const Identifier &id) const
create a HWIdentifier from an Identifier (not inline)
Container class for LArRawSC.
Liquid Argon SuperCell raw data.
Definition LArRawSC.h:19
Base class for LArDigits taken by LATOME.
Definition LArSCDigit.h:19
STL class.
singleton-like access to IMessageSvc via open function and helper
int ev
Definition globals.cxx:25
std::vector< std::string > patterns
Definition listroot.cxx:187
@ LARHIGHGAIN
Definition CaloGain.h:18
=============================================================================
eformat::ROBFragment< PointerType > ROBFragment
Definition RawEvent.h:27
Extra patterns decribing particle interation process.