ATLAS Offline Software
Loading...
Searching...
No Matches
JepRoiByteStreamV2Tool.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
20
21#include "CmxSubBlock.h"
22#include "JemRoiSubBlockV2.h"
24#include "L1CaloSrcIdMap.h"
25#include "L1CaloSubBlock.h"
26#include "L1CaloUserHeader.h"
27
29
30namespace LVL1BS {
31
32// Interface ID
33
34static const InterfaceID IID_IJepRoiByteStreamV2Tool("JepRoiByteStreamV2Tool",
35 1, 1);
36
41
42// Constructor
43
45 const std::string& name,
46 const IInterface* parent)
47 : AthAlgTool(type, name, parent),
48 m_robDataProvider("ROBDataProviderSvc", name),
49 m_errorTool("LVL1BS::L1CaloErrorByteStreamTool/L1CaloErrorByteStreamTool"),
51 m_subDetector (eformat::TDAQ_CALO_JET_PROC_ROI)
52{
53 declareInterface<JepRoiByteStreamV2Tool>(this);
54
55 declareProperty("ErrorTool", m_errorTool,
56 "Tool to collect errors for monitoring");
57 declareProperty("CrateOffsetHw", m_crateOffsetHw = 12,
58 "Offset of JEP crate numbers in bytestream");
59 declareProperty("CrateOffsetSw", m_crateOffsetSw = 0,
60 "Offset of JEP crate numbers in RDOs");
61
62 // Properties for reading bytestream only
63 declareProperty("ROBSourceIDs", m_sourceIDsProp,
64 "ROB fragment source identifiers");
65 declareProperty("ROBSourceIDsRoIB", m_sourceIDsRoIBProp,
66 "ROB fragment source identifiers");
67
68 // Properties for writing bytestream only
69 declareProperty("DataVersion", m_version = 2, //<<== CHECK
70 "Format version number in sub-block header");
71 declareProperty("DataFormat", m_dataFormat = 1,
72 "Format identifier (0-1) in sub-block header");
73 declareProperty("SlinksPerCrate", m_slinks = 1,
74 "The number of S-Links per crate");
75 declareProperty("CrateMin", m_crateMin = 0,
76 "Minimum crate number, allows partial output");
77 declareProperty("CrateMax", m_crateMax = m_crates - 1,
78 "Maximum crate number, allows partial output");
79
80}
81
82// Destructor
83
87
88// Initialize
89
90
92{
93 ATH_MSG_INFO ("Initializing " << name());
94
95 ATH_CHECK( m_errorTool.retrieve() );
96 ATH_CHECK( m_byteStreamCnvSvc.retrieve() );
97
98 return StatusCode::SUCCESS;
99}
100
101// Finalize
102
104{
105 return StatusCode::SUCCESS;
106}
107
108// Conversion bytestream to JEM RoI
109
111 const std::string& sgKey,
112 DataVector<LVL1::JEMTobRoI> *const collection) const
113{
114 const std::vector<uint32_t>& vID(sourceIDs(sgKey));
115 // // get ROB fragments
117 m_robDataProvider->getROBData(Gaudi::Hive::currentContext(), vID, robFrags, "JepRoiByteStreamV2Tool");
118 ATH_MSG_DEBUG("Number of ROB fragments:" << robFrags.size());
119 return convert(robFrags, collection);
120}
121
123 const IROBDataProviderSvc::VROBFRAG& robFrags,
124 DataVector<LVL1::JEMTobRoI>* const jeCollection) const
125{
126 return convertBs(robFrags, jeCollection, nullptr);
127}
128
129// Conversion bytestream to CMX RoI
130
132 const std::string& sgKey,
133 LVL1::CMXRoI* cmCollection) const
134{
135 const std::vector<uint32_t>& vID(sourceIDs(sgKey));
136 // // get ROB fragments
138 m_robDataProvider->getROBData(Gaudi::Hive::currentContext(), vID, robFrags, "JepRoiByteStreamV2Tool");
139 ATH_MSG_DEBUG("Number of ROB fragments:" << robFrags.size());
140 return convert(robFrags, cmCollection);
141}
142
144 const IROBDataProviderSvc::VROBFRAG& robFrags,
145 LVL1::CMXRoI* cmCollection) const
146{
147 return convertBs(robFrags, nullptr, cmCollection);
148}
149
150// Conversion of JEP container to bytestream
151
153 const LVL1::JEPRoIBSCollectionV2* const jep) const
154{
155 const bool debug = msgLvl(MSG::DEBUG);
156 if (debug) msg(MSG::DEBUG);
157
158 // Get the event assembler
160 ATH_CHECK( m_byteStreamCnvSvc->getFullEventAssembler (fea,
161 "JepRoiByteStreamV2") );
162 const uint16_t minorVersion = m_srcIdMap.minorVersion();
163 fea->setRodMinorVersion(minorVersion);
164
165 // Pointer to ROD data vector
166
168
169 // Sub-block for neutral format
170 JemRoiSubBlockV2 subBlock;
171
172 // Set up the container maps
173
174 const bool neutralFormat = m_dataFormat == L1CaloSubBlock::NEUTRAL;
175
176 // JEM RoI map
177 JemRoiMap roiMap;
178 setupJemRoiMap(jep->JemRoi(), roiMap);
179 JemRoiMap::const_iterator mapIter = roiMap.begin();
180 JemRoiMap::const_iterator mapIterEnd = roiMap.end();
181
182 // CMX energy sums map
183 CmxSumsMap cmxEtMap;
184 if (neutralFormat) {
185 setupCmxEtMap(jep->CmxSums(), cmxEtMap);
186 }
187
188 // Loop over JEM RoI data
189
190 const int modulesPerSlink = m_modules / m_slinks;
191 for (int crate = m_crateMin; crate <= m_crateMax; ++crate) {
192 const int hwCrate = crate + m_crateOffsetHw;
193
194 for (int module = 0; module < m_modules; ++module) {
195
196 // Pack required number of modules per slink
197
198 if (module % modulesPerSlink == 0) {
199 const int daqOrRoi = 1;
200 const int slink = module / modulesPerSlink;
201 if (debug) {
202 msg() << "Treating crate " << hwCrate
203 << " slink " << slink << endmsg
204 << "Data Version/Format: " << m_version
205 << " " << m_dataFormat << endmsg;
206 }
207 const uint32_t rodIdJem = m_srcIdMap.getRodID(hwCrate, slink, daqOrRoi,
209 theROD = fea->getRodData(rodIdJem);
210 if (neutralFormat) {
211 const L1CaloUserHeader userHeader;
212 theROD->push_back(userHeader.header());
213 }
214 }
215 if (debug) msg() << "JEM Module " << module << endmsg;
216 if (!theROD) break; // for coverity, shouldn't happen
217
218 // Create a sub-block (Neutral format only)
219
220 if (neutralFormat) {
221 subBlock.clear();
222 subBlock.setRoiHeader(m_version, hwCrate, module);
223 }
224
225 // Find JEM RoIs for this module
226
227 for (; mapIter != mapIterEnd; ++mapIter) {
228 const LVL1::JEMTobRoI* const roi = mapIter->second;
229 if (roi->crate() < crate) continue;
230 if (roi->crate() > crate) break;
231 if (roi->jem() < module) continue;
232 if (roi->jem() > module) break;
233 if (roi->energyLarge() || roi->energySmall()) {
234 if (neutralFormat) subBlock.fillRoi(*roi);
235 else theROD->push_back(roi->roiWord());
236 }
237 }
238
239 // Pack and write the sub-block
240
241 if (neutralFormat) {
242 if ( !subBlock.pack()) {
243 msg(MSG::ERROR) << "JEM RoI sub-block packing failed" << endmsg;
244 return StatusCode::FAILURE;
245 }
246 if (debug) {
247 msg() << "JEM RoI sub-block data words: "
248 << subBlock.dataWords() << endmsg;
249 }
250 subBlock.write(theROD);
251 }
252 }
253 if (!theROD) break; // for coverity, shouldn't happen
254
255 // Append CMX RoIs to last S-Link of the system crate
256
257 if (crate != m_crates - 1) continue;
258
259 // Create sub-blocks for Neutral format
260
261 if (neutralFormat) {
262 const int timeslices = 1;
263 const int slice = 0;
264
265 // CMX-Energy
266
267 CmxEnergySubBlock subBlock;
268 const int cmxEnergyVersion = 3; //<<== CHECK
269 subBlock.setCmxHeader(cmxEnergyVersion, m_dataFormat, slice, hwCrate,
271 CmxSubBlock::LEFT, timeslices);
272 int maxSource = static_cast<int>(LVL1::CMXEtSums::MAX_SOURCE);
273 for (int source = 0; source < maxSource; ++source) {
274 const LVL1::CMXEtSums* const sums = findCmxSums(crate, source, cmxEtMap);
275 if ( sums ) {
276 const unsigned int ex = sums->Ex();
277 const unsigned int ey = sums->Ey();
278 const unsigned int et = sums->Et();
279 const int exErr = sums->ExError();
280 const int eyErr = sums->EyError();
281 const int etErr = sums->EtError();
282 if (source < m_modules) {
283 subBlock.setSubsums(slice, source, ex, ey, et, exErr, eyErr, etErr);
284 } else {
288 energySubBlockTypes(source, srcType, sumType, hitType);
289 if (srcType != CmxEnergySubBlock::MAX_SOURCE_TYPE) {
290 subBlock.setSubsums(slice, srcType, sumType, ex, ey, et,
291 exErr, eyErr, etErr);
292 } else if (hitType != CmxEnergySubBlock::MAX_HITS_TYPE) {
293 subBlock.setEtHits(slice, hitType, sumType, et);
294 }
295 }
296 }
297 }
298 if ( !subBlock.pack()) {
299 msg(MSG::ERROR) << "CMX-Energy sub-block packing failed" << endmsg;
300 return StatusCode::FAILURE;
301 }
302 if (debug) {
303 msg() << "CMX-Energy sub-block data words: "
304 << subBlock.dataWords() << endmsg;
305 }
306 subBlock.write(theROD);
307
308 } else {
309
310 // Standard format
311
312 const LVL1::CMXRoI* const roi = jep->CmxRoi();
313 if ( roi ) {
314 // CMX-Energy RoIs are not zero-supressed unless all are zero
315 for (int word = 0; word < m_maxRoiWords; ++word) {
316 theROD->push_back(roi->roiWord(word));
317 }
318 }
319 }
320 }
321
322 return StatusCode::SUCCESS;
323}
324
325// Return reference to vector with all possible Source Identifiers
326
327std::vector<uint32_t> JepRoiByteStreamV2Tool::makeSourceIDs (bool roiDaq) const
328{
329 std::vector<uint32_t> sourceIDs;
330
331 if (roiDaq) {
333 }
334 else {
336 }
337
338 if (sourceIDs.empty()) {
339 const int maxCrates = m_crates + m_crateOffsetHw;
340 const int maxSlinks = m_srcIdMap.maxSlinks();
341 for (int hwCrate = m_crateOffsetHw; hwCrate < maxCrates; ++hwCrate)
342 {
343 for (int slink = 0; slink < maxSlinks; ++slink)
344 {
345 const int daqOrRoi = 1;
346 const uint32_t rodId = m_srcIdMap.getRodID(hwCrate, slink, daqOrRoi,
348 const uint32_t robId = m_srcIdMap.getRobID(rodId);
349 if (roiDaq)
350 {
351 if (slink < 2) sourceIDs.push_back(robId);
352 }
353 else if (slink >= 2) sourceIDs.push_back(robId);
354 }
355 }
356
357 }
358 return sourceIDs;
359}
360
361const std::vector<uint32_t>& JepRoiByteStreamV2Tool::sourceIDs(
362 const std::string& sgKey) const
363{
364 const std::string flag("RoIB");
365 const std::string::size_type pos = sgKey.find(flag);
366 const bool roiDaq =
367 (pos == std::string::npos || pos != sgKey.length() - flag.length());
368
369 if (roiDaq) {
370 static const std::vector<uint32_t> sourceIDs = makeSourceIDs(roiDaq);
371 return sourceIDs;
372 }
373 else {
374 static const std::vector<uint32_t> sourceIDsRoIB = makeSourceIDs(roiDaq);
375 return sourceIDsRoIB;
376 }
377}
378
379// Convert bytestream to given container type
380
382 const IROBDataProviderSvc::VROBFRAG& robFrags,
383 DataVector<LVL1::JEMTobRoI>* jeCollection,
384 LVL1::CMXRoI* cmCollection) const
385{
386 const bool debug = msgLvl(MSG::DEBUG);
387 if (debug) msg(MSG::DEBUG);
388
389 // Loop over ROB fragments
390
391 int robCount = 0;
392 std::set<uint32_t> dupCheck;
393 std::set<uint32_t> dupRoiCheck;
394 ROBIterator rob = robFrags.begin();
395 ROBIterator robEnd = robFrags.end();
396 for (; rob != robEnd; ++rob) {
397
398 if (debug) {
399 ++robCount;
400 msg() << "Treating ROB fragment " << robCount << endmsg;
401 }
402
403 // Skip fragments with ROB status errors
404
405 uint32_t robid = (*rob)->source_id();
406 if ((*rob)->nstatus() > 0) {
407 ROBPointer robData;
408 (*rob)->status(robData);
409 if (*robData != 0) {
410 m_errorTool->robError(robid, *robData);
411 if (debug) msg() << "ROB status error - skipping fragment" << endmsg;
412 continue;
413 }
414 }
415
416 // Skip duplicate fragments
417
418 if (!dupCheck.insert(robid).second) {
420 if (debug) msg() << "Skipping duplicate ROB fragment" << endmsg;
421 continue;
422 }
423
424 // Unpack ROD data (slinks)
425
426 RODPointer payloadBeg;
427 RODPointer payload;
428 RODPointer payloadEnd;
429 (*rob)->rod_data(payloadBeg);
430 payloadEnd = payloadBeg + (*rob)->rod_ndata();
431 payload = payloadBeg;
432 if (payload == payloadEnd) {
433 if (debug) msg() << "ROB fragment empty" << endmsg;
434 continue;
435 }
436
437 // Check identifier
438 const uint32_t sourceID = (*rob)->rod_source_id();
439 if (m_srcIdMap.getRobID(sourceID) != robid ||
440 m_srcIdMap.subDet(sourceID) != m_subDetector ||
441 m_srcIdMap.daqOrRoi(sourceID) != 1 ||
442 (m_srcIdMap.slink(sourceID) != 0 && m_srcIdMap.slink(sourceID) != 2) ||
443 m_srcIdMap.crate(sourceID) < m_crateOffsetHw ||
444 m_srcIdMap.crate(sourceID) >= m_crateOffsetHw + m_crates) {
446 if (debug) {
447 msg() << "Wrong source identifier in data: "
448 << MSG::hex << sourceID << MSG::dec << endmsg;
449 }
450 continue;
451 }
452
453 // Check minor version
454 const int minorVersion = (*rob)->rod_version() & 0xffff;
455 if (minorVersion <= m_srcIdMap.minorVersionPreLS1()) {
456 if (debug) msg() << "Skipping pre-LS1 data" << endmsg;
457 continue;
458 }
459 const int rodCrate = m_srcIdMap.crate(sourceID);
460 if (debug) {
461 msg() << "Treating crate " << rodCrate
462 << " slink " << m_srcIdMap.slink(sourceID) << endmsg;
463 }
464
465 // First word may be User Header
466 if (L1CaloUserHeader::isValid(*payload)) {
467 L1CaloUserHeader userHeader(*payload);
468 userHeader.setVersion(minorVersion);
469 const int headerWords = userHeader.words();
470 if (headerWords != 1) {
472 if (debug) msg() << "Unexpected number of user header words: "
473 << headerWords << endmsg;
474 continue;
475 }
476 for (int i = 0; i < headerWords; ++i) ++payload;
477 }
478
479 // Loop over sub-blocks if there are any
480
481 unsigned int rodErr = L1CaloSubBlock::ERROR_NONE;
482 while (payload != payloadEnd) {
483
485 const int slice = 0;
486 if (CmxSubBlock::cmxBlock(*payload)) {
487 // CMXs
489 CmxEnergySubBlock subBlock;
490 payload = subBlock.read(payload, payloadEnd);
491 if (cmCollection != nullptr) {
492 if (subBlock.dataWords() && !subBlock.unpack()) {
493 if (debug) {
494 std::string errMsg(subBlock.unpackErrorMsg());
495 msg() << "CMX-Energy sub-block unpacking failed: "
496 << errMsg << endmsg;
497 }
498 rodErr = subBlock.unpackErrorCode();
499 break;
500 }
501 const LVL1::CMXRoI roi(
502 subBlock.energy(slice, CmxEnergySubBlock::TOTAL,
505 subBlock.energy(slice, CmxEnergySubBlock::TOTAL,
508 subBlock.energy(slice, CmxEnergySubBlock::TOTAL,
511 subBlock.error(slice, CmxEnergySubBlock::TOTAL,
514 subBlock.error(slice, CmxEnergySubBlock::TOTAL,
517 subBlock.error(slice, CmxEnergySubBlock::TOTAL,
520 subBlock.hits(slice, CmxEnergySubBlock::SUM_ET,
522 subBlock.hits(slice, CmxEnergySubBlock::MISSING_ET,
526 subBlock.energy(slice, CmxEnergySubBlock::TOTAL,
529 subBlock.energy(slice, CmxEnergySubBlock::TOTAL,
532 subBlock.energy(slice, CmxEnergySubBlock::TOTAL,
535 subBlock.error(slice, CmxEnergySubBlock::TOTAL,
538 subBlock.error(slice, CmxEnergySubBlock::TOTAL,
541 subBlock.error(slice, CmxEnergySubBlock::TOTAL,
544 subBlock.hits(slice, CmxEnergySubBlock::SUM_ET,
546 subBlock.hits(slice, CmxEnergySubBlock::MISSING_ET,
548 for (int word = 0; word < m_maxRoiWords; ++word) {
549 cmCollection->setRoiWord(roi.roiWord(word));
550 }
551 }
552 }
553 } else {
554 // JEM RoI
555 JemRoiSubBlockV2 subBlock;
556 payload = subBlock.read(payload, payloadEnd);
557 if (jeCollection != nullptr) {
558 if (subBlock.dataWords() && !subBlock.unpack()) {
559 if (debug) {
560 std::string errMsg(subBlock.unpackErrorMsg());
561 msg() << "JEM RoI sub-block unpacking failed: "
562 << errMsg << endmsg;
563 }
564 rodErr = subBlock.unpackErrorCode();
565 break;
566 }
567 for (int frame = 0; frame < m_frames; ++frame) {
568 const LVL1::JEMTobRoI roi = subBlock.roi(frame);
569 if (roi.energyLarge() || roi.energySmall()) {
570 jeCollection->push_back(new LVL1::JEMTobRoI(roi));
571 }
572 }
573 }
574 }
575 } else {
576 // Just RoI word
577 LVL1::JEMTobRoI jroi;
578 LVL1::CMXRoI croi;
579 if (jroi.setRoiWord(*payload)) {
580 if (jeCollection != nullptr) {
581 if (jroi.crate() != rodCrate - m_crateOffsetHw) {
582 if (debug) msg() << "Inconsistent RoI crate number: "
583 << jroi.crate() << endmsg;
585 break;
586 }
587 const uint32_t location = (*payload) & 0xfff80000;
588 if (dupRoiCheck.insert(location).second) {
589 if (jroi.energyLarge() || jroi.energySmall()) {
590 jeCollection->push_back(new LVL1::JEMTobRoI(*payload));
591 }
592 } else {
593 if (debug) msg() << "Duplicate RoI word "
594 << MSG::hex << *payload << MSG::dec << endmsg;
596 break;
597 }
598 }
599 } else if (croi.setRoiWord(*payload)) {
600 if (cmCollection != nullptr) {
601 const uint32_t roiType = (*payload) & 0xfc000000;
602
603 if (dupRoiCheck.insert(roiType).second) {
604 cmCollection->setRoiWord(*payload);
605 } else {
606 if (debug) msg() << "Duplicate RoI word "
607 << MSG::hex << *payload << MSG::dec << endmsg;
609 break;
610 }
611 }
612 } else {
613 if (debug) msg() << "Invalid RoI word "
614 << MSG::hex << *payload << MSG::dec << endmsg;
616 break;
617 }
618 ++payload;
619 }
620 }
621 if (rodErr != L1CaloSubBlock::ERROR_NONE)
622 m_errorTool->rodError(robid, rodErr);
623 }
624
625 return StatusCode::SUCCESS;
626}
627
628// Find CMX energy sums for given crate, source
629
631 const int source,
632 const CmxSumsMap& cmxEtMap) const
633{
634 const LVL1::CMXEtSums* sums = 0;
635 CmxSumsMap::const_iterator mapIter;
636 mapIter = cmxEtMap.find(crate * 100 + source);
637 if (mapIter != cmxEtMap.end()) sums = mapIter->second;
638 return sums;
639}
640
641// Set up JEM RoIs map
642
644 const jeCollection,
645 JemRoiMap& roiMap) const
646{
647 roiMap.clear();
648 if (jeCollection) {
649 JemRoiCollection::const_iterator pos = jeCollection->begin();
650 JemRoiCollection::const_iterator pose = jeCollection->end();
651 for (; pos != pose; ++pos) {
652 const LVL1::JEMTobRoI* const roi = *pos;
653 const uint32_t key = roi->roiWord();
654 roiMap.insert(std::make_pair(key, roi));
655 }
656 }
657}
658
659// Set up CMX energy sums map
660
662 const etCollection,
663 CmxSumsMap& cmxEtMap) const
664{
665 cmxEtMap.clear();
666 if (etCollection) {
667 CmxSumsCollection::const_iterator pos = etCollection->begin();
668 CmxSumsCollection::const_iterator pose = etCollection->end();
669 for (; pos != pose; ++pos) {
670 const LVL1::CMXEtSums* const sums = *pos;
671 const int crate = sums->crate() - m_crateOffsetSw;
672 const int key = crate * 100 + sums->source();
673 cmxEtMap.insert(std::make_pair(key, sums));
674 }
675 }
676}
677
678// Get energy subBlock types from CMXEtSums source type
679
683 CmxEnergySubBlock::HitsType& hitType) const
684{
685 switch (source) {
689 break;
693 break;
695 srcType = CmxEnergySubBlock::LOCAL;
697 break;
699 srcType = CmxEnergySubBlock::LOCAL;
701 break;
703 srcType = CmxEnergySubBlock::TOTAL;
705 break;
707 srcType = CmxEnergySubBlock::TOTAL;
709 break;
713 break;
717 break;
721 break;
725 break;
729 break;
730 default:
731 break;
732 }
733}
734
735} // end namespace
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
const bool debug
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
bool msgLvl(const MSG::Level lvl) const
MsgStream & msg() const
Derived DataVector<T>.
Definition DataVector.h:795
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Template class for assembling a full atlas raw event from subfragments.
void setRodMinorVersion(uint16_t m)
change the ROD minor version
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
RODDATA * getRodData(uint32_t id)
get a block of ROD data
std::vector< const ROBF * > VROBFRAG
Sub-Block class for CMX-Energy data post LS1.
unsigned int hits(int slice, HitsType hType, SumType sType) const
Return hits map for given hits type and sum type.
void setSubsums(int slice, int jem, unsigned int ex, unsigned int ey, unsigned int et, int exError, int eyError, int etError)
Store energy subsums and errors for given JEM.
void setEtHits(int slice, HitsType hType, SumType sType, unsigned int map)
Store hits map for given hits type and sum type.
unsigned int energy(int slice, int jem, EnergyType eType) const
Return energy subsum for given JEM and energy type.
int error(int slice, int jem, EnergyType eType) const
Return energy subsum error for given JEM and energy type.
static bool cmxBlock(uint32_t word)
Determine if header word corresponds to CMX.
void setCmxHeader(int version, int format, int slice, int crate, int summing, int firmware, int position, int timeslices)
Store CMX header.
static CmxFirmwareCode cmxType(uint32_t word)
CMX differentiation (CMX_CP, CMX_JET, or CMX_ENERGY)
Sub-Block class for JEM RoI data (neutral format) post-LS1.
void clear()
Clear all data.
LVL1::JEMTobRoI roi(int frame) const
Return RoI for given frame.
void fillRoi(LVL1::JEMTobRoI roi)
Store RoI.
void setRoiHeader(int version, int crate, int module)
Store header.
OFFLINE_FRAGMENTS_NAMESPACE::PointerType ROBPointer
OFFLINE_FRAGMENTS_NAMESPACE::PointerType RODPointer
int m_crateOffsetHw
Property: Hardware crate number offset.
void setupJemRoiMap(const JemRoiCollection *jeCollection, JemRoiMap &roiMap) const
Set up JEM RoIs map.
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
const int m_crates
Number of crates.
IROBDataProviderSvc::VROBFRAG::const_iterator ROBIterator
int m_crateMax
Property: Maximum crate number when writing out bytestream.
int m_version
Property: Sub_block header version.
const int m_modules
Number of JEM modules per crate.
std::vector< uint32_t > makeSourceIDs(bool roiDaq) const
const int m_maxRoiWords
Number of CMX energy RoI words.
DataVector< LVL1::CMXEtSums > CmxSumsCollection
virtual StatusCode finalize() override
const eformat::SubDetector m_subDetector
Sub-detector type.
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
int m_dataFormat
Property: Data compression format.
void energySubBlockTypes(int source, CmxEnergySubBlock::SourceType &srcType, CmxEnergySubBlock::SumType &sumType, CmxEnergySubBlock::HitsType &hitType) const
Get energy subBlock types from CMXEtSums source type.
virtual StatusCode initialize() override
const int m_frames
Number of RoI frames.
int m_crateMin
Property: Minimum crate number when writing out bytestream.
StatusCode convertBs(const IROBDataProviderSvc::VROBFRAG &robFrags, DataVector< LVL1::JEMTobRoI > *jeCollection, LVL1::CMXRoI *cmCollection) const
Convert bytestream to given container type.
void setupCmxEtMap(const CmxSumsCollection *enCollection, CmxSumsMap &cmxEtMap) const
Set up CMX energy sums map.
int m_slinks
Property: Number of slinks per crate when writing out bytestream.
std::vector< uint32_t > m_sourceIDsRoIBProp
Property: ROB source IDs for RoIB.
JepRoiByteStreamV2Tool(const std::string &type, const std::string &name, const IInterface *parent)
int m_crateOffsetSw
Property: Software crate number offset.
const LVL1::CMXEtSums * findCmxSums(int crate, int source, const CmxSumsMap &cmxEtMap) const
Find CMX energy sums for given crate, source.
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
DataVector< LVL1::JEMTobRoI > JemRoiCollection
StatusCode convert(const std::string &name, DataVector< LVL1::JEMTobRoI > *jeCollection) const
Convert ROB fragments to JEM RoIs.
std::map< int, const LVL1::CMXEtSums * > CmxSumsMap
const L1CaloSrcIdMap m_srcIdMap
Source ID converter.
ToolHandle< LVL1BS::L1CaloErrorByteStreamTool > m_errorTool
Property: Error collection tool.
std::vector< uint32_t > m_sourceIDsProp
Property: ROB source IDs.
const std::vector< uint32_t > & sourceIDs(const std::string &sgKey) const
Return reference to vector with all possible Source Identifiers.
std::map< uint32_t, const LVL1::JEMTobRoI * > JemRoiMap
int unpackErrorCode() const
Return the unpacking error code.
int dataWords() const
Return number of data words.
static SubBlockWordType wordType(uint32_t word)
Word identification.
void write(FullEventAssembler< L1CaloSrcIdMap >::RODDATA *theROD) const
Output complete packed sub-block to ROD vector.
std::string unpackErrorMsg() const
Return the unpacking error message for printing.
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.
L1Calo User Header class.
static bool isValid(uint32_t word)
Test for valid header word.
void setVersion(int minorVersion)
Set version flag.
int words() const
Return number of header words (should be one)
uint32_t header() const
Return packed header.
CMXEtSums object stores Et sums from the Energy CMXs.
unsigned int Ey() const
returns module Ey sum for peak sample
unsigned int Ex() const
returns module Ex sum for peak sample
unsigned int Et() const
For triggered time slice.
int ExError() const
returns module Ex sum error for peak sample
int EyError() const
returns module Ey sum error for peak sample
int EtError() const
returns module ET sum error for peak sample
bool setRoiWord(uint32_t roiWord)
Set RoI word with ID check.
Definition CMXRoI.cxx:115
uint32_t roiWord(int word) const
Return packed Energy RoI word (0-5)
bool setRoiWord(uint32_t roiWord)
Set RoI word with ID check.
Definition JEMTobRoI.cxx:55
uint32_t roiWord() const
Return packed RoI word.
int energyLarge() const
Return energy large window size.
int energySmall() const
Return energy small window size.
Jet/Energy Processor RoI container for writing bytestream post-LS1.
const CMXRoI * CmxRoi() const
Return pointer to CMX RoIs.
const DataVector< CMXEtSums > * CmxSums() const
Return pointer to CMX energy sums collection.
const DataVector< JEMTobRoI > * JemRoi() const
Return pointer to JEM RoI collection.
static const InterfaceID IID_IJepRoiByteStreamV2Tool("JepRoiByteStreamV2Tool", 1, 1)
Extra patterns decribing particle interation process.