ATLAS Offline Software
Loading...
Searching...
No Matches
HLT::HLTResultMT Class Reference

A container class for data required to build online output from HLT. More...

#include <HLTResultMT.h>

Collaboration diagram for HLT::HLTResultMT:

Public Types

using RODMinorVersion = std::pair<uint8_t,uint8_t>
 Type to store decoded ROD minor version (16-bit version split into two 8-bit numbers)

Public Member Functions

 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< eformat::helper::StreamTag > & getStreamTags () const
 Const-getter for stream tags.
std::vector< eformat::helper::StreamTag > & getStreamTagsNonConst ()
 Non-const-getter for stream tags needed by the result maker to remove disabled ROBs/SubDets.
StatusCode setStreamTags (const std::vector< eformat::helper::StreamTag > &streamTags)
 Replace the stored list of stream tags with the given one.
StatusCode addStreamTag (const eformat::helper::StreamTag &streamTag)
 Append one stream tag to the stored list.
const boost::dynamic_bitset< uint32_t > & getHltPassRawBits () const
 Const-getter for HLT pass raw bits.
const boost::dynamic_bitset< uint32_t > & getHltPrescaledBits () const
 Const-getter for HLT prescaled bits.
const std::vector< uint32_t > & getHltBitsAsWords () const
 Const-getter for HLT bits as uint32_t array. Ordering: PassRaw, Prescaled.
void setHltPassRawBits (const boost::dynamic_bitset< uint32_t > &bitset)
 Replace HLT pass raw bits with the given bitset.
void setHltPrescaledBits (const boost::dynamic_bitset< uint32_t > &bitset)
 Replace HLT prescaled bits with the given bitset.
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::unordered_map< uint16_t, std::vector< uint32_t > > & getSerialisedData () const
 Serialised data getter.
StatusCode getSerialisedData (const uint16_t moduleId, const std::vector< uint32_t > *&data) const
 Serialised data getter for a given moduleId @in moduleId @out data - const pointer to the stored data, nullptr on failure.
void setSerialisedData (std::unordered_map< uint16_t, std::vector< uint32_t > > data)
 Replaces serialised data with a copy of the given data.
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.
StatusCode addSerialisedDataWithCheck (const uint16_t moduleId, std::vector< uint32_t > data)
 Add serialised data for a given moduleId.
const std::vector< uint32_t > & getStatus () const
 Full event status reference getter (1 bit-mask status word + error code words)
const std::vector< HLT::OnlineErrorCodegetErrorCodes () const
 Error codes getter (by value) - strips off the first bit-mask status word.
void setStatus (std::vector< uint32_t > status)
 Replace the full status words with the given data.
void addErrorCode (const HLT::OnlineErrorCode &errorCode, const eformat::helper::Status &firstStatusWord={ eformat::GenericStatus::DATA_CORRUPTION, eformat::FullEventStatus::PSC_PROBLEM })
 Append an error code.
const std::vector< uint32_t > & getRobStatus (uint16_t moduleId) const
 Status words for ROB with given moduleId.
RODMinorVersion getVersion () const
 ROD minor version getter.
void setVersion (RODMinorVersion version)
 ROD minor version setter.
const std::set< uint16_t > & getTruncatedModuleIds () const
 Getter for the truncation information.
void addTruncatedModuleId (const uint16_t moduleId, bool severeTruncation=true)
 Add module ID to the list of truncated results.
bool severeTruncation () const
 Truncation in at least one collection that is not allowed to be truncated.
bool isAccepted () const
 If there is at least one stream tag set, it means the event is accepted.

Private Member Functions

void updateHltBitWords ()
 Update m_hltBitWords with the contents of m_hltPassRawBits and m_hltPrescaledBits.

Private Attributes

std::vector< eformat::helper::StreamTag > m_streamTags
 Stream tags of the event.
boost::dynamic_bitset< uint32_t > m_hltPassRawBits
 HLT bits (flagging which chains passed)
