24 constexpr std::string_view s_contextName{
"HLT::HLTResultMT"};
31 boost::dynamic_bitset<uint32_t> hltPassRawBits,
32 boost::dynamic_bitset<uint32_t> hltPrescaledBits,
33 std::unordered_map<uint16_t, std::vector<uint32_t> >
data)
55 for (
const auto& st : streamTags) {
58 return StatusCode::SUCCESS;
64 auto compareTypeName = [&streamTag](
const eformat::helper::StreamTag& existingStreamTag) {
65 return streamTag.type == existingStreamTag.type && streamTag.name == existingStreamTag.name;
71 if (streamTag.obeys_lumiblock != p->obeys_lumiblock) {
73 <<
"Stream tags have equal type and name (" << streamTag.type <<
"/" << streamTag.name
74 <<
"), but inconsistent obeys_lumiblock flag";
75 return StatusCode::FAILURE;
77 p->robs.insert(streamTag.robs.begin(), streamTag.robs.end());
78 p->dets.insert(streamTag.dets.begin(), streamTag.dets.end());
84 return StatusCode::SUCCESS;
102 throw std::runtime_error(
"Must have the same number of bits in m_hltPassRawBits and m_hltPrescaledBits");
105 throw std::runtime_error(
"m_hltBitWords size differs from the sum of m_hltPassRawBits and m_hltPrescaledBits");
126 const boost::dynamic_bitset<uint32_t>& prescaledBitset) {
127 if (passRawBitset.num_blocks() != prescaledBitset.num_blocks()) {
128 throw std::runtime_error(
"Must have the same number of bits in passRawBitset and prescaledBitset");
154 const auto it =
m_data.find(moduleId);
157 <<
"No data available in the stored map for the requested moduleId=" << moduleId;
158 return StatusCode::FAILURE;
161 data = &(it->second);
163 return StatusCode::SUCCESS;
174 std::vector<uint32_t>& v =
m_data[moduleId];
176 v.insert(v.end(),
data.begin(),
data.end());
183 <<
"Trying to add data for a module which already exists in the stored map, moduleId=" << moduleId;
184 return StatusCode::FAILURE;
190 return StatusCode::SUCCESS;
202 std::vector<HLT::OnlineErrorCode> errorCodes;
219 const eformat::helper::Status& firstStatusWord) {
221 else m_status[0] |= firstStatusWord.code();
222 m_status.push_back(
static_cast<uint32_t
>(errorCode));
229 static const std::vector<uint32_t>
empty;
232 else return it->second;
267 eformat::helper::Status firstStatusWord(eformat::GenericStatus::DATA_CORRUPTION);
275 auto printWord = [&
str](
const uint32_t word,
const size_t width=8){
276 str <<
"0x" << std::hex << std::setw(
width) << std::setfill(
'0') << word <<
" " << std::dec;
278 str <<
"Printing HLTResultMT:" << std::endl;
281 str <<
"--> Status words = ";
282 for (
const uint32_t word : hltResult.
getStatus()) {
288 str <<
"--> Stream tags = ";
290 for (
const eformat::helper::StreamTag& st : hltResult.
getStreamTags()) {
291 if (first) first=
false;
293 str <<
"{" << st.name <<
", " << st.type <<
", obeysLB=" << st.obeys_lumiblock <<
", robs=[";
294 for (
const auto& robid : st.robs) printWord(robid);
295 str <<
"], dets = [";
296 for (
const auto& detid : st.dets) printWord(detid,2);
297 str <<
"]}" << std::endl;
302 std::vector<uint32_t> hltPassRawBitWords;
303 std::vector<uint32_t> hltPrescaledBitWords;
308 str <<
"--> HLT bits = ";
309 for (
const uint32_t word : hltPassRawBitWords) {
312 for (
const uint32_t word : hltPrescaledBitWords) {
318 str <<
"--> Payload size = ";
321 if (first) first=
false;
323 str <<
"{module " << p.first <<
": " << p.second.size() <<
" words}" << std::endl;
328 str <<
"--> Truncated results = ";
331 if (first) first=
false;
#define ATH_REPORT_ERROR_WITH_CONTEXT
Report an error, with an explicitly specified context name.
#define ATH_CHECK
Evaluate an expression and check for errors.
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
char data[hepevt_bytes_allocation_ATLAS]
static const Attributes_t empty
A container class for data required to build online output from HLT.
std::set< uint16_t > m_truncatedModuleIds
List of module IDs with truncation.
std::vector< uint32_t > m_hltBitWords
Vector storing m_hltBits converted to 4-byte words.
StatusCode addSerialisedDataWithCheck(const uint16_t moduleId, std::vector< uint32_t > data)
Add serialised data for a given moduleId.
void setHltBits(const boost::dynamic_bitset< uint32_t > &passRawBitset, const boost::dynamic_bitset< uint32_t > &prescaledBitset)
Replace both HLT pass raw and prescaled bits with the given bitsets.
const std::vector< uint32_t > & getHltBitsAsWords() const
Const-getter for HLT bits as uint32_t array. Ordering: PassRaw, Prescaled.
RODMinorVersion getVersion() const
ROD minor version getter.
const std::set< uint16_t > & getTruncatedModuleIds() const
Getter for the truncation information.
void updateHltBitWords()
Update m_hltBitWords with the contents of m_hltPassRawBits and m_hltPrescaledBits.
const boost::dynamic_bitset< uint32_t > & getHltPassRawBits() const
Const-getter for HLT pass raw bits.
void addErrorCode(const HLT::OnlineErrorCode &errorCode, const eformat::helper::Status &firstStatusWord={ eformat::GenericStatus::DATA_CORRUPTION, eformat::FullEventStatus::PSC_PROBLEM })
Append an error code.
void addTruncatedModuleId(const uint16_t moduleId, bool severeTruncation=true)
Add module ID to the list of truncated results.
boost::dynamic_bitset< uint32_t > m_hltPassRawBits
HLT bits (flagging which chains passed)
const std::vector< eformat::helper::StreamTag > & getStreamTags() const
Const-getter for stream tags.
bool m_severeTruncation
Should the event be sent to the debug stream due to severe truncation?
boost::dynamic_bitset< uint32_t > m_hltPrescaledBits
void addSerialisedData(const uint16_t moduleId, const std::vector< uint32_t > &data)
Append serialised data (copy of input) for a given moduleId, doesn't remove existing data.
bool severeTruncation() const
Truncation in at least one collection that is not allowed to be truncated.
std::pair< uint8_t, uint8_t > RODMinorVersion
Type to store decoded ROD minor version (16-bit version split into two 8-bit numbers)
std::unordered_map< uint16_t, std::vector< uint32_t > > m_data
Serialised result (ROBFragment payload) for each moduleId (0 for full result, >0 for data scouting)
const std::unordered_map< uint16_t, std::vector< uint32_t > > & getSerialisedData() const
Serialised data getter.
const boost::dynamic_bitset< uint32_t > & getHltPrescaledBits() const
Const-getter for HLT prescaled bits.
const std::vector< uint32_t > & getStatus() const
Full event status reference getter (1 bit-mask status word + error code words)
StatusCode setStreamTags(const std::vector< eformat::helper::StreamTag > &streamTags)
Replace the stored list of stream tags with the given one.
const std::vector< uint32_t > & getRobStatus(uint16_t moduleId) const
Status words for ROB with given moduleId.
void setVersion(RODMinorVersion version)
ROD minor version setter.
void setHltPrescaledBits(const boost::dynamic_bitset< uint32_t > &bitset)
Replace HLT prescaled bits with the given bitset.
void setHltPassRawBits(const boost::dynamic_bitset< uint32_t > &bitset)
Replace HLT pass raw bits with the given bitset.
std::unordered_map< uint16_t, std::vector< uint32_t > > m_robStatus
ROBFragment status words for each moduleId.
std::vector< eformat::helper::StreamTag > & getStreamTagsNonConst()
Non-const-getter for stream tags needed by the result maker to remove disabled ROBs/SubDets.
StatusCode addStreamTag(const eformat::helper::StreamTag &streamTag)
Append one stream tag to the stored list.
HLTResultMT(std::vector< eformat::helper::StreamTag > streamTags={}, boost::dynamic_bitset< uint32_t > hltPassRawBits=boost::dynamic_bitset< uint32_t >(), boost::dynamic_bitset< uint32_t > hltPrescaledBits=boost::dynamic_bitset< uint32_t >(), std::unordered_map< uint16_t, std::vector< uint32_t > > data={})
Standard constructor.
const std::vector< HLT::OnlineErrorCode > getErrorCodes() const
Error codes getter (by value) - strips off the first bit-mask status word.
std::vector< eformat::helper::StreamTag > m_streamTags
Stream tags of the event.
std::vector< uint32_t > m_status
FullEvent status words (first word is eformat::helper::Status, next words are optional error codes)
void setSerialisedData(std::unordered_map< uint16_t, std::vector< uint32_t > > data)
Replaces serialised data with a copy of the given data.
void setStatus(std::vector< uint32_t > status)
Replace the full status words with the given data.
RODMinorVersion m_version
Stores the ROD minor version of the HLT ROBFragments.
MsgStream & operator<<(MsgStream &m, const Navigation &nav)