ATLAS Offline Software
ZdcByteStreamReadV1V2Tool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // ===========================================================================
6 // Includes
7 // ===========================================================================
8 // STD:
9 // ===========================================================================
10 #include <stdexcept>
11 #include <bitset>
12 #include <iomanip>
13 // ===========================================================================
14 
15 #include "eformat/SourceIdentifier.h"
18 
19 // PAS all adapted from L1Calo, since they hide all of their headers in "src"{!!}
25 #include "ZdcByteStream/ZdcL1CaloSubBlock.h" // Only for error codes
28 
31 
33 
34 // ===========================================================================
35 
36 const int slink2ppmChannel[64] =
37  {0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60,
38  3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63,
39  1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61,
40  2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62 };
41 
42 
43 
44 namespace {
45 uint32_t bitFieldSize(uint32_t word, uint8_t offset, uint8_t size) {
46  return (word >> offset) & ((1U << size) - 1);
47 }
48 
49 uint32_t coolId(uint8_t crate, uint8_t module, uint8_t channel) {
50  const uint8_t pin = channel % 16;
51  const uint8_t asic = channel / 16;
52  return (crate << 24) | (1 << 20) | (module << 16) | (pin << 8) | asic;
53 }
54 
55 int16_t pedCorrection(uint16_t twoBytePedCor) {
56  return twoBytePedCor > 511? (twoBytePedCor - 1024): twoBytePedCor;
57 }
58 
59 #if 0
60 std::string noAuxSuffix(const std::string& name) {
61  if ((name.size() > 4) && (name.substr(name.size()-4, 4) == "Aux.")) {
62  return name.substr(0, name.size() - 4);
63  }
64  return name;
65 }
66 #endif
67 }
68 // namespace removed since I was not planning on putting everything into the LVL1BS namespace (yet)
69 // ===========================================================================
70 //namespace LVL1BS {
71 // ===========================================================================
72 // Constructor
74  "ZdcByteStreamxAODReadTool"*/) :
75  AsgTool(name),
76  m_errorTool("ZdcL1CaloErrorByteStreamTool/ZdcL1CaloErrorByteStreamTool"),
77  //m_ppmMaps("LVL1::PpmMappingTool/PpmMappingTool"),
78  m_robDataProvider("ROBDataProviderSvc", name) {
79  declareInterface<ZdcByteStreamReadV1V2Tool>(this);
80  //declareProperty("PpmMappingTool", m_ppmMaps,
81  // "Crate/Module/Channel to Eta/Phi/Layer mapping tool");
82  declareProperty("ROBDataProviderSvc", m_robDataProvider,
83  "Get ROB source IDs service");
84 }
85 
86 // ===========================================================================
87 // Initialize
88 
89 
91 
92  m_srcIdMap = new ZdcSrcIdMap();
93  CHECK(m_errorTool.retrieve());
94  //CHECK(m_ppmMaps.retrieve());
95  CHECK(m_robDataProvider.retrieve());
96 
97  const ZdcID* zdcID = nullptr;
98  if (detStore()->retrieve( zdcID ).isFailure() ) {
99  msg(MSG::ERROR) << "execute: Could not retrieve ZdcID object from the detector store" << endmsg;
100  return StatusCode::FAILURE;
101  }
102  else {
103  msg(MSG::DEBUG) << "execute: retrieved ZdcID" << endmsg;
104  }
105  m_zdcID = zdcID;
106 
107  initSourceIDs();
108 
109  return StatusCode::SUCCESS;
110 }
111 // ===========================================================================
112 // Finalize
113 
115  delete m_srcIdMap;
116 
117  return StatusCode::SUCCESS;
118 }
119 
120 // Conversion bytestream to trigger towers
122  const IROBDataProviderSvc::VROBFRAG& robFrags,
123  xAOD::TriggerTowerContainer* const ttCollection) const
124 {
125  State state;
126  state.m_subDetectorID = eformat::FORWARD_ZDC;
127  state.m_triggerTowers = ttCollection;
128 
129  ROBIterator rob = robFrags.begin();
130  ROBIterator robEnd = robFrags.end();
131 
132  int robCounter = 1;
133  for (; rob != robEnd; ++rob, ++robCounter) {
135  if (!sc.isSuccess()) {
136 
137  }
138  }
139  return StatusCode::SUCCESS;
140 }
141 
142 // Conversion bytestream to trigger towers and then to ZDC digits
143 /*
144 StatusCode ZdcByteStreamReadV1V2Tool::convert(
145  const IROBDataProviderSvc::VROBFRAG& robFrags,
146  ZdcDigitsCollection* zdcCollection)
147 */
149  const IROBDataProviderSvc::VROBFRAG& robFrags,
150  ZdcDigitsCollection* zdcCollection) const
151 {
152 
155  ttCollection->setStore(aux);
156 
157  ATH_MSG_DEBUG("Getting TT collection!");
158 
159  StatusCode sc = convert(robFrags,ttCollection);
160 
161  ATH_MSG_DEBUG("Got it!");
162 
163  if (sc != StatusCode::SUCCESS)
164  {
165  ATH_MSG_DEBUG("ZDC TT Conversion failed");
166  return sc;
167  }
168 
169  ATH_MSG_DEBUG("convertTT2ZD");
170  ZdcDigitsCollection* zc = convertTT2ZD(ttCollection);
171 
172  ATH_MSG_DEBUG("convertedTT2ZD! Now copying");
173  (*zdcCollection) = (*zc); // will copy work?;
174  ATH_MSG_DEBUG("Copied!");
175 
176  return StatusCode::SUCCESS;
177 }
178 
180  xAOD::TriggerTowerContainer* const ttCollection) const {
181  //return convert(LVL1::TrigT1CaloDefs::xAODTriggerTowerLocation, ttCollection);
182  return convert("ZdcTriggerTowerContainer", ttCollection);
183 }
184 
186  xAOD::TriggerTowerContainer* const ttCollection) const {
187 
188  //std::cout << "convert " << sgKey << std::endl;
189 
190  const std::vector<uint32_t>& vID(ppmSourceIDs(sgKey));
191 
192  // // get ROB fragments
194  m_robDataProvider->getROBData(Gaudi::Hive::currentContext(), vID, robFrags, "ZdcByteStreamxAODReadTool");
195  ATH_MSG_DEBUG("Number of ROB fragments:" << robFrags.size());
196 
197  CHECK(convert(robFrags, ttCollection));
198  return StatusCode::SUCCESS;
199 }
200 
201 // ===========================================================================
203  State& state,
204  const ROBIterator& robIter, const RequestType& /*requestedType*/) const {
205 
206  auto rob = **robIter;
207 
209  "Treating ROB fragment source id #" << MSG::hex << rob.rob_source_id());
210 
211 
212  state.m_rodSourceId = rob.rod_source_id();
213  state.m_robSourceId = rob.source_id();
214  const auto sourceID = (state.m_rodSourceId >> 16) & 0xff;
215  const auto rodCrate = ZdcSrcIdMap::crate(state.m_rodSourceId);
216  const auto rodSlink = ZdcSrcIdMap::slink(state.m_rodSourceId);
217  // -------------------------------------------------------------------------
218  // Check Rob status
219  if (rob.nstatus() > 0) {
220  ROBPointer robData;
221  rob.status(robData);
222  if (*robData != 0) {
223  ATH_MSG_WARNING("ROB status error - skipping fragment");
224  m_errorTool->robError(state.m_rodSourceId, *robData);
225  return StatusCode::FAILURE;
226  }
227  }
228  // -------------------------------------------------------------------------
229  RODPointer payloadBeg;
230  RODPointer payloadEnd;
232 
233  rob.rod_data(payloadBeg);
234  payloadEnd = payloadBeg + rob.rod_ndata();
235  payload = payloadBeg;
236  // -------------------------------------------------------------------------
237  if (payload == payloadEnd) {
238  ATH_MSG_DEBUG("ROB fragment empty");
239  return StatusCode::FAILURE;
240  }
241  // -------------------------------------------------------------------------
242 
243 
244  uint16_t rodVer = rob.rod_version() & 0xffff;
245  state.m_verCode = ((rodVer & 0xfff) << 4) | 1;
246  uint32_t rodRunNumber = rob.rod_run_no() & 0xffffff;
247 
248 
249  if (sourceID != state.m_subDetectorID) {
250  ATH_MSG_ERROR("Wrong subdetector source id for requested objects: " << state.m_rodSourceId);
251  return StatusCode::FAILURE;
252  }
253 
254  ATH_MSG_DEBUG("Treating crate " << rodCrate << " slink " << rodSlink);
255 
257  if (!state.m_caloUserHeader.isValid()) {
258  ATH_MSG_ERROR("Invalid or missing user header");
259  return StatusCode::FAILURE;
260  }
261 
263  "Run number: " << MSG::dec << rodRunNumber << endmsg
264  << "Version code: 0x" << MSG::hex << int(state.m_verCode) << MSG::dec
265  << endmsg << "LUT triggered slice offset: "
266  << int(state.m_caloUserHeader.lut()) << endmsg
267  << "FADC triggered slice offset: " << int(state.m_caloUserHeader.ppFadc())
268  << endmsg << "FADC baseline lower bound: "
269  << int(state.m_caloUserHeader.ppLowerBound()));
270 
271  int indata = 0;
272  uint8_t blockType = 0;
273  int subBlock = 0;
274 
275  for (; payload != payloadEnd; ++payload) {
276  if (ZdcCaloUserHeader::isValid(*payload) && (subBlock == 0)) {
277 
279  indata = 0;
280  CHECK(processPpmBlock_(state));
281 
282  state.m_ppLuts.clear();
283  state.m_ppFadcs.clear();
284  state.m_ppBlock.clear();
285 
286  blockType = (*payload >> 28) & 0xf;
287 
288  if ((blockType & 0xd) == 0xc) {
291  "SubBlock version #" << int(state.m_subBlockHeader.version())
292  << " format #" << int(state.m_subBlockHeader.format())
293  << " seqNum (compVer) #" << int(state.m_subBlockHeader.seqNum())
294  << " nslice1 #" << int(state.m_subBlockHeader.nSlice1())
295  << " nslice2 #" << int(state.m_subBlockHeader.nSlice2())
296  );
297  subBlock = blockType & 0xe;
298  } else if (blockType == (subBlock | 1)) {
299  //m_subBlockStatus = ZdcSubBlockStatus(*payload);
300  subBlock = 0;
301  }
302  } else {
303  switch(state.m_subDetectorID){
304  case eformat::TDAQ_CALO_PREPROC:
305  CHECK(processPpmWord_(state, *payload, indata));
306  break;
307  case eformat::FORWARD_ZDC:
308  CHECK(processPpmWord_(state, *payload, indata));
309  break;
310  default:
311  break;
312  }
313  indata++;
314  }
315  }
316  CHECK(processPpmBlock_(state));
317  return StatusCode::SUCCESS;
318 }
319 
321  uint32_t word,
322  int indata) const {
323  if ( (state.m_subBlockHeader.format() == 0)
324  || (state.m_subBlockHeader.format() >= 2)
325  || (state.m_verCode >= 0x41)) {
326  state.m_ppBlock.push_back(word);
327  } else if ((state.m_verCode == 0x21) || (state.m_verCode == 0x31)) {
328  return processPpmStandardR3V1_(state, word, indata);
329  } else {
330  ATH_MSG_ERROR("Unsupported PPM version:format ("
331  << state.m_verCode << ":" << state.m_subBlockHeader.format()
332  <<") combination");
333  return StatusCode::FAILURE;
334  }
335  return StatusCode::SUCCESS;
336 }
337 
338 
340  if (!state.m_ppBlock.empty()) {
341  if (state.m_subBlockHeader.format() == 0) {
343  state.m_ppBlock.clear();
344  CHECK(sc);
345  return sc;
346  }
347 
348  if (state.m_verCode == 0x31) {
350  state.m_ppBlock.clear();
351  CHECK(sc);
352  return sc;
353  }
354 
355  if (state.m_verCode == 0x41 || state.m_verCode == 0x42) {
357  state.m_ppBlock.clear();
358  CHECK(sc);
359  return sc;
360  }
361  }
362 
363  if (!state.m_ppLuts.empty()) {
364  if (state.m_verCode == 0x21 || state.m_verCode == 0x31) {
366  state.m_ppLuts.clear();
367  state.m_ppFadcs.clear();
368  CHECK(sc);
369  return sc;
370  }
371  ATH_MSG_ERROR("Unknown PPM subheader format '"
372  << int(state.m_subBlockHeader.format())
373  << "' for rob version '"
374  << MSG::hex << int(state.m_verCode)
375  << MSG::dec << "'" );
376  return StatusCode::FAILURE;
377  }
378  return StatusCode::SUCCESS;
379 }
380 
382  uint8_t numLut = state.m_subBlockHeader.nSlice1();
383  uint8_t numFadc = state.m_subBlockHeader.nSlice2();
384  uint8_t totSlice = 3 * numLut + numFadc;
385 
386  uint8_t channel = 0;
387  for ( int asic = 0 ; asic < 4 ; ++asic ) {
388  for ( int mcm = 0 ; mcm < 16 ; ++mcm ) {
389  // ----------------------------------------------------------------------
390  std::vector<uint32_t> rotated(totSlice);
391 
392  for ( uint8_t slice = 0 ; slice < totSlice ; ++slice ) {
393  for ( uint8_t bit = 0 ; bit < 11 ; ++bit ) {
394  if ( state.m_ppBlock[slice * 11 + asic * (11 * totSlice) + bit + 1] & (1 << mcm))
395  rotated[slice] |= (1 << bit);
396  }
397  }
398 
399  bool nonZeroData = false;
400  for (uint8_t slice = 0; slice < numLut; ++slice) {
401  if (rotated[slice]
402  || rotated[slice + numLut]
403  || rotated[slice + 2 * numLut + numFadc]) { // CP, JET
404  nonZeroData = true;
405  break;
406  }
407  }
408 
409  std::vector<uint8_t> lcpVal;
410  std::vector<uint8_t> lcpBcidVec;
411  std::vector<uint8_t> ljeVal;
412  std::vector<uint8_t> ljeSat80Vec;
413  std::vector<int16_t> pedCor;
414  std::vector<uint8_t> pedEn;
415 
416  std::vector<uint16_t> adcVal;
417  std::vector<uint8_t> adcExt;
418 
419  if (nonZeroData) {
420  for (uint8_t slice = 0; slice < numLut; ++slice) {
421  lcpVal.push_back(rotated[slice] & 0xff);
422  ljeVal.push_back(rotated[slice + numLut] & 0xff);
423  pedCor.push_back(::pedCorrection(rotated[slice + 2 * numLut + numFadc] & 0x3ff));
424 
425  lcpBcidVec.push_back((rotated[slice] >> 8) & 0x7);
426  ljeSat80Vec.push_back((rotated[slice + numLut] >> 8) & 0x7);
427  pedEn.push_back((rotated[slice + 2 * numLut + numFadc] >> 10) & 0x1);
428  }
429  }
430 
431  for (uint8_t slice = 0; slice < numFadc; ++slice) {
432  if (rotated[slice + numLut]) { // CP, JET
433  nonZeroData = true;
434  break;
435  }
436  }
437 
438  if (nonZeroData) {
439  for (uint8_t slice = 0; slice < numFadc; ++ slice) {
440  adcVal.push_back(rotated[slice + 2 * numLut] & 0x3ff);
441  adcExt.push_back((rotated[slice + 2 * numLut] >> 10 & 0x1) & 0x3ff);
442  }
443  }
444 
446  state,
447  state.m_subBlockHeader.crate(),
448  state.m_subBlockHeader.module(),
449  channel,
450  lcpVal,
451  lcpBcidVec,
452  ljeVal,
453  ljeSat80Vec, adcVal,
454  adcExt,
455  pedCor,
456  pedEn));
457  // ---------------------------------------------------------------------
458  channel++;
459  }
460  }
461  return StatusCode::SUCCESS;
462 }
463 
465  uint8_t chan = 0;
466  BitReader br (state.m_ppBlock);
467  try{
468  while (chan < 64) {
469  uint8_t present = 1;
470  if (state.m_subBlockHeader.format() == 3) {
471  present = br.getField (1);
472  }
473 
474  if (present == 1) {
475  uint8_t lutVal = 0;
476  uint8_t fmt = 6;
477  uint8_t lutSat=0;
478  uint8_t lutExt=0;
479  uint8_t lutPeak=0;
480 
481  std::vector<uint16_t> adcVal = {0 , 0, 0, 0, 0};
482  std::vector<uint8_t> adcExt = {0 , 0, 0, 0, 0};
483 
484  uint8_t minHeader = br.getField (4);
485  uint8_t minIndex = minHeader % 5;
486  if (minHeader < 15) { // Formats 0-5
487  if (minHeader < 10) { // Formats 0-1
488  fmt = minHeader / 5;
489  } else { // Formats 2-5
490  fmt = 2 + br.getField (2);
491  uint8_t haveLut = br.getField (1);
492  if (fmt == 2) {
493  if (haveLut == 1) {
494  lutVal = br.getField (3);
495  lutPeak = 1; // Even if LutVal==0 it seems
496  }
497  } else {
498  uint8_t haveExt = br.getField (1);
499  if (haveLut == 1) {
500  lutVal = br.getField (8);
501  lutExt = br.getField (1);
502  lutSat = br.getField (1);
503  lutPeak = br.getField (1);
504  }
505 
506  if (haveExt == 1){
507  for(uint8_t i = 0; i < 5; ++i) {
508  adcExt[i] = br.getField (1);
509  }
510  } else {
511  adcExt[2] = lutExt;
512  }
513  }
514  }
515  adcVal = getPpmAdcSamplesR3_(state, br, fmt, minIndex);
516  } else {
517  uint8_t haveAdc = br.getField (1);
518  if (haveAdc == 1) {
519  uint16_t val = br.getField (10);
520  for(uint8_t i = 0; i < 5; ++i) {
521  adcVal[i] = val;
522  }
523  }
524  }
525  // Add Trigger Tower
526  //std::vector<uint8_t> luts = {lutVal};
528  state,
529  state.m_subBlockHeader.crate(),
530  state.m_subBlockHeader.module(),
531  chan,
532  std::vector<uint8_t> {lutVal},
533  std::vector<uint8_t> {uint8_t(lutExt | (lutSat << 1) | (lutPeak << 2))},
534  adcVal,
535  adcExt
536  ));
537  }
538  chan++;
539  }
540  }catch (const std::out_of_range& ex) {
541  ATH_MSG_WARNING("Excess Data in Sub-block");
543  }
544  return StatusCode::SUCCESS;
545 }
546 
548  State& state,
549  BitReader& br, uint8_t format, uint8_t minIndex) const {
550 
551  std::vector<uint16_t> adc = {0, 0, 0, 0, 0};
552  uint8_t minAdc = 0;
553 
554  for(uint8_t i = 0; i <5; ++i) {
555  uint8_t longField = 0;
556  uint8_t numBits = 0;
557  if (format > 2) {
558  longField = br.getField (1);
559  numBits = longField == 0? 4: (format * 2);
560  } else {
561  numBits = i == 0? 4: (format + 2);
562  }
563 
564  if (i == 0) {
565  minAdc = br.getField (numBits);
566  if (longField == 0) {
567  minAdc += state.m_caloUserHeader.ppLowerBound();
568  }
569  } else {
570  adc[i] = minAdc + br.getField (numBits);
571  }
572  }
573 
574  if (minIndex == 0) {
575  adc[0] = minAdc;
576  } else {
577  adc[0] = adc[minIndex];
578  adc[minIndex] = minAdc;
579  }
580  return adc;
581 }
582 
583 
584 
586  uint32_t word,
587  int inData) const {
588  StatusCode sc;
589  if (state.m_subBlockHeader.seqNum() == 63) { // Error block
590  ATH_MSG_DEBUG("Error PPM subblock");
591  //TODO: errorTool
592  } else {
593  const uint8_t numAdc = state.m_subBlockHeader.nSlice2();
594  const uint8_t numLut = state.m_subBlockHeader.nSlice1();
595  const uint8_t nTotal = numAdc + numLut;
596  const uint8_t wordsPerBlock = 8; // 16 towers (4 MCMs) / 2 per word
597  const uint8_t iBlk = inData / wordsPerBlock;
598  uint8_t iChan = state.m_subBlockHeader.seqNum() + 2 * (inData % wordsPerBlock);
599 
600  if (iBlk < numLut) { // First all LUT values
601  for(uint8_t i = 0; i < 2; ++i) {
602  uint16_t subword = (word >> 16 * i) & 0x7ff;
603  state.m_ppLuts[iChan].push_back(subword);
604  iChan++;
605  }
606  } else if (iBlk < nTotal) { // Next all FADC values
607  for(uint8_t i = 0; i < 2; ++i) {
608  uint16_t subword = (word >> (16 * i)) & 0x7ff;
609  state.m_ppFadcs[iChan].push_back(subword);
610  iChan++;
611  }
612 
613  } else{
614  ATH_MSG_WARNING("Error decoding Ppm word (run1)");
615  sc = StatusCode::FAILURE;
616  }
617 
618  }
619  return sc;
620 }
621 
623  if (state.m_subBlockHeader.format() == 1) {
625  return StatusCode::SUCCESS;
626  } else if (state.m_subBlockHeader.format() >= 2) {
627  // TODO: convert compressed
629  return StatusCode::SUCCESS;
630  }
631  return StatusCode::FAILURE;
632 }
633 
635  BitReader br (state.m_ppBlock);
636 
637  uint8_t numAdc = state.m_subBlockHeader.nSlice2();
638  uint8_t numLut = state.m_subBlockHeader.nSlice1();
639  int16_t pedCorBase = -20;
640 
641 
642  // for(size_t i = 0; i < state.m_ppBlock.size(); ++i) {
643  // std::bitset<32> x(state.m_ppBlock[i]);
644  // std::cout << i << " " << x << std::endl;
645  // }
646 
647  try{
648  for(uint8_t chan = 0; chan < 64; ++chan) {
649  uint8_t present = 1;
650 
651  std::vector<uint8_t> haveLut(numLut, 0);
652  std::vector<uint8_t> lcpVal(numLut, 0);
653 
654  std::vector<uint8_t> lcpExt(numLut, 0);
655  std::vector<uint8_t> lcpSat(numLut, 0);
656  std::vector<uint8_t> lcpPeak(numLut, 0);
657  std::vector<uint8_t> lcpBcidVec(numLut, 0);
658 
659  std::vector<uint8_t> ljeVal(numLut, 0);
660 
661  std::vector<uint8_t> ljeLow(numLut, 0);
662  std::vector<uint8_t> ljeHigh(numLut, 0);
663  std::vector<uint8_t> ljeRes(numLut, 0);
664  std::vector<uint8_t> ljeSat80Vec(numLut, 0);
665 
666  std::vector<uint16_t> adcVal(numAdc, 0);
667  std::vector<uint8_t> adcExt(numAdc, 0);
668  std::vector<int16_t> pedCor(numLut, 0);
669  std::vector<uint8_t> pedEn(numLut, 0);
670 
671  int8_t encoding = -1;
672  int8_t minIndex = -1;
673 
674  if (state.m_subBlockHeader.format() == 3) {
675  present = br.getField (1);
676  }
677  if (present == 1) {
678  interpretPpmHeaderR4V1_(br, numAdc, encoding, minIndex);
679  CHECK((encoding != -1) && (minIndex != -1));
680  // First get the LIT related quantities
681  if (encoding < 3) {
682  // Get the peal finder bits
683  for(uint i=0; i < numLut; ++i) {
684  lcpPeak[i] = br.getField (1);
685  }
686  // Get Sat80 low bits
687  if (encoding > 0) {
688  for (uint8_t i = 0; i < numLut; ++i) {
689  ljeLow[i] = br.getField (1);
690  }
691  }
692  // Get LutCP and LutJEP values (these are
693  // only present if the peak finder is set).
694  if (encoding == 2) {
695  for (uint8_t i = 0; i < numLut; ++i) {
696  if (lcpPeak[i] == 1) {
697  lcpVal[i] = br.getField (4);
698  }
699  }
700  for(uint8_t i = 0; i < numLut; ++i) {
701  if (lcpPeak[i] == 1){
702  ljeVal[i] = br.getField (3);
703  }
704  }
705  }
706  } else if (encoding < 6) {
707  // Get LUT presence flag for each LUT slice.
708  for(uint8_t i = 0; i < numLut; ++i){
709  haveLut[i] = br.getField (1);
710  }
711 
712  // Get external BCID bits (if block is present).
713  uint8_t haveExt = br.getField (1);
714 
715  if (haveExt == 1) {
716  for (uint8_t i = 0; i < numAdc; ++i) {
717  adcExt[i] = br.getField (1);
718  }
719  }
720 
721  for(uint8_t i = 0; i < numLut; ++i){
722  if (haveLut[i] == 1) {
723  lcpVal[i] = br.getField (8);
724  lcpExt[i] = br.getField (1);
725  lcpSat[i] = br.getField (1);
726  lcpPeak[i] = br.getField (1);
727  }
728  }
729  // Get JEP LUT values and corresponding bits.
730  for(uint8_t i = 0; i < numLut; ++i){
731  if (haveLut[i] == 1) {
732  ljeVal[i] = br.getField (8);
733  ljeLow[i] = br.getField (1);
734  ljeHigh[i] = br.getField (1);
735  ljeRes[i] = br.getField (1);
736  }
737  }
738 
739  }
740 
741  }
742 
743  if (minIndex < 0)
744  return StatusCode::FAILURE;
745 
746  // Next get the ADC related quantities (all encodings).
747  adcVal = getPpmAdcSamplesR4_(state, br, encoding, minIndex);
748  // Finally get the pedestal correction.
749  if ((encoding < 3) || (encoding == 6)) {
750  for (uint8_t i = 0; i < numLut; ++i)
751  {
752  pedCor[i] = br.getField (6) + pedCorBase;
753  if (state.m_subBlockHeader.compVer() > 0) {
754  pedEn[i] = 1;
755  }
756  }
757  } else {
758  // At the moment there is an enabled bit for every LUT slice
759  // (even though its really a global flag).
760  // The correction values is a twos complement signed value.
761  for (uint8_t i = 0; i < numLut; ++i)
762  {
763  uint16_t val = br.getField (10);
764  pedCor[i] = ::pedCorrection(val);
765  pedEn[i] = br.getField (1);
766  }
767  }
768 
769  for(uint8_t i=0; i < numLut; ++i){
770  lcpBcidVec[i] = uint8_t((lcpPeak[i] << 2) | (lcpSat[i] << 1) | lcpExt[i]);
771  ljeSat80Vec[i] = uint8_t((ljeRes[i] << 2) | (ljeHigh[i] << 1) | ljeLow[i]);
772  }
774  chan, lcpVal, lcpBcidVec, ljeVal, ljeSat80Vec, adcVal, adcExt, pedCor,
775  pedEn));
776  }
777  } catch (const std::out_of_range& ex) {
778  ATH_MSG_WARNING("Excess Data in Sub-block");
780  }
781  return StatusCode::SUCCESS;
782 
783 }
784 
786  uint8_t numAdc,
787  int8_t& encoding, int8_t& minIndex) const {
788  uint8_t minHeader = 0;
789 
790  if (numAdc == 5) {
791  minHeader = br.getField (4);
792  //ATH_MSG_DEBUG("SASHA: minHeader=" << int(minHeader));
793  minIndex = minHeader % 5;
794  if (minHeader < 15){ // Encodings 0-5
795  if (minHeader < 10) {
796  encoding = minHeader / 5;
797  } else {
798  encoding = 2 + br.getField (2);
799  }
800  } else {
801  encoding = 6;
802  }
803  } else {
804  uint8_t numBits = 0;
805  if (numAdc ==3 ) {
806  numBits = 2;
807  } else if (numAdc == 7) {
808  numBits = 3;
809  } else if (numAdc < 16) {
810  numBits = 4;
811  }
812 
813  if (numBits > 0) {
814  uint8_t fieldSize = 1 << numBits;
815  minHeader = br.getField (numBits);
816  uint8_t encValue = fieldSize - 1;
817  if (minHeader == encValue) { // Encoding 6
818  encoding = 6;
819  minIndex = 0;
820  } else {
821  minHeader += br.getField (2) << numBits;
822  minIndex = minHeader % fieldSize;
823  encValue = 3 * fieldSize;
824 
825  if (minHeader < encValue) { // Encodings 0-2
826  encoding = minHeader / fieldSize;
827  } else {
828  encoding = 3 + br.getField (2);
829  }
830  }
831  }
832  }
833 }
834 
836  State& state,
837  BitReader& br, uint8_t encoding, uint8_t minIndex) const {
838  uint8_t numAdc = state.m_subBlockHeader.nSlice2();
839 
840  if (encoding == 6) {
841  uint16_t val = br.getField (6);
842  return std::vector<uint16_t>(numAdc, val);
843  } else if ( encoding < 3) {
844  std::vector<uint16_t> adc(numAdc, 0);
845  uint16_t minAdc = br.getField (5) + state.m_caloUserHeader.ppLowerBound();
846  adc[minIndex] = minAdc;
847  for(uint8_t i = 1; i < numAdc; ++i) {
848  adc[i == minIndex? 0: i] = br.getField (encoding + 2) + minAdc;
849  }
850  return adc;
851  } else {
852  std::vector<uint16_t> adc(numAdc, 0);
853  uint16_t minAdc = br.getField (1)
854  ? br.getField (encoding * 2)
855  : (br.getField (5) +
857 
858  adc[minIndex] = minAdc;
859  for (uint8_t i = 1; i < numAdc; ++i) {
860  adc[minIndex == i? 0: i] = br.getField (
861  br.getField (1)? encoding * 2: 4
862  ) + minAdc;
863  }
864  return adc;
865  }
866 }
867 
869  if (state.m_subBlockHeader.format() == 1) {
871  return StatusCode::SUCCESS;
872  } else if (state.m_subBlockHeader.format() >= 2) {
873  // TODO: convert compressed
874  return StatusCode::FAILURE;
875  }
876  return StatusCode::FAILURE;
877 }
878 
880 
881  //std::cout << "Here I am in processPpmStandardR4V1_" << std::endl;
882  uint8_t numAdc = state.m_subBlockHeader.nSlice2();
883  uint8_t numLut = state.m_subBlockHeader.nSlice1();
884  uint8_t crate = state.m_subBlockHeader.crate();
886 
887 
888  BitReader br (state.m_ppBlock);
889 
890  for (uint8_t chan = 0; chan < 64; ++chan) {
891  //for (uint8_t k = 0; k < 4; ++k) {
892  std::vector<uint8_t> lcpVal;
893  std::vector<uint8_t> lcpBcidVec;
894 
895  std::vector<uint8_t> ljeVal;
896  std::vector<uint8_t> ljeSat80Vec;
897 
898 
899 
900  std::vector<uint16_t> adcVal;
901  std::vector<uint8_t> adcExt;
902  std::vector<int16_t> pedCor;
903  std::vector<uint8_t> pedEn;
904  try {
905  for (int i = 0; i < numLut; ++i) {
906  lcpVal.push_back(br.getField (8));
907  lcpBcidVec.push_back(br.getField (3));
908  }
909 
910  for (int i = 0; i < numLut; ++i) {
911  ljeVal.push_back(br.getField (8));
912  ljeSat80Vec.push_back(br.getField (3));
913  }
914 
915  for (int i = 0; i < numAdc; ++i) {
916  adcVal.push_back(br.getField (10));
917  adcExt.push_back(br.getField (1));
918  }
919 
920  for (int i = 0; i < numLut; ++i) {
921  uint16_t pc = br.getField (10);
922  pedCor.push_back(pedCorrection(pc));
923  pedEn.push_back(br.getField (1));
924  }
925  } catch (const std::out_of_range& ex) {
926  ATH_MSG_WARNING("Excess Data in Sub-block");
928  }
929  CHECK(
930  addTriggerTowerV2_(state, crate, module, chan, lcpVal, lcpBcidVec,
931  ljeVal, ljeSat80Vec, adcVal, adcExt, pedCor, pedEn));
932  }
933 
934  return StatusCode::SUCCESS;
935 }
936 
938  for(const auto& lut : state.m_ppLuts) {
940  state,
941  state.m_subBlockHeader.crate(),
942  state.m_subBlockHeader.module(),
943  lut.first,
944  lut.second,
945  state.m_ppFadcs[lut.first]));
946  }
947  return StatusCode::SUCCESS;
948 }
949 
951  State& state,
952  uint8_t crate,
953  uint8_t module,
955  const std::vector<uint8_t>& lcpVal,
956  const std::vector<uint8_t>& lcpBcidVec,
957  const std::vector<uint8_t>& ljeVal,
958  const std::vector<uint8_t>& ljeSat80Vec,
959  const std::vector<uint16_t>& adcVal,
960  const std::vector<uint8_t>& adcExt,
961  const std::vector<int16_t>& pedCor,
962  const std::vector<uint8_t>& pedEn) const {
963 
964  //int layer = 0;
965  int error = 0;
966  double eta = 0.;
967  double phi = 0.;
968 
969  bool isNotSpare = false; // PAS - just to minimize changing code
970  // PAS - not using L1Calo PPMMap
971  /*
972  bool isNotSpare = m_ppmMaps->mapping(crate, module, channel, eta, phi, layer);
973  if (!isNotSpare && !m_ppmIsRetSpare && !m_ppmIsRetMuon){
974  return StatusCode::SUCCESS;
975  }
976  */
977 
978  if (!isNotSpare) {
979  const int pin = channel % 16;
980  const int asic = channel / 16;
981  eta = 16 * crate + module;
982  phi = 4 * pin + asic;
983  }
984 
985  uint32_t coolId = ::coolId(crate, module, channel);
986  CHECK(state.m_coolIds.count(coolId) == 0);
987  state.m_coolIds.insert(coolId);
988 
990  //std::cout << ZdcToString(*tt) << std::endl;
991 
992  state.m_triggerTowers->push_back(tt);
993  // tt->initialize(
994  // const uint_least32_t& coolId,
995  // const uint_least8_t& layer,
996  // const float& eta,
997  // const float& phi,
998  // const std::vector<uint_least8_t>& lut_cp,
999  // const std::vector<uint_least8_t>& lut_jep,
1000  // const std::vector<int_least16_t>& correction,
1001  // const std::vector<uint_least8_t>& correctionEnabled,
1002  // const std::vector<uint_least8_t>& bcidVec,
1003  // const std::vector<uint_least16_t>& adc,
1004  // const std::vector<uint_least8_t>& bcidExt,
1005  // const std::vector<uint_least8_t>& sat80,
1006  // const uint_least16_t& error,
1007  // const uint_least8_t& peak,
1008  // const uint_least8_t& adcPeak
1009  // );
1010  tt->initialize(coolId, eta, phi, lcpVal, ljeVal, pedCor, pedEn,
1011  lcpBcidVec, adcVal, adcExt, ljeSat80Vec, error, state.m_caloUserHeader.lut(),
1012  state.m_caloUserHeader.ppFadc());
1013  return StatusCode::SUCCESS;
1014 }
1015 
1017  State& state,
1018  uint8_t crate,
1019  uint8_t module,
1020  uint8_t channel,
1021  const std::vector<uint8_t>& luts,
1022  const std::vector<uint8_t>& lcpBcidVec,
1023  const std::vector<uint16_t>& fadc,
1024  const std::vector<uint8_t>& bcidExt
1025  ) const {
1026 
1027  std::vector<uint8_t> ljeSat80Vec;
1028 
1029  std::vector<int16_t> pedCor;
1030  std::vector<uint8_t> pedEn;
1031 
1032  CHECK(addTriggerTowerV2_(state, crate, module, channel, luts, lcpBcidVec,
1033  luts , ljeSat80Vec, fadc, bcidExt, pedCor, pedEn)
1034  );
1035 
1036  return StatusCode::SUCCESS;
1037 }
1038 
1040  State& state,
1041  uint8_t crate,
1042  uint8_t module,
1043  uint8_t channel,
1044  const std::vector<uint16_t>& luts,
1045  const std::vector<uint16_t>& fadc
1046  ) const {
1047 
1048  std::vector<uint8_t> lcpVal;
1049  std::vector<uint8_t> lcpBcidVec;
1050 
1051  std::vector<uint16_t> adcVal;
1052  std::vector<uint8_t> adcExt;
1053 
1054  for(auto lut: luts) {
1055  lcpVal.push_back(BitField::get<uint8_t>(lut, 0, 8));
1056  lcpBcidVec.push_back(BitField::get<uint8_t>(lut, 8, 3));
1057  }
1058 
1059  for(auto f: fadc) {
1060  adcExt.push_back(BitField::get<uint8_t>(f, 0, 1));
1061  adcVal.push_back(BitField::get<uint16_t>(f, 1, 10));
1062  }
1063 
1064  CHECK(addTriggerTowerV1_(state, crate, module, channel, lcpVal, lcpBcidVec,
1065  adcVal, adcExt));
1066 
1067  return StatusCode::SUCCESS;
1068 }
1069 
1071 {
1072  const int crates = 8;
1073  m_ppmSourceIDs.clear();
1074  m_ppmSourceIDsSpare.clear();
1075  m_ppmSourceIDsMuon.clear();
1076 
1077  for (int crate = 0; crate < crates; ++crate) {
1078  for (int slink = 0; slink < m_srcIdMap->maxSlinks(); ++slink) {
1079  //const uint32_t rodId = m_srcIdMap->getRodID(crate, slink, 0,
1080  // eformat::TDAQ_CALO_PREPROC);
1081  const uint32_t rodId = m_srcIdMap->getRodID(crate, slink, 0,
1082  eformat::FORWARD_ZDC);
1083  const uint32_t robId = m_srcIdMap->getRobID(rodId);
1084  m_ppmSourceIDs.push_back(robId);
1085  //std::cout << "robId=" << std::hex << robId << std::dec << std::endl;
1086  if (crate > 1 && crate < 6) {
1087  m_ppmSourceIDsSpare.push_back(robId);
1088  if (crate < 4 && slink == 0) {
1089  m_ppmSourceIDsMuon.push_back(robId);
1090  }
1091  }
1092  }
1093  }
1094 }
1095 
1096 // Return reference to vector with all possible Source Identifiers
1097 
1098 const std::vector<uint32_t>& ZdcByteStreamReadV1V2Tool::ppmSourceIDs(
1099  const std::string& sgKey) const
1100 {
1101  if (sgKey.find("Muon") != std::string::npos) {
1102  return m_ppmSourceIDsMuon;
1103  }
1104  else if (sgKey.find("Spare") != std::string::npos) {
1105  return m_ppmSourceIDsSpare;
1106  }
1107 
1108  return m_ppmSourceIDs;
1109 }
1110 
1111 
1112 
1114  (const uint8_t numBits)
1115 {
1116  if ((m_ppPointer + numBits) <= m_ppMaxBit) {
1117  uint32_t iWord = m_ppPointer / 31;
1118  uint8_t iBit = m_ppPointer % 31;
1119  m_ppPointer += numBits;
1120 
1121  uint32_t result;
1122  if ((iBit + numBits) <= 31) {
1123  result = ::bitFieldSize(m_ppBlock[iWord], iBit, numBits);
1124  } else {
1125  uint8_t nb1 = 31 - iBit;
1126  uint8_t nb2 = numBits - nb1;
1127  uint32_t field1 = ::bitFieldSize(m_ppBlock[iWord], iBit, nb1);
1128  uint32_t field2 = ::bitFieldSize(m_ppBlock[iWord + 1], 0, nb2);
1129  result = field1 | (field2 << nb1);
1130  }
1131 
1132  return result;
1133  }
1134 
1135  throw std::out_of_range("Requested too much bits from ppm block");
1136 }
1137 
1139 {
1140  typedef std::map<uint32_t,ZdcDigits*> hashmapType;
1141  hashmapType digits_map;
1142  Identifier chan_id;
1143 
1144  for (const xAOD::TriggerTower* tt : *ttCollection)
1145  {
1146  uint32_t coolId = tt->coolId();
1147  uint32_t pin = (coolId>>8) & 0xf;
1148  uint32_t asic = coolId & 0xf;
1149  uint32_t slinkChannel = asic*16 + pin;
1150  uint32_t ppmChannel = slink2ppmChannel[slinkChannel];
1151 
1152  uint32_t module = (coolId>>16) & 0xf;
1153 
1154  ATH_MSG_DEBUG( "--> ZCS: " << ZdcCablingService::getInstance() << " mod=" << module << " slinkC=" << slinkChannel << " ppmC=" << ppmChannel );
1155  chan_id = ZdcCablingService::getInstance()->h2s_channel_id(module, ppmChannel);
1156 
1157  const uint32_t chan_hash = chan_id.get_identifier32().get_compact();
1158  int gain = ZdcCablingService::getInstance()->hwid2gain(module,ppmChannel);
1160 
1161  ATH_MSG_DEBUG("Trying to find chan_hash " << chan_hash << " g" << gain << "d" << delay);
1162 
1163  hashmapType::iterator iter = digits_map.find(chan_hash);
1164  if (iter == digits_map.end())
1165  {
1166  ATH_MSG_DEBUG("new channel for " << chan_id);
1167  digits_map.insert(std::pair<uint32_t,ZdcDigits*>(chan_hash,new ZdcDigits(chan_id)));
1168  iter = digits_map.find(chan_hash);
1169  }
1170  if (iter != digits_map.end())
1171  {
1172  ATH_MSG_DEBUG("new auxdata for " << chan_id);
1173  if (gain==0&&delay==0) (*iter).second->set_digits_gain0_delay0( tt->adc() );
1174  if (gain==1&&delay==0) (*iter).second->set_digits_gain1_delay0( tt->adc() );
1175  if (gain==0&&delay==1) (*iter).second->set_digits_gain0_delay1( tt->adc() );
1176  if (gain==1&&delay==1) (*iter).second->set_digits_gain1_delay1( tt->adc() );
1177  }
1178 
1179  }
1180 
1181  ZdcDigitsCollection* zdcCollection = new ZdcDigitsCollection();
1182 
1183  hashmapType::iterator iter = digits_map.begin();
1184  hashmapType::iterator iter_end = digits_map.end();
1185 
1186  while (iter != iter_end)
1187  {
1188  /*
1189  Identifier id = ((*iter).second)->identify();
1190  std::cout
1191  << "side=" << m_zdcID->side(id)
1192  << " mod=" << m_zdcID->module(id)
1193  << " type=" << m_zdcID->type(id)
1194  << " chan=" << m_zdcID->channel(id)
1195  << std::endl;
1196  ((*iter).second)->print();
1197  */
1198  zdcCollection->push_back((*iter).second);
1199  ++iter;
1200  }
1201 
1202  return zdcCollection;
1203 }
1204 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
ZdcSrcIdMap::crate
static int crate(uint32_t code)
moduleID -> crate
Definition: ZdcSrcIdMap.cxx:55
ZdcByteStreamReadV1V2Tool::convert
StatusCode convert(const IROBDataProviderSvc::VROBFRAG &robFrags, xAOD::TriggerTowerContainer *const ttCollection) const
Convert ROB fragments to trigger towers.
Definition: ZdcByteStreamReadV1V2Tool.cxx:121
ZdcPpmSubBlock.h
ZdcCablingService::getInstance
static const ZdcCablingService * getInstance()
get pointer to service instance
Definition: ZdcCablingService.cxx:14
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:215
ZdcByteStreamReadV1V2Tool::RODPointer
OFFLINE_FRAGMENTS_NAMESPACE::PointerType RODPointer
Definition: ZdcByteStreamReadV1V2Tool.h:74
createLinkingScheme.iter
iter
Definition: createLinkingScheme.py:62
ZdcByteStreamReadV1V2Tool::State::m_ppFadcs
std::map< uint8_t, std::vector< uint16_t > > m_ppFadcs
Definition: ZdcByteStreamReadV1V2Tool.h:113
get_generator_info.result
result
Definition: get_generator_info.py:21
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
ZdcByteStreamReadV1V2Tool::m_ppmSourceIDs
std::vector< uint32_t > m_ppmSourceIDs
Definition: ZdcByteStreamReadV1V2Tool.h:190
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
vtune_athena.format
format
Definition: vtune_athena.py:14
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:558
ZdcByteStreamReadV1V2Tool::getPpmAdcSamplesR4_
std::vector< uint16_t > getPpmAdcSamplesR4_(State &state, BitReader &br, uint8_t encoding, uint8_t minIndex) const
Definition: ZdcByteStreamReadV1V2Tool.cxx:835
ZdcByteStreamReadV1V2Tool::ZdcByteStreamReadV1V2Tool
ZdcByteStreamReadV1V2Tool(const std::string &name)
Definition: ZdcByteStreamReadV1V2Tool.cxx:73
ZdcByteStreamReadV1V2Tool::State::m_caloUserHeader
ZdcCaloUserHeader m_caloUserHeader
Definition: ZdcByteStreamReadV1V2Tool.h:102
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
ZdcByteStreamReadV1V2Tool::initSourceIDs
void initSourceIDs()
Definition: ZdcByteStreamReadV1V2Tool.cxx:1070
ZdcCaloUserHeader.h
xAOD::TriggerTowerAuxContainer
TriggerTowerAuxContainer_v2 TriggerTowerAuxContainer
Define the latest version of the TriggerTower auxiliary container.
Definition: TriggerTowerAuxContainer.h:14
ZdcByteStreamReadV1V2Tool::m_zdcID
const ZdcID * m_zdcID
Definition: ZdcByteStreamReadV1V2Tool.h:194
ZdcSubBlockHeader.h
ZdcByteStreamReadV1V2Tool::State::m_triggerTowers
xAOD::TriggerTowerContainer * m_triggerTowers
Definition: ZdcByteStreamReadV1V2Tool.h:100
ZdcByteStreamReadV1V2Tool::BitReader::m_ppPointer
uint32_t m_ppPointer
Definition: ZdcByteStreamReadV1V2Tool.h:91
ZdcSubBlockStatus.h
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
ZdcSrcIdMap::getRobID
static uint32_t getRobID(uint32_t rod_id)
ROD -> ROB.
Definition: ZdcSrcIdMap.cxx:30
L1Topo::blockType
L1Topo::BlockTypes blockType(const uint32_t word, uint32_t offset=28, uint32_t size=0x0f)
Function to return the block type of a data word from L1Topo
Definition: BlockTypes.cxx:9
ZdcDigits
Definition: ZdcDigits.h:28
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
fmt
const char *const fmt
Definition: TripleGaussCollFit.cxx:84
ZdcByteStreamReadV1V2Tool::processPpmBlockR3V1_
StatusCode processPpmBlockR3V1_(State &state) const
Definition: ZdcByteStreamReadV1V2Tool.cxx:868
ZdcByteStreamReadV1V2Tool::State::m_ppBlock
std::vector< uint32_t > m_ppBlock
Definition: ZdcByteStreamReadV1V2Tool.h:111
ZdcSubBlockHeader::module
uint8_t module() const
Definition: ZdcSubBlockHeader.cxx:45
ZdcSubBlockHeader
L1Calo User Header class.
Definition: ZdcSubBlockHeader.h:20
ZdcByteStreamReadV1V2Tool::processPpmBlock_
StatusCode processPpmBlock_(State &state) const
Definition: ZdcByteStreamReadV1V2Tool.cxx:339
ZdcDigitsCollection.h
ZdcCablingService::h2s_channel_id
Identifier h2s_channel_id(int crate, int channel) const
Definition: ZdcCablingService.cxx:326
ZdcCaloUserHeader::lut
uint8_t lut() const
Definition: ZdcCaloUserHeader.cxx:34
ZdcByteStreamReadV1V2Tool::ROBPointer
OFFLINE_FRAGMENTS_NAMESPACE::PointerType ROBPointer
Definition: ZdcByteStreamReadV1V2Tool.h:73
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
ZdcByteStreamReadV1V2Tool::BitReader::m_ppBlock
const std::vector< uint32_t > & m_ppBlock
Definition: ZdcByteStreamReadV1V2Tool.h:93
ZdcByteStreamReadV1V2Tool::State::m_rodSourceId
uint32_t m_rodSourceId
Definition: ZdcByteStreamReadV1V2Tool.h:106
ZdcByteStreamReadV1V2Tool::addTriggerTowerV2_
StatusCode addTriggerTowerV2_(State &state, uint8_t crate, uint8_t module, uint8_t channel, const std::vector< uint8_t > &lcpVal, const std::vector< uint8_t > &lcpBcidVec, const std::vector< uint8_t > &ljeVal, const std::vector< uint8_t > &ljeSat80Vec, const std::vector< uint16_t > &adcVal, const std::vector< uint8_t > &adcExt, const std::vector< int16_t > &pedCor, const std::vector< uint8_t > &pedEn) const
Definition: ZdcByteStreamReadV1V2Tool.cxx:950
ZdcByteStreamReadV1V2Tool::convertTT2ZD
ZdcDigitsCollection * convertTT2ZD(xAOD::TriggerTowerContainer *const ttCollection) const
Definition: ZdcByteStreamReadV1V2Tool.cxx:1138
ZdcByteStreamReadV1V2Tool::State::m_coolIds
std::set< uint32_t > m_coolIds
Definition: ZdcByteStreamReadV1V2Tool.h:99
xAOD::int16_t
setScaleOne setStatusOne setSaturated int16_t
Definition: gFexGlobalRoI_v1.cxx:55
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition: Identifier32.h:44
ZdcByteStreamReadV1V2Tool::processPpmCompressedR3V1_
StatusCode processPpmCompressedR3V1_(State &state) const
Definition: ZdcByteStreamReadV1V2Tool.cxx:464
ITkPixEncoding::lut
constexpr auto lut(Generator &&f)
Definition: ITkPixQCoreEncodingLUT.h:19
ZdcByteStreamReadV1V2Tool::interpretPpmHeaderR4V1_
void interpretPpmHeaderR4V1_(BitReader &br, uint8_t numAdc, int8_t &encoding, int8_t &minIndex) const
Definition: ZdcByteStreamReadV1V2Tool.cxx:785
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
ZdcByteStreamReadV1V2Tool::BitReader
Definition: ZdcByteStreamReadV1V2Tool.h:78
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
ZdcSubBlockHeader::format
uint8_t format() const
Definition: ZdcSubBlockHeader.cxx:36
ZdcL1CaloSubBlock.h
ZdcByteStreamReadV1V2Tool::processPpmStandardR4V1_
StatusCode processPpmStandardR4V1_(State &state) const
Definition: ZdcByteStreamReadV1V2Tool.cxx:879
ZdcByteStreamReadV1V2Tool::processPpmStandardR3V1_
StatusCode processPpmStandardR3V1_(State &state) const
Definition: ZdcByteStreamReadV1V2Tool.cxx:937
ZdcByteStreamReadV1V2Tool::ppmSourceIDs
const std::vector< uint32_t > & ppmSourceIDs(const std::string &sgKey) const
Return reference to vector with all possible Source Identifiers.
Definition: ZdcByteStreamReadV1V2Tool.cxx:1098
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
python.PyAthena.module
module
Definition: PyAthena.py:131
ZdcByteStreamReadV1V2Tool::finalize
virtual StatusCode finalize()
Definition: ZdcByteStreamReadV1V2Tool.cxx:114
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
ZdcCaloUserHeader::ppLowerBound
uint8_t ppLowerBound() const
Definition: ZdcCaloUserHeader.cxx:43
ZdcSubBlockHeader::version
uint8_t version() const
Definition: ZdcSubBlockHeader.cxx:33
ZdcCaloUserHeader::isValid
bool isValid() const
Definition: ZdcCaloUserHeader.cxx:46
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ZdcCablingService.h
slink2ppmChannel
const int slink2ppmChannel[64]
Definition: ZdcByteStreamReadV1V2Tool.cxx:36
ZdcByteStreamReadV1V2Tool::processPpmWord_
StatusCode processPpmWord_(State &state, uint32_t word, int indata) const
Definition: ZdcByteStreamReadV1V2Tool.cxx:320
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
ZdcByteStreamReadV1V2Tool::BitReader::getField
uint32_t getField(const uint8_t numBits)
Definition: ZdcByteStreamReadV1V2Tool.cxx:1114
perfmonmt-refit.slice
slice
Definition: perfmonmt-refit.py:52
ZdcByteStreamReadV1V2Tool::State::m_ppLuts
std::map< uint8_t, std::vector< uint16_t > > m_ppLuts
Definition: ZdcByteStreamReadV1V2Tool.h:114
lumiFormat.i
int i
Definition: lumiFormat.py:85
ZdcSubBlockHeader::nSlice1
uint8_t nSlice1() const
Definition: ZdcSubBlockHeader.cxx:51
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
ZdcCablingService::hwid2delay
int hwid2delay(int crate, int channel) const
Definition: ZdcCablingService.cxx:417
ZdcCaloUserHeader::ppFadc
uint8_t ppFadc() const
Definition: ZdcCaloUserHeader.cxx:31
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
generateReferenceFile.encoding
encoding
Definition: generateReferenceFile.py:15
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
ZdcByteStreamReadV1V2Tool::State::m_robSourceId
uint32_t m_robSourceId
Definition: ZdcByteStreamReadV1V2Tool.h:107
ZdcByteStreamReadV1V2Tool::RequestType::PPM
@ PPM
ZdcSrcIdMap::maxSlinks
static int maxSlinks()
Return the maximum possible number of slinks.
Definition: ZdcSrcIdMap.cxx:80
ZdcByteStreamReadV1V2Tool::State::m_subDetectorID
uint8_t m_subDetectorID
Definition: ZdcByteStreamReadV1V2Tool.h:105
ZdcSrcIdMap.h
xAOD::TriggerTower_v2
Description of TriggerTower_v2.
Definition: TriggerTower_v2.h:49
ZdcByteStreamReadV1V2Tool::getPpmAdcSamplesR3_
std::vector< uint16_t > getPpmAdcSamplesR3_(State &state, BitReader &br, uint8_t format, uint8_t minIndex) const
Definition: ZdcByteStreamReadV1V2Tool.cxx:547
ZdcSubBlockHeader::compVer
uint8_t compVer() const
Definition: ZdcSubBlockHeader.h:34
ZdcSubBlockHeader::nSlice2
uint8_t nSlice2() const
Definition: ZdcSubBlockHeader.cxx:48
ZdcSrcIdMap::slink
static int slink(uint32_t code)
moduleID -> slink
Definition: ZdcSrcIdMap.cxx:71
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
hist_file_dump.f
f
Definition: hist_file_dump.py:140
delay
double delay(std::size_t d)
Definition: JetTrigTimerTest.cxx:11
IROBDataProviderSvc::VROBFRAG
std::vector< const ROBF * > VROBFRAG
Definition: IROBDataProviderSvc.h:27
xAOD::TriggerTowerAuxContainer_v2
AuxContainer for TriggerTower_v2.
Definition: TriggerTowerAuxContainer_v2.h:28
ZdcByteStreamReadV1V2Tool::m_robDataProvider
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Service for reading bytestream.
Definition: ZdcByteStreamReadV1V2Tool.h:187
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
plotBeamSpotCompare.xd
xd
Definition: plotBeamSpotCompare.py:219
ZdcL1CaloSubBlock::UNPACK_EXCESS_DATA
@ UNPACK_EXCESS_DATA
Definition: ZdcL1CaloSubBlock.h:42
ZdcToString.h
ZdcSubBlockHeader::seqNum
uint8_t seqNum() const
Definition: ZdcSubBlockHeader.cxx:39
xAOD::TriggerTowerContainer
TriggerTowerContainer_v2 TriggerTowerContainer
Define the latest version of the TriggerTower container.
Definition: TriggerTowerContainer.h:15
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
ZdcByteStreamReadV1V2Tool::RequestType
RequestType
Definition: ZdcByteStreamReadV1V2Tool.h:71
ZdcByteStreamReadV1V2Tool::processPpmCompressedR4V1_
StatusCode processPpmCompressedR4V1_(State &state) const
Definition: ZdcByteStreamReadV1V2Tool.cxx:634
ZdcByteStreamReadV1V2Tool::State::m_subBlockHeader
ZdcSubBlockHeader m_subBlockHeader
Definition: ZdcByteStreamReadV1V2Tool.h:103
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
TrigT1CaloDefs.h
PixelModuleFeMask_create_db.payload
string payload
Definition: PixelModuleFeMask_create_db.py:69
ZdcSubBlockHeader::crate
uint8_t crate() const
Definition: ZdcSubBlockHeader.cxx:42
ZdcCablingService::hwid2gain
int hwid2gain(int crate, int channel) const
Definition: ZdcCablingService.cxx:407
ZdcByteStreamReadV1V2Tool::State::m_verCode
uint8_t m_verCode
Definition: ZdcByteStreamReadV1V2Tool.h:108
ZdcSrcIdMap::getRodID
static uint32_t getRodID(int crate, int slink, int daqOrRoi, eformat::SubDetector subdet)
Make a ROD Source ID.
Definition: ZdcSrcIdMap.cxx:19
ZdcCaloUserHeader
L1Calo User Header class.
Definition: ZdcCaloUserHeader.h:22
ZdcByteStreamReadV1V2Tool::State
Definition: ZdcByteStreamReadV1V2Tool.h:98
ZdcByteStreamReadV1V2Tool.h
ReadFloatFromCool.adc
adc
Definition: ReadFloatFromCool.py:48
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
ZdcByteStreamReadV1V2Tool::m_srcIdMap
ZdcSrcIdMap * m_srcIdMap
Definition: ZdcByteStreamReadV1V2Tool.h:193
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
ZdcByteStreamReadV1V2Tool::m_errorTool
ToolHandle< ZdcL1CaloErrorByteStreamTool > m_errorTool
Definition: ZdcByteStreamReadV1V2Tool.h:184
ZdcDigitsCollection
Definition: ZdcDigitsCollection.h:20
ZdcByteStreamReadV1V2Tool::processPpmNeutral_
StatusCode processPpmNeutral_(State &state) const
Definition: ZdcByteStreamReadV1V2Tool.cxx:381
ZdcByteStreamReadV1V2Tool::ROBIterator
IROBDataProviderSvc::VROBFRAG::const_iterator ROBIterator
Definition: ZdcByteStreamReadV1V2Tool.h:72
ZdcSrcIdMap
This class provides conversion between Lower level Source ID to higher level source ID for L1Calo Byt...
Definition: ZdcSrcIdMap.h:24
ZdcByteStreamReadV1V2Tool::processPpmBlockR4V1_
StatusCode processPpmBlockR4V1_(State &state) const
Definition: ZdcByteStreamReadV1V2Tool.cxx:622
ZdcByteStreamReadV1V2Tool::m_ppmSourceIDsMuon
std::vector< uint32_t > m_ppmSourceIDsMuon
Definition: ZdcByteStreamReadV1V2Tool.h:191
error
Definition: IImpactPoint3dEstimator.h:70
TileDCSDataPlotter.tt
tt
Definition: TileDCSDataPlotter.py:876
ZdcWordDecoder.h
ZdcID
Definition: ZdcID.h:25
ZdcByteStreamReadV1V2Tool::m_ppmSourceIDsSpare
std::vector< uint32_t > m_ppmSourceIDsSpare
Definition: ZdcByteStreamReadV1V2Tool.h:192
python.SystemOfUnits.pc
float pc
Definition: SystemOfUnits.py:114
ZdcByteStreamReadV1V2Tool::initialize
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: ZdcByteStreamReadV1V2Tool.cxx:90
ZdcByteStreamReadV1V2Tool::addTriggerTowerV1_
StatusCode addTriggerTowerV1_(State &state, uint8_t crate, uint8_t module, uint8_t channel, const std::vector< uint16_t > &luts, const std::vector< uint16_t > &fadc) const
Definition: ZdcByteStreamReadV1V2Tool.cxx:1039
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
xAOD::TriggerTower
TriggerTower_v2 TriggerTower
Define the latest version of the TriggerTower class.
Definition: Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/TriggerTower.h:16
PlotCalibFromCool.br
br
Definition: PlotCalibFromCool.py:355
ZdcByteStreamReadV1V2Tool::BitReader::m_ppMaxBit
uint32_t m_ppMaxBit
Definition: ZdcByteStreamReadV1V2Tool.h:92
ZdcSubBlockHeader::isSubBlockHeader
bool isSubBlockHeader() const
Definition: ZdcSubBlockHeader.cxx:55
ZdcByteStreamReadV1V2Tool::processRobFragment_
StatusCode processRobFragment_(State &state, const ROBIterator &robFrag, const RequestType &requestedType) const
Definition: ZdcByteStreamReadV1V2Tool.cxx:202
TriggerTowerAuxContainer.h
Identifier
Definition: IdentifierFieldParser.cxx:14