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