ATLAS Offline Software
TrigDecisionToolLite.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 
10 
11 std::atomic<bool> Trig::TrigDecisionToolLite::s_printWarningMessages = true;
12 
14 
16  ATH_CHECK(m_HLTSummaryKeyIn.initialize());
17  return StatusCode::SUCCESS;
18 }
19 
21  SG::ReadHandle<TrigCompositeUtils::DecisionContainer> navigationRH = SG::ReadHandle(m_HLTSummaryKeyIn, ctx);
22  if ( not navigationRH.isValid() ) {
23  ATH_MSG_ERROR("Cannot read trigger navigation container " << m_HLTSummaryKeyIn.key());
24  return StatusCode::FAILURE;
25  }
26  const TrigCompositeUtils::Decision* terminusNode = TrigCompositeUtils::getTerminusNode(navigationRH);
27  if ( not terminusNode ) {
28  ATH_MSG_ERROR("Cannot locate terminus node within " << m_HLTSummaryKeyIn.key() << ", the navigation graph has " << navigationRH->size() << " nodes.");
29  return StatusCode::FAILURE;
30  }
31  TrigCompositeUtils::decisionIDs(terminusNode, setOfAllPassingChains); // Populate setOfAllPassingChains from the vector of passing chain IDs in terminusNode
32  return StatusCode::SUCCESS;
33 }
34 
35 bool Trig::TrigDecisionToolLite::isPassed(const std::vector<HLT::Identifier>& chainIDs, const EventContext& ctx) const {
36  TrigCompositeUtils::DecisionIDContainer setOfAllPassingChains;
37  if ( fillPassingChainsSet(setOfAllPassingChains, ctx).isFailure() ) {
38  return false;
39  }
40  for ( const HLT::Identifier& chainID : chainIDs ) { // Return the OR of the vector of supplied chains
41  if ( setOfAllPassingChains.count( chainID.numeric() ) ) {
42  return true;
43  }
44  }
45  return false;
46 }
47 
48 bool Trig::TrigDecisionToolLite::isPassed(const HLT::Identifier& chainID, const EventContext& ctx) const {
49  TrigCompositeUtils::DecisionIDContainer setOfAllPassingChains;
50  if ( fillPassingChainsSet(setOfAllPassingChains, ctx).isFailure() ) {
51  return false;
52  }
53  return setOfAllPassingChains.count( chainID.numeric() );
54 }
55 
56 bool Trig::TrigDecisionToolLite::isPassed(const std::vector<std::string>& chains, const EventContext& ctx) const {
57  std::vector<HLT::Identifier> chainIDs;
58  for ( const std::string& chain : chains ) {
59  chainIDs.emplace_back(chain);
60  }
61  return isPassed( chainIDs, ctx );
62 }
63 
64 bool Trig::TrigDecisionToolLite::isPassed(const std::string& chain, const EventContext& ctx) const {
65  return isPassed( HLT::Identifier(chain), ctx );
66 }
67 
68 std::vector<TrigCompositeUtils::TypelessLinkInfo>
69 Trig::TrigDecisionToolLite::typelessFeatures(const Trig::FeatureRequestDescriptor& frd, const CLID clid, const EventContext& ctx) const {
70  return FeatureRequestHelpers::typelessFeaturesImplimentation(frd, clid, m_HLTSummaryKeyIn, msg(), ctx, getEventStore(), s_printWarningMessages);
71 }
72 
74  return &*evtStore(); // Service handle to pointer (in Athena)
75 }
Trig::FeatureRequestDescriptor
Definition: TrigAnalysisHelpers/TrigAnalysisHelpers/FeatureRequestDescriptor.h:33
Trig::TrigDecisionToolLite::TrigDecisionToolLite
TrigDecisionToolLite(const std::string &name)
Definition: TrigDecisionToolLite.cxx:13
ChainNameParser.h
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
HLT::Identifier::numeric
TrigCompositeUtils::DecisionID numeric() const
numeric ID
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:41
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
Trig::TrigDecisionToolLite::fillPassingChainsSet
StatusCode fillPassingChainsSet(TrigCompositeUtils::DecisionIDContainer &setOfAllPassingChains, const EventContext &ctx) const
Internal.
Definition: TrigDecisionToolLite.cxx:20
Trig::TrigDecisionToolLite::isPassed
virtual bool isPassed(const HLT::Identifier &chain, const EventContext &ctx=Gaudi::Hive::currentContext()) const final
true if the given HLT chain passed for physics
Definition: TrigDecisionToolLite.cxx:48
asg
Definition: DataHandleTestTool.h:28
Trig::TrigDecisionToolLite::initialize
StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: TrigDecisionToolLite.cxx:15
TrigCompositeUtils::getTerminusNode
const Decision * getTerminusNode(SG::ReadHandle< DecisionContainer > &container)
Definition: TrigCompositeUtilsRoot.cxx:258
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:122
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
FeatureRequestHelpers.h
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:49
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
HLT::Identifier
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:19
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
python.copyTCTOutput.chains
chains
Definition: copyTCTOutput.py:78
TrigCompositeUtils::DecisionIDContainer
std::set< DecisionID > DecisionIDContainer
Definition: TrigComposite_v1.h:28
Trig::TrigDecisionToolLite::typelessFeatures
virtual std::vector< TrigCompositeUtils::TypelessLinkInfo > typelessFeatures(const Trig::FeatureRequestDescriptor &frd, const CLID clid, const EventContext &ctx) const final
Internal type erased features retrieval implementation call.
Definition: TrigDecisionToolLite.cxx:69
TrigCompositeUtils::decisionIDs
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
Definition: TrigCompositeUtilsRoot.cxx:65
Trig::TrigDecisionToolLite::getEventStore
virtual const asg::EventStoreType * getEventStore() const final
Internal call to obtain event store pointer from concrete tool implementation. Note that evtStore() i...
Definition: TrigDecisionToolLite.cxx:73
TrigDecisionToolLite.h
FeatureRequestHelpers::typelessFeaturesImplimentation
std::vector< TrigCompositeUtils::TypelessLinkInfo > typelessFeaturesImplimentation(const Trig::FeatureRequestDescriptor &frd, const CLID clid, const SG::ReadHandleKey< TrigCompositeUtils::DecisionContainer > &navRHKey, MsgStream &msg, const EventContext &ctx, const asg::EventStoreType *eventStore, const bool printWarningMessages)
Standalone implementation of feature retrieval, common between TrigDecisionTool and TrigDecisionToolL...
Definition: FeatureRequestHelpers.cxx:16
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
MsgStream.h