ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAnalysis
TriggerMatchingTool
Root
R3IParticleRetrievalTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TriggerMatchingTool/R3IParticleRetrievalTool.h
"
6
#include "
xAODBase/IParticleContainer.h
"
7
#include "
TrigCompositeUtils/Combinations.h
"
8
9
namespace
Trig
10
{
11
R3IParticleRetrievalTool::R3IParticleRetrievalTool
(
const
std::string &name)
12
:
asg
::
AsgTool
(name)
13
{
14
declareProperty
(
"TrigDecisionTool"
,
m_tdt
);
15
}
16
17
R3IParticleRetrievalTool::~R3IParticleRetrievalTool
() {}
18
19
StatusCode
R3IParticleRetrievalTool::initialize
()
20
{
21
ATH_MSG_INFO
(
"Initializing "
<< name());
22
ATH_CHECK
(
m_tdt
.retrieve());
23
return
StatusCode::SUCCESS;
24
}
25
26
StatusCode
R3IParticleRetrievalTool::retrieveParticles
(
27
std::vector<std::vector<const xAOD::IParticle *>> &combinations,
28
const
std::string &chain,
29
bool
rerun)
const
30
{
31
using
IPartLinkInfo_t =
TrigCompositeUtils::LinkInfo<xAOD::IParticleContainer>
;
32
using
VecLinkInfo_t = std::vector<IPartLinkInfo_t>;
33
// Make sure we start from a blank slate
34
combinations.clear();
35
36
// Start by getting the chain group
37
const
ChainGroup
*cg =
m_tdt
->getChainGroup(chain);
38
// Make sure that this group actually contains triggers. If it doesn't then
39
// this is very wrong and the job shouldn't be allowed to continue
40
if
(cg->
getListOfTriggers
().size() == 0)
41
{
42
ATH_MSG_ERROR
(
"Chain group "
<< chain
43
<<
" is empty! This means that no matching chains were found!"
);
44
return
StatusCode::FAILURE;
45
}
46
47
// Now go chain by chain
48
for
(
const
std::string &name : cg->
getListOfTriggers
())
49
{
50
if
(!
m_tdt
->isPassed(name, rerun ?
TrigDefs::Physics
|
TrigDefs::allowResurrectedDecision
:
TrigDefs::Physics
))
51
{
52
ATH_MSG_DEBUG
(
"Chain "
<< name <<
" did not pass"
);
53
continue
;
54
}
55
ATH_MSG_DEBUG
(
"Chain "
<< name <<
" passed"
);
56
const
auto
&features =
m_tdt
->features<
xAOD::IParticleContainer
>(name);
57
ATH_MSG_DEBUG
(
"Found "
<< features.size() <<
" features"
);
58
// Check for dead legs
59
if
(std::any_of(
60
features.begin(), features.end(),
61
[] (
const
TrigCompositeUtils::LinkInfo<xAOD::IParticleContainer>
& li) {return !li.link.isValid();}))
62
{
63
// Only warn once per chain per job
64
std::scoped_lock
lock
(
m_warnedChainsMutex
);
65
if
(m_warnedChains.insert(name).second)
66
ATH_MSG_WARNING
(
"Invalid link found for "
<< name <<
"!"
);
67
continue
;
68
}
69
// Build up the full list of trigger combinations
70
// TODO - right now we use a filter that passes everything that isn't pointer-equal.
71
// This will probably need to be fixed to something else later - at least the unique RoI filter
72
TrigCompositeUtils::Combinations
trigCombinations =
TrigCompositeUtils::buildCombinations
(
73
name,
74
features,
75
m_tdt
->ExperimentalAndExpertMethods().getChainConfigurationDetails(name),
76
TrigCompositeUtils::FilterType::UniqueObjects
);
77
// Copy the combinations into the output vector
78
for
(
const
VecLinkInfo_t &combo : trigCombinations)
79
{
80
std::vector<const xAOD::IParticle *> comboOut;
81
comboOut.reserve(combo.size());
82
for
(
const
IPartLinkInfo_t &info : combo)
83
comboOut.push_back(*info.link);
84
combinations.push_back(std::move(comboOut));
85
}
86
}
87
return
StatusCode::SUCCESS;
88
}
89
}
// namespace Trig
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
Combinations.h
lock
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
R3IParticleRetrievalTool.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
TrigCompositeUtils::Combinations
Definition
Combinations.h:18
Trig::ChainGroup
Definition
ChainGroup.h:51
Trig::ChainGroup::getListOfTriggers
std::vector< std::string > getListOfTriggers() const
Definition
ChainGroup.cxx:467
Trig::R3IParticleRetrievalTool::initialize
virtual StatusCode initialize() override
Initialise the tool.
Definition
R3IParticleRetrievalTool.cxx:19
Trig::R3IParticleRetrievalTool::m_tdt
ToolHandle< Trig::TrigDecisionTool > m_tdt
The TrigDecisionTool that will be used to get the navigation.
Definition
R3IParticleRetrievalTool.h:52
Trig::R3IParticleRetrievalTool::~R3IParticleRetrievalTool
virtual ~R3IParticleRetrievalTool() override
Destructor.
Definition
R3IParticleRetrievalTool.cxx:17
Trig::R3IParticleRetrievalTool::R3IParticleRetrievalTool
R3IParticleRetrievalTool(const std::string &name)
Standard constructor.
Definition
R3IParticleRetrievalTool.cxx:11
Trig::R3IParticleRetrievalTool::m_warnedChainsMutex
std::mutex m_warnedChainsMutex
mutex to protect that set
Definition
R3IParticleRetrievalTool.h:56
Trig::R3IParticleRetrievalTool::retrieveParticles
virtual StatusCode retrieveParticles(std::vector< std::vector< const xAOD::IParticle * > > &combinations, const std::string &chain, bool rerun=false) const override
Retrieve the particles that caused this trigger to fire.
Definition
R3IParticleRetrievalTool.cxx:26
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition
AsgTool.cxx:58
TrigCompositeUtils::buildCombinations
Combinations buildCombinations(const std::string &chainName, const std::vector< LinkInfo< xAOD::IParticleContainer > > &features, const std::vector< std::size_t > &legMultiplicities, const IPartCombItr::FilterFunc_t &filter)
Produce the combinations for a set of features.
Definition
TrigCompositeUtilsRoot.cxx:824
TrigCompositeUtils::FilterType::UniqueObjects
@ UniqueObjects
Do not allow any repeated objects.
Definition
IPartCombItr.h:27
TrigDefs::allowResurrectedDecision
static const unsigned int allowResurrectedDecision
Definition
TrigEvent/TrigDecisionInterface/TrigDecisionInterface/Conditions.h:29
TrigDefs::Physics
static const unsigned int Physics
Definition
TrigEvent/TrigDecisionInterface/TrigDecisionInterface/Conditions.h:43
Trig
The common trigger namespace for trigger analysis tools.
Definition
LArCellMonAlg.h:33
asg
Definition
DataHandleTestTool.h:28
xAOD::IParticleContainer
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
Definition
xAOD/xAODBase/xAODBase/IParticleContainer.h:32
TrigCompositeUtils::LinkInfo
Helper to keep a Decision object, ElementLink and ActiveState (with respect to some requested ChainGr...
Definition
LinkInfo.h:22
IParticleContainer.h
Generated on
for ATLAS Offline Software by
1.17.0