|
ATLAS Offline Software
|
Go to the documentation of this file.
10 #include "GaudiKernel/IInterface.h"
11 #include "GaudiKernel/MsgStream.h"
12 #include "GaudiKernel/StatusCode.h"
37 static const InterfaceID IID_IJepRoiByteStreamTool(
"JepRoiByteStreamTool",
42 return IID_IJepRoiByteStreamTool;
48 const std::string&
name,
51 m_errorTool(
"LVL1BS::L1CaloErrorByteStreamTool/L1CaloErrorByteStreamTool"),
52 m_crates(2), m_modules(16),
53 m_subDetector (
eformat::TDAQ_CALO_JET_PROC_ROI)
55 declareInterface<JepRoiByteStreamTool>(
this);
58 "Offset of JEP crate numbers in bytestream");
60 "Offset of JEP crate numbers in RDOs");
64 "ROB fragment source identifiers");
66 "ROB fragment source identifiers");
70 "Format version number in sub-block header");
72 "Format identifier (0-1) in sub-block header");
74 "The number of S-Links per crate");
94 return StatusCode::SUCCESS;
101 return StatusCode::SUCCESS;
110 return convertBs(robFrags, jeCollection,
nullptr);
119 return convertBs(robFrags,
nullptr, cmCollection);
133 "JepRoiByteStream") );
151 JemRoiMap::const_iterator mapIter = roiMap.begin();
152 JemRoiMap::const_iterator mapIterEnd = roiMap.end();
166 for (
int crate = 0; crate <
m_crates; ++crate) {
173 if (
module % modulesPerSlink == 0) {
174 const int daqOrRoi = 1;
175 const int slink =
module / modulesPerSlink;
177 msg() <<
"Treating crate " << hwCrate
178 <<
" slink " << slink <<
endmsg
187 theROD->push_back(userHeader.
header());
202 for (; mapIter != mapIterEnd; ++mapIter) {
204 if (roi->
crate() < crate)
continue;
205 if (roi->
crate() > crate)
break;
209 if (neutralFormat) subBlock.
fillRoi(*roi);
210 else theROD->push_back(roi->
roiWord());
217 if ( !subBlock.
pack()) {
218 msg(MSG::ERROR) <<
"JEM RoI sub-block packing failed" <<
endmsg;
219 return StatusCode::FAILURE;
222 msg() <<
"JEM RoI sub-block data words: "
225 subBlock.
write(theROD);
232 if (crate !=
m_crates - 1)
continue;
237 const int timeslices = 1;
243 const int cmmEnergyVersion = 2;
248 for (
int dataID = 0; dataID < maxDataID; ++dataID) {
274 const unsigned int ex = sums->
Ex();
275 const unsigned int ey = sums->
Ey();
276 const unsigned int et = sums->
Et();
277 const int exErr = sums->
ExError();
278 const int eyErr = sums->
EyError();
279 const int etErr = sums->
EtError();
291 if ( !enBlock.
pack()) {
292 msg(MSG::ERROR) <<
"CMM-Energy sub-block packing failed" <<
endmsg;
293 return StatusCode::FAILURE;
296 msg() <<
"CMM-Energy sub-block data words: "
299 enBlock.
write(theROD);
308 for (
int dataID = 0; dataID < maxDataID; ++dataID) {
341 const unsigned int hits =
ch->Hits();
342 const int errs =
ch->Error();
350 if ( !jetBlock.
pack()) {
351 msg(MSG::ERROR) <<
"CMM-Jet sub-block packing failed" <<
endmsg;
352 return StatusCode::FAILURE;
355 msg() <<
"CMM-Jet sub-block data words: "
358 jetBlock.
write(theROD);
369 roi->
ex(), roi->
ey(), roi->
et(),
390 return StatusCode::SUCCESS;
411 for (
int slink = 0; slink < maxSlinks; ++slink)
413 const int daqOrRoi = 1;
419 if (slink < 2)
sourceIDs.push_back(robId);
421 else if (slink >= 2)
sourceIDs.push_back(robId);
430 const std::string& sgKey)
const
432 const std::string
flag(
"RoIB");
433 const std::string::size_type
pos = sgKey.find(
flag);
435 (
pos == std::string::npos ||
pos != sgKey.length() -
flag.length());
442 static const std::vector<uint32_t> sourceIDsRoIB =
makeSourceIDs(roiDaq);
443 return sourceIDsRoIB;
460 std::set<uint32_t> dupCheck;
461 std::set<uint32_t> dupRoiCheck;
464 for (; rob != robEnd; ++rob) {
468 msg() <<
"Treating ROB fragment " << robCount <<
endmsg;
473 uint32_t robid = (*rob)->source_id();
474 if ((*rob)->nstatus() > 0) {
476 (*rob)->status(robData);
479 if (
debug)
msg() <<
"ROB status error - skipping fragment" <<
endmsg;
486 if (!dupCheck.insert(robid).second) {
497 (*rob)->rod_data(payloadBeg);
498 payloadEnd = payloadBeg + (*rob)->rod_ndata();
506 const uint32_t sourceID = (*rob)->rod_source_id();
515 msg() <<
"Wrong source identifier in data: "
516 << MSG::hex << sourceID << MSG::dec <<
endmsg;
522 msg() <<
"Treating crate " << rodCrate
529 const int minorVersion = (*rob)->rod_version() & 0xffff;
531 const int headerWords = userHeader.
words();
532 if (headerWords != 1) {
534 if (
debug)
msg() <<
"Unexpected number of user header words: "
538 for (
int i = 0;
i < headerWords; ++
i) ++
payload;
544 while (
payload != payloadEnd) {
553 if (cmCollection !=
nullptr) {
557 msg() <<
"CMM-Jet sub-block unpacking failed: "
564 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
570 if (cmCollection !=
nullptr) {
574 msg() <<
"CMM-Energy sub-block unpacking failed: "
599 if (jeCollection !=
nullptr) {
603 msg() <<
"JEM RoI sub-block unpacking failed: "
609 for (
int frame = 0; frame < 8; ++frame) {
610 for (
int forward = 0; forward < 2; ++forward) {
624 if (jeCollection !=
nullptr) {
626 if (
debug)
msg() <<
"Inconsistent RoI crate number: "
631 const uint32_t location = (*payload) & 0xfffc0000;
632 if (dupRoiCheck.insert(location).second) {
637 if (
debug)
msg() <<
"Duplicate RoI word "
644 if (cmCollection !=
nullptr) {
645 uint32_t roiType = (*payload) & 0xf0000000;
646 if ((roiType & 0xe0000000) == 0xa0000000) roiType = 0xa0000000;
647 if (dupRoiCheck.insert(roiType).second) {
650 if (
debug)
msg() <<
"Duplicate RoI word "
657 if (
debug)
msg() <<
"Invalid RoI word "
669 return StatusCode::SUCCESS;
679 CmmHitsMap::const_iterator mapIter;
680 mapIter = cmmHitsMap.find(crate * 100 + dataID);
681 if (mapIter != cmmHitsMap.end())
hits = mapIter->second;
692 CmmSumsMap::const_iterator mapIter;
693 mapIter = cmmEtMap.find(crate * 100 + dataID);
694 if (mapIter != cmmEtMap.end()) sums = mapIter->second;
708 for (;
pos != pose; ++
pos) {
711 roiMap.insert(std::make_pair(
key, roi));
726 for (;
pos != pose; ++
pos) {
729 const int key = crate * 100 +
hits->dataID();
730 cmmHitsMap.insert(std::make_pair(
key,
hits));
745 for (;
pos != pose; ++
pos) {
748 const int key = crate * 100 + sums->
dataID();
749 cmmEtMap.insert(std::make_pair(
key, sums));
unsigned int missingEtSigHits(int slice) const
Return Missing-ET-Sig Hits map.
void setSumEtHits(int slice, unsigned int map)
Store Sum-Et Hits map.
static CmmFirmwareCode cmmType(uint32_t word)
CMM differentiation (CMM_CP, CMM_JET, or CMM_ENERGY)
int exError(int slice, int source) const
Return Ex subsum error for given JEM or source ID.
int slink(uint32_t code) const
Return slink from unpacked moduleID.
Extra patterns decribing particle interation process.
Const iterator class for DataVector/DataList.
uint32_t energyRoiWord2() const
Return packed Energy RoI word 2.
unsigned int et(int slice, int source) const
Return Et subsum for given JEM or source ID.
int unpackErrorCode() const
Return the unpacking error code.
Template class for assembling a full atlas raw event from subfragments.
int exError() const
Return Ex error flags (bit 0 Overflow, bit 1 Parity)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
int sumEtHits() const
Return Sum-ET hits.
CMMEtSums object stores Et sums from the Energy CMMs.
void setCmmHeader(int version, int format, int slice, int crate, int summing, int firmware, int position, int timeslices)
Store CMM header.
static bool cmmBlock(uint32_t word)
Determine if header word corresponds to CMM.
unsigned int jetEtMap(int slice) const
Return jet ET map.
const DataVector< JEMRoI > * JemRoi() const
Return pointer to JEM RoI collection.
void write(FullEventAssembler< L1CaloSrcIdMap >::RODDATA *theROD) const
Output complete packed sub-block to ROD vector.
bool msgLvl(const MSG::Level lvl) const
uint32_t getRobID(uint32_t rod_id) const
Make a ROB Source ID from a ROD source ID.
unsigned int Et() const
For triggered time slice.
void clear()
Clear all data.
unsigned int missingEtHits(int slice) const
Return Missing-ET Hits map.
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.
int etError() const
Return Et error flags (bit 0 Overflow, bit 1 Parity)
void setRoiHeader(int version, int crate, int module)
Store header.
int eyError(int slice, int source) const
Return Ey subsum error for given JEM or source ID.
int dataID() const
returns data ID
uint32_t energyRoiWord0() const
Return packed Energy RoI word 0.
int jetEtError() const
Return Jet-ET error flag (bit 1 Parity)
unsigned int Ex() const
returns module Ex sum for peak sample
int EyError() const
returns module Ey sum error for peak sample
uint32_t energyRoiWord1() const
Return packed Energy RoI word 1.
const DataVector< CMMEtSums > * CmmSums() const
Return pointer to CMM energy sums collection.
unsigned int Ey() const
returns module Ey sum for peak sample
int error() const
Return error flags (bit 0 Saturation, bit 1 Parity)
int EtError() const
returns module ET sum error for peak sample
int hits() const
Return Jet hit map (8 bits Main or 4 bits Forward)
::StatusCode StatusCode
StatusCode definition for legacy code.
int sumEtError() const
Return Sum-ET error flag (bit 1 Parity)
LVL1::JEMRoI roi(int frame, int forward) const
Return RoI for given frame and forward.
int crate(uint32_t code) const
Return crate from unpacked moduleID.
void setMissingEtSigHits(int slice, unsigned int map)
Store Missing-ET-Sig Hits map.
int jetEtHits() const
Return Jet-ET hits.
const DataVector< CMMJetHits > * CmmHits() const
Return pointer to CMM hit sums collection.
int ExError() const
returns module Ex sum error for peak sample
Jet/Energy Processor RoI container for writing bytestream.
std::vector< const ROBF * > VROBFRAG
unsigned int sumEtHits(int slice) const
Return Sum-Et Hits map.
int etError(int slice, int source) const
Return Et subsum error for given JEM or source ID.
static SubBlockWordType wordType(uint32_t word)
Word identification.
Sub-Block class for JEM RoI data (neutral format).
std::string unpackErrorMsg() const
Return the unpacking error message for printing.
bool unpack()
Unpack data.
int missingEtHits() const
Return Missing-ET hits.
void setJetHits(int slice, int source, unsigned int hits, int error)
Store jet hit counts and error for given jem or source ID.
uint16_t minorVersion() const
Return ROD header minor version to use when writing BS.
int crate() const
Return crate number (0-1)
const CMMRoI * CmmRoi() const
Return pointer to CMM RoIs.
void fillRoi(LVL1::JEMRoI roi)
Store RoI.
int dataWords() const
Return number of data words.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
void setJetEtMap(int slice, unsigned int map)
Store jet ET map.
int crate() const
Data accessors.
unsigned int ex(int slice, int source) const
Return Ex subsum for given JEM or source ID.
bool unpack()
Unpack data.
int eyError() const
Return Ey error flags (bit 0 Overflow, bit 1 Parity)
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
eformat::SubDetector subDet(uint32_t code) const
Return sub-detector for given ID.
uint32_t jetEtRoiWord() const
Return packed Jet-Et RoI word.
bool unpack()
Unpack data.
Sub-Block class for CMM-Jet data.
int missingEtSigError() const
Return Missing-ET-Sig error flag (bit 1 Parity)
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.
void setRodMinorVersion(uint16_t m)
change the ROD minor version
int jem() const
Return JEM number (0-15)
unsigned int ey(int slice, int source) const
Return Ey subsum for given JEM or source ID.
CMMJetHits class stores Jet hit multiplicities received by and read out from the Jet CMMs.
bool setRoiWord(uint32_t roiWord)
Set RoI word with ID check.
uint32_t getRodID(int crate, int slink, int daqOrRoi, eformat::SubDetector subdet) const
Make a ROD Source ID.
int missingEtError() const
Return Missing-ET error flag (bit 1 Parity)
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
Sub-Block class for CMM-Energy data.
void setMissingEtHits(int slice, unsigned int map)
Store Missing-ET Hits map.
int missingEtSigHits() const
Return Missing-ET-Sig hits.
int maxSlinks() const
Return the maximum possible number of slinks.
bool setRoiWord(uint32_t roiWord)
Set RoI word with ID check.
uint32_t roiWord() const
Return packed RoI word.
int daqOrRoi(uint32_t code) const
Return daqOrRoi from unpacked moduleID.
RODDATA * getRodData(uint32_t id)
get a block of ROD data
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.