ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
TrigErrorMonTool Class Reference

Retrieves and monitors all non-success status codes returned by algorithms. More...

#include <TrigErrorMonTool.h>

Inheritance diagram for TrigErrorMonTool:
Collaboration diagram for TrigErrorMonTool:

Public Member Functions

 TrigErrorMonTool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual StatusCode initialize () override
 
virtual StatusCode finalize () override
 
virtual std::unordered_map< std::string_view, StatusCode > algExecErrors (const EventContext &eventContext) const override
 Produce a subset of IAlgExecStateSvc::algExecStates with only non-success StatusCodes and fill relevant histograms. More...
 

Private Attributes

ServiceHandle< IAlgExecStateSvc > m_aess {this, "AlgExecStateSvc", "AlgExecStateSvc"}
 
ServiceHandle< ITrigCostSvcm_trigCostSvcHandle {this, "TrigCostSvc", ""}
 
ToolHandle< GenericMonitoringToolm_monTool {this, "MonTool", "", "Monitoring tool"}
 
ToolHandle< TrigCompositeUtils::AlgToChainToolm_algToChainTool {this, "AlgToChainTool", "", "Tool to retrieve chains for algorithm"}
 

Detailed Description

Retrieves and monitors all non-success status codes returned by algorithms.

Definition at line 20 of file TrigErrorMonTool.h.

Constructor & Destructor Documentation

◆ TrigErrorMonTool()

TrigErrorMonTool::TrigErrorMonTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 11 of file TrigErrorMonTool.cxx.

12 : base_class(type, name, parent) {}

Member Function Documentation

◆ algExecErrors()

std::unordered_map< std::string_view, StatusCode > TrigErrorMonTool::algExecErrors ( const EventContext &  eventContext) const
overridevirtual

Produce a subset of IAlgExecStateSvc::algExecStates with only non-success StatusCodes and fill relevant histograms.

Definition at line 40 of file TrigErrorMonTool.cxx.

40  {
41  std::unordered_map<std::string_view, StatusCode> algErrors;
42  bool wasTimeout = false;
43  for (const auto& [key, state] : m_aess->algExecStates(eventContext)) {
44  if (!state.execStatus().isSuccess() && state.state()!=AlgExecState::State::None) {
45 
46  ATH_MSG_DEBUG("Algorithm " << key << " returned StatusCode " << state.execStatus().message()
47  << " in event " << eventContext.eventID());
48  algErrors[key.str()] = state.execStatus();
49  auto monErrorAlgName = Monitored::Scalar<std::string>("ErrorAlgName", key.str());
50  auto monErrorCode = Monitored::Scalar<std::string>("ErrorCode", state.execStatus().message());
51  auto mon = Monitored::Group(m_monTool, monErrorAlgName, monErrorCode);
52 
53  if (m_algToChainTool.isEnabled()) {
54  std::set<std::string> chainNames = m_algToChainTool->getActiveChainsForAlg(key.str(), eventContext);
55  // Monitored::Collection requires operator[]
56  std::vector<std::string> chainNamesVec(chainNames.begin(), chainNames.end());
57 
58  auto monErrorChainNames= Monitored::Collection<std::vector<std::string>>("ErrorChainName", chainNamesVec);
59  Monitored::Group(m_monTool, monErrorChainNames, monErrorCode);
60  }
61 
62  if (state.execStatus() == Athena::Status::TIMEOUT) {
63  // Print report of most time consuming algorithms
64  wasTimeout = true;
65  }
66  }
67  }
68 
69  if (wasTimeout && !m_trigCostSvcHandle.empty()){
70  std::string timeoutReport;
71  if (m_trigCostSvcHandle->generateTimeoutReport(eventContext, timeoutReport) == StatusCode::FAILURE){
72  ATH_MSG_ERROR("Generating timeout algorithm report failed.");
73  }
74  else if (timeoutReport.empty()){
75  ATH_MSG_INFO("CostMonitoring not active in this event. A list of slow algorithms is not available.");
76  }
77  else {
78  ATH_MSG_ERROR(timeoutReport);
79  }
80  }
81 
82  return algErrors;
83 }

◆ finalize()

StatusCode TrigErrorMonTool::finalize ( )
overridevirtual

Definition at line 30 of file TrigErrorMonTool.cxx.

30  {
31  ATH_CHECK(m_monTool.release());
32  ATH_CHECK(m_algToChainTool.release());
33  ATH_CHECK(m_aess.release());
34  return StatusCode::SUCCESS;
35 }

◆ initialize()

StatusCode TrigErrorMonTool::initialize ( )
overridevirtual

Definition at line 17 of file TrigErrorMonTool.cxx.

17  {
18  ATH_CHECK(m_monTool.retrieve(DisableTool{m_monTool.name().empty()}));
19  ATH_CHECK(m_algToChainTool.retrieve(DisableTool{m_algToChainTool.name().empty()}));
20  ATH_CHECK(m_aess.retrieve());
21 
22  if (!m_trigCostSvcHandle.empty()) ATH_CHECK(m_trigCostSvcHandle.retrieve());
23 
24  return StatusCode::SUCCESS;
25 }

Member Data Documentation

◆ m_aess

ServiceHandle<IAlgExecStateSvc> TrigErrorMonTool::m_aess {this, "AlgExecStateSvc", "AlgExecStateSvc"}
private

Definition at line 33 of file TrigErrorMonTool.h.

◆ m_algToChainTool

ToolHandle<TrigCompositeUtils::AlgToChainTool> TrigErrorMonTool::m_algToChainTool {this, "AlgToChainTool", "", "Tool to retrieve chains for algorithm"}
private

Definition at line 36 of file TrigErrorMonTool.h.

◆ m_monTool

ToolHandle<GenericMonitoringTool> TrigErrorMonTool::m_monTool {this, "MonTool", "", "Monitoring tool"}
private

Definition at line 35 of file TrigErrorMonTool.h.

◆ m_trigCostSvcHandle

ServiceHandle<ITrigCostSvc> TrigErrorMonTool::m_trigCostSvcHandle {this, "TrigCostSvc", ""}
private

Definition at line 34 of file TrigErrorMonTool.h.


The documentation for this class was generated from the following files:
TrigErrorMonTool::m_algToChainTool
ToolHandle< TrigCompositeUtils::AlgToChainTool > m_algToChainTool
Definition: TrigErrorMonTool.h:36
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
TrigErrorMonTool::m_trigCostSvcHandle
ServiceHandle< ITrigCostSvc > m_trigCostSvcHandle
Definition: TrigErrorMonTool.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
TrigErrorMonTool::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: TrigErrorMonTool.h:35
CaloCellPos2Ntuple.None
None
Definition: CaloCellPos2Ntuple.py:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TrigErrorMonTool::m_aess
ServiceHandle< IAlgExecStateSvc > m_aess
Definition: TrigErrorMonTool.h:33
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
Athena::Status::TIMEOUT
@ TIMEOUT
Timeout during event processing.
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
plotBeamSpotMon.mon
mon
Definition: plotBeamSpotMon.py:67
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37