ATLAS Offline Software
JepByteStreamTool.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 #include <numeric>
7 #include <set>
8 #include <utility>
9 
10 #include "GaudiKernel/IInterface.h"
11 #include "GaudiKernel/MsgStream.h"
12 #include "GaudiKernel/StatusCode.h"
13 
15 
24 
25 #include "CmmEnergySubBlock.h"
26 #include "CmmJetSubBlock.h"
27 #include "CmmSubBlock.h"
28 #include "JemJetElement.h"
29 #include "JemSubBlock.h"
31 #include "L1CaloSubBlock.h"
32 #include "L1CaloUserHeader.h"
33 #include "ModifySlices.h"
34 
35 #include "JepByteStreamTool.h"
36 
37 namespace LVL1BS {
38 
39 // Interface ID
40 
41 static const InterfaceID IID_IJepByteStreamTool("JepByteStreamTool", 1, 1);
42 
43 const InterfaceID& JepByteStreamTool::interfaceID()
44 {
45  return IID_IJepByteStreamTool;
46 }
47 
48 // Constructor
49 
51  const std::string& name,
52  const IInterface* parent)
54  m_jemMaps("LVL1::JemMappingTool/JemMappingTool"),
55  m_errorTool("LVL1BS::L1CaloErrorByteStreamTool/L1CaloErrorByteStreamTool"),
56  m_channels(44), m_crates(2), m_modules(16),
57  m_subDetector(eformat::TDAQ_CALO_JET_PROC_DAQ)
58 {
59  declareInterface<JepByteStreamTool>(this);
60 
61  declareProperty("JemMappingTool", m_jemMaps,
62  "Crate/Module/Channel to Eta/Phi/Layer mapping tool");
63 
64  declareProperty("CrateOffsetHw", m_crateOffsetHw = 12,
65  "Offset of JEP crate numbers in bytestream");
66  declareProperty("CrateOffsetSw", m_crateOffsetSw = 0,
67  "Offset of JEP crate numbers in RDOs");
68  declareProperty("SlinksPerCrate", m_slinks = 4,
69  "The number of S-Links per crate");
70 
71  // Properties for reading bytestream only
72  declareProperty("ROBSourceIDs", m_sourceIDsProp,
73  "ROB fragment source identifiers");
74 
75  // Properties for writing bytestream only
76  declareProperty("DataVersion", m_version = 1,
77  "Format version number in sub-block header");
78  declareProperty("DataFormat", m_dataFormat = 1,
79  "Format identifier (0-1) in sub-block header");
80  declareProperty("SimulSlices", m_dfltSlices = 1,
81  "The number of slices in the simulation");
82  declareProperty("ForceSlices", m_forceSlices = 0,
83  "If >0, the number of slices in bytestream");
84 
85 }
86 
87 // Destructor
88 
90 {
91 }
92 
93 // Initialize
94 
95 
97 {
98  msg(MSG::INFO) << "Initializing " << name() << endmsg;
99 
100  StatusCode sc = m_jemMaps.retrieve();
101  if (sc.isFailure()) {
102  msg(MSG::ERROR) << "Failed to retrieve tool " << m_jemMaps << endmsg;
103  return sc;
104  } else msg(MSG::INFO) << "Retrieved tool " << m_jemMaps << endmsg;
105 
106  sc = m_errorTool.retrieve();
107  if (sc.isFailure()) {
108  msg(MSG::ERROR) << "Failed to retrieve tool " << m_errorTool << endmsg;
109  return sc;
110  } else msg(MSG::INFO) << "Retrieved tool " << m_errorTool << endmsg;
111 
112  ATH_CHECK( m_byteStreamCnvSvc.retrieve() );
113 
114  return StatusCode::SUCCESS;
115 }
116 
117 // Finalize
118 
120 {
121  return StatusCode::SUCCESS;
122 }
123 
124 // Conversion bytestream to jet elements
125 
127  const std::string& sgKey,
128  const IROBDataProviderSvc::VROBFRAG& robFrags,
129  DataVector<LVL1::JetElement>* const jeCollection) const
130 {
131  JetElementData data (jeCollection);
132  return convertBs(sgKey, robFrags, data);
133 }
134 
135 // Conversion bytestream to jet hits
136 
138  const std::string& sgKey,
139  const IROBDataProviderSvc::VROBFRAG& robFrags,
140  DataVector<LVL1::JEMHits>* const hitCollection) const
141 {
142  JetHitsData data (hitCollection);
143  return convertBs(sgKey, robFrags, data);
144 }
145 
146 // Conversion bytestream to energy sums
147 
149  const std::string& sgKey,
150  const IROBDataProviderSvc::VROBFRAG& robFrags,
151  DataVector<LVL1::JEMEtSums>* const etCollection) const
152 {
153  EnergySumsData data (etCollection);
154  return convertBs(sgKey, robFrags, data);
155 }
156 
157 // Conversion bytestream to CMM hits
158 
160  const std::string& sgKey,
161  const IROBDataProviderSvc::VROBFRAG& robFrags,
162  DataVector<LVL1::CMMJetHits>* const hitCollection) const
163 {
164  CmmHitsData data (hitCollection);
165  return convertBs(sgKey, robFrags, data);
166 }
167 
168 // Conversion bytestream to CMM energy sums
169 
171  const std::string& sgKey,
172  const IROBDataProviderSvc::VROBFRAG& robFrags,
173  DataVector<LVL1::CMMEtSums>* const etCollection) const
174 {
175  CmmSumsData data (etCollection);
176  return convertBs(sgKey, robFrags, data);
177 }
178 
179 // Conversion of JEP container to bytestream
180 
181 // xxx
183 {
184  const bool debug = msgLvl(MSG::DEBUG);
185  if (debug) msg(MSG::DEBUG);
186 
187  // Get the event assembler
188  FullEventAssembler<L1CaloSrcIdMap>* fea = nullptr;
189  ATH_CHECK( m_byteStreamCnvSvc->getFullEventAssembler (fea,
190  "JepByteStream") );
191  const uint16_t minorVersion = m_srcIdMap.minorVersion();
192  fea->setRodMinorVersion(minorVersion);
193 
194  // Pointer to ROD data vector
195 
197 
198  // Jet element key provider
199  LVL1::JetElementKey elementKey;
200 
201  // Set up the container maps
202 
203  // Jet element map
204  ConstJetElementMap jeMap;
205  setupJeMap(jep->JetElements(), jeMap, elementKey);
206 
207  // Jet hits map
208  ConstJetHitsMap hitsMap;
209  setupHitsMap(jep->JetHits(), hitsMap);
210 
211  // Energy sums map
212  ConstEnergySumsMap etMap;
213  setupEtMap(jep->EnergySums(), etMap);
214 
215  // CMM hits map
216  ConstCmmHitsMap cmmHitsMap;
217  setupCmmHitsMap(jep->CmmHits(), cmmHitsMap);
218 
219  // CMM energy sums map
220  ConstCmmSumsMap cmmEtMap;
221  setupCmmEtMap(jep->CmmSums(), cmmEtMap);
222 
223  // Loop over data
224 
225  const bool neutralFormat = m_dataFormat == L1CaloSubBlock::NEUTRAL;
226  const int modulesPerSlink = m_modules / m_slinks;
227  int timeslices = 1;
228  int trigJem = 0;
229  int timeslicesNew = 1;
230  int trigJemNew = 0;
231  for (int crate = 0; crate < m_crates; ++crate) {
232  const int hwCrate = crate + m_crateOffsetHw;
233 
234  for (int module = 0; module < m_modules; ++module) {
235 
236  // Pack required number of modules per slink
237 
238  if (module % modulesPerSlink == 0) {
239  const int daqOrRoi = 0;
240  const int slink = module / modulesPerSlink;
241  if (debug) {
242  msg() << "Treating crate " << hwCrate
243  << " slink " << slink << endmsg;
244  }
245  // Get number of JEM slices and triggered slice offset
246  // for this slink
247  if ( ! slinkSlices(crate, module, modulesPerSlink,
248  timeslices, trigJem,
249  jeMap,
250  hitsMap,
251  etMap,
252  cmmHitsMap,
253  cmmEtMap,
254  elementKey))
255  {
256  msg(MSG::ERROR) << "Inconsistent number of slices or "
257  << "triggered slice offsets in data for crate "
258  << hwCrate << " slink " << slink << endmsg;
259  return StatusCode::FAILURE;
260  }
261  timeslicesNew = (m_forceSlices) ? m_forceSlices : timeslices;
262  trigJemNew = ModifySlices::peak(trigJem, timeslices, timeslicesNew);
263  if (debug) {
264  msg() << "Data Version/Format: " << m_version
265  << " " << m_dataFormat << endmsg
266  << "Slices/offset: " << timeslices << " " << trigJem;
267  if (timeslices != timeslicesNew) {
268  msg() << " modified to " << timeslicesNew << " " << trigJemNew;
269  }
270  msg() << endmsg;
271  }
272  L1CaloUserHeader userHeader;
273  userHeader.setJem(trigJemNew);
274  const uint32_t rodIdJem = m_srcIdMap.getRodID(hwCrate, slink, daqOrRoi,
275  m_subDetector);
276  theROD = fea->getRodData(rodIdJem);
277  theROD->push_back(userHeader.header());
278  }
279  if (debug) msg() << "Module " << module << endmsg;
280 
281  // Create a sub-block for each slice (except Neutral format)
282 
283  // Vector for current JEM sub-blocks
284  DataVector<JemSubBlock> jemBlocks;
285 
286  for (int slice = 0; slice < timeslicesNew; ++slice) {
287  JemSubBlock* const subBlock = new JemSubBlock();
289  hwCrate, module, timeslicesNew);
290  jemBlocks.push_back(subBlock);
291  if (neutralFormat) break;
292  }
293 
294  // Find jet elements corresponding to each eta/phi pair and fill
295  // sub-blocks
296 
297  for (int chan = 0; chan < m_channels; ++chan) {
298  double eta = 0.;
299  double phi = 0.;
300  int layer = 0;
301  if (m_jemMaps->mapping(crate, module, chan, eta, phi, layer)) {
302  const LVL1::JetElement* const je = findJetElement(eta, phi, jeMap, elementKey);
303  if (je ) {
304  std::vector<int> emData;
305  std::vector<int> hadData;
306  std::vector<int> emErrors;
307  std::vector<int> hadErrors;
308  ModifySlices::data(je->emEnergyVec(), emData, timeslicesNew);
309  ModifySlices::data(je->hadEnergyVec(), hadData, timeslicesNew);
310  ModifySlices::data(je->emErrorVec(), emErrors, timeslicesNew);
311  ModifySlices::data(je->hadErrorVec(), hadErrors, timeslicesNew);
312  for (int slice = 0; slice < timeslicesNew; ++slice) {
313  const LVL1::DataError emErrBits(emErrors[slice]);
314  const LVL1::DataError hadErrBits(hadErrors[slice]);
315  const int index = ( neutralFormat ) ? 0 : slice;
316  JemSubBlock* const subBlock = jemBlocks[index];
317  const JemJetElement jetEle(chan, emData[slice], hadData[slice],
318  emErrBits.get(LVL1::DataError::Parity),
319  hadErrBits.get(LVL1::DataError::Parity),
320  emErrBits.get(LVL1::DataError::LinkDown) +
321  (hadErrBits.get(LVL1::DataError::LinkDown) << 1));
322  subBlock->fillJetElement(slice, jetEle);
323  }
324  }
325  }
326  }
327 
328  // Add jet hits and energy subsums
329 
330  const LVL1::JEMHits* const hits = findJetHits(crate, module, hitsMap);
331  if (hits) {
332  std::vector<unsigned int> vec;
333  ModifySlices::data(hits->JetHitsVec(), vec, timeslicesNew);
334  for (int slice = 0; slice < timeslicesNew; ++slice) {
335  const int index = ( neutralFormat ) ? 0 : slice;
336  JemSubBlock* const subBlock = jemBlocks[index];
337  subBlock->setJetHits(slice, vec[slice]);
338  }
339  }
340  const LVL1::JEMEtSums* const et = findEnergySums(crate, module, etMap);
341  if (et) {
342  std::vector<unsigned int> exVec;
343  std::vector<unsigned int> eyVec;
344  std::vector<unsigned int> etVec;
345  ModifySlices::data(et->ExVec(), exVec, timeslicesNew);
346  ModifySlices::data(et->EyVec(), eyVec, timeslicesNew);
347  ModifySlices::data(et->EtVec(), etVec, timeslicesNew);
348  for (int slice = 0; slice < timeslicesNew; ++slice) {
349  const int index = ( neutralFormat ) ? 0 : slice;
350  JemSubBlock* const subBlock = jemBlocks[index];
351  subBlock->setEnergySubsums(slice, exVec[slice], eyVec[slice],
352  etVec[slice]);
353  }
354  }
355 
356  // Pack and write the sub-blocks
357 
359  for (pos = jemBlocks.begin(); pos != jemBlocks.end(); ++pos) {
360  JemSubBlock* const subBlock = *pos;
361  if ( !subBlock->pack()) {
362  msg(MSG::ERROR) << "JEM sub-block packing failed" << endmsg;
363  return StatusCode::FAILURE;
364  }
365  if (debug) {
366  msg() << "JEM sub-block data words: "
367  << subBlock->dataWords() << endmsg;
368  }
369  subBlock->write(theROD);
370  }
371  }
372 
373  // Append CMMs to last S-Link of the crate
374 
375  // Create a sub-block for each slice (except Neutral format)
376 
377  // Vector for current CMM-Energy sub-blocks
378  DataVector<CmmEnergySubBlock> cmmEnergyBlocks;
379  // Vector for current CMM-Jet sub-blocks
380  DataVector<CmmJetSubBlock> cmmJetBlocks;
381 
382  const int summing = (crate == m_crates - 1) ? CmmSubBlock::SYSTEM
384  for (int slice = 0; slice < timeslicesNew; ++slice) {
385  CmmEnergySubBlock* const enBlock = new CmmEnergySubBlock();
386  const int cmmEnergyVersion = 2; // with Missing-ET-Sig
387  enBlock->setCmmHeader(cmmEnergyVersion, m_dataFormat, slice, hwCrate,
388  summing, CmmSubBlock::CMM_ENERGY,
389  CmmSubBlock::LEFT, timeslicesNew);
390  cmmEnergyBlocks.push_back(enBlock);
391  CmmJetSubBlock* const jetBlock = new CmmJetSubBlock();
392  jetBlock->setCmmHeader(m_version, m_dataFormat, slice, hwCrate,
393  summing, CmmSubBlock::CMM_JET,
394  CmmSubBlock::RIGHT, timeslicesNew);
395  cmmJetBlocks.push_back(jetBlock);
396  if (neutralFormat) break;
397  }
398 
399  // CMM-Energy
400 
401  int maxDataID = static_cast<int>(LVL1::CMMEtSums::MAXID);
402  for (int dataID = 0; dataID < maxDataID; ++dataID) {
403  int source = dataID;
404  if (dataID >= m_modules) {
405  if (summing == CmmSubBlock::CRATE &&
406  dataID != LVL1::CMMEtSums::LOCAL) continue;
407  // coverity[mixed_enums : FALSE]
408  // coverity[switch_on_enum : FALSE]
409  // coverity[first_enum_type : FALSE]
410  switch (dataID) {
413  break;
416  break;
419  break;
423  break;
424  default:
425  continue;
426  }
427  }
428  const LVL1::CMMEtSums* const sums = findCmmSums(crate, dataID, cmmEtMap);
429  if ( sums ) {
430  std::vector<unsigned int> ex;
431  std::vector<unsigned int> ey;
432  std::vector<unsigned int> et;
433  std::vector<int> exErr;
434  std::vector<int> eyErr;
435  std::vector<int> etErr;
436  ModifySlices::data(sums->ExVec(), ex, timeslicesNew);
437  ModifySlices::data(sums->EyVec(), ey, timeslicesNew);
438  ModifySlices::data(sums->EtVec(), et, timeslicesNew);
439  ModifySlices::data(sums->ExErrorVec(), exErr, timeslicesNew);
440  ModifySlices::data(sums->EyErrorVec(), eyErr, timeslicesNew);
441  ModifySlices::data(sums->EtErrorVec(), etErr, timeslicesNew);
442  for (int slice = 0; slice < timeslicesNew; ++slice) {
443  const LVL1::DataError exErrBits(exErr[slice]);
444  const LVL1::DataError eyErrBits(eyErr[slice]);
445  const LVL1::DataError etErrBits(etErr[slice]);
446  int exError = exErrBits.get(LVL1::DataError::Parity);
447  int eyError = eyErrBits.get(LVL1::DataError::Parity);
448  int etError = etErrBits.get(LVL1::DataError::Parity);
449  if (dataID == LVL1::CMMEtSums::LOCAL ||
450  dataID == LVL1::CMMEtSums::REMOTE ||
451  dataID == LVL1::CMMEtSums::TOTAL) {
452  exError = (exError << 1) + exErrBits.get(LVL1::DataError::Overflow);
453  eyError = (eyError << 1) + eyErrBits.get(LVL1::DataError::Overflow);
454  etError = (etError << 1) + etErrBits.get(LVL1::DataError::Overflow);
455  }
456  const int index = ( neutralFormat ) ? 0 : slice;
457  CmmEnergySubBlock* const subBlock = cmmEnergyBlocks[index];
458  if (dataID == LVL1::CMMEtSums::MISSING_ET_MAP) {
459  subBlock->setMissingEtHits(slice, et[slice]);
460  } else if (dataID == LVL1::CMMEtSums::SUM_ET_MAP) {
461  subBlock->setSumEtHits(slice, et[slice]);
462  } else if (dataID == LVL1::CMMEtSums::MISSING_ET_SIG_MAP) {
463  subBlock->setMissingEtSigHits(slice, et[slice]);
464  } else {
465  subBlock->setSubsums(slice, source,
466  ex[slice], ey[slice], et[slice],
467  exError, eyError, etError);
468  }
469  }
470  }
471  }
473  pos = cmmEnergyBlocks.begin();
474  for (; pos != cmmEnergyBlocks.end(); ++pos) {
475  CmmEnergySubBlock* const subBlock = *pos;
476  if ( !subBlock->pack()) {
477  msg(MSG::ERROR) << "CMM-Energy sub-block packing failed" << endmsg;
478  return StatusCode::FAILURE;
479  }
480  if (debug) {
481  msg() << "CMM-Energy sub-block data words: "
482  << subBlock->dataWords() << endmsg;
483  }
484  subBlock->write(theROD);
485  }
486 
487  // CMM-Jet
488 
489  maxDataID = static_cast<int>(LVL1::CMMJetHits::MAXID);
490  for (int dataID = 0; dataID < maxDataID; ++dataID) {
491  int source = dataID;
492  if (dataID >= m_modules) {
493  if (summing == CmmSubBlock::CRATE &&
494  dataID != LVL1::CMMJetHits::LOCAL_MAIN &&
495  dataID != LVL1::CMMJetHits::LOCAL_FORWARD) continue;
496  switch (dataID) {
499  break;
502  break;
505  break;
508  break;
511  break;
514  break;
516  break;
517  default:
518  continue;
519  }
520  }
521  const LVL1::CMMJetHits* const ch = findCmmHits(crate, dataID, cmmHitsMap);
522  if ( ch ) {
523  std::vector<unsigned int> hits;
524  std::vector<int> errs;
525  ModifySlices::data(ch->HitsVec(), hits, timeslicesNew);
526  ModifySlices::data(ch->ErrorVec(), errs, timeslicesNew);
527  for (int slice = 0; slice < timeslicesNew; ++slice) {
528  const LVL1::DataError errBits(errs[slice]);
529  const int index = ( neutralFormat ) ? 0 : slice;
530  CmmJetSubBlock* const subBlock = cmmJetBlocks[index];
531  if (dataID == LVL1::CMMJetHits::ET_MAP) {
532  subBlock->setJetEtMap(slice, hits[slice]);
533  } else {
534  subBlock->setJetHits(slice, source, hits[slice],
535  errBits.get(LVL1::DataError::Parity));
536  }
537  }
538  }
539  }
541  jos = cmmJetBlocks.begin();
542  for (; jos != cmmJetBlocks.end(); ++jos) {
543  CmmJetSubBlock* const subBlock = *jos;
544  if ( !subBlock->pack()) {
545  msg(MSG::ERROR) << "CMM-Jet sub-block packing failed" << endmsg;
546  return StatusCode::FAILURE;
547  }
548  if (debug) {
549  msg() << "CMM-Jet sub-block data words: "
550  << subBlock->dataWords() << endmsg;
551  }
552  subBlock->write(theROD);
553  }
554  }
555 
556  return StatusCode::SUCCESS;
557 }
558 
559 // Return reference to vector with all possible Source Identifiers
560 
561 std::vector<uint32_t> JepByteStreamTool::makeSourceIDs() const
562 {
563  std::vector<uint32_t> sourceIDs;
564 
565  if (!m_sourceIDsProp.empty()) {
567  }
568  else {
569  const int maxCrates = m_crates + m_crateOffsetHw;
570  const int maxSlinks = m_srcIdMap.maxSlinks();
571  for (int hwCrate = m_crateOffsetHw; hwCrate < maxCrates; ++hwCrate)
572  {
573  for (int slink = 0; slink < maxSlinks; ++slink)
574  {
575  const int daqOrRoi = 0;
576  const uint32_t rodId = m_srcIdMap.getRodID(hwCrate, slink, daqOrRoi,
577  m_subDetector);
578  const uint32_t robId = m_srcIdMap.getRobID(rodId);
579  sourceIDs.push_back(robId);
580  }
581  }
582  }
583  return sourceIDs;
584 }
585 
586 const std::vector<uint32_t>& JepByteStreamTool::sourceIDs() const
587 {
588  static const std::vector<uint32_t> sourceIDs = makeSourceIDs();
589  return sourceIDs;
590 }
591 
592 // Convert bytestream to given container type
593 
595  const std::string& sgKey,
596  const IROBDataProviderSvc::VROBFRAG& robFrags,
598 {
599  LocalData ld;
600 
601  // Check if overlap jet element channels wanted
602  const std::string flag("Overlap");
603  const std::string::size_type pos = sgKey.find(flag);
604  ld.coreOverlap =
605  (pos == std::string::npos || pos != sgKey.length() - flag.length()) ? 0 : 1;
606 
607  const bool debug = msgLvl(MSG::DEBUG);
608  if (debug) msg(MSG::DEBUG);
609 
610  // JemSubBlock for unpacking
611  JemSubBlock jemSubBlock;
612  // CmmEnergySubBlock for unpacking
613  CmmEnergySubBlock cmmEnergySubBlock;
614  // CmmJetSubBlock for unpacking
615  CmmJetSubBlock cmmJetSubBlock;
616 
617  // Loop over ROB fragments
618 
619  int robCount = 0;
620  std::set<uint32_t> dupCheck;
621  ROBIterator rob = robFrags.begin();
622  ROBIterator robEnd = robFrags.end();
623  for (; rob != robEnd; ++rob) {
624 
625  if (debug) {
626  ++robCount;
627  msg() << "Treating ROB fragment " << robCount << endmsg;
628  }
629 
630  // Skip fragments with ROB status errors
631 
632  uint32_t robid = (*rob)->source_id();
633  if ((*rob)->nstatus() > 0) {
634  ROBPointer robData;
635  (*rob)->status(robData);
636  if (*robData != 0) {
637  m_errorTool->robError(robid, *robData);
638  if (debug) msg() << "ROB status error - skipping fragment" << endmsg;
639  continue;
640  }
641  }
642 
643  // Skip duplicate fragments
644 
645  if (!dupCheck.insert(robid).second) {
647  if (debug) msg() << "Skipping duplicate ROB fragment" << endmsg;
648  continue;
649  }
650 
651  // Unpack ROD data (slinks)
652 
653  RODPointer payloadBeg;
655  RODPointer payloadEnd;
656  (*rob)->rod_data(payloadBeg);
657  payloadEnd = payloadBeg + (*rob)->rod_ndata();
658  payload = payloadBeg;
659  if (payload == payloadEnd) {
660  if (debug) msg() << "ROB fragment empty" << endmsg;
661  continue;
662  }
663 
664  // Check identifier
665  const uint32_t sourceID = (*rob)->rod_source_id();
666  if (m_srcIdMap.getRobID(sourceID) != robid ||
667  m_srcIdMap.subDet(sourceID) != m_subDetector ||
668  m_srcIdMap.daqOrRoi(sourceID) != 0 ||
669  m_srcIdMap.slink(sourceID) >= m_slinks ||
670  m_srcIdMap.crate(sourceID) < m_crateOffsetHw ||
671  m_srcIdMap.crate(sourceID) >= m_crateOffsetHw + m_crates) {
672  m_errorTool->rodError(robid, L1CaloSubBlock::ERROR_ROD_ID);
673  if (debug) {
674  msg() << "Wrong source identifier in data: ROD "
675  << MSG::hex << sourceID << " ROB " << robid
676  << MSG::dec << endmsg;
677  }
678  continue;
679  }
680  const int rodCrate = m_srcIdMap.crate(sourceID);
681  if (debug) {
682  msg() << "Treating crate " << rodCrate
683  << " slink " << m_srcIdMap.slink(sourceID) << endmsg;
684  }
685 
686  // First word should be User Header
689  if (debug) msg() << "Invalid or missing user header" << endmsg;
690  continue;
691  }
692  L1CaloUserHeader userHeader(*payload);
693  const int minorVersion = (*rob)->rod_version() & 0xffff;
694  userHeader.setVersion(minorVersion);
695  const int headerWords = userHeader.words();
696  if (headerWords != 1) {
698  if (debug) msg() << "Unexpected number of user header words: "
699  << headerWords << endmsg;
700  continue;
701  }
702  for (int i = 0; i < headerWords; ++i) ++payload;
703  // triggered slice offsets
704  int trigJem = userHeader.jem();
705  int trigCmm = userHeader.jepCmm();
706  if (debug) {
707  msg() << "Minor format version number: " << MSG::hex
708  << minorVersion << MSG::dec << endmsg
709  << "JEM triggered slice offset: " << trigJem << endmsg
710  << "CMM triggered slice offset: " << trigCmm << endmsg;
711  }
712  if (trigJem != trigCmm) {
713  const int newTrig = (trigJem > trigCmm) ? trigJem : trigCmm;
714  trigJem = newTrig;
715  trigCmm = newTrig;
716  if (debug) msg() << "Changed both offsets to " << newTrig << endmsg;
717  }
718 
719  // Loop over sub-blocks
720 
722  while (payload != payloadEnd) {
723 
725  if (debug) msg() << "Unexpected data sequence" << endmsg;
727  break;
728  }
730  // CMMs
732  cmmJetSubBlock.clear();
733  payload = cmmJetSubBlock.read(payload, payloadEnd);
734  if (cmmJetSubBlock.crate() != rodCrate) {
735  if (debug) msg() << "Inconsistent crate number in ROD source ID"
736  << endmsg;
738  break;
739  }
740  if (data.m_collection == CMM_HITS) {
741  decodeCmmJet(&cmmJetSubBlock, trigCmm, static_cast<CmmHitsData&>(data), ld);
742  if (ld.rodErr != L1CaloSubBlock::ERROR_NONE) {
743  if (debug) msg() << "decodeCmmJet failed" << endmsg;
744  break;
745  }
746  }
748  cmmEnergySubBlock.clear();
749  payload = cmmEnergySubBlock.read(payload, payloadEnd);
750  if (cmmEnergySubBlock.crate() != rodCrate) {
751  if (debug) msg() << "Inconsistent crate number in ROD source ID"
752  << endmsg;
754  break;
755  }
756  if (data.m_collection == CMM_SUMS) {
757  decodeCmmEnergy(&cmmEnergySubBlock, trigCmm, static_cast<CmmSumsData&>(data), ld);
758  if (ld.rodErr != L1CaloSubBlock::ERROR_NONE) {
759  if (debug) msg() << "decodeCmmEnergy failed" << endmsg;
760  break;
761  }
762  }
763  } else {
764  if (debug) msg() << "Invalid CMM type in module field" << endmsg;
766  break;
767  }
768  } else {
769  // JEM
770  jemSubBlock.clear();
771  payload = jemSubBlock.read(payload, payloadEnd);
772  if (jemSubBlock.crate() != rodCrate) {
773  if (debug) msg() << "Inconsistent crate number in ROD source ID"
774  << endmsg;
776  break;
777  }
778  if (data.m_collection == JET_ELEMENTS || data.m_collection == JET_HITS ||
779  data.m_collection == ENERGY_SUMS) {
780  decodeJem(&jemSubBlock, trigJem, data, ld);
781  if (ld.rodErr != L1CaloSubBlock::ERROR_NONE) {
782  if (debug) msg() << "decodeJem failed" << endmsg;
783  break;
784  }
785  }
786  }
787  }
788  if (ld.rodErr != L1CaloSubBlock::ERROR_NONE)
789  m_errorTool->rodError(robid, ld.rodErr);
790  }
791 
792  return StatusCode::SUCCESS;
793 }
794 
795 // Unpack CMM-Energy sub-block
796 
798  int trigCmm,
799  CmmSumsData& data,
800  LocalData& ld) const
801 {
802  const bool debug = msgLvl(MSG::DEBUG);
803  if (debug) msg(MSG::DEBUG);
804 
805  const int hwCrate = subBlock->crate();
806  const int module = subBlock->cmmPosition();
807  const int firmware = subBlock->cmmFirmware();
808  const int summing = subBlock->cmmSumming();
809  const int timeslices = subBlock->timeslices();
810  const int sliceNum = subBlock->slice();
811  if (debug) {
812  msg() << "CMM-Energy: Crate " << hwCrate
813  << " Module " << module
814  << " Firmware " << firmware
815  << " Summing " << summing
816  << " Total slices " << timeslices
817  << " Slice " << sliceNum << endmsg;
818  }
819  if (timeslices <= trigCmm) {
820  if (debug) msg() << "Triggered CMM slice from header "
821  << "inconsistent with number of slices: "
822  << trigCmm << ", " << timeslices << endmsg;
824  return;
825  }
826  if (timeslices <= sliceNum) {
827  if (debug) msg() << "Total slices inconsistent with slice number: "
828  << timeslices << ", " << sliceNum << endmsg;
830  return;
831  }
832  // Unpack sub-block
833  if (subBlock->dataWords() && !subBlock->unpack()) {
834  if (debug) {
835  std::string errMsg(subBlock->unpackErrorMsg());
836  msg() << "CMM-Energy sub-block unpacking failed: " << errMsg << endmsg;
837  }
838  ld.rodErr = subBlock->unpackErrorCode();
839  return;
840  }
841 
842  // Retrieve required data
843 
844  const bool neutralFormat = subBlock->format() == L1CaloSubBlock::NEUTRAL;
845  const int crate = hwCrate - m_crateOffsetHw;
846  const int swCrate = crate + m_crateOffsetSw;
847  const int maxSid = static_cast<int>(CmmEnergySubBlock::MAX_SOURCE_ID);
848  LVL1::DataError derr;
849  derr.set(LVL1::DataError::SubStatusWord, subBlock->subStatus());
850  const int ssError = derr.error();
851  const int sliceBeg = ( neutralFormat ) ? 0 : sliceNum;
852  const int sliceEnd = ( neutralFormat ) ? timeslices : sliceNum + 1;
853  for (int slice = sliceBeg; slice < sliceEnd; ++slice) {
854 
855  // Energy sums
856 
857  for (int source = 0; source < maxSid; ++source) {
858  int dataID = source;
859  if (source >= m_modules) {
860  if (summing == CmmSubBlock::CRATE &&
861  source != CmmEnergySubBlock::LOCAL) continue;
862  // coverity[mixed_enums : FALSE]
863  // coverity[switch_on_enum : FALSE]
864  // coverity[first_enum_type : FALSE]
865  switch (source) {
867  dataID = LVL1::CMMEtSums::LOCAL;
868  break;
870  dataID = LVL1::CMMEtSums::REMOTE;
871  break;
873  dataID = LVL1::CMMEtSums::TOTAL;
874  break;
875  default:
876  continue;
877  }
878  }
879  const unsigned int ex = subBlock->ex(slice, source);
880  const unsigned int ey = subBlock->ey(slice, source);
881  const unsigned int et = subBlock->et(slice, source);
882  int exErr = subBlock->exError(slice, source);
883  int eyErr = subBlock->eyError(slice, source);
884  int etErr = subBlock->etError(slice, source);
885  LVL1::DataError exErrBits(ssError);
886  LVL1::DataError eyErrBits(ssError);
887  LVL1::DataError etErrBits(ssError);
888  // coverity[mixed_enums : FALSE]
889  // coverity[switch_on_enum : FALSE]
890  // coverity[first_enum_type : FALSE]
891  if (dataID == LVL1::CMMEtSums::LOCAL ||
892  dataID == LVL1::CMMEtSums::REMOTE ||
893  dataID == LVL1::CMMEtSums::TOTAL) {
894  exErrBits.set(LVL1::DataError::Overflow, exErr);
895  exErrBits.set(LVL1::DataError::Parity, exErr >> 1);
896  eyErrBits.set(LVL1::DataError::Overflow, eyErr);
897  eyErrBits.set(LVL1::DataError::Parity, eyErr >> 1);
898  etErrBits.set(LVL1::DataError::Overflow, etErr);
899  etErrBits.set(LVL1::DataError::Parity, etErr >> 1);
900  } else {
901  exErrBits.set(LVL1::DataError::Parity, exErr);
902  eyErrBits.set(LVL1::DataError::Parity, eyErr);
903  etErrBits.set(LVL1::DataError::Parity, etErr);
904  }
905  exErr = exErrBits.error();
906  eyErr = eyErrBits.error();
907  etErr = etErrBits.error();
908  if (ex || ey || et || exErr || eyErr || etErr) {
909  LVL1::CMMEtSums* sums = findCmmSums(data, crate, dataID);
910  if ( ! sums ) { // create new CMM energy sums
911  ld.exVec.assign(timeslices, 0);
912  ld.eyVec.assign(timeslices, 0);
913  ld.etVec.assign(timeslices, 0);
914  ld.exErrVec.assign(timeslices, 0);
915  ld.eyErrVec.assign(timeslices, 0);
916  ld.etErrVec.assign(timeslices, 0);
917  ld.exVec[slice] = ex;
918  ld.eyVec[slice] = ey;
919  ld.etVec[slice] = et;
920  ld.exErrVec[slice] = exErr;
921  ld.eyErrVec[slice] = eyErr;
922  ld.etErrVec[slice] = etErr;
923  auto sumsp =
924  std::make_unique<LVL1::CMMEtSums>(swCrate, dataID, ld.etVec, ld.exVec, ld.eyVec,
925  ld.etErrVec, ld.exErrVec, ld.eyErrVec, trigCmm);
926  const int key = crate * 100 + dataID;
927  data.m_cmmEtMap.insert(std::make_pair(key, sumsp.get()));
928  data.m_cmmEtCollection->push_back(std::move(sumsp));
929  } else {
930  ld.exVec = sums->ExVec();
931  ld.eyVec = sums->EyVec();
932  ld.etVec = sums->EtVec();
933  ld.exErrVec = sums->ExErrorVec();
934  ld.eyErrVec = sums->EyErrorVec();
935  ld.etErrVec = sums->EtErrorVec();
936  const int nsl = ld.exVec.size();
937  if (timeslices != nsl) {
938  if (debug) msg() << "Inconsistent number of slices in sub-blocks"
939  << endmsg;
941  return;
942  }
943  if (ld.exVec[slice] != 0 || ld.eyVec[slice] != 0 || ld.etVec[slice] != 0 ||
944  ld.exErrVec[slice] != 0 || ld.eyErrVec[slice] != 0 ||
945  ld.etErrVec[slice] != 0) {
946  if (debug) msg() << "Duplicate data for slice " << slice << endmsg;
948  return;
949  }
950  ld.exVec[slice] = ex;
951  ld.eyVec[slice] = ey;
952  ld.etVec[slice] = et;
953  ld.exErrVec[slice] = exErr;
954  ld.eyErrVec[slice] = eyErr;
955  ld.etErrVec[slice] = etErr;
956  sums->addEx(ld.exVec, ld.exErrVec);
957  sums->addEy(ld.eyVec, ld.eyErrVec);
958  sums->addEt(ld.etVec, ld.etErrVec);
959  }
960  }
961  }
962 
963  // Hit maps - store as Et
964 
965  if (summing == CmmSubBlock::SYSTEM) {
966  const unsigned int missEt = subBlock->missingEtHits(slice);
967  if ( missEt || ssError ) {
968  const int dataID = LVL1::CMMEtSums::MISSING_ET_MAP;
969  LVL1::CMMEtSums* map = findCmmSums(data, crate, dataID);
970  if ( ! map ) {
971  ld.etVec.assign(timeslices, 0);
972  ld.etErrVec.assign(timeslices, 0);
973  ld.etVec[slice] = missEt;
974  ld.etErrVec[slice] = ssError;
975  auto mapp =
976  std::make_unique<LVL1::CMMEtSums>(swCrate, dataID,
977  ld.etVec, ld.etVec, ld.etVec,
978  ld.etErrVec, ld.etErrVec, ld.etErrVec, trigCmm);
979  const int key = crate * 100 + dataID;
980  data.m_cmmEtMap.insert(std::make_pair(key, mapp.get()));
981  data.m_cmmEtCollection->push_back(std::move(mapp));
982  } else {
983  ld.etVec = map->EtVec();
984  ld.etErrVec = map->EtErrorVec();
985  const int nsl = ld.etVec.size();
986  if (timeslices != nsl) {
987  if (debug) msg() << "Inconsistent number of slices in sub-blocks"
988  << endmsg;
990  return;
991  }
992  if (ld.etVec[slice] != 0 || ld.etErrVec[slice] != 0) {
993  if (debug) msg() << "Duplicate data for slice " << slice << endmsg;
995  return;
996  }
997  ld.etVec[slice] = missEt;
998  ld.etErrVec[slice] = ssError;
999  map->addEx(ld.etVec, ld.etErrVec);
1000  map->addEy(ld.etVec, ld.etErrVec);
1001  map->addEt(ld.etVec, ld.etErrVec);
1002  }
1003  }
1004  const unsigned int sumEt = subBlock->sumEtHits(slice);
1005  if ( sumEt || ssError ) {
1006  const int dataID = LVL1::CMMEtSums::SUM_ET_MAP;
1007  LVL1::CMMEtSums* map = findCmmSums(data, crate, dataID);
1008  if ( ! map ) {
1009  ld.etVec.assign(timeslices, 0);
1010  ld.etErrVec.assign(timeslices, 0);
1011  ld.etVec[slice] = sumEt;
1012  ld.etErrVec[slice] = ssError;
1013  auto mapp =
1014  std::make_unique<LVL1::CMMEtSums>(swCrate, dataID,
1015  ld.etVec, ld.etVec, ld.etVec,
1016  ld.etErrVec, ld.etErrVec, ld.etErrVec, trigCmm);
1017  const int key = crate * 100 + dataID;
1018  data.m_cmmEtMap.insert(std::make_pair(key, mapp.get()));
1019  data.m_cmmEtCollection->push_back(std::move(mapp));
1020  } else {
1021  ld.etVec = map->EtVec();
1022  ld.etErrVec = map->EtErrorVec();
1023  const int nsl = ld.etVec.size();
1024  if (timeslices != nsl) {
1025  if (debug) msg() << "Inconsistent number of slices in sub-blocks"
1026  << endmsg;
1028  return;
1029  }
1030  if (ld.etVec[slice] != 0 || ld.etErrVec[slice] != 0) {
1031  if (debug) msg() << "Duplicate data for slice " << slice << endmsg;
1033  return;
1034  }
1035  ld.etVec[slice] = sumEt;
1036  ld.etErrVec[slice] = ssError;
1037  map->addEx(ld.etVec, ld.etErrVec);
1038  map->addEy(ld.etVec, ld.etErrVec);
1039  map->addEt(ld.etVec, ld.etErrVec);
1040  }
1041  }
1042  if (subBlock->version() > 1) {
1043  const unsigned int missEtSig = subBlock->missingEtSigHits(slice);
1044  if ( missEtSig || ssError ) {
1045  const int dataID = LVL1::CMMEtSums::MISSING_ET_SIG_MAP;
1046  LVL1::CMMEtSums* map = findCmmSums(data, crate, dataID);
1047  if ( ! map ) {
1048  ld.etVec.assign(timeslices, 0);
1049  ld.etErrVec.assign(timeslices, 0);
1050  ld.etVec[slice] = missEtSig;
1051  ld.etErrVec[slice] = ssError;
1052  auto mapp =
1053  std::make_unique<LVL1::CMMEtSums>(swCrate, dataID,
1054  ld.etVec, ld.etVec, ld.etVec,
1055  ld.etErrVec, ld.etErrVec, ld.etErrVec, trigCmm);
1056  const int key = crate * 100 + dataID;
1057  data.m_cmmEtMap.insert(std::make_pair(key, mapp.get()));
1058  data.m_cmmEtCollection->push_back(std::move(mapp));
1059  } else {
1060  ld.etVec = map->EtVec();
1061  ld.etErrVec = map->EtErrorVec();
1062  const int nsl = ld.etVec.size();
1063  if (timeslices != nsl) {
1064  if (debug) msg() << "Inconsistent number of slices in sub-blocks"
1065  << endmsg;
1067  return;
1068  }
1069  if (ld.etVec[slice] != 0 || ld.etErrVec[slice] != 0) {
1070  if (debug) msg() << "Duplicate data for slice "
1071  << slice << endmsg;
1073  return;
1074  }
1075  ld.etVec[slice] = missEtSig;
1076  ld.etErrVec[slice] = ssError;
1077  map->addEx(ld.etVec, ld.etErrVec);
1078  map->addEy(ld.etVec, ld.etErrVec);
1079  map->addEt(ld.etVec, ld.etErrVec);
1080  }
1081  }
1082  }
1083  }
1084  }
1085 
1086  return;
1087 }
1088 
1089 // Unpack CMM-Jet sub-block
1090 
1092  CmmHitsData& data,
1093  LocalData& ld) const
1094 {
1095  const bool debug = msgLvl(MSG::DEBUG);
1096  if (debug) msg(MSG::DEBUG);
1097 
1098  const int hwCrate = subBlock->crate();
1099  const int module = subBlock->cmmPosition();
1100  const int firmware = subBlock->cmmFirmware();
1101  const int summing = subBlock->cmmSumming();
1102  const int timeslices = subBlock->timeslices();
1103  const int sliceNum = subBlock->slice();
1104  if (debug) {
1105  msg() << "CMM-Jet: Crate " << hwCrate
1106  << " Module " << module
1107  << " Firmware " << firmware
1108  << " Summing " << summing
1109  << " Total slices " << timeslices
1110  << " Slice " << sliceNum << endmsg;
1111  }
1112  if (timeslices <= trigCmm) {
1113  if (debug) msg() << "Triggered CMM slice from header "
1114  << "inconsistent with number of slices: "
1115  << trigCmm << ", " << timeslices << endmsg;
1117  return;
1118  }
1119  if (timeslices <= sliceNum) {
1120  if (debug) msg() << "Total slices inconsistent with slice number: "
1121  << timeslices << ", " << sliceNum << endmsg;
1123  return;
1124  }
1125  // Unpack sub-block
1126  if (subBlock->dataWords() && !subBlock->unpack()) {
1127  if (debug) {
1128  std::string errMsg(subBlock->unpackErrorMsg());
1129  msg() << "CMM-Jet sub-block unpacking failed: " << errMsg << endmsg;
1130  }
1131  ld.rodErr = subBlock->unpackErrorCode();
1132  return;
1133  }
1134 
1135  // Retrieve required data
1136 
1137  const bool neutralFormat = subBlock->format() == L1CaloSubBlock::NEUTRAL;
1138  const int crate = hwCrate - m_crateOffsetHw;
1139  const int swCrate = crate + m_crateOffsetSw;
1140  const int maxSid = static_cast<int>(CmmJetSubBlock::MAX_SOURCE_ID);
1141  LVL1::DataError derr;
1142  derr.set(LVL1::DataError::SubStatusWord, subBlock->subStatus());
1143  const int ssError = derr.error();
1144  const int sliceBeg = ( neutralFormat ) ? 0 : sliceNum;
1145  const int sliceEnd = ( neutralFormat ) ? timeslices : sliceNum + 1;
1146  for (int slice = sliceBeg; slice < sliceEnd; ++slice) {
1147 
1148  // Jet hit counts
1149 
1150  for (int source = 0; source < maxSid; ++source) {
1151  int dataID = source;
1152  if (source >= m_modules) {
1153  if (summing == CmmSubBlock::CRATE &&
1156  switch (source) {
1159  break;
1162  break;
1165  break;
1168  break;
1171  break;
1174  break;
1175  default:
1176  continue;
1177  }
1178  }
1179  const unsigned int hits = subBlock->jetHits(slice, source);
1180  LVL1::DataError errBits(ssError);
1181  errBits.set(LVL1::DataError::Parity,
1182  subBlock->jetHitsError(slice, source));
1183  const int err = errBits.error();
1184  if (hits || err) {
1185  LVL1::CMMJetHits* jh = findCmmHits(data, crate, dataID);
1186  if ( ! jh ) { // create new CMM hits
1187  ld.hitsVec.assign(timeslices, 0);
1188  ld.errVec.assign(timeslices, 0);
1189  ld.hitsVec[slice] = hits;
1190  ld.errVec[slice] = err;
1191  auto jhp =
1192  std::make_unique<LVL1::CMMJetHits>(swCrate, dataID, ld.hitsVec, ld.errVec, trigCmm);
1193  const int key = crate * 100 + dataID;
1194  data.m_cmmHitsMap.insert(std::make_pair(key, jhp.get()));
1195  data.m_cmmHitCollection->push_back(std::move(jhp));
1196  } else {
1197  ld.hitsVec = jh->HitsVec();
1198  ld.errVec = jh->ErrorVec();
1199  const int nsl = ld.hitsVec.size();
1200  if (timeslices != nsl) {
1201  if (debug) msg() << "Inconsistent number of slices in sub-blocks"
1202  << endmsg;
1204  return;
1205  }
1206  if (ld.hitsVec[slice] != 0 || ld.errVec[slice] != 0) {
1207  if (debug) msg() << "Duplicate data for slice " << slice << endmsg;
1209  return;
1210  }
1211  ld.hitsVec[slice] = hits;
1212  ld.errVec[slice] = err;
1213  jh->addHits(ld.hitsVec, ld.errVec);
1214  }
1215  }
1216  }
1217 
1218  // Hit map - store as hits
1219 
1220  if (summing == CmmSubBlock::SYSTEM) {
1221  const unsigned int etMap = subBlock->jetEtMap(slice);
1222  if ( etMap || ssError ) {
1223  const int dataID = LVL1::CMMJetHits::ET_MAP;
1224  LVL1::CMMJetHits* map = findCmmHits(data, crate, dataID);
1225  if ( ! map ) {
1226  ld.hitsVec.assign(timeslices, 0);
1227  ld.errVec.assign(timeslices, 0);
1228  ld.hitsVec[slice] = etMap;
1229  ld.errVec[slice] = ssError;
1230  auto mapp =
1231  std::make_unique<LVL1::CMMJetHits>(swCrate, dataID, ld.hitsVec, ld.errVec, trigCmm);
1232  const int key = crate * 100 + dataID;
1233  data.m_cmmHitsMap.insert(std::make_pair(key, mapp.get()));
1234  data.m_cmmHitCollection->push_back(std::move(mapp));
1235  } else {
1236  ld.hitsVec = map->HitsVec();
1237  ld.errVec = map->ErrorVec();
1238  const int nsl = ld.hitsVec.size();
1239  if (timeslices != nsl) {
1240  if (debug) msg() << "Inconsistent number of slices in sub-blocks"
1241  << endmsg;
1243  return;
1244  }
1245  if (ld.hitsVec[slice] != 0 || ld.errVec[slice] != 0) {
1246  if (debug) msg() << "Duplicate data for slice " << slice << endmsg;
1248  return;
1249  }
1250  ld.hitsVec[slice] = etMap;
1251  ld.errVec[slice] = ssError;
1252  map->addHits(ld.hitsVec, ld.errVec);
1253  }
1254  }
1255  }
1256  }
1257 
1258  return;
1259 }
1260 
1261 // Unpack JEM sub-block
1262 
1263 void JepByteStreamTool::decodeJem(JemSubBlock* subBlock, int trigJem,
1265  LocalData& ld) const
1266 {
1267  const bool debug = msgLvl(MSG::DEBUG);
1268  const bool verbose = msgLvl(MSG::VERBOSE);
1269  if (debug) msg(MSG::DEBUG);
1270 
1271  const int hwCrate = subBlock->crate();
1272  const int module = subBlock->module();
1273  const int timeslices = subBlock->timeslices();
1274  const int sliceNum = subBlock->slice();
1275  if (debug) {
1276  msg() << "JEM: Crate " << hwCrate
1277  << " Module " << module
1278  << " Total slices " << timeslices
1279  << " Slice " << sliceNum << endmsg;
1280  }
1281  if (timeslices <= trigJem) {
1282  if (debug) msg() << "Triggered JEM slice from header "
1283  << "inconsistent with number of slices: "
1284  << trigJem << ", " << timeslices << endmsg;
1286  return;
1287  }
1288  if (timeslices <= sliceNum) {
1289  if (debug) msg() << "Total slices inconsistent with slice number: "
1290  << timeslices << ", " << sliceNum << endmsg;
1292  return;
1293  }
1294  // Unpack sub-block
1295  if (subBlock->dataWords() && !subBlock->unpack()) {
1296  if (debug) {
1297  std::string errMsg(subBlock->unpackErrorMsg());
1298  msg() << "JEM sub-block unpacking failed: " << errMsg << endmsg;
1299  }
1300  ld.rodErr = subBlock->unpackErrorCode();
1301  return;
1302  }
1303 
1304  // Retrieve required data
1305 
1306  const bool neutralFormat = subBlock->format() == L1CaloSubBlock::NEUTRAL;
1307  const int crate = hwCrate - m_crateOffsetHw;
1308  const int swCrate = crate + m_crateOffsetSw;
1309  LVL1::DataError derr;
1310  derr.set(LVL1::DataError::SubStatusWord, subBlock->subStatus());
1311  const int ssError = derr.error();
1312  std::vector<int> dummy(timeslices);
1313  const int sliceBeg = ( neutralFormat ) ? 0 : sliceNum;
1314  const int sliceEnd = ( neutralFormat ) ? timeslices : sliceNum + 1;
1315  for (int slice = sliceBeg; slice < sliceEnd; ++slice) {
1316 
1317  if (data.m_collection == JET_ELEMENTS) {
1318  JetElementData& jedata = static_cast<JetElementData&>(data);
1319 
1320  // Loop over jet element channels and fill jet elements
1321 
1322  for (int chan = 0; chan < m_channels; ++chan) {
1323  const JemJetElement jetEle(subBlock->jetElement(slice, chan));
1324  if (jetEle.data() || ssError) {
1325  double eta = 0.;
1326  double phi = 0.;
1327  int layer = 0;
1328  if (m_jemMaps->mapping(crate, module, chan, eta, phi, layer)) {
1329  if (layer == ld.coreOverlap) {
1330  LVL1::JetElement* je = findJetElement(jedata, eta, phi, ld.elementKey);
1331  if ( ! je ) { // create new jet element
1332  const unsigned int key = ld.elementKey.jeKey(phi, eta);
1333  auto jep =
1334  std::make_unique<LVL1::JetElement>(phi, eta, dummy, dummy, key,
1335  dummy, dummy, dummy, trigJem);
1336  je = jep.get();
1337  jedata.m_jeMap.insert(std::make_pair(key, jep.get()));
1338  jedata.m_jeCollection->push_back(std::move(jep));
1339  } else {
1340  const std::vector<int>& emEnergy(je->emEnergyVec());
1341  const std::vector<int>& hadEnergy(je->hadEnergyVec());
1342  const std::vector<int>& emError(je->emErrorVec());
1343  const std::vector<int>& hadError(je->hadErrorVec());
1344  const int nsl = emEnergy.size();
1345  if (timeslices != nsl) {
1346  if (debug) {
1347  msg() << "Inconsistent number of slices in sub-blocks"
1348  << endmsg;
1349  }
1351  return;
1352  }
1353  if (emEnergy[slice] != 0 || hadEnergy[slice] != 0 ||
1354  emError[slice] != 0 || hadError[slice] != 0) {
1355  if (debug) msg() << "Duplicate data for slice "
1356  << slice << endmsg;
1358  return;
1359  }
1360  }
1361  LVL1::DataError emErrBits(ssError);
1362  LVL1::DataError hadErrBits(ssError);
1363  const int linkError = jetEle.linkError();
1364  emErrBits.set(LVL1::DataError::Parity, jetEle.emParity());
1365  emErrBits.set(LVL1::DataError::LinkDown, linkError);
1366  hadErrBits.set(LVL1::DataError::Parity, jetEle.hadParity());
1367  hadErrBits.set(LVL1::DataError::LinkDown, linkError >> 1);
1368  je->addSlice(slice, jetEle.emData(), jetEle.hadData(),
1369  emErrBits.error(), hadErrBits.error(),
1370  linkError);
1371  }
1372  } else if (verbose && jetEle.data()) {
1373  msg(MSG::VERBOSE) << "Non-zero data but no channel mapping for channel "
1374  << chan << endmsg;
1375  msg(MSG::DEBUG);
1376  }
1377  } else if (verbose) {
1378  msg(MSG::VERBOSE) << "No jet element data for channel "
1379  << chan << " slice " << slice << endmsg;
1380  msg(MSG::DEBUG);
1381  }
1382  }
1383  } else if (data.m_collection == JET_HITS) {
1384  JetHitsData& jhdata = static_cast<JetHitsData&>(data);
1385 
1386  // Get jet hits
1387 
1388  const unsigned int hits = subBlock->jetHits(slice);
1389  if (hits) {
1390  LVL1::JEMHits* jh = findJetHits(jhdata, crate, module);
1391  if ( ! jh ) { // create new jet hits
1392  ld.hitsVec.assign(timeslices, 0);
1393  ld.hitsVec[slice] = hits;
1394  auto jhp =
1395  std::make_unique<LVL1::JEMHits>(swCrate, module, ld.hitsVec, trigJem);
1396  jhdata.m_hitsMap.insert(std::make_pair(crate * m_modules + module, jhp.get()));
1397  jhdata.m_hitCollection->push_back(std::move(jhp));
1398  } else {
1399  ld.hitsVec = jh->JetHitsVec();
1400  const int nsl = ld.hitsVec.size();
1401  if (timeslices != nsl) {
1402  if (debug) {
1403  msg() << "Inconsistent number of slices in sub-blocks"
1404  << endmsg;
1405  }
1407  return;
1408  }
1409  if (ld.hitsVec[slice] != 0) {
1410  if (debug) msg() << "Duplicate data for slice "
1411  << slice << endmsg;
1413  return;
1414  }
1415  ld.hitsVec[slice] = hits;
1416  jh->addJetHits(ld.hitsVec);
1417  }
1418  } else if (verbose) {
1419  msg(MSG::VERBOSE) << "No jet hits data for crate/module/slice "
1420  << hwCrate << "/" << module << "/" << slice
1421  << endmsg;
1422  msg(MSG::DEBUG);
1423  }
1424  } else if (data.m_collection == ENERGY_SUMS) {
1425  EnergySumsData& sumdata = static_cast<EnergySumsData&>(data);
1426 
1427  // Get energy subsums
1428 
1429  const unsigned int ex = subBlock->ex(slice);
1430  const unsigned int ey = subBlock->ey(slice);
1431  const unsigned int et = subBlock->et(slice);
1432  if (ex | ey | et) {
1433  LVL1::JEMEtSums* sums = findEnergySums(sumdata, crate, module);
1434  if ( ! sums ) { // create new energy sums
1435  ld.exVec.assign(timeslices, 0);
1436  ld.eyVec.assign(timeslices, 0);
1437  ld.etVec.assign(timeslices, 0);
1438  ld.exVec[slice] = ex;
1439  ld.eyVec[slice] = ey;
1440  ld.etVec[slice] = et;
1441  auto sumsp =
1442  std::make_unique<LVL1::JEMEtSums>(swCrate, module, ld.etVec, ld.exVec, ld.eyVec,
1443  trigJem);
1444  sumdata.m_etMap.insert(std::make_pair(crate * m_modules + module, sumsp.get()));
1445  sumdata.m_etCollection->push_back(std::move(sumsp));
1446  } else {
1447  ld.exVec = sums->ExVec();
1448  ld.eyVec = sums->EyVec();
1449  ld.etVec = sums->EtVec();
1450  const int nsl = ld.exVec.size();
1451  if (timeslices != nsl) {
1452  if (debug) {
1453  msg() << "Inconsistent number of slices in sub-blocks"
1454  << endmsg;
1455  }
1457  return;
1458  }
1459  if (ld.exVec[slice] != 0 || ld.eyVec[slice] != 0 || ld.etVec[slice] != 0) {
1460  if (debug) msg() << "Duplicate data for slice "
1461  << slice << endmsg;
1463  return;
1464  }
1465  ld.exVec[slice] = ex;
1466  ld.eyVec[slice] = ey;
1467  ld.etVec[slice] = et;
1468  sums->addEx(ld.exVec);
1469  sums->addEy(ld.eyVec);
1470  sums->addEt(ld.etVec);
1471  }
1472  } else if (verbose) {
1473  msg(MSG::VERBOSE) << "No energy sums data for crate/module/slice "
1474  << hwCrate << "/" << module << "/" << slice
1475  << endmsg;
1476  msg(MSG::DEBUG);
1477  }
1478  }
1479  }
1480  return;
1481 }
1482 
1483 // Find a jet element given eta, phi
1484 
1485 const
1487  const double phi,
1488  const ConstJetElementMap& jeMap,
1489  LVL1::JetElementKey& elementKey) const
1490 {
1491  const unsigned int key = elementKey.jeKey(phi, eta);
1492  ConstJetElementMap::const_iterator mapIter = jeMap.find(key);
1493  if (mapIter != jeMap.end()) return mapIter->second;
1494  return nullptr;
1495 }
1496 
1498  const double eta,
1499  const double phi,
1500  LVL1::JetElementKey& elementKey) const
1501 {
1502  const unsigned int key = elementKey.jeKey(phi, eta);
1503  JetElementMap::const_iterator mapIter = data.m_jeMap.find(key);
1504  if (mapIter != data.m_jeMap.end()) return mapIter->second;
1505  return nullptr;
1506 }
1507 
1508 // Find jet hits for given crate, module
1509 
1510 const
1512  const int module,
1513  const ConstJetHitsMap& hitsMap) const
1514 {
1515  ConstJetHitsMap::const_iterator mapIter = hitsMap.find(crate * m_modules + module);
1516  if (mapIter != hitsMap.end()) return mapIter->second;
1517  return nullptr;
1518 }
1519 
1521  const int crate,
1522  const int module) const
1523 {
1524  JetHitsMap::const_iterator mapIter = data.m_hitsMap.find(crate * m_modules + module);
1525  if (mapIter != data.m_hitsMap.end()) return mapIter->second;
1526  return nullptr;
1527 }
1528 
1529 // Find energy sums for given crate, module
1530 
1531 const
1533  const int module,
1534  const ConstEnergySumsMap& etMap) const
1535 {
1536  ConstEnergySumsMap::const_iterator mapIter = etMap.find(crate * m_modules + module);
1537  if (mapIter != etMap.end()) return mapIter->second;
1538  return nullptr;
1539 }
1540 
1542  const int crate,
1543  const int module) const
1544 {
1545  EnergySumsMap::const_iterator mapIter = data.m_etMap.find(crate * m_modules + module);
1546  if (mapIter != data.m_etMap.end()) return mapIter->second;
1547  return nullptr;
1548 }
1549 
1550 // Find CMM hits for given crate, dataID
1551 
1552 const
1554  const int dataID,
1555  const ConstCmmHitsMap& cmmHitsMap) const
1556 {
1557  ConstCmmHitsMap::const_iterator mapIter = cmmHitsMap.find(crate * 100 + dataID);
1558  if (mapIter != cmmHitsMap.end()) return mapIter->second;
1559  return nullptr;
1560 }
1561 
1563  const int crate,
1564  const int dataID) const
1565 {
1566  CmmHitsMap::const_iterator mapIter = data.m_cmmHitsMap.find(crate * 100 + dataID);
1567  if (mapIter != data.m_cmmHitsMap.end()) return mapIter->second;
1568  return nullptr;
1569 }
1570 
1571 // Find CMM energy sums for given crate, module, dataID
1572 
1573 const
1575  const int dataID,
1576  const ConstCmmSumsMap& cmmEtMap) const
1577 {
1578  ConstCmmSumsMap::const_iterator mapIter = cmmEtMap.find(crate * 100 + dataID);
1579  if (mapIter != cmmEtMap.end()) return mapIter->second;
1580  return nullptr;
1581 }
1582 
1584  const int crate,
1585  const int dataID) const
1586 {
1587  CmmSumsMap::const_iterator mapIter = data.m_cmmEtMap.find(crate * 100 + dataID);
1588  if (mapIter != data.m_cmmEtMap.end()) return mapIter->second;
1589  return nullptr;
1590 }
1591 
1592 // Set up jet element map
1593 
1595  const jeCollection,
1596  ConstJetElementMap& jeMap,
1597  LVL1::JetElementKey& elementKey) const
1598 {
1599  jeMap.clear();
1600  if (jeCollection) {
1602  JetElementCollection::const_iterator pose = jeCollection->end();
1603  for (; pos != pose; ++pos) {
1604  const LVL1::JetElement* const je = *pos;
1605  const unsigned int key = elementKey.jeKey(je->phi(), je->eta());
1606  jeMap.insert(std::make_pair(key, je));
1607  }
1608  }
1609 }
1610 
1611 // Set up jet hits map
1612 
1614  const hitCollection,
1615  ConstJetHitsMap& hitsMap) const
1616 {
1617  hitsMap.clear();
1618  if (hitCollection) {
1619  JetHitsCollection::const_iterator pos = hitCollection->begin();
1620  JetHitsCollection::const_iterator pose = hitCollection->end();
1621  for (; pos != pose; ++pos) {
1622  const LVL1::JEMHits* const hits = *pos;
1623  const int crate = hits->crate() - m_crateOffsetSw;
1624  const int key = m_modules * crate + hits->module();
1625  hitsMap.insert(std::make_pair(key, hits));
1626  }
1627  }
1628 }
1629 
1630 // Set up energy sums map
1631 
1633  const etCollection,
1634  ConstEnergySumsMap& etMap) const
1635 {
1636  etMap.clear();
1637  if (etCollection) {
1639  EnergySumsCollection::const_iterator pose = etCollection->end();
1640  for (; pos != pose; ++pos) {
1641  const LVL1::JEMEtSums* const sums = *pos;
1642  const int crate = sums->crate() - m_crateOffsetSw;
1643  const int key = m_modules * crate + sums->module();
1644  etMap.insert(std::make_pair(key, sums));
1645  }
1646  }
1647 }
1648 
1649 // Set up CMM hits map
1650 
1652  const hitCollection,
1653  ConstCmmHitsMap& cmmHitsMap) const
1654 {
1655  cmmHitsMap.clear();
1656  if (hitCollection) {
1657  CmmHitsCollection::const_iterator pos = hitCollection->begin();
1658  CmmHitsCollection::const_iterator pose = hitCollection->end();
1659  for (; pos != pose; ++pos) {
1660  const LVL1::CMMJetHits* const hits = *pos;
1661  const int crate = hits->crate() - m_crateOffsetSw;
1662  const int key = crate * 100 + hits->dataID();
1663  cmmHitsMap.insert(std::make_pair(key, hits));
1664  }
1665  }
1666 }
1667 
1668 // Set up CMM energy sums map
1669 
1671  const etCollection,
1672  ConstCmmSumsMap& cmmEtMap) const
1673 {
1674  cmmEtMap.clear();
1675  if (etCollection) {
1676  CmmSumsCollection::const_iterator pos = etCollection->begin();
1677  CmmSumsCollection::const_iterator pose = etCollection->end();
1678  for (; pos != pose; ++pos) {
1679  const LVL1::CMMEtSums* const sums = *pos;
1680  const int crate = sums->crate() - m_crateOffsetSw;
1681  const int key = crate * 100 + sums->dataID();
1682  cmmEtMap.insert(std::make_pair(key, sums));
1683  }
1684  }
1685 }
1686 
1687 // Get number of slices and triggered slice offset for next slink
1688 
1689 bool JepByteStreamTool::slinkSlices(const int crate, const int module,
1690  const int modulesPerSlink,
1691  int& timeslices,
1692  int& trigJem,
1693  const ConstJetElementMap& jeMap,
1694  const ConstJetHitsMap& hitsMap,
1695  const ConstEnergySumsMap& etMap,
1696  const ConstCmmHitsMap& cmmHitsMap,
1697  const ConstCmmSumsMap& cmmEtMap,
1698  LVL1::JetElementKey& elementKey) const
1699 {
1700  int slices = -1;
1701  int trigJ = m_dfltSlices / 2;
1702  for (int mod = module; mod < module + modulesPerSlink; ++mod) {
1703  for (int chan = 0; chan < m_channels; ++chan) {
1704  double eta = 0.;
1705  double phi = 0.;
1706  int layer = 0;
1707  if ( !m_jemMaps->mapping(crate, mod, chan, eta, phi, layer)) continue;
1708  const LVL1::JetElement* const je = findJetElement(eta, phi, jeMap, elementKey);
1709  if ( !je ) continue;
1710  const int numdat = 5;
1711  std::vector<int> sums(numdat);
1712  std::vector<int> sizes(numdat);
1713  sums[0] = std::accumulate((je->emEnergyVec()).begin(),
1714  (je->emEnergyVec()).end(), 0);
1715  sums[1] = std::accumulate((je->hadEnergyVec()).begin(),
1716  (je->hadEnergyVec()).end(), 0);
1717  sums[2] = std::accumulate((je->emErrorVec()).begin(),
1718  (je->emErrorVec()).end(), 0);
1719  sums[3] = std::accumulate((je->hadErrorVec()).begin(),
1720  (je->hadErrorVec()).end(), 0);
1721  sums[4] = std::accumulate((je->linkErrorVec()).begin(),
1722  (je->linkErrorVec()).end(), 0);
1723  sizes[0] = (je->emEnergyVec()).size();
1724  sizes[1] = (je->hadEnergyVec()).size();
1725  sizes[2] = (je->emErrorVec()).size();
1726  sizes[3] = (je->hadErrorVec()).size();
1727  sizes[4] = (je->linkErrorVec()).size();
1728  const int peak = je->peak();
1729  for (int i = 0; i < numdat; ++i) {
1730  if (sums[i] == 0) continue;
1731  if (slices < 0) {
1732  slices = sizes[i];
1733  trigJ = peak;
1734  } else if (slices != sizes[i] || trigJ != peak) return false;
1735  }
1736  }
1737  const LVL1::JEMHits* const hits = findJetHits(crate, mod, hitsMap);
1738  if (hits) {
1739  const unsigned int sum = std::accumulate((hits->JetHitsVec()).begin(),
1740  (hits->JetHitsVec()).end(), 0);
1741  if (sum) {
1742  const int size = (hits->JetHitsVec()).size();
1743  const int peak = hits->peak();
1744  if (slices < 0) {
1745  slices = size;
1746  trigJ = peak;
1747  } else if (slices != size || trigJ != peak) return false;
1748  }
1749  }
1750  const LVL1::JEMEtSums* const et = findEnergySums(crate, mod, etMap);
1751  if (et) {
1752  const int numdat = 3;
1753  std::vector<unsigned int> sums(numdat);
1754  std::vector<int> sizes(numdat);
1755  sums[0] = std::accumulate((et->ExVec()).begin(),
1756  (et->ExVec()).end(), 0);
1757  sums[1] = std::accumulate((et->EyVec()).begin(),
1758  (et->EyVec()).end(), 0);
1759  sums[2] = std::accumulate((et->EtVec()).begin(),
1760  (et->EtVec()).end(), 0);
1761  sizes[0] = (et->ExVec()).size();
1762  sizes[1] = (et->EyVec()).size();
1763  sizes[2] = (et->EtVec()).size();
1764  const int peak = et->peak();
1765  for (int i = 0; i < numdat; ++i) {
1766  if (sums[i] == 0) continue;
1767  if (slices < 0) {
1768  slices = sizes[i];
1769  trigJ = peak;
1770  } else if (slices != sizes[i] || trigJ != peak) return false;
1771  }
1772  }
1773  }
1774  // CMM last slink of crate
1775  if (module / modulesPerSlink == m_slinks - 1) {
1776  const int maxDataID1 = LVL1::CMMJetHits::MAXID;
1777  const int maxDataID2 = LVL1::CMMEtSums::MAXID;
1778  const int maxDataID = (maxDataID1 > maxDataID2) ? maxDataID1 : maxDataID2;
1779  for (int dataID = 0; dataID < maxDataID; ++dataID) {
1780  const int numdat = 6;
1781  std::vector<unsigned int> sums(numdat);
1782  std::vector<int> sizes(numdat);
1783  const LVL1::CMMJetHits* hits = 0;
1784  if (dataID < maxDataID1) hits = findCmmHits(crate, dataID, cmmHitsMap);
1785  if (hits) {
1786  sums[0] = std::accumulate((hits->HitsVec()).begin(),
1787  (hits->HitsVec()).end(), 0);
1788  sums[1] = std::accumulate((hits->ErrorVec()).begin(),
1789  (hits->ErrorVec()).end(), 0);
1790  sizes[0] = (hits->HitsVec()).size();
1791  sizes[1] = (hits->ErrorVec()).size();
1792  const int peak = hits->peak();
1793  for (int i = 0; i < 2; ++i) {
1794  if (sums[i] == 0) continue;
1795  if (slices < 0) {
1796  slices = sizes[i];
1797  trigJ = peak;
1798  } else if (slices != sizes[i] || trigJ != peak) return false;
1799  }
1800  }
1801  const LVL1::CMMEtSums* et = 0;
1802  if (dataID < maxDataID2) et = findCmmSums(crate, dataID, cmmEtMap);
1803  if (et) {
1804  sums[0] = std::accumulate((et->ExVec()).begin(),
1805  (et->ExVec()).end(), 0);
1806  sums[1] = std::accumulate((et->EyVec()).begin(),
1807  (et->EyVec()).end(), 0);
1808  sums[2] = std::accumulate((et->EtVec()).begin(),
1809  (et->EtVec()).end(), 0);
1810  sums[3] = std::accumulate((et->ExErrorVec()).begin(),
1811  (et->ExErrorVec()).end(), 0);
1812  sums[4] = std::accumulate((et->EyErrorVec()).begin(),
1813  (et->EyErrorVec()).end(), 0);
1814  sums[5] = std::accumulate((et->EtErrorVec()).begin(),
1815  (et->EtErrorVec()).end(), 0);
1816  sizes[0] = (et->ExVec()).size();
1817  sizes[1] = (et->EyVec()).size();
1818  sizes[2] = (et->EtVec()).size();
1819  sizes[3] = (et->ExErrorVec()).size();
1820  sizes[4] = (et->EyErrorVec()).size();
1821  sizes[5] = (et->EtErrorVec()).size();
1822  const int peak = et->peak();
1823  for (int i = 0; i < numdat; ++i) {
1824  if (sums[i] == 0) continue;
1825  if (slices < 0) {
1826  slices = sizes[i];
1827  trigJ = peak;
1828  } else if (slices != sizes[i] || trigJ != peak) return false;
1829  }
1830  }
1831  }
1832  }
1833  if (slices < 0) slices = m_dfltSlices;
1834  timeslices = slices;
1835  trigJem = trigJ;
1836  return true;
1837 }
1838 
1839 } // end namespace
eformat
Definition: L1CaloBsDecoderUtil.h:11
LVL1BS::CmmEnergySubBlock::missingEtSigHits
unsigned int missingEtSigHits(int slice) const
Return Missing-ET-Sig Hits map.
Definition: CmmEnergySubBlock.cxx:187
LVL1BS::CmmEnergySubBlock::setSumEtHits
void setSumEtHits(int slice, unsigned int map)
Store Sum-Et Hits map.
Definition: CmmEnergySubBlock.cxx:263
LVL1BS::CmmSubBlock::cmmType
static CmmFirmwareCode cmmType(uint32_t word)
CMM differentiation (CMM_CP, CMM_JET, or CMM_ENERGY)
Definition: CmmSubBlock.cxx:60
LVL1BS::CmmEnergySubBlock::exError
int exError(int slice, int source) const
Return Ex subsum error for given JEM or source ID.
Definition: CmmEnergySubBlock.cxx:110
LVL1::CMMJetHits::LOCAL_FORWARD
@ LOCAL_FORWARD
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMJetHits.h:36
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
LVL1BS::L1CaloSrcIdMap::slink
int slink(uint32_t code) const
Return slink from unpacked moduleID.
Definition: L1CaloSrcIdMap.cxx:73
LVL1BS::JepByteStreamTool::JET_ELEMENTS
@ JET_ELEMENTS
Definition: JepByteStreamTool.h:127
LVL1::JEPBSCollection::JetHits
const DataVector< JEMHits > * JetHits() const
Return pointer to hit sums collection.
Definition: JEPBSCollection.h:66
et
Extra patterns decribing particle interation process.
LVL1BS::CmmJetSubBlock::TOTAL_MAIN
@ TOTAL_MAIN
Definition: CmmJetSubBlock.h:26
LVL1::DataError::LinkDown
@ LinkDown
Definition: DataError.h:31
LVL1BS::L1CaloUserHeader
L1Calo User Header class.
Definition: L1CaloUserHeader.h:20
JEMEtSums.h
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
LVL1BS::JemJetElement
JEM jet element dataword class.
Definition: JemJetElement.h:20
LVL1BS::CmmSubBlock::RIGHT
@ RIGHT
Definition: CmmSubBlock.h:28
LVL1BS::L1CaloSubBlock::ERROR_MISSING_HEADER
@ ERROR_MISSING_HEADER
Definition: L1CaloSubBlock.h:33
LVL1BS::CmmSubBlock::CMM_JET
@ CMM_JET
Definition: CmmSubBlock.h:25
LVL1BS::JemSubBlock::setEnergySubsums
void setEnergySubsums(int slice, unsigned int ex, unsigned int ey, unsigned int et)
Store energy subsum data.
Definition: JemSubBlock.cxx:111
LVL1BS::JepByteStreamTool::JetHitsData::m_hitsMap
JetHitsMap m_hitsMap
Definition: JepByteStreamTool.h:167
LVL1BS::CmmEnergySubBlock::et
unsigned int et(int slice, int source) const
Return Et subsum for given JEM or source ID.
Definition: CmmEnergySubBlock.cxx:95
LVL1BS::JepByteStreamTool::m_subDetector
const eformat::SubDetector m_subDetector
Sub-detector type.
Definition: JepByteStreamTool.h:286
LVL1::JEPBSCollection
Jet/Energy Processor container for writing bytestream.
Definition: JEPBSCollection.h:26
LVL1BS::JepByteStreamTool::m_dataFormat
int m_dataFormat
Property: Data compression format.
Definition: JepByteStreamTool.h:270
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
LVL1::DataError
Error data.
Definition: DataError.h:27
LVL1::JetElement::emEnergyVec
const std::vector< int > & emEnergyVec() const
Return data for all slices.
Definition: JetElement.cxx:245
JEPBSCollection.h
LVL1::CMMEtSums::SUM_ET_MAP
@ SUM_ET_MAP
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMEtSums.h:37
LVL1BS::L1CaloSubBlock::unpackErrorCode
int unpackErrorCode() const
Return the unpacking error code.
Definition: L1CaloSubBlock.h:343
LVL1BS::JemSubBlock::jetElement
JemJetElement jetElement(int slice, int channel) const
Return jet element for given channel.
Definition: JemSubBlock.cxx:129
LVL1::JetElement::addSlice
void addSlice(int slice, int emEnergy, int hadEnergy, int emError, int hadError, int linkError)
add data for one timeslice.
Definition: JetElement.cxx:174
FullEventAssembler
Template class for assembling a full atlas raw event from subfragments.
Definition: FullEventAssembler.h:40
LVL1BS::JepByteStreamTool::convert
StatusCode convert(const std::string &sgKey, const IROBDataProviderSvc::VROBFRAG &robFrags, DataVector< LVL1::JetElement > *jeCollection) const
Convert ROB fragments to jet elements.
Definition: JepByteStreamTool.cxx:126
LVL1BS::JepByteStreamTool::JepByteStreamToolData
Definition: JepByteStreamTool.h:150
LVL1::JetElementKeyBase::jeKey
virtual unsigned int jeKey(const xAOD::TriggerTower &tower)
returns key of passed tower
Definition: JetElementKeyBase.cxx:157
LVL1BS::CmmSubBlock::CRATE
@ CRATE
Definition: CmmSubBlock.h:27
xAOD::et
et
Definition: TrigEMCluster_v1.cxx:25
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LVL1BS::ModifySlices::peak
static int peak(int oldPeak, int oldSlices, int newSlices)
Return new triggered slice offset.
Definition: ModifySlices.cxx:12
index
Definition: index.py:1
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
LVL1::CMMEtSums
CMMEtSums object stores Et sums from the Energy CMMs.
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMEtSums.h:33
LVL1BS::L1CaloSubBlock::ERROR_DUPLICATE_ROB
@ ERROR_DUPLICATE_ROB
Definition: L1CaloSubBlock.h:31
LVL1BS::JepByteStreamTool::CMM_HITS
@ CMM_HITS
Definition: JepByteStreamTool.h:128
LVL1::JetElement::peak
int peak() const
return triggered slice offset
Definition: JetElement.cxx:240
LVL1BS::JemSubBlock::jetHits
unsigned int jetHits(int slice) const
Return jet hit counts.
Definition: JemSubBlock.cxx:141
accumulate
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
Definition: FPGATrackSimMatrixAccumulator.cxx:22
LVL1BS::JemSubBlock::timeslices
int timeslices() const
Return number of timeslices.
Definition: JemSubBlock.cxx:185
LVL1BS::L1CaloUserHeader::jepCmm
int jepCmm() const
Definition: L1CaloUserHeader.h:99
L1CaloUserHeader.h
LVL1::CMMEtSums::LOCAL
@ LOCAL
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMEtSums.h:36
LVL1BS::CmmSubBlock::setCmmHeader
void setCmmHeader(int version, int format, int slice, int crate, int summing, int firmware, int position, int timeslices)
Store CMM header.
Definition: CmmSubBlock.cxx:33
LVL1BS::CmmSubBlock::cmmBlock
static bool cmmBlock(uint32_t word)
Determine if header word corresponds to CMM.
Definition: CmmSubBlock.cxx:84
LVL1BS::CmmJetSubBlock::jetEtMap
unsigned int jetEtMap(int slice) const
Return jet ET map.
Definition: CmmJetSubBlock.cxx:88
CMMJetHits.h
LVL1BS::L1CaloUserHeader::header
uint32_t header() const
Return packed header.
Definition: L1CaloUserHeader.h:89
LVL1BS::JepByteStreamTool::~JepByteStreamTool
virtual ~JepByteStreamTool()
Definition: JepByteStreamTool.cxx:89
LVL1BS::JepByteStreamTool::findCmmSums
const LVL1::CMMEtSums * findCmmSums(int crate, int dataID, const ConstCmmSumsMap &cmmEtMap) const
Find CMM energy sums for given crate, data ID.
Definition: JepByteStreamTool.cxx:1574
LVL1BS::JemJetElement::emParity
int emParity() const
Definition: JemJetElement.h:81
LVL1BS::JepByteStreamTool::setupHitsMap
void setupHitsMap(const JetHitsCollection *hitCollection, ConstJetHitsMap &hitsMap) const
Set up jet hits map.
Definition: JepByteStreamTool.cxx:1613
LVL1BS::JemJetElement::hadData
int hadData() const
Definition: JemJetElement.h:76
LVL1BS::L1CaloSubBlock::write
void write(FullEventAssembler< L1CaloSrcIdMap >::RODDATA *theROD) const
Output complete packed sub-block to ROD vector.
Definition: L1CaloSubBlock.cxx:165
LVL1BS::JemSubBlock
Sub-Block class for JEM data.
Definition: JemSubBlock.h:25
LVL1BS::JepByteStreamTool::ConstJetElementMap
std::map< unsigned int, const LVL1::JetElement * > ConstJetElementMap
Definition: JepByteStreamTool.h:136
LVL1BS::JepByteStreamTool::decodeCmmEnergy
void decodeCmmEnergy(CmmEnergySubBlock *subBlock, int trigCmm, CmmSumsData &data, LocalData &ld) const
Unpack CMM-Energy sub-block.
Definition: JepByteStreamTool.cxx:797
LVL1::CMMEtSums::ExErrorVec
const std::vector< int > & ExErrorVec() const
returns module Ex errors
Definition: CMMEtSums.cxx:140
LVL1BS::CmmSubBlock::timeslices
int timeslices() const
Definition: CmmSubBlock.cxx:48
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
LVL1BS::L1CaloSrcIdMap::getRobID
uint32_t getRobID(uint32_t rod_id) const
Make a ROB Source ID from a ROD source ID.
Definition: L1CaloSrcIdMap.cxx:32
LVL1BS::JemJetElement::hadParity
int hadParity() const
Definition: JemJetElement.h:86
ModifySlices.h
LVL1::JEMEtSums::EyVec
const std::vector< unsigned int > & EyVec() const
returns module Ey sum
Definition: JEMEtSums.cxx:103
LVL1BS::CmmEnergySubBlock::missingEtHits
unsigned int missingEtHits(int slice) const
Return Missing-ET Hits map.
Definition: CmmEnergySubBlock.cxx:164
LVL1BS::L1CaloSubBlock::read
OFFLINE_FRAGMENTS_NAMESPACE::PointerType read(const OFFLINE_FRAGMENTS_NAMESPACE::PointerType beg, const OFFLINE_FRAGMENTS_NAMESPACE::PointerType end)
Input complete packed sub-block from ROD array.
Definition: L1CaloSubBlock.cxx:118
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
LVL1BS::L1CaloSubBlock::NEUTRAL
@ NEUTRAL
Definition: L1CaloSubBlock.h:28
LVL1::JEMEtSums::module
int module() const
returns module number
Definition: JEMEtSums.cxx:73
LVL1BS::JepByteStreamTool::ROBIterator
IROBDataProviderSvc::VROBFRAG::const_iterator ROBIterator
Definition: JepByteStreamTool.h:145
LVL1::CMMEtSums::EyErrorVec
const std::vector< int > & EyErrorVec() const
returns module Ey errors
Definition: CMMEtSums.cxx:145
CmmJetSubBlock.h
LVL1BS::L1CaloSubBlock::slice
int slice() const
Definition: L1CaloSubBlock.h:258
LVL1::CMMEtSums::REMOTE
@ REMOTE
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMEtSums.h:36
LVL1BS::CmmEnergySubBlock::eyError
int eyError(int slice, int source) const
Return Ey subsum error for given JEM or source ID.
Definition: CmmEnergySubBlock.cxx:128
LVL1::CMMJetHits::TOTAL_MAIN
@ TOTAL_MAIN
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMJetHits.h:35
LVL1BS::JepByteStreamTool::m_crateOffsetSw
int m_crateOffsetSw
Property: Software crate number offset.
Definition: JepByteStreamTool.h:266
LVL1BS::CmmEnergySubBlock::TOTAL
@ TOTAL
Definition: CmmEnergySubBlock.h:26
LVL1BS::CmmEnergySubBlock::REMOTE
@ REMOTE
Definition: CmmEnergySubBlock.h:26
LVL1::JEMEtSums::addEy
void addEy(const std::vector< unsigned int > &Ey)
Update Ey sum.
Definition: JEMEtSums.cxx:123
LVL1::CMMJetHits::REMOTE_FORWARD
@ REMOTE_FORWARD
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMJetHits.h:36
LVL1BS::L1CaloSubBlock::HEADER
@ HEADER
Definition: L1CaloSubBlock.h:27
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
LVL1BS::CmmJetSubBlock::LOCAL_FORWARD
@ LOCAL_FORWARD
Definition: CmmJetSubBlock.h:27
LVL1BS::L1CaloSubBlock::crate
int crate() const
Definition: L1CaloSubBlock.h:263
LVL1BS::JepByteStreamTool::m_crates
const int m_crates
Number of crates.
Definition: JepByteStreamTool.h:274
LVL1::CMMEtSums::dataID
int dataID() const
returns data ID
Definition: CMMEtSums.cxx:85
LVL1BS::JepByteStreamTool::m_jemMaps
ToolHandle< LVL1::IL1CaloMappingTool > m_jemMaps
Property: Channel mapping tool.
Definition: JepByteStreamTool.h:259
LVL1::CMMEtSums::MAXID
@ MAXID
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMEtSums.h:37
LVL1BS::JepByteStreamTool::initialize
virtual StatusCode initialize()
Definition: JepByteStreamTool.cxx:96
LVL1::DataError::SubStatusWord
@ SubStatusWord
Definition: DataError.h:44
LVL1BS::JepByteStreamTool::setupCmmEtMap
void setupCmmEtMap(const CmmSumsCollection *enCollection, ConstCmmSumsMap &cmmEtMap) const
Set up CMM energy sums map.
Definition: JepByteStreamTool.cxx:1670
LVL1::JetElement::hadEnergyVec
const std::vector< int > & hadEnergyVec() const
return Had energy vector reference (all timeslices)
Definition: JetElement.cxx:250
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
CxxUtils::vec
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
Definition: vec.h:207
python.PyAthena.module
module
Definition: PyAthena.py:131
LVL1BS::JepByteStreamTool::JetHitsData
Definition: JepByteStreamTool.h:163
LVL1BS::JepByteStreamTool::EnergySumsData::m_etCollection
EnergySumsCollection *const m_etCollection
Definition: JepByteStreamTool.h:173
LVL1BS::JepByteStreamTool::decodeCmmJet
void decodeCmmJet(CmmJetSubBlock *subBlock, int trigCmm, CmmHitsData &data, LocalData &ld) const
Unpack CMM-Jet sub-block.
Definition: JepByteStreamTool.cxx:1091
LVL1BS::JepByteStreamTool::CMM_SUMS
@ CMM_SUMS
Definition: JepByteStreamTool.h:128
LVL1BS::L1CaloSubBlock::ERROR_ROD_ID
@ ERROR_ROD_ID
Definition: L1CaloSubBlock.h:31
LVL1BS::JepByteStreamTool::findJetHits
const LVL1::JEMHits * findJetHits(int crate, int module, const ConstJetHitsMap &hitsMap) const
Find jet hits for given crate, module.
Definition: JepByteStreamTool.cxx:1511
LVL1BS::CmmJetSubBlock::REMOTE_FORWARD
@ REMOTE_FORWARD
Definition: CmmJetSubBlock.h:27
LVL1::JetElement
Jet elements are the inputs to the Jet, ETmiss and ETsum triggers.
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/JetElement.h:43
LVL1BS::ModifySlices::data
static void data(const std::vector< int > &oldVec, std::vector< int > &newVec, int newSlices)
Return modified data vector<int>
Definition: ModifySlices.cxx:20
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
LVL1BS::CmmJetSubBlock::clear
void clear()
Clear all data.
Definition: CmmJetSubBlock.cxx:47
maskDeadModules.mod
mod
Definition: maskDeadModules.py:36
LVL1::JEMEtSums::crate
int crate() const
returns crate number
Definition: JEMEtSums.cxx:68
LVL1BS::CmmEnergySubBlock::clear
void clear()
Clear all data.
Definition: CmmEnergySubBlock.cxx:57
LVL1BS::L1CaloSubBlock::ERROR_CRATE_NUMBER
@ ERROR_CRATE_NUMBER
Definition: L1CaloSubBlock.h:34
LVL1::DataError::Overflow
@ Overflow
Definition: DataError.h:31
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
LVL1BS::CmmJetSubBlock::LOCAL_MAIN
@ LOCAL_MAIN
Definition: CmmJetSubBlock.h:26
LVL1BS::JepByteStreamTool::setupEtMap
void setupEtMap(const EnergySumsCollection *enCollection, ConstEnergySumsMap &etMap) const
Set up energy sums map.
Definition: JepByteStreamTool.cxx:1632
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:182
LVL1BS::JepByteStreamTool::JetHitsData::m_hitCollection
JetHitsCollection *const m_hitCollection
Definition: JepByteStreamTool.h:166
perfmonmt-refit.slice
slice
Definition: perfmonmt-refit.py:52
LVL1::CMMEtSums::addEt
void addEt(const std::vector< unsigned int > &Et, const std::vector< int > &EtError)
Add data to existing objects.
Definition: CMMEtSums.cxx:150
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
LVL1BS::JemSubBlock::setJetHits
void setJetHits(int slice, unsigned int hits)
Store jet hit counts.
Definition: JemSubBlock.cxx:93
lumiFormat.i
int i
Definition: lumiFormat.py:85
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
LVL1::JEPBSCollection::JetElements
const DataVector< JetElement > * JetElements() const
Return pointer to jet element collection.
Definition: JEPBSCollection.h:61
L1CaloSubBlock.h
LVL1BS::L1CaloSubBlock::ERROR_DUPLICATE_DATA
@ ERROR_DUPLICATE_DATA
Definition: L1CaloSubBlock.h:35
LVL1::JEMHits::JetHitsVec
const std::vector< unsigned int > & JetHitsVec() const
returns jet hits
Definition: JEMHits.cxx:75
LVL1BS::CmmSubBlock::cmmFirmware
int cmmFirmware() const
Definition: CmmSubBlock.h:68
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
CmmSubBlock.h
LVL1::CMMEtSums::EyVec
const std::vector< unsigned int > & EyVec() const
returns module Ey sum
Definition: CMMEtSums.cxx:130
LVL1::DataError::set
void set(ErrorBit bit, int value=1)
Set an error bit or data.
Definition: DataError.cxx:28
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
LVL1BS::L1CaloSrcIdMap::crate
int crate(uint32_t code) const
Return crate from unpacked moduleID.
Definition: L1CaloSrcIdMap.cxx:57
LVL1BS::CmmEnergySubBlock::setMissingEtSigHits
void setMissingEtSigHits(int slice, unsigned int map)
Store Missing-ET-Sig Hits map.
Definition: CmmEnergySubBlock.cxx:279
LVL1::JEMHits::addJetHits
void addJetHits(const std::vector< unsigned int > &hits)
Set Jet hits.
Definition: JEMHits.cxx:85
LVL1::CMMJetHits::MAXID
@ MAXID
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMJetHits.h:37
master.flag
bool flag
Definition: master.py:29
LVL1BS::JepByteStreamTool::ConstJetHitsMap
std::map< int, const LVL1::JEMHits * > ConstJetHitsMap
Definition: JepByteStreamTool.h:138
LVL1BS::L1CaloUserHeader::jem
int jem() const
Definition: L1CaloUserHeader.h:111
LVL1::CMMJetHits::REMOTE_MAIN
@ REMOTE_MAIN
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMJetHits.h:35
LVL1BS::CmmJetSubBlock::jetHits
unsigned int jetHits(int slice, int source) const
Return jet hit counts for given jem or source ID.
Definition: CmmJetSubBlock.cxx:55
LVL1BS::JepByteStreamTool::JepByteStreamTool
JepByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: JepByteStreamTool.cxx:50
LVL1BS::L1CaloSubBlock::format
int format() const
Definition: L1CaloSubBlock.h:248
test_pyathena.parent
parent
Definition: test_pyathena.py:15
LVL1BS::JepByteStreamTool::JetElementData::m_jeCollection
JetElementCollection *const m_jeCollection
Definition: JepByteStreamTool.h:159
LVL1BS::JepByteStreamTool::m_srcIdMap
const L1CaloSrcIdMap m_srcIdMap
Source ID converter.
Definition: JepByteStreamTool.h:288
CmmEnergySubBlock.h
LVL1BS::JepByteStreamTool::m_slinks
int m_slinks
Property: Number of slinks per crate when writing out bytestream.
Definition: JepByteStreamTool.h:278
python.xAODType.dummy
dummy
Definition: xAODType.py:4
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LVL1BS::L1CaloUserHeader::setVersion
void setVersion(int minorVersion)
Set version flag.
Definition: L1CaloUserHeader.h:176
LVL1BS::JepByteStreamTool::LocalData
Definition: JepByteStreamTool.h:102
LVL1BS::CmmEnergySubBlock::pack
bool pack()
Pack data.
Definition: CmmEnergySubBlock.cxx:295
IROBDataProviderSvc::VROBFRAG
std::vector< const ROBF * > VROBFRAG
Definition: IROBDataProviderSvc.h:27
LVL1BS::L1CaloSubBlock::ERROR_NONE
@ ERROR_NONE
Definition: L1CaloSubBlock.h:31
LVL1BS::CmmEnergySubBlock::sumEtHits
unsigned int sumEtHits(int slice) const
Return Sum-Et Hits map.
Definition: CmmEnergySubBlock.cxx:175
LVL1BS::CmmEnergySubBlock::etError
int etError(int slice, int source) const
Return Et subsum error for given JEM or source ID.
Definition: CmmEnergySubBlock.cxx:146
LVL1::CMMEtSums::EtVec
const std::vector< unsigned int > & EtVec() const
Access multi-slice data.
Definition: CMMEtSums.cxx:120
LVL1::DataError::Parity
@ Parity
Definition: DataError.h:31
LVL1BS::JepByteStreamTool::m_modules
const int m_modules
Number of JEM modules per crate.
Definition: JepByteStreamTool.h:276
DataVector< LVL1::JetElement >
LVL1::CMMEtSums::addEy
void addEy(const std::vector< unsigned int > &Ey, const std::vector< int > &EyError)
Update Ey sum.
Definition: CMMEtSums.cxx:164
LVL1::JetElement::eta
double eta() const
Eta of centre of JetElement.
Definition: JetElement.cxx:82
LVL1BS::L1CaloSubBlock::wordType
static SubBlockWordType wordType(uint32_t word)
Word identification.
Definition: L1CaloSubBlock.cxx:479
FullEventAssembler.h
DataError.h
LVL1::JEPBSCollection::CmmHits
const DataVector< CMMJetHits > * CmmHits() const
Return pointer to CMM hit sums collection.
Definition: JEPBSCollection.h:76
LVL1::DataError::error
int error() const
Return the full error word.
Definition: DataError.h:78
LVL1::CMMJetHits::ET_MAP
@ ET_MAP
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMJetHits.h:37
LVL1::CMMJetHits::LOCAL_MAIN
@ LOCAL_MAIN
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMJetHits.h:35
LVL1::JEPBSCollection::CmmSums
const DataVector< CMMEtSums > * CmmSums() const
Return pointer to CMM energy sums collection.
Definition: JEPBSCollection.h:81
LVL1BS::L1CaloSubBlock::unpackErrorMsg
std::string unpackErrorMsg() const
Return the unpacking error message for printing.
Definition: L1CaloSubBlock.cxx:228
LVL1BS::CmmJetSubBlock::TOTAL_FORWARD
@ TOTAL_FORWARD
Definition: CmmJetSubBlock.h:27
LVL1BS::CmmJetSubBlock::unpack
bool unpack()
Unpack data.
Definition: CmmJetSubBlock.cxx:157
LVL1BS::JepByteStreamTool::ConstEnergySumsMap
std::map< int, const LVL1::JEMEtSums * > ConstEnergySumsMap
Definition: JepByteStreamTool.h:140
LVL1BS::L1CaloSubBlock::version
int version() const
Definition: L1CaloSubBlock.h:243
LVL1BS::CmmJetSubBlock::setJetHits
void setJetHits(int slice, int source, unsigned int hits, int error)
Store jet hit counts and error for given jem or source ID.
Definition: CmmJetSubBlock.cxx:99
LVL1::JetElementKey
The JetElementKey object provides the key for each JetElement depending on its eta,...
Definition: JetElementKey.h:51
LVL1BS::L1CaloSrcIdMap::minorVersion
uint16_t minorVersion() const
Return ROD header minor version to use when writing BS.
Definition: L1CaloSrcIdMap.h:61
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
debug
const bool debug
Definition: MakeUncertaintyPlots.cxx:53
LVL1BS::JepByteStreamTool::CmmHitsData
Definition: JepByteStreamTool.h:177
L1CaloErrorByteStreamTool.h
LVL1BS::L1CaloSubBlock::dataWords
int dataWords() const
Return number of data words.
Definition: L1CaloSubBlock.h:233
LVL1BS::L1CaloUserHeader::setJem
void setJem(int offset)
Definition: L1CaloUserHeader.h:149
LVL1BS::L1CaloSubBlock::subStatus
uint32_t subStatus() const
Return Sub-status word.
Definition: L1CaloSubBlock.h:323
IL1CaloMappingTool.h
LVL1::CMMJetHits::addHits
void addHits(const std::vector< unsigned int > &hits, const std::vector< int > &errors)
Add hits to existing object.
Definition: CMMJetHits.cxx:93
LVL1BS::JepByteStreamTool::setupJeMap
void setupJeMap(const JetElementCollection *jeCollection, ConstJetElementMap &jeMap, LVL1::JetElementKey &elementKey) const
Set up jet element map.
Definition: JepByteStreamTool.cxx:1594
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
LVL1BS::CmmJetSubBlock::setJetEtMap
void setJetEtMap(int slice, unsigned int map)
Store jet ET map.
Definition: CmmJetSubBlock.cxx:121
LVL1::JEMEtSums::ExVec
const std::vector< unsigned int > & ExVec() const
returns module Ex sum
Definition: JEMEtSums.cxx:98
LVL1BS::L1CaloUserHeader::words
int words() const
Return number of header words (should be one)
Definition: L1CaloUserHeader.h:94
LVL1BS::JemSubBlock::et
unsigned int et(int slice) const
Return energy subsum Et.
Definition: JemSubBlock.cxx:174
LVL1::CMMEtSums::crate
int crate() const
Data accessors.
Definition: CMMEtSums.cxx:80
LVL1BS::JepByteStreamTool::decodeJem
void decodeJem(JemSubBlock *subBlock, int trigJem, JepByteStreamToolData &data, LocalData &ld) const
Unpack JEM sub-block.
Definition: JepByteStreamTool.cxx:1263
LVL1::JetElement::hadErrorVec
const std::vector< int > & hadErrorVec() const
return Had error vector reference (all timeslices)
Definition: JetElement.cxx:260
LVL1BS::JepByteStreamTool::findCmmHits
const LVL1::CMMJetHits * findCmmHits(int crate, int dataID, const ConstCmmHitsMap &cmmHitsMap) const
Find CMM hits for given crate, data ID.
Definition: JepByteStreamTool.cxx:1553
PixelModuleFeMask_create_db.payload
string payload
Definition: PixelModuleFeMask_create_db.py:69
LVL1BS::JemJetElement::data
uint32_t data() const
Definition: JemJetElement.h:111
CMMEtSums.h
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
LVL1BS::JepByteStreamTool::m_forceSlices
int m_forceSlices
Property: Force number of slices in bytestream.
Definition: JepByteStreamTool.h:282
LVL1BS::CmmEnergySubBlock::ex
unsigned int ex(int slice, int source) const
Return Ex subsum for given JEM or source ID.
Definition: CmmEnergySubBlock.cxx:65
LVL1BS::JepByteStreamTool::ConstCmmSumsMap
std::map< int, const LVL1::CMMEtSums * > ConstCmmSumsMap
Definition: JepByteStreamTool.h:144
LVL1BS::JepByteStreamTool::makeSourceIDs
std::vector< uint32_t > makeSourceIDs() const
Definition: JepByteStreamTool.cxx:561
LVL1BS::JepByteStreamTool::RODPointer
OFFLINE_FRAGMENTS_NAMESPACE::PointerType RODPointer
Definition: JepByteStreamTool.h:147
LVL1BS::JepByteStreamTool::slinkSlices
bool slinkSlices(int crate, int module, int modulesPerSlink, int &timeslices, int &trigJem, const ConstJetElementMap &jeMap, const ConstJetHitsMap &hitsMap, const ConstEnergySumsMap &etMap, const ConstCmmHitsMap &cmmHitsMap, const ConstCmmSumsMap &cmmEtMap, LVL1::JetElementKey &elementKey) const
Get number of slices and triggered slice offset for next slink.
Definition: JepByteStreamTool.cxx:1689
LVL1BS::JepByteStreamTool::convertBs
StatusCode convertBs(const std::string &sgKey, const IROBDataProviderSvc::VROBFRAG &robFrags, JepByteStreamToolData &data) const
Convert bytestream to given container type.
Definition: JepByteStreamTool.cxx:594
LVL1BS::L1CaloSubBlock::module
int module() const
Definition: L1CaloSubBlock.h:268
LVL1BS::JepByteStreamTool::m_sourceIDsProp
std::vector< uint32_t > m_sourceIDsProp
Property: ROB source IDs.
Definition: JepByteStreamTool.h:284
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
LVL1BS::JepByteStreamTool::JET_HITS
@ JET_HITS
Definition: JepByteStreamTool.h:127
LVL1BS::L1CaloSrcIdMap::subDet
eformat::SubDetector subDet(uint32_t code) const
Return sub-detector for given ID.
Definition: L1CaloSrcIdMap.cxx:89
LVL1BS::CmmEnergySubBlock::LOCAL
@ LOCAL
Definition: CmmEnergySubBlock.h:26
LVL1BS::CmmSubBlock::cmmPosition
int cmmPosition() const
Definition: CmmSubBlock.h:73
LVL1BS::JepByteStreamTool::m_errorTool
ToolHandle< LVL1BS::L1CaloErrorByteStreamTool > m_errorTool
Error collection tool.
Definition: JepByteStreamTool.h:261
LVL1BS::CmmSubBlock::SYSTEM
@ SYSTEM
Definition: CmmSubBlock.h:27
LVL1::CMMJetHits::TOTAL_FORWARD
@ TOTAL_FORWARD
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMJetHits.h:36
DeMoScan.index
string index
Definition: DeMoScan.py:364
LVL1BS::JepByteStreamTool::EnergySumsData
Definition: JepByteStreamTool.h:170
LVL1BS::CmmEnergySubBlock::unpack
bool unpack()
Unpack data.
Definition: CmmEnergySubBlock.cxx:317
LVL1BS::JepByteStreamTool::JetElementData
Definition: JepByteStreamTool.h:156
LVL1BS::CmmJetSubBlock
Sub-Block class for CMM-Jet data.
Definition: CmmJetSubBlock.h:23
LVL1BS::CmmEnergySubBlock::setSubsums
void setSubsums(int slice, int source, unsigned int ex, unsigned int ey, unsigned int et, int exError, int eyError, int etError)
Store energy subsums and errors for given JEM or source ID.
Definition: CmmEnergySubBlock.cxx:199
LVL1BS::CmmJetSubBlock::MAX_SOURCE_ID
@ MAX_SOURCE_ID
Definition: CmmJetSubBlock.h:28
LVL1::JEPBSCollection::EnergySums
const DataVector< JEMEtSums > * EnergySums() const
Return pointer to energy sums collection.
Definition: JEPBSCollection.h:71
LVL1::JEMEtSums::addEt
void addEt(const std::vector< unsigned int > &Et)
Update ET sum.
Definition: JEMEtSums.cxx:113
LVL1::CMMEtSums::addEx
void addEx(const std::vector< unsigned int > &Ex, const std::vector< int > &ExError)
Update Ex sum.
Definition: CMMEtSums.cxx:157
LVL1BS::JemSubBlock::setJemHeader
void setJemHeader(int version, int format, int slice, int crate, int module, int timeslices)
Store JEM header.
Definition: JemSubBlock.cxx:71
LVL1BS::JepByteStreamTool::findJetElement
const LVL1::JetElement * findJetElement(double eta, double phi, const ConstJetElementMap &jeMap, LVL1::JetElementKey &elementKey) const
Find a jet element given eta, phi.
Definition: JepByteStreamTool.cxx:1486
FullEventAssembler::setRodMinorVersion
void setRodMinorVersion(uint16_t m)
change the ROD minor version
LVL1BS::JepByteStreamTool::JetElementData::m_jeMap
JetElementMap m_jeMap
Definition: JepByteStreamTool.h:160
LVL1::CMMEtSums::MISSING_ET_SIG_MAP
@ MISSING_ET_SIG_MAP
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMEtSums.h:37
LVL1::JEMEtSums
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/JEMEtSums.h:27
LVL1BS::JepByteStreamTool::m_byteStreamCnvSvc
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
Definition: JepByteStreamTool.h:99
JemJetElement.h
LVL1::JetElement::phi
double phi() const
Phi of centre of JetElement.
Definition: JetElement.cxx:87
LVL1BS::CmmSubBlock::CMM_ENERGY
@ CMM_ENERGY
Definition: CmmSubBlock.h:25
LVL1BS::JemSubBlock::unpack
bool unpack()
Unpack data.
Definition: JemSubBlock.cxx:219
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
LVL1BS::JepByteStreamTool::m_dfltSlices
int m_dfltSlices
Property: Default number of slices in simulation.
Definition: JepByteStreamTool.h:280
LVL1BS::L1CaloSubBlock::ERROR_SLICES
@ ERROR_SLICES
Definition: L1CaloSubBlock.h:35
python.TriggerHandler.verbose
verbose
Definition: TriggerHandler.py:297
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
LVL1BS::CmmEnergySubBlock::ey
unsigned int ey(int slice, int source) const
Return Ey subsum for given JEM or source ID.
Definition: CmmEnergySubBlock.cxx:80
LVL1BS
Definition: ZdcModifySlices.h:10
LVL1BS::CmmSubBlock::LEFT
@ LEFT
Definition: CmmSubBlock.h:28
LVL1::JEMHits
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/JEMHits.h:27
LVL1BS::JepByteStreamTool::interfaceID
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
Definition: JepByteStreamTool.cxx:43
LVL1BS::JepByteStreamTool::m_channels
const int m_channels
Number of channels per module.
Definition: JepByteStreamTool.h:272
LVL1BS::L1CaloSubBlock::ERROR_MODULE_NUMBER
@ ERROR_MODULE_NUMBER
Definition: L1CaloSubBlock.h:34
LVL1::CMMJetHits
CMMJetHits class stores Jet hit multiplicities received by and read out from the Jet CMMs.
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMJetHits.h:32
LVL1BS::JepByteStreamTool::sourceIDs
const std::vector< uint32_t > & sourceIDs() const
Return reference to vector with all possible Source Identifiers.
Definition: JepByteStreamTool.cxx:586
LVL1BS::CmmEnergySubBlock::MAX_SOURCE_ID
@ MAX_SOURCE_ID
Definition: CmmEnergySubBlock.h:26
LVL1BS::L1CaloSrcIdMap::getRodID
uint32_t getRodID(int crate, int slink, int daqOrRoi, eformat::SubDetector subdet) const
Make a ROD Source ID.
Definition: L1CaloSrcIdMap.cxx:18
LVL1::CMMEtSums::MISSING_ET_MAP
@ MISSING_ET_MAP
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMEtSums.h:37
LVL1BS::JepByteStreamTool::ENERGY_SUMS
@ ENERGY_SUMS
Definition: JepByteStreamTool.h:127
LVL1::JEMEtSums::EtVec
const std::vector< unsigned int > & EtVec() const
returns module ET sum
Definition: JEMEtSums.cxx:93
LVL1BS::JemJetElement::emData
int emData() const
Definition: JemJetElement.h:71
LVL1::JEMEtSums::addEx
void addEx(const std::vector< unsigned int > &Ex)
Update Ex sum.
Definition: JEMEtSums.cxx:118
JepByteStreamTool.h
LVL1BS::JepByteStreamTool::findEnergySums
const LVL1::JEMEtSums * findEnergySums(int crate, int module, const ConstEnergySumsMap &etMap) const
Find energy sums for given crate, module.
Definition: JepByteStreamTool.cxx:1532
copySelective.source
string source
Definition: copySelective.py:32
JEMHits.h
LVL1BS::JemSubBlock::clear
void clear()
Clear all data.
Definition: JemSubBlock.cxx:61
LVL1BS::JepByteStreamTool::CmmSumsData
Definition: JepByteStreamTool.h:184
FullEventAssembler::RODDATA
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
Definition: FullEventAssembler.h:54
LVL1::JetElement::emErrorVec
const std::vector< int > & emErrorVec() const
return Em error vector reference (all timeslices)
Definition: JetElement.cxx:255
LVL1BS::JemSubBlock::ex
unsigned int ex(int slice) const
Return energy subsum Ex.
Definition: JemSubBlock.cxx:152
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
LVL1BS::CmmEnergySubBlock
Sub-Block class for CMM-Energy data.
Definition: CmmEnergySubBlock.h:23
LVL1BS::CmmJetSubBlock::REMOTE_MAIN
@ REMOTE_MAIN
Definition: CmmJetSubBlock.h:26
AthAlgTool
Definition: AthAlgTool.h:26
LVL1::DataError::get
int get(ErrorBit bit) const
Return an error bit or data.
Definition: DataError.cxx:48
LVL1::CMMEtSums::EtErrorVec
const std::vector< int > & EtErrorVec() const
returns module ET errors
Definition: CMMEtSums.cxx:135
LVL1BS::CmmEnergySubBlock::setMissingEtHits
void setMissingEtHits(int slice, unsigned int map)
Store Missing-ET Hits map.
Definition: CmmEnergySubBlock.cxx:247
LVL1::JetElement::linkErrorVec
const std::vector< int > & linkErrorVec() const
return link error vector reference (all timeslices)
Definition: JetElement.cxx:265
LVL1BS::L1CaloSrcIdMap::maxSlinks
int maxSlinks() const
Return the maximum possible number of slinks.
Definition: L1CaloSrcIdMap.cxx:82
LVL1BS::JepByteStreamTool::m_crateOffsetHw
int m_crateOffsetHw
Property: Hardware crate number offset.
Definition: JepByteStreamTool.h:264
LVL1BS::CmmSubBlock::cmmSumming
int cmmSumming() const
Definition: CmmSubBlock.h:63
LVL1::CMMEtSums::TOTAL
@ TOTAL
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMMEtSums.h:36
JemSubBlock.h
LVL1BS::JemSubBlock::ey
unsigned int ey(int slice) const
Return energy subsum Ey.
Definition: JemSubBlock.cxx:163
LVL1BS::L1CaloUserHeader::isValid
static bool isValid(uint32_t word)
Test for valid header word.
Definition: L1CaloUserHeader.cxx:36
LVL1BS::JepByteStreamTool::ConstCmmHitsMap
std::map< int, const LVL1::CMMJetHits * > ConstCmmHitsMap
Definition: JepByteStreamTool.h:142
LVL1BS::L1CaloSrcIdMap::daqOrRoi
int daqOrRoi(uint32_t code) const
Return daqOrRoi from unpacked moduleID.
Definition: L1CaloSrcIdMap.cxx:65
LVL1BS::JepByteStreamTool::ROBPointer
OFFLINE_FRAGMENTS_NAMESPACE::PointerType ROBPointer
Definition: JepByteStreamTool.h:146
geometry_dat_to_json.ld
ld
Definition: geometry_dat_to_json.py:32
LVL1BS::L1CaloSubBlock::ERROR_USER_HEADER
@ ERROR_USER_HEADER
Definition: L1CaloSubBlock.h:32
LVL1BS::JepByteStreamTool::EnergySumsData::m_etMap
EnergySumsMap m_etMap
Definition: JepByteStreamTool.h:174
LVL1BS::CmmJetSubBlock::pack
bool pack()
Pack data.
Definition: CmmJetSubBlock.cxx:135
LVL1BS::JemJetElement::linkError
int linkError() const
Definition: JemJetElement.h:91
LVL1BS::JemSubBlock::pack
bool pack()
Pack data.
Definition: JemSubBlock.cxx:197
FullEventAssembler::getRodData
RODDATA * getRodData(uint32_t id)
get a block of ROD data
keylayer_zslicemap.slices
slices
Definition: keylayer_zslicemap.py:112
LVL1BS::JepByteStreamTool::setupCmmHitsMap
void setupCmmHitsMap(const CmmHitsCollection *hitCollection, ConstCmmHitsMap &cmmHitsMap) const
Set up CMM hits map.
Definition: JepByteStreamTool.cxx:1651
JetElement.h
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
LVL1::CMMEtSums::ExVec
const std::vector< unsigned int > & ExVec() const
returns module Ex sum
Definition: CMMEtSums.cxx:125
LVL1::CMMJetHits::HitsVec
const std::vector< unsigned int > & HitsVec() const
Multi-slice accessors.
Definition: CMMJetHits.cxx:83
LVL1BS::CmmJetSubBlock::jetHitsError
int jetHitsError(int slice, int source) const
Return jet hit error for given jem or source ID.
Definition: CmmJetSubBlock.cxx:71
LVL1BS::JemSubBlock::fillJetElement
void fillJetElement(int slice, const JemJetElement &jetEle)
Store jet element data.
Definition: JemSubBlock.cxx:80
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
LVL1::CMMJetHits::ErrorVec
const std::vector< int > & ErrorVec() const
returns errors
Definition: CMMJetHits.cxx:88
LVL1BS::JepByteStreamTool::m_version
int m_version
Property: Sub_block header version.
Definition: JepByteStreamTool.h:268
LVL1BS::JepByteStreamTool::finalize
virtual StatusCode finalize()
Definition: JepByteStreamTool.cxx:119