ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigSteer
DecisionHandling
src
TestHypoTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
TestHypoTool.h
"
5
#include "
TrigCompositeUtils/HLTIdentifier.h
"
6
7
using namespace
TrigCompositeUtils
;
8
9
10
namespace
HLTTest
{
11
12
TestHypoTool::TestHypoTool
(
const
std::string&
type
,
13
const
std::string& name,
14
const
IInterface* parent ) :
15
ITestHypoTool
( name ),
16
AthAlgTool
(
type
, name, parent )
17
{
18
m_decisionId
=
HLT::Identifier::fromToolName
(name );
19
}
20
21
TestHypoTool::~TestHypoTool
() {}
22
23
StatusCode
TestHypoTool::initialize
() {
24
ATH_MSG_INFO
(
"Initializing "
<< name() <<
"..."
);
25
26
ATH_MSG_DEBUG
(
"Configured to require chain "
<<
m_decisionId
);
27
ATH_MSG_DEBUG
(
"Link name is "
<<
m_linkName
.value());
28
ATH_MSG_DEBUG
(
"threshold="
<<
m_threshold
);
29
ATH_MSG_DEBUG
(
"property="
<<
m_property
);
30
return
StatusCode::SUCCESS;
31
}
32
33
StatusCode
TestHypoTool::decide
(
DecisionContainer
* decisions )
const
{
34
ATH_MSG_DEBUG
(
"Add decisionIDs to "
<< decisions->size() <<
" output decisions"
);
35
size_t
counter = 0;
36
for
(
const
auto
d: *decisions ) {
37
//get previous decisions
38
std::vector<ElementLink<DecisionContainer>> inputLinks =
getLinkToPrevious
(d);
39
ATH_MSG_DEBUG
(
"Decision "
<< counter <<
": Got "
<<inputLinks.size()<<
" input decisions"
);
40
for
(
const
auto
& previousDecisions: inputLinks){
41
42
TrigCompositeUtils::DecisionIDContainer
objDecisions;
43
TrigCompositeUtils::decisionIDs
( *previousDecisions, objDecisions );
44
45
ATH_MSG_DEBUG
(
"Number of decision-IDs for input "
<< counter <<
" is: "
<< objDecisions.size() );
46
47
if
(
TrigCompositeUtils::passed
(
m_decisionId
.numeric(), objDecisions ) ) {
48
const
auto
feature = d->objectLink<
xAOD::TrigCompositeContainer
>(
"feature"
);
49
if
( not feature.isValid() ) {
50
ATH_MSG_ERROR
(
" Can not find reference to the object from the decision"
);
51
return
StatusCode::FAILURE;
52
}
53
const
float
v = (*feature)->getDetail<
float
>(
m_property
);
54
if
( v >
m_threshold
) {
// actual cut will be more complex of course
55
ATH_MSG_DEBUG
(
m_threshold
<<
" passed by value: "
<< v <<
". Adding "
<<
m_decisionId
<<
" to output"
);
56
addDecisionID
(
m_decisionId
, d );
57
}
else
{
58
ATH_MSG_DEBUG
(
m_threshold
<<
" not passed by value "
<< v );
59
}
60
61
}
else
{
62
ATH_MSG_DEBUG
(
"No Input decisions matched"
);
63
}
64
counter++;
65
}
66
}
67
return
StatusCode::SUCCESS;
68
}
69
70
71
StatusCode
TestHypoTool::finalize
() {
72
ATH_MSG_INFO
(
"Finalizing "
<< name() <<
"..."
);
73
return
StatusCode::SUCCESS;
74
}
75
76
}
//> end namespace HLTTest
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
TestHypoTool.h
HLTIdentifier.h
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
HLTTest::ITestHypoTool::ITestHypoTool
ITestHypoTool(const std::string &name)
Definition
ITestHypoTool.h:28
HLTTest::ITestHypoTool::m_decisionId
HLT::Identifier m_decisionId
Definition
ITestHypoTool.h:45
HLTTest::TestHypoTool::m_linkName
StringProperty m_linkName
Definition
TestHypoTool.h:49
HLTTest::TestHypoTool::initialize
StatusCode initialize() override
Definition
TestHypoTool.cxx:23
HLTTest::TestHypoTool::decide
StatusCode decide(DecisionContainer *decisions) const override
method invoked to work out the decisions per object
Definition
TestHypoTool.cxx:33
HLTTest::TestHypoTool::TestHypoTool
TestHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
TestHypoTool.cxx:12
HLTTest::TestHypoTool::~TestHypoTool
virtual ~TestHypoTool()
Definition
TestHypoTool.cxx:21
HLTTest::TestHypoTool::m_threshold
Gaudi::Property< float > m_threshold
Definition
TestHypoTool.h:43
HLTTest::TestHypoTool::m_property
StringProperty m_property
Definition
TestHypoTool.h:44
HLTTest::TestHypoTool::finalize
StatusCode finalize() override
Definition
TestHypoTool.cxx:71
HLT::Identifier::fromToolName
static HLT::Identifier fromToolName(const std::string &tname)
Definition
HLTIdentifier.cxx:21
HLTTest
Definition
ITestHypoTool.cxx:9
TrigCompositeUtils
Definition
TrigComposite.h:19
TrigCompositeUtils::getLinkToPrevious
const std::vector< ElementLink< DecisionContainer > > getLinkToPrevious(const Decision *d)
returns links to previous decision object 'seed'
Definition
TrigCompositeUtilsRoot.cxx:157
TrigCompositeUtils::passed
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
Definition
TrigCompositeUtilsRoot.cxx:118
TrigCompositeUtils::DecisionIDContainer
std::set< DecisionID > DecisionIDContainer
Definition
TrigComposite_v1.h:28
TrigCompositeUtils::DecisionContainer
xAOD::TrigCompositeContainer DecisionContainer
Definition
TrigCompositeContainer.h:21
TrigCompositeUtils::addDecisionID
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
Definition
TrigCompositeUtilsRoot.cxx:59
TrigCompositeUtils::decisionIDs
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
Definition
TrigCompositeUtilsRoot.cxx:65
xAOD::TrigCompositeContainer
TrigCompositeContainer_v1 TrigCompositeContainer
Declare the latest version of the container.
Definition
TrigCompositeContainer.h:17
type
Generated on
for ATLAS Offline Software by
1.17.0