|
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"
34 static const InterfaceID IID_IJepRoiByteStreamV2Tool(
"JepRoiByteStreamV2Tool",
39 return IID_IJepRoiByteStreamV2Tool;
45 const std::string&
name,
48 m_robDataProvider(
"ROBDataProviderSvc",
name),
49 m_errorTool(
"LVL1BS::L1CaloErrorByteStreamTool/L1CaloErrorByteStreamTool"),
50 m_crates(2), m_modules(16), m_frames(8), m_maxRoiWords(6),
51 m_subDetector (
eformat::TDAQ_CALO_JET_PROC_ROI)
53 declareInterface<JepRoiByteStreamV2Tool>(
this);
56 "Tool to collect errors for monitoring");
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");
76 "Minimum crate number, allows partial output");
78 "Maximum crate number, allows partial output");
98 return StatusCode::SUCCESS;
105 return StatusCode::SUCCESS;
111 const std::string& sgKey,
114 const std::vector<uint32_t>& vID(
sourceIDs(sgKey));
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);
126 return convertBs(robFrags, jeCollection,
nullptr);
132 const std::string& sgKey,
135 const std::vector<uint32_t>& vID(
sourceIDs(sgKey));
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);
147 return convertBs(robFrags,
nullptr, cmCollection);
161 "JepRoiByteStreamV2") );
179 JemRoiMap::const_iterator mapIter = roiMap.begin();
180 JemRoiMap::const_iterator mapIterEnd = roiMap.end();
198 if (
module % modulesPerSlink == 0) {
199 const int daqOrRoi = 1;
200 const int slink =
module / modulesPerSlink;
202 msg() <<
"Treating crate " << hwCrate
203 <<
" slink " << slink <<
endmsg
212 theROD->push_back(userHeader.
header());
227 for (; mapIter != mapIterEnd; ++mapIter) {
229 if (roi->
crate() < crate)
continue;
230 if (roi->
crate() > crate)
break;
234 if (neutralFormat) subBlock.
fillRoi(*roi);
235 else theROD->push_back(roi->
roiWord());
242 if ( !subBlock.
pack()) {
243 msg(MSG::ERROR) <<
"JEM RoI sub-block packing failed" <<
endmsg;
244 return StatusCode::FAILURE;
247 msg() <<
"JEM RoI sub-block data words: "
250 subBlock.
write(theROD);
257 if (crate !=
m_crates - 1)
continue;
262 const int timeslices = 1;
268 const int cmxEnergyVersion = 3;
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();
291 exErr, eyErr, etErr);
298 if ( !subBlock.
pack()) {
299 msg(MSG::ERROR) <<
"CMX-Energy sub-block packing failed" <<
endmsg;
300 return StatusCode::FAILURE;
303 msg() <<
"CMX-Energy sub-block data words: "
306 subBlock.
write(theROD);
316 theROD->push_back(roi->
roiWord(word));
322 return StatusCode::SUCCESS;
343 for (
int slink = 0; slink < maxSlinks; ++slink)
345 const int daqOrRoi = 1;
351 if (slink < 2)
sourceIDs.push_back(robId);
353 else if (slink >= 2)
sourceIDs.push_back(robId);
362 const std::string& sgKey)
const
364 const std::string
flag(
"RoIB");
365 const std::string::size_type
pos = sgKey.find(
flag);
367 (
pos == std::string::npos ||
pos != sgKey.length() -
flag.length());
374 static const std::vector<uint32_t> sourceIDsRoIB =
makeSourceIDs(roiDaq);
375 return sourceIDsRoIB;
392 std::set<uint32_t> dupCheck;
393 std::set<uint32_t> dupRoiCheck;
396 for (; rob != robEnd; ++rob) {
400 msg() <<
"Treating ROB fragment " << robCount <<
endmsg;
405 uint32_t robid = (*rob)->source_id();
406 if ((*rob)->nstatus() > 0) {
408 (*rob)->status(robData);
411 if (
debug)
msg() <<
"ROB status error - skipping fragment" <<
endmsg;
418 if (!dupCheck.insert(robid).second) {
429 (*rob)->rod_data(payloadBeg);
430 payloadEnd = payloadBeg + (*rob)->rod_ndata();
438 const uint32_t sourceID = (*rob)->rod_source_id();
447 msg() <<
"Wrong source identifier in data: "
448 << MSG::hex << sourceID << MSG::dec <<
endmsg;
454 const int minorVersion = (*rob)->rod_version() & 0xffff;
461 msg() <<
"Treating crate " << rodCrate
469 const int headerWords = userHeader.
words();
470 if (headerWords != 1) {
472 if (
debug)
msg() <<
"Unexpected number of user header words: "
476 for (
int i = 0;
i < headerWords; ++
i) ++
payload;
482 while (
payload != payloadEnd) {
491 if (cmCollection !=
nullptr) {
495 msg() <<
"CMX-Energy sub-block unpacking failed: "
557 if (jeCollection !=
nullptr) {
561 msg() <<
"JEM RoI sub-block unpacking failed: "
567 for (
int frame = 0; frame <
m_frames; ++frame) {
580 if (jeCollection !=
nullptr) {
582 if (
debug)
msg() <<
"Inconsistent RoI crate number: "
587 const uint32_t location = (*payload) & 0xfff80000;
588 if (dupRoiCheck.insert(location).second) {
593 if (
debug)
msg() <<
"Duplicate RoI word "
600 if (cmCollection !=
nullptr) {
601 const uint32_t roiType = (*payload) & 0xfc000000;
603 if (dupRoiCheck.insert(roiType).second) {
606 if (
debug)
msg() <<
"Duplicate RoI word "
613 if (
debug)
msg() <<
"Invalid RoI word "
625 return StatusCode::SUCCESS;
635 CmxSumsMap::const_iterator mapIter;
636 mapIter = cmxEtMap.find(crate * 100 +
source);
637 if (mapIter != cmxEtMap.end()) sums = mapIter->second;
651 for (;
pos != pose; ++
pos) {
654 roiMap.insert(std::make_pair(
key, roi));
669 for (;
pos != pose; ++
pos) {
672 const int key = crate * 100 + sums->
source();
673 cmxEtMap.insert(std::make_pair(
key, sums));
const CMXRoI * CmxRoi() const
Return pointer to CMX RoIs.
void fillRoi(LVL1::JEMTobRoI roi)
Store RoI.
uint16_t minorVersionPreLS1() const
Return last ROD header minor version for pre-LS1 data.
unsigned int Ey() const
returns module Ey sum for peak sample
int slink(uint32_t code) const
Return slink from unpacked moduleID.
Extra patterns decribing particle interation process.
Const iterator class for DataVector/DataList.
void setEtHits(int slice, HitsType hType, SumType sType, unsigned int map)
Store hits map for given hits type and sum type.
int unpackErrorCode() const
Return the unpacking error code.
Template class for assembling a full atlas raw event from subfragments.
int source() const
returns data source
void clear()
Clear all data.
const DataVector< CMXEtSums > * CmxSums() const
Return pointer to CMX energy sums collection.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
void write(FullEventAssembler< L1CaloSrcIdMap >::RODDATA *theROD) const
Output complete packed sub-block to ROD vector.
Sub-Block class for JEM RoI data (neutral format) post-LS1.
bool setRoiWord(uint32_t roiWord)
Set RoI word with ID check.
bool msgLvl(const MSG::Level lvl) const
Jet/Energy Processor RoI container for writing bytestream post-LS1.
uint32_t getRobID(uint32_t rod_id) const
Make a ROB Source ID from a ROD source ID.
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 EyError() const
returns module Ey sum error for peak sample
static bool cmxBlock(uint32_t word)
Determine if header word corresponds to CMX.
unsigned int Et() const
For triggered time slice.
uint32_t roiWord() const
Return packed RoI word.
bool unpack()
Unpack data.
::StatusCode StatusCode
StatusCode definition for legacy code.
unsigned int Ex() const
returns module Ex sum for peak sample
int crate(uint32_t code) const
Return crate from unpacked moduleID.
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.
int ExError() const
returns module Ex sum error for peak sample
std::vector< const ROBF * > VROBFRAG
LVL1::JEMTobRoI roi(int frame) const
Return RoI for given frame.
static SubBlockWordType wordType(uint32_t word)
Word identification.
std::string unpackErrorMsg() const
Return the unpacking error message for printing.
int energySmall() const
Return energy small window size.
@ MISSING_ET_SIG_STANDARD
uint16_t minorVersion() const
Return ROD header minor version to use when writing BS.
const DataVector< JEMTobRoI > * JemRoi() const
Return pointer to JEM RoI collection.
int dataWords() const
Return number of data words.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
CMXEtSums object stores Et sums from the Energy CMXs.
static CmxFirmwareCode cmxType(uint32_t word)
CMX differentiation (CMX_CP, CMX_JET, or CMX_ENERGY)
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.
void setCmxHeader(int version, int format, int slice, int crate, int summing, int firmware, int position, int timeslices)
Store CMX header.
bool setRoiWord(uint32_t roiWord)
Set RoI word with ID check.
int EtError() const
returns module ET sum error for peak sample
void setRodMinorVersion(uint16_t m)
change the ROD minor version
int jem() const
Return JEM number (0-15)
unsigned int energy(int slice, int jem, EnergyType eType) const
Return energy subsum for given JEM and energy type.
unsigned int hits(int slice, HitsType hType, SumType sType) const
Return hits map for given hits type and sum type.
int energyLarge() const
Return energy large window size.
uint32_t getRodID(int crate, int slink, int daqOrRoi, eformat::SubDetector subdet) const
Make a ROD Source ID.
int crate() const
Data accessors.
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
int crate() const
Return crate number (0-1)
void setRoiHeader(int version, int crate, int module)
Store header.
int maxSlinks() const
Return the maximum possible number of slinks.
Sub-Block class for CMX-Energy data post LS1.
uint32_t roiWord(int word) const
Return packed Energy RoI word (0-5)
int daqOrRoi(uint32_t code) const
Return daqOrRoi from unpacked moduleID.
int error(int slice, int jem, EnergyType eType) const
Return energy subsum error for given JEM and energy type.
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.
bool unpack()
Unpack data.