ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
TriggerAnalysisAlgorithms
Root
TrigMatchingAlg.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 <
TrigCompositeUtils/ChainNameParser.h
>
8
#include <
TriggerAnalysisAlgorithms/TrigMatchingAlg.h
>
9
#include <algorithm>
10
11
12
namespace
CP
13
{
14
15
TrigMatchingAlg::TrigMatchingAlg
(
const
std::string&
name
,
16
ISvcLocator *svcLoc)
17
:
EL
::
AnaAlgorithm
(
name
, svcLoc)
18
{
19
declareProperty
(
"matchingTool"
,
m_trigMatchingTool
,
"trigger matching tool"
);
20
}
21
22
StatusCode
TrigMatchingAlg::initialize
()
23
{
24
if
(
m_matchingDecoration
.empty())
25
{
26
ATH_MSG_ERROR
(
"The decoration name needs to be defined"
);
27
return
StatusCode::FAILURE;
28
}
29
30
if
(
m_trigSingleMatchingList
.empty() &&
m_trigSingleMatchingListDummy
.empty())
31
{
32
ATH_MSG_ERROR
(
"At least one trigger needs to be provided in the list"
);
33
return
StatusCode::FAILURE;
34
}
35
36
// retrieve the trigger matching tool
37
ANA_CHECK
(
m_trigMatchingTool
.retrieve());
38
const
std::string prefix =
m_matchingDecoration
+
"_"
;
39
for
(
const
std::string &chain :
m_trigSingleMatchingList
)
40
{
41
std::string chainfix = chain;
42
std::replace(chainfix.begin(), chainfix.end(),
'-'
,
'_'
);
43
m_matchingDecorators
.emplace(chain, prefix + chainfix);
44
}
45
for
(
const
std::string &chain :
m_trigSingleMatchingListDummy
)
46
{
47
std::string chainfix = chain;
48
std::replace(chainfix.begin(), chainfix.end(),
'-'
,
'_'
);
49
m_matchingDecorators
.emplace(chain, prefix + chainfix);
50
}
51
52
ANA_CHECK
(
m_particlesHandle
.initialize (
m_systematicsList
));
53
ANA_CHECK
(
m_systematicsList
.initialize());
54
55
return
StatusCode::SUCCESS;
56
}
57
58
59
60
StatusCode
TrigMatchingAlg::execute
(
const
EventContext& ctx)
61
{
62
63
for
(
const
auto
& syst :
m_systematicsList
.systematicsVector())
64
{
65
const
xAOD::IParticleContainer
* particles(
nullptr
);
66
67
ANA_CHECK
(
m_particlesHandle
.retrieve(particles, syst, ctx));
68
69
ATH_MSG_DEBUG
(
"Retrieving "
<<
m_particlesHandle
.getName(syst));
70
71
for
(
const
xAOD::IParticle
*particle : *particles)
72
{
73
ATH_MSG_DEBUG
(
"-- Considering offline eta:"
<< particle->eta() <<
" phi:"
<< particle->phi() <<
" (pT:"
<< particle->pt() <<
")"
);
74
for
(
const
std::string &chain :
m_trigSingleMatchingList
)
75
{
76
// A string-based signature-identifier per leg, may contain duplicated return values for asymmetric chains.
77
const
std::vector<std::string> signatures =
ChainNameParser::signatures
(chain);
78
if
(signatures.size() != 1) {
79
ANA_MSG_ERROR
(
"The decoration-based TrigMatchingAlg only supports single-legged triggers."
<< chain <<
" has "
<< signatures.size() <<
" legs."
);
80
return
StatusCode::FAILURE;
81
}
82
83
const
float
dR = (signatures.at(0) ==
"tau"
? 0.2 : 0.1);
84
const
bool
match
=
m_trigMatchingTool
->match(*particle, chain, dR,
false
);
85
(
m_matchingDecorators
.at(chain))(*particle) =
match
;
86
ATH_MSG_DEBUG
(
"-- -- Considering for "
<< chain <<
", match = "
<<
match
);
87
}
88
89
for
(
const
std::string &chain :
m_trigSingleMatchingListDummy
)
90
{
91
ATH_MSG_DEBUG
(
"Applying dummy match=0 decoration for "
<< chain);
92
(
m_matchingDecorators
.at(chain))(*particle) = 0;
93
}
94
}
95
}
96
return
StatusCode::SUCCESS;
97
}
98
}
// namespace CP
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
ChainNameParser.h
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
TrigMatchingAlg.h
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
CP::TrigMatchingAlg::m_particlesHandle
SysReadHandle< xAOD::IParticleContainer > m_particlesHandle
input particle collection
Definition
TrigMatchingAlg.h:64
CP::TrigMatchingAlg::m_trigSingleMatchingListDummy
Gaudi::Property< std::vector< std::string > > m_trigSingleMatchingListDummy
list of triggers for dummy matching decorations
Definition
TrigMatchingAlg.h:61
CP::TrigMatchingAlg::initialize
virtual StatusCode initialize() final override
Definition
TrigMatchingAlg.cxx:22
CP::TrigMatchingAlg::TrigMatchingAlg
TrigMatchingAlg(const std::string &name, ISvcLocator *pSvcLocator)
the standard constructor
Definition
TrigMatchingAlg.cxx:15
CP::TrigMatchingAlg::m_trigMatchingTool
ToolHandle< Trig::IMatchingTool > m_trigMatchingTool
trigger decision tool handle
Definition
TrigMatchingAlg.h:46
CP::TrigMatchingAlg::m_matchingDecoration
Gaudi::Property< std::string > m_matchingDecoration
the decoration for trigger matching
Definition
TrigMatchingAlg.h:52
CP::TrigMatchingAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition
TrigMatchingAlg.h:49
CP::TrigMatchingAlg::m_matchingDecorators
std::unordered_map< std::string, SG::Decorator< char > > m_matchingDecorators
the decorators for m_matchingDecoration and triggers combination
Definition
TrigMatchingAlg.h:55
CP::TrigMatchingAlg::m_trigSingleMatchingList
Gaudi::Property< std::vector< std::string > > m_trigSingleMatchingList
list of triggers
Definition
TrigMatchingAlg.h:58
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:321
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition
Event/xAOD/xAODBase/xAODBase/IParticle.h:41
match
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition
hcg.cxx:359
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
ChainNameParser::signatures
std::vector< std::string > signatures(const std::string &chain)
Definition
ChainNameParser.cxx:237
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition
AsgComponentFactories.h:16
xAOD::name
name
Definition
TriggerMenuJson_v1.cxx:29
xAOD::IParticleContainer
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
Definition
xAOD/xAODBase/xAODBase/IParticleContainer.h:32
Generated on
for ATLAS Offline Software by
1.17.0