|
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_IJepRoiByteStreamV1Tool(
"JepRoiByteStreamV1Tool",
42 return IID_IJepRoiByteStreamV1Tool;
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<JepRoiByteStreamV1Tool>(
this);
58 "Tool to collect errors for monitoring");
60 "Offset of JEP crate numbers in bytestream");
62 "Offset of JEP crate numbers in RDOs");
66 "ROB fragment source identifiers");
68 "ROB fragment source identifiers");
72 "Format version number in sub-block header");
74 "Format identifier (0-1) in sub-block header");
76 "The number of S-Links per crate");
78 "Minimum crate number, allows partial output");
80 "Maximum crate number, allows partial output");
100 return StatusCode::SUCCESS;
107 return StatusCode::SUCCESS;
116 return convertBs(robFrags, jeCollection,
nullptr);
125 return convertBs(robFrags,
nullptr, cmCollection);
139 "JepRoiByteStreamV1") );
157 JemRoiMap::const_iterator mapIter = roiMap.begin();
158 JemRoiMap::const_iterator mapIterEnd = roiMap.end();
179 if (
module % modulesPerSlink == 0) {
180 const int daqOrRoi = 1;
181 const int slink =
module / modulesPerSlink;
183 msg() <<
"Treating crate " << hwCrate
184 <<
" slink " << slink <<
endmsg
193 theROD->push_back(userHeader.
header());
208 for (; mapIter != mapIterEnd; ++mapIter) {
210 if (roi->
crate() < crate)
continue;
211 if (roi->
crate() > crate)
break;
215 if (neutralFormat) subBlock.
fillRoi(*roi);
216 else theROD->push_back(roi->
roiWord());
223 if ( !subBlock.
pack()) {
224 msg(MSG::ERROR) <<
"JEM RoI sub-block packing failed" <<
endmsg;
225 return StatusCode::FAILURE;
228 msg() <<
"JEM RoI sub-block data words: "
231 subBlock.
write(theROD);
238 if (crate !=
m_crates - 1)
continue;
243 const int timeslices = 1;
249 const int cmmEnergyVersion = 2;
254 for (
int dataID = 0; dataID < maxDataID; ++dataID) {
277 const unsigned int ex = sums->
Ex();
278 const unsigned int ey = sums->
Ey();
279 const unsigned int et = sums->
Et();
280 const int exErr = sums->
ExError();
281 const int eyErr = sums->
EyError();
282 const int etErr = sums->
EtError();
294 if ( !enBlock.
pack()) {
295 msg(MSG::ERROR) <<
"CMM-Energy sub-block packing failed" <<
endmsg;
296 return StatusCode::FAILURE;
299 msg() <<
"CMM-Energy sub-block data words: "
302 enBlock.
write(theROD);
311 for (
int dataID = 0; dataID < maxDataID; ++dataID) {
344 const unsigned int hits =
ch->Hits();
345 const int errs =
ch->Error();
353 if ( !jetBlock.
pack()) {
354 msg(MSG::ERROR) <<
"CMM-Jet sub-block packing failed" <<
endmsg;
355 return StatusCode::FAILURE;
358 msg() <<
"CMM-Jet sub-block data words: "
361 jetBlock.
write(theROD);
372 roi->
ex(), roi->
ey(), roi->
et(),
393 return StatusCode::SUCCESS;
414 for (
int slink = 0; slink < maxSlinks; ++slink)
416 const int daqOrRoi = 1;
422 if (slink < 2)
sourceIDs.push_back(robId);
424 else if (slink >= 2)
sourceIDs.push_back(robId);
433 const std::string& sgKey)
const
435 const std::string
flag(
"RoIB");
436 const std::string::size_type
pos = sgKey.find(
flag);
438 (
pos == std::string::npos ||
pos != sgKey.length() -
flag.length());
445 static const std::vector<uint32_t> sourceIDsRoIB =
makeSourceIDs(roiDaq);
446 return sourceIDsRoIB;
463 std::set<uint32_t> dupCheck;
464 std::set<uint32_t> dupRoiCheck;
467 for (; rob != robEnd; ++rob) {
471 msg() <<
"Treating ROB fragment " << robCount <<
endmsg;
476 uint32_t robid = (*rob)->source_id();
477 if ((*rob)->nstatus() > 0) {
479 (*rob)->status(robData);
482 if (
debug)
msg() <<
"ROB status error - skipping fragment" <<
endmsg;
489 if (!dupCheck.insert(robid).second) {
500 (*rob)->rod_data(payloadBeg);
501 payloadEnd = payloadBeg + (*rob)->rod_ndata();
509 const uint32_t sourceID = (*rob)->rod_source_id();
518 msg() <<
"Wrong source identifier in data: "
519 << MSG::hex << sourceID << MSG::dec <<
endmsg;
525 const int minorVersion = (*rob)->rod_version() & 0xffff;
532 msg() <<
"Treating crate " << rodCrate
540 const int headerWords = userHeader.
words();
541 if (headerWords != 1) {
543 if (
debug)
msg() <<
"Unexpected number of user header words: "
547 for (
int i = 0;
i < headerWords; ++
i) ++
payload;
553 while (
payload != payloadEnd) {
562 if (cmCollection !=
nullptr) {
566 msg() <<
"CMM-Jet sub-block unpacking failed: "
573 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
579 if (cmCollection !=
nullptr) {
583 msg() <<
"CMM-Energy sub-block unpacking failed: "
608 if (jeCollection !=
nullptr) {
612 msg() <<
"JEM RoI sub-block unpacking failed: "
618 for (
int frame = 0; frame < 8; ++frame) {
619 for (
int forward = 0; forward < 2; ++forward) {
633 if (jeCollection !=
nullptr) {
635 if (
debug)
msg() <<
"Inconsistent RoI crate number: "
640 const uint32_t location = (*payload) & 0xfffc0000;
641 if (dupRoiCheck.insert(location).second) {
646 if (
debug)
msg() <<
"Duplicate RoI word "
653 if (cmCollection !=
nullptr) {
654 uint32_t roiType = (*payload) & 0xf0000000;
655 if ((roiType & 0xe0000000) == 0xa0000000) roiType = 0xa0000000;
656 if (dupRoiCheck.insert(roiType).second) {
659 if (
debug)
msg() <<
"Duplicate RoI word "
666 if (
debug)
msg() <<
"Invalid RoI word "
678 return StatusCode::SUCCESS;
688 CmmHitsMap::const_iterator mapIter;
689 mapIter = cmmHitsMap.find(crate * 100 + dataID);
690 if (mapIter != cmmHitsMap.end())
hits = mapIter->second;
701 CmmSumsMap::const_iterator mapIter;
702 mapIter = cmmEtMap.find(crate * 100 + dataID);
703 if (mapIter != cmmEtMap.end()) sums = mapIter->second;
717 for (;
pos != pose; ++
pos) {
720 roiMap.insert(std::make_pair(
key, roi));
735 for (;
pos != pose; ++
pos) {
738 const int key = crate * 100 +
hits->dataID();
739 cmmHitsMap.insert(std::make_pair(
key,
hits));
754 for (;
pos != pose; ++
pos) {
757 const int key = crate * 100 + sums->
dataID();
758 cmmEtMap.insert(std::make_pair(
key, sums));
Sub-Block class for JEM RoI data (neutral format) pre-LS1.
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.
uint16_t minorVersionPreLS1() const
Return last ROD header minor version for pre-LS1 data.
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.
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.
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)
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.
Jet/Energy Processor RoI container for writing bytestream pre-LS1.
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)
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< JEMRoI > * JemRoi() const
Return pointer to JEM RoI collection.
const DataVector< CMMJetHits > * CmmHits() const
Return pointer to CMM hit sums collection.
LVL1::JEMRoI roi(int frame, int forward) const
Return RoI for given frame and forward.
int ExError() const
returns module Ex sum error for peak sample
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.
std::string unpackErrorMsg() const
Return the unpacking error message for printing.
bool unpack()
Unpack data.
int missingEtHits() const
Return Missing-ET hits.
bool unpack()
Unpack data.
const CMMRoI * CmmRoi() const
Return pointer to CMM RoIs.
const DataVector< CMMEtSums > * CmmSums() const
Return pointer to CMM energy sums collection.
void setJetHits(int slice, int source, unsigned int hits, int error)
Store jet hit counts and error for given jem or source ID.
void fillRoi(LVL1::JEMRoI roi)
Store RoI.
int crate() const
Return crate number (0-1)
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.
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 setRoiHeader(int version, int crate, int module)
Store header.
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.
void clear()
Clear all data.
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.