ATLAS Offline Software
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)
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 }
L1TopoOnlineMonitorHypoTool::InputVector
std::vector< std::pair< TrigCompositeUtils::Decision *, const TrigCompositeUtils::Decision * > > InputVector
Definition: L1TopoOnlineMonitorHypoTool.h:25
TrigCompositeUtils::DecisionID
unsigned int DecisionID
Definition: TrigComposite_v1.h:27
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:117
HLT::Identifier::numeric
TrigCompositeUtils::DecisionID numeric() const
numeric ID
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:47
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
CutsMETMaker::accept
StatusCode accept(const xAOD::Muon *mu)
Definition: CutsMETMaker.cxx:18
TrigCompositeUtils::addDecisionID
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
Definition: TrigCompositeUtilsRoot.cxx:61
xAOD::TrigComposite_v1::hasDetail
bool hasDetail(const std::string &name) const
Check if a given type of detail is available.
L1TopoOnlineMonitorHypoTool::L1TopoOnlineMonitorHypoTool
L1TopoOnlineMonitorHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition: L1TopoOnlineMonitorHypoTool.cxx:18
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition: HLTResultReader.h:26
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
master.flag
bool flag
Definition: master.py:29
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TrigCompositeUtils::featureString
const std::string & featureString()
Definition: TrigCompositeUtilsRoot.cxx:884
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
L1TopoOnlineMonitorHypoTool.h
HLT::getFlag
const std::vector< bool > & getFlag(const TrigPassFlags *flags, const T *obj, const CONTAINER *container, const size_t position)
Returns the flag at index position.
Definition: TrigPassFlags.h:145
L1TopoOnlineMonitorHypoTool::initialize
virtual StatusCode initialize() override
Implementation of AthAlgTool::initialize()
Definition: L1TopoOnlineMonitorHypoTool.cxx:26
TrigCompositeUtils::DecisionIDContainer
std::set< DecisionID > DecisionIDContainer
Definition: TrigComposite_v1.h:28
L1TopoOnlineMonitorHypoTool::m_acceptTrivialFlag
Gaudi::Property< bool > m_acceptTrivialFlag
Definition: L1TopoOnlineMonitorHypoTool.h:48
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
L1TopoOnlineMonitorHypoTool::m_errorFlagsKey
SG::ReadHandleKey< xAOD::TrigCompositeContainer > m_errorFlagsKey
The input ErrorFlags.
Definition: L1TopoOnlineMonitorHypoTool.h:43
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TrigCompositeUtils::decisionIDs
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
Definition: TrigCompositeUtilsRoot.cxx:67
L1TopoOnlineMonitorHypoTool::m_decisionId
HLT::Identifier m_decisionId
The decision id of the tool instance.
Definition: L1TopoOnlineMonitorHypoTool.h:40
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
AthAlgTool
Definition: AthAlgTool.h:26
xAOD::TrigComposite_v1::getDetail
bool getDetail(const std::string &name, TYPE &value) const
Get an TYPE detail from the object.
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
L1TopoOnlineMonitorHypoTool::decide
StatusCode decide(const InputVector &input, const EventContext &eventContext) const
The main method of the tool.
Definition: L1TopoOnlineMonitorHypoTool.cxx:33
Identifier
Definition: IdentifierFieldParser.cxx:14