ATLAS Offline Software
Loading...
Searching...
No Matches
TrigEventSelectionAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
11
13 ISvcLocator *svcLoc)
14 : EL::AnaAlgorithm(name, svcLoc),
15 m_trigDecisionTool("Trig::TrigDecisionTool/TrigDecisionTool")
16{
17 declareProperty("tool", m_trigDecisionTool, "trigger decision tool");
18}
19
21{
22 if (m_trigList.empty()) {
23 ATH_MSG_ERROR("A list of triggers needs to be provided");
24 return StatusCode::FAILURE;
25 }
26
27 ANA_CHECK(m_trigDecisionTool.retrieve());
28
29 if (!m_selectionDecoration.empty()) {
30 const std::string prefix{m_selectionDecoration.value() + "_"};
31 for (const std::string &chain : m_trigList) {
32 m_selectionAccessors.emplace_back( prefix + sanitizeTriggerChainName(chain));
33 }
34 }
35
36 ANA_CHECK (m_eventInfoKey.initialize(!m_selectionDecoration.empty()));
37 ANA_CHECK (m_filterParams.initialize());
38
39 return StatusCode::SUCCESS;
40}
41
42StatusCode CP::TrigEventSelectionAlg::execute(const EventContext& ctx)
43{
45
46 const xAOD::EventInfo *evtInfo = nullptr;
47 if (!m_selectionDecoration.empty()) {
49 ANA_CHECK(evtInfoHandle.isValid());
50 evtInfo = evtInfoHandle.cptr();
51 }
52
53 for (size_t i = 0; i < m_trigList.size(); i++) {
54 bool trigPassed = m_noL1.value()
56 : m_trigDecisionTool->isPassed(m_trigList[i]);
57 if (evtInfo) {
58 m_selectionAccessors[i](*evtInfo) = trigPassed;
59 }
60 if (trigPassed)
61 filter.setPassed (true);
62 }
63
64 return StatusCode::SUCCESS;
65}
66
68{
69 ANA_MSG_INFO (m_filterParams.summary());
70
71 return StatusCode::SUCCESS;
72}
#define ATH_MSG_ERROR(x,...)
Handle class for reading from StoreGate.
#define ANA_MSG_INFO(xmsg,...)
Macro printing info messages.
#define ANA_CHECK(EXP)
check whether the given expression was successful
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
the EventInfo to decorate
ToolHandle< Trig::ITrigDecisionTool > m_trigDecisionTool
trigger decision tool handle
Gaudi::Property< bool > m_noFilter
whether to not apply an event filter
virtual StatusCode finalize() final override
TrigEventSelectionAlg(const std::string &name, ISvcLocator *svcLoc=nullptr)
Gaudi::Property< bool > m_noL1
whether to not require L1 decision
Gaudi::Property< std::string > m_selectionDecoration
the decoration for trigger selection
FilterReporterParams m_filterParams
the filter reporter params
std::vector< SG::Decorator< bool > > m_selectionAccessors
the accessors for m_selectionDecoration and m_trigList combination
virtual StatusCode initialize() final override
Gaudi::Property< std::vector< std::string > > m_trigList
list of triggers or trigger chains
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
virtual::StatusCode execute()
execute this algorithm
a guard class for use with ref FilterReporterParams
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
std::string sanitizeTriggerChainName(std::string chain)
convert a trigger chain name into a string usable in decoration/branch names (.
This module defines the arguments passed from the BATCH driver to the BATCH worker.
EventInfo_v1 EventInfo
Definition of the latest event info version.