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