boost::dynamic_bitset< uint32_t > m_hltPrescaledBits
std::vector< uint32_t > m_hltBitWords
 Vector storing m_hltBits converted to 4-byte words.
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)
std::vector< uint32_t > m_status
 FullEvent status words (first word is eformat::helper::Status, next words are optional error codes)
std::unordered_map< uint16_t, std::vector< uint32_t > > m_robStatus
 ROBFragment status words for each moduleId.
RODMinorVersion m_version
 Stores the ROD minor version of the HLT ROBFragments.
std::set< uint16_t > m_truncatedModuleIds
 List of module IDs with truncation.
bool m_severeTruncation {false}
 Should the event be sent to the debug stream due to severe truncation?

Detailed Description

A container class for data required to build online output from HLT.

This is not an EDM class and it is not meant to be serialised and persistified. It is a transient container for collecting serialised EDM objects and other event data before saving to ByteStream or after reading from ByteStream. It provides only getter and setter methods for the stored data. It does not serialise/deserialise the data on its own.

Definition at line 38 of file HLTResultMT.h.

Member Typedef Documentation

◆ RODMinorVersion

using HLT::HLTResultMT::RODMinorVersion = std::pair<uint8_t,uint8_t>

Type to store decoded ROD minor version (16-bit version split into two 8-bit numbers)

Definition at line 50 of file HLTResultMT.h.

Constructor & Destructor Documentation

◆ HLTResultMT()

HLT::HLTResultMT::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.

Definition at line 30 of file HLTResultMT.cxx.

34: m_streamTags(std::move(streamTags)),
35 m_hltPassRawBits(std::move(hltPassRawBits)),
36 m_hltPrescaledBits(std::move(hltPrescaledBits)),
37 m_data(std::move(data)),
38 m_version(s_currentHltRodMinorVersion) {}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
boost::dynamic_bitset< uint32_t > m_hltPassRawBits
HLT bits (flagging which chains passed)
boost::dynamic_bitset< uint32_t > m_hltPrescaledBits
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)
std::vector< eformat::helper::StreamTag > m_streamTags
Stream tags of the event.
RODMinorVersion m_version
Stores the ROD minor version of the HLT ROBFragments.

Member Function Documentation

◆ addErrorCode()

void HLT::HLTResultMT::addErrorCode ( const HLT::OnlineErrorCode & errorCode,
const eformat::helper::Status & firstStatusWord = { eformat::GenericStatus::DATA_CORRUPTION, eformat::FullEventStatus::PSC_PROBLEM } )

Append an error code.

Makes the current first word |= new first word and appends errorCode to the vector of optional error codes

Definition at line 218 of file HLTResultMT.cxx.

219 {
220 if (m_status.empty()) m_status.push_back(firstStatusWord.code());
221 else m_status[0] |= firstStatusWord.code();
222 m_status.push_back(static_cast<uint32_t>(errorCode));
223}
std::vector< uint32_t > m_status
FullEvent status words (first word is eformat::helper::Status, next words are optional error codes)
setEventNumber uint32_t

◆ addSerialisedData()

void HLT::HLTResultMT::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.

Definition at line 173 of file HLTResultMT.cxx.

173 {
174 std::vector<uint32_t>& v = m_data[moduleId]; // creates new empty vector if the key doesn't exist
175 // WARNING, copying data which may be large
176 v.insert(v.end(),data.begin(),data.end());
177}

◆ addSerialisedDataWithCheck()

StatusCode HLT::HLTResultMT::addSerialisedDataWithCheck ( const uint16_t moduleId,
std::vector< uint32_t > data )

Add serialised data for a given moduleId.

Fails if any data for the given module already exist

Returns
FAILURE if moduleId is already present in the stored map

Definition at line 180 of file HLTResultMT.cxx.

