ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigMonitoring
TrigCostMonitor
src
lib
AlgorithmIdentifier.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
AthViews/View.h
"
6
#include "
AthenaKernel/ExtendedEventContext.h
"
7
#include "
AthenaBaseComps/AthCheckMacros.h
"
8
9
#include "
TrigCostMonitor/AlgorithmIdentifier.h
"
10
12
13
AlgorithmIdentifier::AlgorithmIdentifier
() :
14
m_realSlot
(),
15
m_slotToSaveInto
(),
16
m_caller
(
""
),
17
m_store
(
""
),
18
m_viewID
(0),
19
m_hash
(0)
20
{}
21
22
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
23
24
AlgorithmIdentifier::AlgorithmIdentifier
(
const
size_t
realSlot,
const
size_t
saveSlot,
const
std::string& caller,
const
std::string& storeName,
const
int16_t viewID) :
25
m_realSlot
(realSlot),
26
m_slotToSaveInto
(saveSlot),
27
m_caller
(caller),
28
m_store
(storeName),
29
m_viewID
(viewID),
30
m_hash
(
std
::hash<
std
::
string
>{}(m_caller + m_store + std::to_string(realSlot)))
31
{}
32
33
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
34
35
TrigConf::HLTHash
AlgorithmIdentifier::callerHash
(MsgStream&
msg
)
const
{
36
try
{
37
return
TrigConf::HLTUtils::string2hash
(
m_caller
,
"ALG"
);
38
}
catch
(
const
std::exception& ex) {
39
msg
<< MSG::DEBUG <<
"Caught "
<<
typeid
(ex).name() <<
": "
<< ex.what() <<
endmsg
;
40
}
41
return
0;
42
}
43
44
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
45
46
TrigConf::HLTHash
AlgorithmIdentifier::storeHash
(MsgStream&
msg
)
const
{
47
try
{
48
return
TrigConf::HLTUtils::string2hash
(
m_store
,
"STORE"
);
49
}
catch
(
const
std::exception& ex) {
50
msg
<< MSG::DEBUG <<
"Caught "
<<
typeid
(ex).name() <<
": "
<< ex.what() <<
endmsg
;
51
}
52
return
0;
53
}
54
55
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
56
57
StatusCode
AlgorithmIdentifier::isValid
()
const
{
58
if
(
m_caller
==
""
||
m_store
==
""
|| !
m_hash
) {
59
return
StatusCode::FAILURE;
60
}
61
return
StatusCode::SUCCESS;
62
}
63
64
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
65
66
void
AlgorithmIdentifier::dump
(MsgStream&
msg
) {
67
TrigConf::HLTHash
theCallerHash =
callerHash
(
msg
);
68
TrigConf::HLTHash
theStoreHash =
storeHash
(
msg
);
69
70
msg
<< MSG::INFO <<
"----------"
<<
endmsg
;
71
msg
<<
"Valid? "
<< (
isValid
() ?
"YES"
:
"NO"
) <<
endmsg
;
72
msg
<<
"Real Slot:"
<<
m_realSlot
<<
endmsg
;
73
msg
<<
"Slot Save Overrride:"
<<
m_slotToSaveInto
<<
endmsg
;
74
msg
<<
"Caller:'"
<<
m_caller
<<
"'"
<<
endmsg
;
75
msg
<<
"Caller Hash:"
<< theCallerHash <<
endmsg
;
76
msg
<<
"Store:'"
<<
m_store
<<
"'"
<<
endmsg
;
77
msg
<<
"Store Hash:"
<< theStoreHash <<
endmsg
;
78
msg
<<
"View ID:"
<<
m_viewID
<<
endmsg
;
79
msg
<<
"AI Hash:"
<<
m_hash
<<
endmsg
;
80
}
81
82
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
83
84
AlgorithmIdentifier
AlgorithmIdentifierMaker::make
(
const
EventContext& context,
const
std::string& caller, MsgStream&
msg
,
const
int16_t slotOverride) {
85
const
SG::View
* view =
nullptr
;
86
const
IProxyDict
* proxy =
nullptr
;
87
if
(
Atlas::hasExtendedEventContext
(context)) {
88
proxy =
Atlas::getExtendedEventContext
(context).proxy();
89
if
(proxy) view =
dynamic_cast<
const
SG::View
*
>
(proxy);
90
}
91
if
(!proxy) {
92
msg
<< MSG::ERROR <<
"Unable to obtain IProxyDict from Atlas::ExtendedEventContext"
<<
endmsg
;
93
return
AlgorithmIdentifier
();
// Return a default constructed, invalid, identifier
94
}
95
const
int16_t viewID = (view ==
nullptr
?
AlgorithmIdentifier::s_noView
: view->viewID());
96
const
size_t
saveSlot = (slotOverride >= 0 ? slotOverride : context.slot());
97
return
AlgorithmIdentifier
(context.slot(), saveSlot, caller, proxy->name(), viewID);
98
}
99
100
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
AlgorithmIdentifier.h
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
AthCheckMacros.h
ExtendedEventContext.h
View.h
IProxyDict
A proxy dictionary.
Definition
AthenaKernel/AthenaKernel/IProxyDict.h:47
SG::View
A "view" of the event store (IProxyDict).
Definition
View.h:46
TrigConf::HLTUtils::string2hash
static HLTHash string2hash(const std::string &, const std::string &category="TE")
hash function translating TE names into identifiers
string
STL class.
Atlas::getExtendedEventContext
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
Definition
ExtendedEventContext.cxx:32
Atlas::hasExtendedEventContext
bool hasExtendedEventContext(const EventContext &ctx)
Test whether a context object has an extended context installed.
Definition
ExtendedEventContext.cxx:23
TrigConf::HLTHash
uint32_t HLTHash
Definition
TrigConfHLTUtils/TrigConfHLTUtils/HLTUtils.h:19
std
STL namespace.
AlgorithmIdentifierMaker::make
static AlgorithmIdentifier make(const EventContext &context, const std::string &caller, MsgStream &msg, const int16_t slotOverride=-1)
Construct an AlgorithmIdentifier.
Definition
AlgorithmIdentifier.cxx:84
AlgorithmIdentifier
Small structure to hold an algorithm's name and store, plus some details on its EventView.
Definition
AlgorithmIdentifier.h:21
AlgorithmIdentifier::m_caller
std::string m_caller
Name of the algorithm.
Definition
AlgorithmIdentifier.h:33
AlgorithmIdentifier::m_store
std::string m_store
Name of the algorithm's store.
Definition
AlgorithmIdentifier.h:34
AlgorithmIdentifier::callerHash
TrigConf::HLTHash callerHash(MsgStream &msg) const
Definition
AlgorithmIdentifier.cxx:35
AlgorithmIdentifier::m_slotToSaveInto
size_t m_slotToSaveInto
The slot which is used for the purposes of recording data on this algorithm's execution.
Definition
AlgorithmIdentifier.h:32
AlgorithmIdentifier::AlgorithmIdentifier
AlgorithmIdentifier()
Definition
AlgorithmIdentifier.cxx:13
AlgorithmIdentifier::s_noView
static constexpr int16_t s_noView
Constant value used to express an Algorithm which is not running in a View.
Definition
AlgorithmIdentifier.h:38
AlgorithmIdentifier::storeHash
TrigConf::HLTHash storeHash(MsgStream &msg) const
Definition
AlgorithmIdentifier.cxx:46
AlgorithmIdentifier::dump
void dump(MsgStream &msg)
Definition
AlgorithmIdentifier.cxx:66
AlgorithmIdentifier::m_realSlot
size_t m_realSlot
The actual slot of the algorithm.
Definition
AlgorithmIdentifier.h:31
AlgorithmIdentifier::m_hash
size_t m_hash
Hash of algorithm + store + realSlot.
Definition
AlgorithmIdentifier.h:36
AlgorithmIdentifier::isValid
StatusCode isValid() const
Definition
AlgorithmIdentifier.cxx:57
AlgorithmIdentifier::m_viewID
int16_t m_viewID
If not within an event view, then the m_iewID = s_noView = -1.
Definition
AlgorithmIdentifier.h:35
msg
MsgStream & msg
Definition
testRead.cxx:32
Generated on
for ATLAS Offline Software by
1.17.0