ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
AnalysisCommon
AssociationUtils
Root
TauJetOverlapTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// System includes
6
#include <typeinfo>
7
8
// Framework includes
9
#include "
AthContainers/ConstDataVector.h
"
10
11
// Local includes
12
#include "
AssociationUtils/TauJetOverlapTool.h
"
13
#include "
AssociationUtils/DeltaRMatcher.h
"
14
15
namespace
ORUtils
16
{
17
18
//---------------------------------------------------------------------------
19
// Constructor
20
//---------------------------------------------------------------------------
21
TauJetOverlapTool::TauJetOverlapTool
(
const
std::string& name)
22
:
BaseOverlapTool
(name)
23
{
24
declareProperty
(
"BJetLabel"
,
m_bJetLabel
=
""
,
25
"Input b-jet flag. Disabled by default."
);
26
declareProperty
(
"DR"
,
m_dR
= 0.2,
"Maximum dR for overlap match"
);
27
declareProperty
(
"UseRapidity"
,
m_useRapidity
=
true
,
28
"Calculate delta-R using rapidity"
);
29
}
30
31
//---------------------------------------------------------------------------
32
// Initialize
33
//---------------------------------------------------------------------------
34
StatusCode
TauJetOverlapTool::initializeDerived
()
35
{
36
// Initialize the b-jet helper
37
if
(!
m_bJetLabel
.empty()) {
38
ATH_MSG_DEBUG
(
"Configuring btag-aware OR with btag label: "
<<
m_bJetLabel
);
39
resetAccessor (
m_accessors
->m_bJetAcc, *
m_accessors
,
m_bJetLabel
);
40
}
41
42
// Initialize the dR matcher
43
m_dRMatcher
= std::make_unique<DeltaRMatcher>(
m_dR
,
m_useRapidity
);
44
ATH_CHECK
(
m_dRMatcher
->setObjectTypes (
xAODType::ObjectType::Jet
,
xAODType::ObjectType::Tau
));
45
addSubtool(*
m_dRMatcher
);
46
47
return
StatusCode::SUCCESS;
48
}
49
50
//---------------------------------------------------------------------------
51
// Identify overlaps
52
//---------------------------------------------------------------------------
53
StatusCode
TauJetOverlapTool::
54
findOverlaps
(
columnar::Particle1Range
cont1,
55
columnar::Particle2Range
cont2,
56
columnar::EventContextId
/*eventContext*/
)
const
57
{
58
// Check the container types
59
ATH_CHECK
(
checkForXAODContainer<xAOD::JetContainer>
(cont1,
"First container arg is not of type JetContainer!"
) );
60
ATH_CHECK
(
checkForXAODContainer<xAOD::TauJetContainer>
(cont2,
"Second container arg is not of type TauJetContainer!"
) );
61
62
ATH_CHECK
(
internalFindOverlaps
(cont1, cont2) );
63
return
StatusCode::SUCCESS;
64
}
65
66
//---------------------------------------------------------------------------
67
// Identify overlaps
68
//---------------------------------------------------------------------------
69
StatusCode
TauJetOverlapTool::
70
internalFindOverlaps
(
columnar::Particle1Range
jets,
71
columnar::Particle2Range
taus
)
const
72
{
73
ATH_MSG_DEBUG
(
"Removing overlapping taus and jets"
);
74
auto
& acc = *
m_accessors
;
75
76
// Initialize output decorations if necessary
77
initializeDecorations
(
taus
);
78
initializeDecorations
(jets);
79
80
// TODO: add anti-tau support.
81
82
// Remove non-btagged jets that overlap with taus.
83
for
(
const
auto
tau :
taus
){
84
if
(!
isSurvivingObject
(tau))
continue
;
85
for
(
const
auto
jet
: jets){
86
if
(!
isSurvivingObject
(
jet
))
continue
;
87
88
// Don't reject user-defined b-tagged jets
89
if
(!
m_bJetLabel
.empty() && acc.m_bJetAcc(
jet
))
continue
;
90
91
if
(
m_dRMatcher
->objectsMatch(tau,
jet
)){
92
ATH_CHECK
(
handleOverlap
(
jet
, tau) );
93
}
94
}
95
}
96
97
// Remove taus that overlap with remaining jets
98
for
(
const
auto
jet
: jets){
99
if
(!
isSurvivingObject
(
jet
))
continue
;
100
for
(
const
auto
tau :
taus
){
101
if
(!
isSurvivingObject
(tau))
continue
;
102
103
if
(
m_dRMatcher
->objectsMatch(
jet
, tau)) {
104
ATH_CHECK
(
handleOverlap
(tau,
jet
) );
105
}
106
}
107
}
108
109
return
StatusCode::SUCCESS;
110
}
111
112
}
// namespace ORUtils
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
ConstDataVector.h
DataVector adapter that acts like it holds const pointers.
DeltaRMatcher.h
taus
static Double_t taus
Definition
LArPhysWaveHECTool.cxx:37
TauJetOverlapTool.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
ORUtils::BaseOverlapTool::initializeDecorations
void initializeDecorations(columnar::Particle1Range container) const
Definition
BaseOverlapTool.h:142
ORUtils::BaseOverlapTool::BaseOverlapTool
BaseOverlapTool(const std::string &name)
Create proper constructor for Athena.
Definition
BaseOverlapTool.cxx:14
ORUtils::BaseOverlapTool::handleOverlap
StatusCode handleOverlap(const columnar::ObjectId< CI1, CM > &testParticle, const columnar::ObjectId< CI2, CM > &refParticle) const
Common helper method to handle an overlap result.
Definition
BaseOverlapTool.h:178
ORUtils::BaseOverlapTool::isSurvivingObject
bool isSurvivingObject(columnar::Particle1Id obj) const
Definition
BaseOverlapTool.h:150
ORUtils::BaseOverlapTool::checkForXAODContainer
StatusCode checkForXAODContainer(columnar::ObjectRange< CI, CM > cont, std::string_view message) const
check whether the container is of the right type
Definition
BaseOverlapTool.h:83
ORUtils::TauJetOverlapTool::findOverlaps
virtual StatusCode findOverlaps(columnar::Particle1Range cont1, columnar::Particle2Range cont2, columnar::EventContextId eventContext) const override
Identify overlapping taus and jets.
Definition
TauJetOverlapTool.cxx:54
ORUtils::TauJetOverlapTool::m_dR
float m_dR
Flat delta-R cone for matching objects.
Definition
TauJetOverlapTool.h:78
ORUtils::TauJetOverlapTool::m_useRapidity
bool m_useRapidity
Calculate deltaR using rapidity.
Definition
TauJetOverlapTool.h:80
ORUtils::TauJetOverlapTool::initializeDerived
virtual StatusCode initializeDerived() override
Initialize the tool.
Definition
TauJetOverlapTool.cxx:34
ORUtils::TauJetOverlapTool::m_bJetLabel
std::string m_bJetLabel
Input jet decoration which labels a bjet.
Definition
TauJetOverlapTool.h:75
ORUtils::TauJetOverlapTool::internalFindOverlaps
virtual StatusCode internalFindOverlaps(columnar::Particle1Range jets, columnar::Particle2Range taus) const
Identify overlapping taus and jets.
Definition
TauJetOverlapTool.cxx:70
ORUtils::TauJetOverlapTool::m_accessors
std::unique_ptr< Accessors > m_accessors
Definition
TauJetOverlapTool.h:94
ORUtils::TauJetOverlapTool::TauJetOverlapTool
TauJetOverlapTool(const std::string &name)
Create proper constructor for Athena.
Definition
TauJetOverlapTool.cxx:21
ORUtils::TauJetOverlapTool::m_dRMatcher
std::unique_ptr< IParticleAssociator > m_dRMatcher
Delta-R matcher.
Definition
TauJetOverlapTool.h:97
ORUtils
Definition
AltMuJetOverlapTool.h:30
columnar::EventContextId
ObjectId< EventContextDef > EventContextId
Definition
ContainerId.h:212
columnar::Particle2Range
ObjectRange< Particle2Def > Particle2Range
Definition
ParticleDef.h:50
columnar::Particle1Range
ObjectRange< Particle1Def > Particle1Range
Definition
ParticleDef.h:44
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
xAODType::Jet
@ Jet
The object is a jet.
Definition
ObjectType.h:40
xAODType::Tau
@ Tau
The object is a tau (jet).
Definition
ObjectType.h:49
Generated on
for ATLAS Offline Software by
1.17.0