ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigMonitoring
TrigSteerMonitor
src
TrigErrorMonTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
TrigErrorMonTool.h
"
5
#include "
AthenaKernel/AthStatusCode.h
"
6
#include "GaudiKernel/IAlgExecStateSvc.h"
7
#include "GaudiKernel/IAlgManager.h"
8
9
// =============================================================================
10
// Standard constructor
11
// =============================================================================
12
TrigErrorMonTool::TrigErrorMonTool
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent)
13
: base_class(
type
, name, parent) {}
14
15
// =============================================================================
16
// Implementation of IStateful::initialize
17
// =============================================================================
18
StatusCode
TrigErrorMonTool::initialize
() {
19
ATH_CHECK
(
m_monTool
.retrieve(DisableTool{m_monTool.name().empty()}));
20
ATH_CHECK
(
m_algToChainTool
.retrieve(DisableTool{m_algToChainTool.name().empty()}));
21
22
if
(!
m_trigCostSvcHandle
.empty())
ATH_CHECK
(
m_trigCostSvcHandle
.retrieve());
23
24
return
StatusCode::SUCCESS;
25
}
26
27
// =============================================================================
28
// Implementation of IStateful::finalize
29
// =============================================================================
30
StatusCode
TrigErrorMonTool::finalize
() {
31
ATH_CHECK
(
m_monTool
.release());
32
ATH_CHECK
(
m_algToChainTool
.release());
33
return
StatusCode::SUCCESS;
34
}
35
36
// =============================================================================
37
// The main method of the tool, ITrigErrorMonTool::algExecErrors
38
// =============================================================================
39
std::unordered_map<std::string_view, StatusCode>
TrigErrorMonTool::algExecErrors
(
const
EventContext& eventContext)
const
{
40
std::unordered_map<std::string_view, StatusCode> algErrors;
41
bool
wasTimeout =
false
;
42
SmartIF<IAlgManager> algMgr{serviceLocator()->as<IAlgManager>()};
43
for
(
const
IAlgorithm* alg : algMgr->getAlgorithms()) {
44
auto
state = alg->execState(eventContext);
45
if
(!state.execStatus().isSuccess() && state.state()!=AlgExecState::State::None) {
46
47
ATH_MSG_DEBUG
(
"Algorithm "
<< alg->name() <<
" returned StatusCode "
<< state.execStatus().message()
48
<<
" in event "
<< eventContext.eventID());
49
algErrors[alg->name()] = state.execStatus();
50
auto
monErrorAlgName =
Monitored::Scalar<std::string>
(
"ErrorAlgName"
, alg->name());
51
auto
monErrorCode =
Monitored::Scalar<std::string>
(
"ErrorCode"
, state.execStatus().message());
52
auto
mon =
Monitored::Group
(
m_monTool
, monErrorAlgName, monErrorCode);
53
54
if
(
m_algToChainTool
.isEnabled()) {
55
std::set<std::string> chainNames =
m_algToChainTool
->getActiveChainsForAlg(alg->name(), eventContext);
56
// Monitored::Collection requires operator[]
57
std::vector<std::string> chainNamesVec(chainNames.begin(), chainNames.end());
58
59
auto
monErrorChainNames=
Monitored::Collection<std::vector<std::string>
>(
"ErrorChainName"
, chainNamesVec);
60
Monitored::Group
(
m_monTool
, monErrorChainNames, monErrorCode);
61
}
62
63
if
(state.execStatus() ==
Athena::Status::TIMEOUT
) {
64
// Print report of most time consuming algorithms
65
wasTimeout =
true
;
66
}
67
}
68
}
69
70
if
(wasTimeout && !
m_trigCostSvcHandle
.empty()){
71
std::string timeoutReport;
72
if
(
m_trigCostSvcHandle
->generateTimeoutReport(eventContext, timeoutReport) == StatusCode::FAILURE){
73
ATH_MSG_ERROR
(
"Generating timeout algorithm report failed."
);
74
}
75
else
if
(timeoutReport.empty()){
76
ATH_MSG_INFO
(
"CostMonitoring not active in this event. A list of slow algorithms is not available."
);
77
}
78
else
{
79
ATH_MSG_ERROR
(timeoutReport);
80
}
81
}
82
83
return
algErrors;
84
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
AthStatusCode.h
TrigErrorMonTool.h
Monitored::Group
Group of local monitoring quantities and retain correlation when filling histograms
Definition
MonitoredGroup.h:53
Monitored::Scalar
Declare a monitored scalar variable.
Definition
MonitoredScalar.h:34
TrigErrorMonTool::TrigErrorMonTool
TrigErrorMonTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
TrigErrorMonTool.cxx:12
TrigErrorMonTool::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition
TrigErrorMonTool.h:33
TrigErrorMonTool::m_algToChainTool
ToolHandle< TrigCompositeUtils::AlgToChainTool > m_algToChainTool
Definition
TrigErrorMonTool.h:34
TrigErrorMonTool::algExecErrors
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 releva...
Definition
TrigErrorMonTool.cxx:39
TrigErrorMonTool::m_trigCostSvcHandle
ServiceHandle< ITrigCostSvc > m_trigCostSvcHandle
Definition
TrigErrorMonTool.h:32
TrigErrorMonTool::initialize
virtual StatusCode initialize() override
Definition
TrigErrorMonTool.cxx:18
TrigErrorMonTool::finalize
virtual StatusCode finalize() override
Definition
TrigErrorMonTool.cxx:30
Athena::Status::TIMEOUT
@ TIMEOUT
Timeout during event processing.
Definition
AthStatusCode.h:23
Monitored::Collection
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
Definition
MonitoredCollection.h:38
type
Generated on
for ATLAS Offline Software by
1.17.0