9 #include "eformat/StreamTag.h"
24 const std::string&
name,
33 return StatusCode::SUCCESS;
41 return StatusCode::SUCCESS;
46 const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& vrobf)
const {
49 ATH_MSG_ERROR(
"Empty ROBFragment vector passed to getHltRodMinorVersion, returning invalid version");
56 uint32_t thisRodVersion = robf->rod_version();
57 uint16_t thisRodMinorVersion = (thisRodVersion & 0xffff
u);
58 if (thisRodMinorVersion == 0xffffu) {
59 ATH_MSG_WARNING(
"Invalid HLT ROD minor version 0xffff found in ROBFragment 0x"
60 << MSG::hex << robf->rob_source_id() << MSG::dec);
65 else if (thisRodMinorVersion !=
version) {
66 ATH_MSG_ERROR(
"Inconsistent HLT ROD minor versions in different ROBFragments, 0x"
67 << MSG::hex <<
version <<
" and " << thisRodMinorVersion << MSG::dec
68 <<
", getHltRodMinorVersion returning invalid version");
82 return StatusCode::FAILURE;
84 ATH_MSG_DEBUG(
"Decoding HLTResultMT from ByteStream event " << rawEvent->global_id());
92 std::vector<uint32_t> statusWords;
95 const uint32_t nStatus = rawEvent->nstatus();
96 const uint32_t* rawStatus = rawEvent->status();
98 statusWords.assign(rawStatus, rawStatus+nStatus);
101 ATH_MSG_ERROR(
"std::exception caught when reading status words: " << ex.what());
102 return StatusCode::FAILURE;
105 ATH_MSG_ERROR(
"Unknown exception caught when reading status words");
106 return StatusCode::FAILURE;
108 ATH_MSG_DEBUG(
"Successfully read " << statusWords.size() <<
" status words");
109 resultToFill.
setStatus(std::move(statusWords));
114 std::vector<eformat::helper::StreamTag> streamTags;
120 ATH_MSG_ERROR(
"std::exception caught when reading stream tags: " << ex.what());
121 return StatusCode::FAILURE;
124 ATH_MSG_ERROR(
"Unknown exception caught when reading stream tags");
125 return StatusCode::FAILURE;
127 ATH_MSG_DEBUG(
"Successfully read " << streamTags.size() <<
" stream tags");
134 std::vector<uint32_t> hltBitWords;
137 const uint32_t nHltInfo = rawEvent->nhlt_info();
138 const uint32_t* hltInfo = rawEvent->hlt_info();
140 hltBitWords.assign(hltInfo, hltInfo+nHltInfo);
143 ATH_MSG_ERROR(
"std::exception caught when reading HLT bits: " << ex.what());
144 return StatusCode::FAILURE;
147 ATH_MSG_ERROR(
"Unknown exception caught when reading HLT bits");
148 return StatusCode::FAILURE;
152 const size_t numBitSets = (hltRodMinorVersion==
RODMinorVersion{1,0}) ? 3 : 2;
154 if (hltBitWords.size() % numBitSets != 0) {
155 ATH_MSG_ERROR(
"Size of hltBitWords=" << hltBitWords.size() <<
" must be divisible by " << numBitSets
156 <<
". Expecting {raw, prescaled" << (numBitSets==3 ?
", rerun" :
"") <<
"} bits.");
157 return StatusCode::FAILURE;
159 const size_t sizeOfBlock = hltBitWords.size() / numBitSets;
160 auto beginPrescaledIt = hltBitWords.cbegin() + sizeOfBlock;
161 auto endIt = (numBitSets==2) ? hltBitWords.cend() : hltBitWords.cbegin() + 2*sizeOfBlock;
162 resultToFill.
setHltBits( {hltBitWords.cbegin(), beginPrescaledIt},
163 {beginPrescaledIt, endIt} );
165 return StatusCode::SUCCESS;
175 eformat::helper::SourceIdentifier sid(robf->rob_source_id());
181 if (robf->nstatus() > 1) {
183 if (firstStatusWord.generic() == eformat::GenericStatus::DATA_CORRUPTION &&
185 ATH_MSG_DEBUG(
"Detected truncated ROBFragment " << sid.human());
193 std::vector<uint32_t>
data;
196 const uint32_t nRodData = robf->rod_ndata();
197 const uint32_t* rodData = robf->rod_data();
199 data.assign(rodData, rodData+nRodData);
202 ATH_MSG_ERROR(
"std::exception caught when reading HLT result payload: " << ex.what());
203 return StatusCode::FAILURE;
206 ATH_MSG_ERROR(
"Unknown exception caught when reading HLT result payload");
207 return StatusCode::FAILURE;
209 size_t datasize =
data.size();
212 ATH_MSG_DEBUG(
"Successfully read " << datasize <<
" words of HLT result payload for module ID "
215 return StatusCode::SUCCESS;
222 return StatusCode::FAILURE;
225 ATH_MSG_ERROR(
"HLT ROD minor version " << printRodMinorVersion(
version) <<
" is lower than 1.0. "
226 <<
"This tool is for decoding versions 1.0 or later (i.e. HLT ByteStream from Run 3 or later)");
227 return StatusCode::FAILURE;
230 return StatusCode::SUCCESS;