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