ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
TriggerAnalysisAlgorithms
Root
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
7
#include <
EventBookkeeperTools/FilterReporter.h
>
8
#include <
TriggerAnalysisAlgorithms/TrigEventSelectionAlg.h
>
9
#include <
TriggerAnalysisAlgorithms/TrigChainNameHelpers.h
>
10
#include <
AsgDataHandles/ReadHandle.h
>
11
12
CP::TrigEventSelectionAlg::TrigEventSelectionAlg
(
const
std::string &
name
,
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
20
StatusCode
CP::TrigEventSelectionAlg::initialize
()
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
42
StatusCode
CP::TrigEventSelectionAlg::execute
(
const
EventContext& ctx)
43
{
44
FilterReporter
filter (
m_filterParams
,
m_noFilter
.value());
45
46
const
xAOD::EventInfo
*evtInfo =
nullptr
;
47
if
(!
m_selectionDecoration
.empty()) {
48
SG::ReadHandle<xAOD::EventInfo>
evtInfoHandle(
m_eventInfoKey
, ctx);
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()
55
?
m_trigDecisionTool
->isPassed(
m_trigList
[i],
TrigDefs::requireDecision
)
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
67
StatusCode
CP::TrigEventSelectionAlg::finalize
()
68
{
69
ANA_MSG_INFO
(
m_filterParams
.summary());
70
71
return
StatusCode::SUCCESS;
72
}
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
ReadHandle.h
Handle class for reading from StoreGate.
ANA_MSG_INFO
#define ANA_MSG_INFO(xmsg,...)
Macro printing info messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:291
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:325
FilterReporter.h
TrigChainNameHelpers.h
TrigEventSelectionAlg.h
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
CP::TrigEventSelectionAlg::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
the EventInfo to decorate
Definition
TrigEventSelectionAlg.h:38
CP::TrigEventSelectionAlg::m_trigDecisionTool
ToolHandle< Trig::ITrigDecisionTool > m_trigDecisionTool
trigger decision tool handle
Definition
TrigEventSelectionAlg.h:35
CP::TrigEventSelectionAlg::m_noFilter
Gaudi::Property< bool > m_noFilter
whether to not apply an event filter
Definition
TrigEventSelectionAlg.h:47
CP::TrigEventSelectionAlg::finalize
virtual StatusCode finalize() final override
Definition
TrigEventSelectionAlg.cxx:67
CP::TrigEventSelectionAlg::TrigEventSelectionAlg
TrigEventSelectionAlg(const std::string &name, ISvcLocator *svcLoc=nullptr)
Definition
TrigEventSelectionAlg.cxx:12
CP::TrigEventSelectionAlg::m_noL1
Gaudi::Property< bool > m_noL1
whether to not require L1 decision
Definition
TrigEventSelectionAlg.h:50
CP::TrigEventSelectionAlg::m_selectionDecoration
Gaudi::Property< std::string > m_selectionDecoration
the decoration for trigger selection
Definition
TrigEventSelectionAlg.h:44
CP::TrigEventSelectionAlg::m_filterParams
FilterReporterParams m_filterParams
the filter reporter params
Definition
TrigEventSelectionAlg.h:56
CP::TrigEventSelectionAlg::m_selectionAccessors
std::vector< SG::Decorator< bool > > m_selectionAccessors
the accessors for m_selectionDecoration and m_trigList combination
Definition
TrigEventSelectionAlg.h:53
CP::TrigEventSelectionAlg::initialize
virtual StatusCode initialize() final override
Definition
TrigEventSelectionAlg.cxx:20
CP::TrigEventSelectionAlg::m_trigList
Gaudi::Property< std::vector< std::string > > m_trigList
list of triggers or trigger chains
Definition
TrigEventSelectionAlg.h:41
EL::AnaAlgorithm::AnaAlgorithm
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
Definition
AnaAlgorithm.cxx:40
EL::AnaAlgorithm::execute
virtual::StatusCode execute()
execute this algorithm
Definition
AnaAlgorithm.cxx:315
FilterReporter
a guard class for use with ref FilterReporterParams
Definition
FilterReporter.h:35
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:66
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
CP::sanitizeTriggerChainName
std::string sanitizeTriggerChainName(std::string chain)
convert a trigger chain name into a string usable in decoration/branch names (.
Definition
TrigChainNameHelpers.h:18
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition
AsgComponentFactories.h:16
TrigDefs::requireDecision
static const unsigned int requireDecision
Definition
TrigEvent/TrigDecisionInterface/TrigDecisionInterface/Conditions.h:25
xAOD::name
name
Definition
TriggerMenuJson_v1.cxx:29
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition
IEventInfoCnvTool.h:16
Generated on
for ATLAS Offline Software by
1.17.0