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