ATLAS Offline Software
Loading...
Searching...
No Matches
TrigEventSelectionAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 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 for (const std::string &chain : m_trigList) {
31 m_selectionAccessors.emplace_back(m_selectionDecoration + "_" + RCU::substitute(RCU::substitute(chain, ".", "p"), "-", "_"));
32 }
33 }
34
35 ANA_CHECK (m_filterParams.initialize());
36
37 return StatusCode::SUCCESS;
38}
39
41{
43
44 if (m_trigList.empty()) {
45 filter.setPassed(true);
46 return StatusCode::SUCCESS;
47 }
48
49 const xAOD::EventInfo *evtInfo = 0;
50 ANA_CHECK(evtStore()->retrieve(evtInfo, "EventInfo"));
51
52 for (size_t i = 0; i < m_trigList.size(); i++) {
53 bool trigPassed = m_noL1.value()
55 : m_trigDecisionTool->isPassed(m_trigList[i]);
56 if (!m_selectionDecoration.empty()) {
57 m_selectionAccessors[i](*evtInfo) = trigPassed;
58 }
59 if (trigPassed)
60 filter.setPassed (true);
61 }
62
63 return StatusCode::SUCCESS;
64}
65
67{
68 ANA_MSG_INFO (m_filterParams.summary());
69
70 return StatusCode::SUCCESS;
71}
#define ATH_MSG_ERROR(x)
#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)
virtual StatusCode initialize() final
ToolHandle< Trig::ITrigDecisionTool > m_trigDecisionTool
trigger decision tool handle
Gaudi::Property< bool > m_noFilter
whether to not apply an event filter
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
virtual StatusCode execute() final
std::vector< SG::Decorator< bool > > m_selectionAccessors
the accessors for m_selectionDecoration and m_trigList combination
virtual StatusCode finalize() final
Gaudi::Property< std::vector< std::string > > m_trigList
list of triggers or trigger chains
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
a guard class for use with ref FilterReporterParams
This module defines the arguments passed from the BATCH driver to the BATCH worker.
std::string substitute(const std::string &str, const std::string &pattern, const std::string &with)
effects: substitute all occurences of "pattern" with "with" in the string "str" returns: the substitu...
EventInfo_v1 EventInfo
Definition of the latest event info version.