180 {
181 if (m_data.find(moduleId)!=m_data.cend()) {
182 ATH_REPORT_ERROR_WITH_CONTEXT(StatusCode::FAILURE, s_contextName.data())
183 << "Trying to add data for a module which already exists in the stored map, moduleId=" << moduleId;
184 return StatusCode::FAILURE;
185 }
186 else {
187 // moving data
188 m_data[moduleId] = std::move(data);
189 }
190 return StatusCode::SUCCESS;
191}
#define ATH_REPORT_ERROR_WITH_CONTEXT
Report an error, with an explicitly specified context name.

◆ addStreamTag()

StatusCode HLT::HLTResultMT::addStreamTag ( const eformat::helper::StreamTag & streamTag)

Append one stream tag to the stored list.

Removes duplicates by merging robs and dets lists of stream tags with equal name and type.

Returns
FAILURE only if two stream tags with equal name nad type have inconsistent obeys_lumiblock flags.

Definition at line 62 of file HLTResultMT.cxx.

62 {
63 // Check if a stream tag with the same type and name is already in the result
64 auto compareTypeName = [&streamTag](const eformat::helper::StreamTag& existingStreamTag) {
65 return streamTag.type == existingStreamTag.type && streamTag.name == existingStreamTag.name;
66 };
67 auto p = std::find_if(m_streamTags.begin(), m_streamTags.end(), compareTypeName);
68
69 // In case of duplicate, merge ROBs and SubDets, otherwise just append the tag to the result
70 if (p != m_streamTags.end()) {
71 if (streamTag.obeys_lumiblock != p->obeys_lumiblock) {
72 ATH_REPORT_ERROR_WITH_CONTEXT(StatusCode::FAILURE, s_contextName.data())
73 << "Stream tags have equal type and name (" << streamTag.type << "/" << streamTag.name
74 << "), but inconsistent obeys_lumiblock flag";
75 return StatusCode::FAILURE;
76 }
77 p->robs.insert(streamTag.robs.begin(), streamTag.robs.end());
78 p->dets.insert(streamTag.dets.begin(), streamTag.dets.end());
79 }
80 else {
81 m_streamTags.push_back(streamTag);
82 }
83
84 return StatusCode::SUCCESS;
85}

◆ addTruncatedModuleId()

void HLT::HLTResultMT::addTruncatedModuleId ( const uint16_t moduleId,
bool severeTruncation = true )

Add module ID to the list of truncated results.

Parameters
moduleIdROB module ID
severeTruncationis the result severely truncated (debug stream)

Definition at line 256 of file HLTResultMT.cxx.

