ATLAS Offline Software
Loading...
Searching...
No Matches
L1TopoOnlineMonitorHypoTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
5
6// TrigCompositeUtils types used here
9
10// TrigCompositeUtils methods used here
15
16// =============================================================================
17
19 const std::string& name,
20 const IInterface* parent)
21: AthAlgTool(type, name, parent),
22 m_decisionId(HLT::Identifier::fromToolName(name)) {}
23
24// =============================================================================
25
27 ATH_CHECK(m_errorFlagsKey.initialize());
28 return StatusCode::SUCCESS;
29}
30
31// =============================================================================
32
34 const EventContext& eventContext) const {
35
36 // Retrieve the error flags
38 ATH_CHECK(errorFlagsCont.isValid());
39 ATH_CHECK(!errorFlagsCont->empty());
40 const xAOD::TrigComposite* errorFlags = errorFlagsCont->at(0);
41
42 for (const auto& [decision, previousDecision] : input) {
43
44 // Set a feature link
45 ElementLink<xAOD::TrigCompositeContainer> featureLink(*errorFlagsCont, 0, eventContext);
46 decision->setObjectLink(featureString(), featureLink);
47
48 // Check previous decisions
49 const DecisionIDContainer previousDecisionIDs{decisionIDs(previousDecision).begin(),
50 decisionIDs(previousDecision).end()};
51 if (not passed(m_decisionId.numeric(), previousDecisionIDs)) {
52 ATH_MSG_DEBUG("Skipping chain because previous step didn't pass");
53 continue;
54 }
55
56
57 // Check error flags
58 auto getFlag = [&errorFlags, this](const std::string& name){
59 if (!errorFlags->hasDetail<bool>(name)) {
60 ATH_MSG_WARNING("Error flag " << name << " missing from the TrigComposite object " << m_errorFlagsKey.key());
61 return false;
62 }
63 const bool flag = errorFlags->getDetail<bool>(name);
64 ATH_MSG_DEBUG("Error flag " << name << " = " << (flag ? "true" : "false"));
65 return flag;
66 };
67
68 bool accept{false};
69
70 if (m_acceptTrivialFlag.value()) {
71 accept |= getFlag("hasTrivialFlag");
72 }
73 ATH_MSG_DEBUG("The accept decision is: " << (accept ? "true" : "false"));
74 if (accept) {
75 addDecisionID(m_decisionId, decision);
76 }
77 }
78
79 return StatusCode::SUCCESS;
80}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
bool passed(DecisionID id, const DecisionIDContainer &)
checks if required decision ID is in the set of IDs in the container
void decisionIDs(const Decision *d, DecisionIDContainer &id)
Extracts DecisionIDs stored in the Decision object.
const std::string & featureString()
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
virtual StatusCode initialize() override
Implementation of AthAlgTool::initialize()
Gaudi::Property< bool > m_acceptTrivialFlag
std::vector< std::pair< TrigCompositeUtils::Decision *, const TrigCompositeUtils::Decision * > > InputVector
SG::ReadHandleKey< xAOD::TrigCompositeContainer > m_errorFlagsKey
The input ErrorFlags.
HLT::Identifier m_decisionId
The decision id of the tool instance.
L1TopoOnlineMonitorHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
StatusCode decide(const InputVector &input, const EventContext &eventContext) const
The main method of the tool.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
bool hasDetail(const std::string &name) const
Check if a given type of detail is available.
bool getDetail(const std::string &name, TYPE &value) const
Get an TYPE detail from the object.
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
unsigned int DecisionID
const std::string & featureString()
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
std::set< DecisionID > DecisionIDContainer
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
TrigComposite_v1 TrigComposite
Declare the latest version of the class.