Fill histograms from contents of a FullEventFragment.
280 {
281
282 eformat::read::FullEventFragment rawEvent(rawEventPtr.get());
283
284
285 if (rawEvent.nstatus() > 1) {
287 std::ostringstream
ss;
289 auto monOnlineErrorCode = Monitored::Scalar<std::string>(
"OnlineErrorCode",
ss.str());
290 Monitored::Group(
m_monTool, monOnlineErrorCode);
291 }
292
293
294 std::vector<eformat::helper::StreamTag> streamTags;
295 try {
296 eformat::helper::decode(rawEvent.nstream_tag(), rawEvent.stream_tag(), streamTags);
297 }
298 catch (const std::exception& ex) {
299 ATH_MSG_ERROR(
"StreamTag decoding failed, caught an unexpected std::exception " << ex.what());
300 return;
301 }
302 catch (...) {
303 ATH_MSG_ERROR(
"StreamTag decoding failed, caught an unexpected exception");
304 return;
305 }
306
307
308 std::vector<eformat::read::ROBFragment>
robs;
309 rawEvent.robs(robs);
310 std::vector<uint16_t> resultSizeMap_moduleID;
311 std::vector<uint32_t> resultSizeMap_size;
313 try {
314 for (const eformat::read::ROBFragment& rob : robs) {
315 eformat::helper::SourceIdentifier sid(rob.rob_source_id());
316 if (sid.subdetector_id() != eformat::SubDetector::TDAQ_HLT)
317 continue;
318 const uint16_t module_id = sid.module_id();
319 const uint32_t size = rob.fragment_size_word();
320 totalSizeWords += size;
321 if (!
contains(resultSizeMap_moduleID, module_id)) {
322 resultSizeMap_moduleID.push_back(module_id);
323 resultSizeMap_size.push_back(size);
324 }
325 else {
326 ATH_MSG_ERROR(
"HLT result ROB monitoring found multiple HLT ROBs with the same module ID " << module_id);
327 }
328 }
329 }
330 catch (const std::exception& ex) {
331 ATH_MSG_ERROR(
"HLT result ROB monitoring failed, caught an unexpected std::exception " << ex.what());
332 return;
333 }
334 catch (...) {
335 ATH_MSG_ERROR(
"HLT result ROB monitoring failed, caught an unexpected exception");
336 return;
337 }
338
339
340 std::vector<std::string> sdFromRobList;
341 std::vector<std::string> sdFromSubDetList;
342 std::vector<std::string> streamTagCorrA;
343 std::vector<std::string> streamTagCorrB;
344 std::vector<float> streamResultSize;
345 streamTagCorrA.reserve(streamTags.size() * streamTags.size());
346 streamTagCorrB.reserve(streamTags.size() * streamTags.size());
347 streamResultSize.reserve(streamTags.size());
348 for (const eformat::helper::StreamTag& st : streamTags) {
349 bool hasHLTSubDet =
st.dets.find(eformat::SubDetector::TDAQ_HLT) !=
st.dets.end();
350 bool includeAll =
st.robs.empty() && (
st.dets.empty() || hasHLTSubDet);
351
352 uint32_t sizeWords = includeAll ? totalSizeWords : 0;
353 for (
const eformat::SubDetector sd :
st.dets) {
354 const std::string&
detName = eformat::helper::SubDetectorDictionary.string(sd);
355 if (!
contains(sdFromSubDetList, detName)) sdFromSubDetList.push_back(detName);
356 }
357 for (
const uint32_t robid :
st.robs) {
358 eformat::helper::SourceIdentifier sid(robid);
359 const std::string&
detName = sid.human_detector();
360 if (!
contains(sdFromRobList, detName)) sdFromRobList.push_back(detName);
361 if (!includeAll && sid.subdetector_id() == eformat::SubDetector::TDAQ_HLT) {
362 if (
const int ix =
index(resultSizeMap_moduleID, sid.module_id()); ix >= 0) {
363 sizeWords += resultSizeMap_size[ix];
364 }
365 else {
367 << " in ROB list, but the ROBFragment is missing");
368 }
369 }
370 }
371 streamResultSize.push_back(sizeWords*wordsToKiloBytes);
372 for (const eformat::helper::StreamTag& st2 : streamTags) {
373 streamTagCorrA.push_back(mon_streamTypeName(st));
374 streamTagCorrB.push_back(mon_streamTypeName(st2));
375 }
376 }
377
378
379 auto monStreamTagsNum = Monitored::Scalar<size_t>("StreamTagsNum", streamTags.size());
384
386 auto monPebRobsNum =
Monitored::Collection(
"StreamTagsPebRobsNum", streamTags, mon_streamPebRobsNum);
387 auto monPebSubDetsNum =
Monitored::Collection(
"StreamTagsPebSubDetsNum", streamTags, mon_streamPebSubDetsNum);
388 auto monSubDetsFromRobList =
Monitored::Collection(
"StreamTagsPebSubDetsFromRobList", sdFromRobList);
389 auto monSubDetsFromSubDetList =
Monitored::Collection(
"StreamTagsPebSubDetsFromSubDetList", sdFromSubDetList);
390
391 auto monResultSizeTotal = Monitored::Scalar<float>("ResultSizeTotal", totalSizeWords*wordsToKiloBytes);
392 auto monResultSizeFullEvFrag = Monitored::Scalar<float>("ResultSizeFullEvFrag", rawEvent.fragment_size_word()*wordsToKiloBytes);
394 auto monResultCollModuleSize =
Monitored::Collection(
"ResultModuleSize", resultSizeMap_size, [](uint32_t sw){
return sw*wordsToKiloBytes;});
396
397 Monitored::Group(
m_monTool, monStreamTagsNum, monStreamTags, monStreamTagsType, monStreamTagCorrA,
398 monStreamTagCorrB, monStreamIsPeb, monPebRobsNum, monPebSubDetsNum, monSubDetsFromRobList,
399 monSubDetsFromSubDetList, monResultSizeTotal, monResultSizeFullEvFrag, monResultCollModuleID,
400 monResultCollModuleSize, monResultSizeByStream);
401}
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.