256 {
257 // decide if event should go to the debug stream
259
260 auto [itr, inserted] = m_truncatedModuleIds.insert(moduleId);
261 // Also update ROB status words
262 if (inserted) {
263 // Note that the per-ROB status requires the specific status bits to be zero
264 // if a problem is detected by the HLT framework. This is different from the
265 // event status where we set PSC_PROBLEM.
266 // See eformat v5.0.2, section 5.8.2 (https://cds.cern.ch/record/683741)
267 eformat::helper::Status firstStatusWord(eformat::GenericStatus::DATA_CORRUPTION);
268 m_robStatus[moduleId] = {firstStatusWord.code(),
270 }
271}
std::set< uint16_t > m_truncatedModuleIds
List of module IDs with truncation.
bool m_severeTruncation
Should the event be sent to the debug stream due to severe truncation?
bool severeTruncation() const
Truncation in at least one collection that is not allowed to be truncated.
std::unordered_map< uint16_t, std::vector< uint32_t > > m_robStatus
ROBFragment status words for each moduleId.

◆ getErrorCodes()

const std::vector< HLT::OnlineErrorCode > HLT::HLTResultMT::getErrorCodes ( ) const

Error codes getter (by value) - strips off the first bit-mask status word.

Definition at line 201 of file HLTResultMT.cxx.

201 {
202 std::vector<HLT::OnlineErrorCode> errorCodes;
203 if (m_status.size()<2)
204 return errorCodes;
205 for (auto it=m_status.cbegin()+1; it!=m_status.cend(); ++it) {
206 errorCodes.push_back(static_cast<HLT::OnlineErrorCode>(*it));
207 }
208 return errorCodes;
209}

◆ getHltBitsAsWords()

const std::vector< uint32_t > & HLT::HLTResultMT::getHltBitsAsWords ( ) const

Const-getter for HLT bits as uint32_t array. Ordering: PassRaw, Prescaled.

Definition at line 100 of file HLTResultMT.cxx.

100 {
101 if (m_hltPassRawBits.num_blocks() != m_hltPrescaledBits.num_blocks()) {
102 throw std::runtime_error("Must have the same number of bits in m_hltPassRawBits and m_hltPrescaledBits");
103 }
104 if (m_hltBitWords.size() != m_hltPassRawBits.num_blocks() + m_hltPrescaledBits.num_blocks()) {
105 throw std::runtime_error("m_hltBitWords size differs from the sum of m_hltPassRawBits and m_hltPrescaledBits");
106 }
107 return m_hltBitWords;
108}
std::vector< uint32_t > m_hltBitWords
Vector storing m_hltBits converted to 4-byte words.

◆ getHltPassRawBits()

const boost::dynamic_bitset< uint32_t > & HLT::HLTResultMT::getHltPassRawBits ( ) const

Const-getter for HLT pass raw bits.

Definition at line 90 of file HLTResultMT.cxx.

90 {
91 return m_hltPassRawBits;
92}

◆ getHltPrescaledBits()

const boost::dynamic_bitset< uint32_t > & HLT::HLTResultMT::getHltPrescaledBits ( ) const

Const-getter for HLT prescaled bits.

Definition at line 95 of file HLTResultMT.cxx.

95 {
96 return m_hltPrescaledBits;
97}

◆ getRobStatus()

const std::vector< uint32_t > & HLT::HLTResultMT::getRobStatus ( uint16_t moduleId) const

Status words for ROB with given moduleId.

Definition at line 226 of file HLTResultMT.cxx.

226 {
227 const auto it = m_robStatus.find(moduleId);
228 if (it==m_robStatus.end()) {
229 static const std::vector<uint32_t> empty;
230 return empty;
231 }
232 else return it->second;
233}
static const Attributes_t empty

◆ getSerialisedData() [1/2]

const std::unordered_map< uint16_t, std::vector< uint32_t > > & HLT::HLTResultMT::getSerialisedData ( ) const

Serialised data getter.

The only way to retrieve the data by reference with no exception throwing.

Definition at line 147 of file HLTResultMT.cxx.

147 {
148 return m_data;
149}

◆ getSerialisedData() [2/2]

StatusCode HLT::HLTResultMT::getSerialisedData ( const uint16_t moduleId,
const std::vector< uint32_t > *& data ) const

Serialised data getter for a given moduleId @in moduleId @out data - const pointer to the stored data, nullptr on failure.

Returns
FAILURE if moduleId is not found in the stored map

Definition at line 152 of file HLTResultMT.cxx.

152 {
153 data = nullptr;
154 const auto it = m_data.find(moduleId);
155 if (it==m_data.cend()) {
156 REPORT_MESSAGE_WITH_CONTEXT(MSG::DEBUG, s_contextName.data())
157 << "No data available in the stored map for the requested moduleId=" << moduleId;
158 return StatusCode::FAILURE;
159 }
160 else {
161 data = &(it->second);
162 }
163 return StatusCode::SUCCESS;
164}
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.

◆ getStatus()

const std::vector< uint32_t > & HLT::HLTResultMT::getStatus ( ) const

Full event status reference getter (1 bit-mask status word + error code words)

Definition at line 196 of file HLTResultMT.cxx.

196 {
197 return m_status;
198}

◆ getStreamTags()

const std::vector< eformat::helper::StreamTag > & HLT::HLTResultMT::getStreamTags ( ) const

Const-getter for stream tags.

Definition at line 43 of file HLTResultMT.cxx.

43 {
44 return m_streamTags;
45}

◆ getStreamTagsNonConst()

std::vector< eformat::helper::StreamTag > & HLT::HLTResultMT::getStreamTagsNonConst ( )

Non-const-getter for stream tags needed by the result maker to remove disabled ROBs/SubDets.

Definition at line 48 of file HLTResultMT.cxx.

48 {
49 return m_streamTags;
50}

◆ getTruncatedModuleIds()

const std::set< uint16_t > & HLT::HLTResultMT::getTruncatedModuleIds ( ) const

Getter for the truncation information.

Definition at line 251 of file HLTResultMT.cxx.

251 {
253}

◆ getVersion()

HLT::HLTResultMT::RODMinorVersion HLT::HLTResultMT::getVersion ( ) const

ROD minor version getter.

Definition at line 239 of file HLTResultMT.cxx.

239 {
240 return m_version;
241}

◆ isAccepted()

bool HLT::HLTResultMT::isAccepted ( ) const
inline

If there is at least one stream tag set, it means the event is accepted.

Definition at line 178 of file HLTResultMT.h.

178{return !m_streamTags.empty();}

◆ setHltBits()

void HLT::HLTResultMT::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.

Definition at line 125 of file HLTResultMT.cxx.

126 {
127 if (passRawBitset.num_blocks() != prescaledBitset.num_blocks()) {
128 throw std::runtime_error("Must have the same number of bits in passRawBitset and prescaledBitset");
129 }
130 // copy assignments
131 m_hltPassRawBits = passRawBitset;
132 m_hltPrescaledBits = prescaledBitset;
134}
void updateHltBitWords()
Update m_hltBitWords with the contents of m_hltPassRawBits and m_hltPrescaledBits.

◆ setHltPassRawBits()

void HLT::HLTResultMT::setHltPassRawBits ( const boost::dynamic_bitset< uint32_t > & bitset)

Replace HLT pass raw bits with the given bitset.

Definition at line 111 of file HLTResultMT.cxx.

111 {
112 // copy assignment
113 m_hltPassRawBits = bitset;
115}

◆ setHltPrescaledBits()

void HLT::HLTResultMT::setHltPrescaledBits ( const boost::dynamic_bitset< uint32_t > & bitset)

Replace HLT prescaled bits with the given bitset.

Definition at line 118 of file HLTResultMT.cxx.

118 {
119 // copy assignment
120 m_hltPrescaledBits = bitset;
122}

◆ setSerialisedData()

void HLT::HLTResultMT::setSerialisedData ( std::unordered_map< uint16_t, std::vector< uint32_t > > data)

Replaces serialised data with a copy of the given data.

Definition at line 167 of file HLTResultMT.cxx.

167 {
168 // WARNING, copying data which may be large - recommend calling this with std::move if appropriate
169 m_data = std::move(data);
170}

◆ setStatus()

void HLT::HLTResultMT::setStatus ( std::vector< uint32_t > status)

Replace the full status words with the given data.

Definition at line 212 of file HLTResultMT.cxx.

212 {
213 // move assignment
214 m_status = std::move(status);
215}

◆ setStreamTags()

StatusCode HLT::HLTResultMT::setStreamTags ( const std::vector< eformat::helper::StreamTag > & streamTags)

Replace the stored list of stream tags with the given one.

Removes duplicates from the input list by merging robs and dets lists of stream tags with equal name and type.

Returns
FAILURE only if two stream tags with equal name nad type have inconsistent obeys_lumiblock flags.

Definition at line 53 of file HLTResultMT.cxx.

53 {
54 m_streamTags.clear();
55 for (const auto& st : streamTags) {
57 }
58 return StatusCode::SUCCESS;
59}
#define ATH_CHECK
Evaluate an expression and check for errors.
StatusCode addStreamTag(const eformat::helper::StreamTag &streamTag)
Append one stream tag to the stored list.

◆ setVersion()

void HLT::HLTResultMT::setVersion ( RODMinorVersion version)

ROD minor version setter.

Definition at line 244 of file HLTResultMT.cxx.

◆ severeTruncation()

bool HLT::HLTResultMT::severeTruncation ( ) const
inline

Truncation in at least one collection that is not allowed to be truncated.

Definition at line 174 of file HLTResultMT.h.

174{ return m_severeTruncation; }

◆ updateHltBitWords()

void HLT::HLTResultMT::updateHltBitWords ( )
private

Update m_hltBitWords with the contents of m_hltPassRawBits and m_hltPrescaledBits.

Definition at line 137 of file HLTResultMT.cxx.

137 {
138 m_hltBitWords.clear();
139 m_hltBitWords.resize(m_hltPassRawBits.num_blocks() + m_hltPrescaledBits.num_blocks(), 0);
140 boost::to_block_range(m_hltPassRawBits, m_hltBitWords.begin());
141 boost::to_block_range(m_hltPrescaledBits, m_hltBitWords.begin() + m_hltPassRawBits.num_blocks());
142}

Member Data Documentation

◆ m_data

std::unordered_map<uint16_t, std::vector<uint32_t> > HLT::HLTResultMT::m_data
private

Serialised result (ROBFragment payload) for each moduleId (0 for full result, >0 for data scouting)

Definition at line 198 of file HLTResultMT.h.

◆ m_hltBitWords

std::vector<uint32_t> HLT::HLTResultMT::m_hltBitWords
private

Vector storing m_hltBits converted to 4-byte words.

HLTResultMT needs to own this vector because its lifetime has to be ensured until the serialisation is finished. This vector is updated internally from m_hltPassRawBits and m_hltPrescaledBits and does not have a setter method.

Definition at line 195 of file HLTResultMT.h.

◆ m_hltPassRawBits

boost::dynamic_bitset<uint32_t> HLT::HLTResultMT::m_hltPassRawBits
private

HLT bits (flagging which chains passed)

Definition at line 187 of file HLTResultMT.h.

◆ m_hltPrescaledBits

boost::dynamic_bitset<uint32_t> HLT::HLTResultMT::m_hltPrescaledBits
private

Definition at line 188 of file HLTResultMT.h.

◆ m_robStatus

std::unordered_map<uint16_t, std::vector<uint32_t> > HLT::HLTResultMT::m_robStatus
private

ROBFragment status words for each moduleId.

Definition at line 204 of file HLTResultMT.h.

◆ m_severeTruncation

bool HLT::HLTResultMT::m_severeTruncation {false}
private

Should the event be sent to the debug stream due to severe truncation?

Definition at line 214 of file HLTResultMT.h.

214{false};

◆ m_status

std::vector<uint32_t> HLT::HLTResultMT::m_status
private

FullEvent status words (first word is eformat::helper::Status, next words are optional error codes)

Definition at line 201 of file HLTResultMT.h.

◆ m_streamTags

std::vector<eformat::helper::StreamTag> HLT::HLTResultMT::m_streamTags
private

Stream tags of the event.

Definition at line 184 of file HLTResultMT.h.

◆ m_truncatedModuleIds

std::set<uint16_t> HLT::HLTResultMT::m_truncatedModuleIds
private

List of module IDs with truncation.

Used only by the framework while creating the result. It is not stored in ByteStream files.

Definition at line 211 of file HLTResultMT.h.

◆ m_version

RODMinorVersion HLT::HLTResultMT::m_version
private

Stores the ROD minor version of the HLT ROBFragments.

Definition at line 207 of file HLTResultMT.h.


The documentation for this class was generated from the following files: