ATLAS Offline Software
Loading...
Searching...
No Matches
HLTResultMT.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIGSTEERINGEVENT_HLTResultMT_H
6#define TRIGSTEERINGEVENT_HLTResultMT_H
7
8// Trigger includes
10
11// Athena includes
13
14// Gaudi includes
15#include "GaudiKernel/StatusCode.h"
16
17// TDAQ includes
18#include "eformat/Status.h"
19#include "eformat/StreamTag.h"
20
21// System includes
22#include <boost/dynamic_bitset.hpp>
23#include <vector>
24#include <unordered_map>
25#include <utility>
26#include <cstdint>
27
28namespace HLT {
29
39 public:
41 HLTResultMT(std::vector<eformat::helper::StreamTag> streamTags = {},
42 boost::dynamic_bitset<uint32_t> hltPassRawBits = boost::dynamic_bitset<uint32_t>(),
43 boost::dynamic_bitset<uint32_t> hltPrescaledBits = boost::dynamic_bitset<uint32_t>(),
44 std::unordered_map<uint16_t, std::vector<uint32_t> > data = {});
45
46
47 // ------------------------- Public typedefs -------------------------------
48
50 using RODMinorVersion = std::pair<uint8_t,uint8_t>;
51
52
53 // ------------------------- Stream tags getters/setters -------------------
54
56 const std::vector<eformat::helper::StreamTag>& getStreamTags() const;
57
59 std::vector<eformat::helper::StreamTag>& getStreamTagsNonConst();
60
66 StatusCode setStreamTags(const std::vector<eformat::helper::StreamTag>& streamTags);
67
73 StatusCode addStreamTag(const eformat::helper::StreamTag& streamTag);
74
75
76 // ------------------------- HLT bits getters/setters ----------------------
77
79 const boost::dynamic_bitset<uint32_t>& getHltPassRawBits() const;
80
82 const boost::dynamic_bitset<uint32_t>& getHltPrescaledBits() const;
83
85 const std::vector<uint32_t>& getHltBitsAsWords() const;
86
88 void setHltPassRawBits(const boost::dynamic_bitset<uint32_t>& bitset);
89
91 void setHltPrescaledBits(const boost::dynamic_bitset<uint32_t>& bitset);
92
94 void setHltBits(const boost::dynamic_bitset<uint32_t>& passRawBitset,
95 const boost::dynamic_bitset<uint32_t>& prescaledBitset);
96
97
98 // ------------------------- Serialised data getters/setters ---------------
99
104 const std::unordered_map<uint16_t, std::vector<uint32_t> >& getSerialisedData() const;
105
111 StatusCode getSerialisedData(const uint16_t moduleId, const std::vector<uint32_t>*& data) const;
112
114 void setSerialisedData(std::unordered_map<uint16_t, std::vector<uint32_t> > data);
115
117 void addSerialisedData(const uint16_t moduleId, const std::vector<uint32_t>& data);
118
122 StatusCode addSerialisedDataWithCheck(const uint16_t moduleId, std::vector<uint32_t> data);
123
124
125 // ------------------------- Error codes getters/setters -------------------
126 // The event processing status is stored as one bit-mask word corresponding to eformat::helper::Status
127 // and n optional error codes. Online HLT framework uses them to store HLT::OnlineErrorCode.
128
130 const std::vector<uint32_t>& getStatus() const;
131
133 const std::vector<HLT::OnlineErrorCode> getErrorCodes() const;
134
136 void setStatus(std::vector<uint32_t> status);
137
143 void addErrorCode(const HLT::OnlineErrorCode& errorCode,
144 const eformat::helper::Status& firstStatusWord = {
145 eformat::GenericStatus::DATA_CORRUPTION,
146 eformat::FullEventStatus::PSC_PROBLEM
147 });
148
150 const std::vector<uint32_t>& getRobStatus(uint16_t moduleId) const;
151
152 // ------------------------- Version getters/setters -----------------------
153 // The format of the HLT ByteStream (ROD payload) and the interpretation of the HLT-specific information
154 // in the full event header are versioned by the ROD minor version of the HLT ROBFragments
155
158
160 void setVersion(RODMinorVersion version);
161
162
163 // ------------------------- Truncation information ------------------------
164
166 const std::set<uint16_t>& getTruncatedModuleIds() const;
167
171 void addTruncatedModuleId(const uint16_t moduleId, bool severeTruncation=true);
172
174 bool severeTruncation() const { return m_severeTruncation; }
175
176 // ------------------------- Extra helper methods --------------------------
178 bool isAccepted() const {return !m_streamTags.empty();}
179
180 private:
181 // ------------------------- Private data members --------------------------
182
184 std::vector<eformat::helper::StreamTag> m_streamTags;
185
187 boost::dynamic_bitset<uint32_t> m_hltPassRawBits;
188 boost::dynamic_bitset<uint32_t> m_hltPrescaledBits;
189
195 std::vector<uint32_t> m_hltBitWords;
196
198 std::unordered_map<uint16_t, std::vector<uint32_t> > m_data;
199
201 std::vector<uint32_t> m_status;
202
204 std::unordered_map<uint16_t, std::vector<uint32_t>> m_robStatus;
205
208
211 std::set<uint16_t> m_truncatedModuleIds;
212
215
216 // ------------------------- Private helper methods ------------------------
217
219 void updateHltBitWords();
220 };
221} // namespace HLT
222
224std::ostream& operator<<(std::ostream& str, const HLT::HLTResultMT& hltResult);
225
226CLASS_DEF(HLT::HLTResultMT, 172156324, 1)
227
228#endif // TRIGSTEERINGEVENT_HLTResultMT_H
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
HLT::HLTResultMT::RODMinorVersion RODMinorVersion
std::ostream & operator<<(std::ostream &str, const HLT::HLTResultMT &hltResult)
operator<< overload for printing to std::ostream
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
A container class for data required to build online output from HLT.
Definition HLTResultMT.h:38
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)
Definition HLTResultMT.h:50
bool isAccepted() const
If there is at least one stream tag set, it means the event is accepted.
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.
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...