ATLAS Offline Software
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 {
42  FilterReporter filter (m_filterParams, m_noFilter.value());
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()
54  ? m_trigDecisionTool->isPassed(m_trigList[i], TrigDefs::requireDecision)
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 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
CP::TrigEventSelectionAlg::m_trigDecisionTool
ToolHandle< Trig::ITrigDecisionTool > m_trigDecisionTool
trigger decision tool handle
Definition: TrigEventSelectionAlg.h:33
FilterReporter
a guard class for use with ref FilterReporterParams
Definition: FilterReporter.h:35
TrigEventSelectionAlg.h
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
StringUtil.h
covarianceTool.filter
filter
Definition: covarianceTool.py:514
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CP::TrigEventSelectionAlg::finalize
virtual StatusCode finalize() final
Definition: TrigEventSelectionAlg.cxx:66
lumiFormat.i
int i
Definition: lumiFormat.py:85
CP::TrigEventSelectionAlg::initialize
virtual StatusCode initialize() final
Definition: TrigEventSelectionAlg.cxx:20
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ANA_MSG_INFO
#define ANA_MSG_INFO(xmsg)
Macro printing info messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:290
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
FilterReporter.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
EventInfo.h
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
RCU::substitute
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...
Definition: StringUtil.cxx:24
CP::TrigEventSelectionAlg::execute
virtual StatusCode execute() final
Definition: TrigEventSelectionAlg.cxx:40
CP::TrigEventSelectionAlg::TrigEventSelectionAlg
TrigEventSelectionAlg(const std::string &name, ISvcLocator *svcLoc=nullptr)
Definition: TrigEventSelectionAlg.cxx:12