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)
34 : m_streamTags(std::move(streamTags)),
35 m_hltPassRawBits(std::move(hltPassRawBits)),
36 m_hltPrescaledBits(std::move(hltPrescaledBits)),
38 m_version(s_currentHltRodMinorVersion) {}
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;
67 auto p = std::find_if(m_streamTags.begin(), m_streamTags.end(), compareTypeName);
70 if (
p != m_streamTags.end()) {
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());
81 m_streamTags.push_back(streamTag);
84 return StatusCode::SUCCESS;
91 return m_hltPassRawBits;
96 return m_hltPrescaledBits;
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");
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");
107 return m_hltBitWords;
113 m_hltPassRawBits = bitset;
120 m_hltPrescaledBits = bitset;
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");
131 m_hltPassRawBits = passRawBitset;
132 m_hltPrescaledBits = prescaledBitset;
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());
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;
163 return StatusCode::SUCCESS;
174 std::vector<uint32_t>&
v =
m_data[moduleId];
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;
203 if (m_status.size()<2)
205 for (
auto it=m_status.cbegin()+1;
it!=m_status.cend(); ++
it) {
214 m_status = std::move(
status);
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));
227 const auto it = m_robStatus.find(moduleId);
228 if (
it==m_robStatus.end()) {
229 static const std::vector<uint32_t>
empty;
232 else return it->second;
252 return m_truncatedModuleIds;
258 m_severeTruncation |= severeTruncation;
260 auto [itr, inserted] = m_truncatedModuleIds.insert(moduleId);
268 m_robStatus[moduleId] = {firstStatusWord.code(),
276 str <<
"0x" << std::hex << std::setw(
width) << std::setfill(
'0') << word <<
" " << std::dec;
278 str <<
"Printing HLTResultMT:" << std::endl;
281 str <<
"--> Status words = ";
288 str <<
"--> Stream tags = ";
290 for (
const eformat::helper::StreamTag& st : hltResult.
getStreamTags()) {
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 = ";
323 str <<
"{module " <<
p.first <<
": " <<
p.second.size() <<
" words}" << std::endl;
328 str <<
"--> Truncated results = ";