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 <algorithm>
9
#include <
TriggerAnalysisAlgorithms/TrigEventSelectionAlg.h
>
10
#include <
xAODEventInfo/EventInfo.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
std::string chainfix = chain;
33
std::replace(chainfix.begin(), chainfix.end(),
'.'
,
'p'
);
34
std::replace(chainfix.begin(), chainfix.end(),
'-'
,
'_'
);
35
m_selectionAccessors
.emplace_back( prefix + chainfix);
36
}
37
}
38
39
ANA_CHECK
(
m_filterParams
.initialize());
40
41
return
StatusCode::SUCCESS;
42
}
43
44
StatusCode
CP::TrigEventSelectionAlg::execute
(
const
EventContext&
/*ctx*/
)
45
{
46
FilterReporter
filter (
m_filterParams
,
m_noFilter
.value());
47
48
if
(
m_trigList
.empty()) {
49
filter.setPassed(
true
);
50
return
StatusCode::SUCCESS;
51
}
52
53
const
xAOD::EventInfo
*evtInfo = 0;
54
ANA_CHECK
(
evtStore
()->retrieve(evtInfo,
"EventInfo"
));
55
56
for
(
size_t
i = 0; i <
m_trigList
.size(); i++) {
57
bool
trigPassed =
m_noL1
.value()
58
?
m_trigDecisionTool
->isPassed(
m_trigList
[i],
TrigDefs::requireDecision
)
59
:
m_trigDecisionTool
->isPassed(
m_trigList
[i]);
60
if
(!
m_selectionDecoration
.empty()) {
61
m_selectionAccessors
[i](*evtInfo) = trigPassed;
62
}
63
if
(trigPassed)
64
filter.setPassed (
true
);
65
}
66
67
return
StatusCode::SUCCESS;
68
}
69
70
StatusCode
CP::TrigEventSelectionAlg::finalize
()
71
{
72
ANA_MSG_INFO
(
m_filterParams
.summary());
73
74
return
StatusCode::SUCCESS;
75
}
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ANA_MSG_INFO
#define ANA_MSG_INFO(xmsg)
Macro printing info messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:290
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
FilterReporter.h
TrigEventSelectionAlg.h
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
CP::TrigEventSelectionAlg::initialize
virtual StatusCode initialize() final
Definition
TrigEventSelectionAlg.cxx:20
CP::TrigEventSelectionAlg::m_trigDecisionTool
ToolHandle< Trig::ITrigDecisionTool > m_trigDecisionTool
trigger decision tool handle
Definition
TrigEventSelectionAlg.h:33
CP::TrigEventSelectionAlg::m_noFilter
Gaudi::Property< bool > m_noFilter
whether to not apply an event filter
Definition
TrigEventSelectionAlg.h:42
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:45
CP::TrigEventSelectionAlg::m_selectionDecoration
Gaudi::Property< std::string > m_selectionDecoration
the decoration for trigger selection
Definition
TrigEventSelectionAlg.h:39
CP::TrigEventSelectionAlg::m_filterParams
FilterReporterParams m_filterParams
the filter reporter params
Definition
TrigEventSelectionAlg.h:51
CP::TrigEventSelectionAlg::m_selectionAccessors
std::vector< SG::Decorator< bool > > m_selectionAccessors
the accessors for m_selectionDecoration and m_trigList combination
Definition
TrigEventSelectionAlg.h:48
CP::TrigEventSelectionAlg::finalize
virtual StatusCode finalize() final
Definition
TrigEventSelectionAlg.cxx:70
CP::TrigEventSelectionAlg::m_trigList
Gaudi::Property< std::vector< std::string > > m_trigList
list of triggers or trigger chains
Definition
TrigEventSelectionAlg.h:36
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
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
EventInfo.h
Generated on
for ATLAS Offline Software by
1.17.0