ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
AnalysisCommon
AssociationUtils
Root
TauLooseEleOverlapTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 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/TauLooseEleOverlapTool.h
"
13
14
namespace
ORUtils
15
{
16
17
//---------------------------------------------------------------------------
18
// Constructor
19
//---------------------------------------------------------------------------
20
TauLooseEleOverlapTool::TauLooseEleOverlapTool
(
const
std::string& name)
21
:
BaseOverlapTool
(name)
22
{
23
declareProperty
(
"DR"
,
m_maxDR
= 0.2,
24
"Delta-R cone for flagging overlaps"
);
25
declareProperty
(
"UseRapidity"
,
m_useRapidity
=
true
,
26
"Calculate delta-R using rapidity"
);
27
declareProperty
(
"ElectronID"
,
m_eleID
=
"DFCommonElectronsLHLoose"
,
28
"Loose electron ID selection string"
);
29
declareProperty
(
"AltElectronID"
,
m_altEleID
=
""
,
30
"Optional alternate ID in case primary one unavailable"
);
31
}
32
33
//---------------------------------------------------------------------------
34
// Initialize
35
//---------------------------------------------------------------------------
36
StatusCode
TauLooseEleOverlapTool::initializeDerived
()
37
{
38
// Initialize the dR matcher
39
m_dRMatcher
= std::make_unique<DeltaRMatcher>(
m_maxDR
,
m_useRapidity
);
40
ATH_CHECK
(
m_dRMatcher
->setObjectTypes (
xAODType::ObjectType::Tau
,
xAODType::ObjectType::Electron
));
41
addSubtool(*
m_dRMatcher
);
42
43
resetAccessor(
m_accessors
->m_eleIDAcc, *
m_accessors
,
m_eleID
, {.isOptional = !m_eleID.empty()});
44
if
(!
m_altEleID
.empty())
45
resetAccessor(
m_accessors
->m_altEleIDAcc, *
m_accessors
,
m_altEleID
, {.isOptional = true});
46
47
return
StatusCode::SUCCESS;
48
}
49
50
//---------------------------------------------------------------------------
51
// Identify overlaps
52
//---------------------------------------------------------------------------
53
StatusCode
TauLooseEleOverlapTool::
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::TauJetContainer>
(cont1,
"First container arg is not of type TauJetContainer!"
) );
60
ATH_CHECK
(
checkForXAODContainer<xAOD::ElectronContainer>
(cont2,
"Second container arg is not of type ElectronContainer!"
) );
61
62
ATH_CHECK
(
internalFindOverlaps
(cont1, cont2) );
63
return
StatusCode::SUCCESS;
64
}
65
66
//---------------------------------------------------------------------------
67
// Identify overlaps
68
//---------------------------------------------------------------------------
69
StatusCode
TauLooseEleOverlapTool::
70
internalFindOverlaps
(
columnar::Particle1Range
taus
,
71
columnar::Particle2Range
electrons)
const
72
{
73
ATH_MSG_DEBUG
(
"Removing taus from loose electrons"
);
74
75
// Initialize output decorations if necessary
76
initializeDecorations
(
taus
);
77
initializeDecorations
(electrons);
78
79
// Loop over loose surviving electrons
80
for
(
auto
electron : electrons){
81
if
(
isRejectedObject
(electron))
continue
;
82
83
// Check the electron ID
84
bool
passID =
false
;
85
ATH_CHECK
(
checkElectronID
(electron, passID) );
86
if
(!passID)
continue
;
87
88
// Loop over surviving taus
89
for
(
auto
tau :
taus
){
90
if
(!
isSurvivingObject
(tau))
continue
;
91
92
// Test for overlap
93
if
(
m_dRMatcher
->objectsMatch(electron, tau)){
94
ATH_CHECK
(
handleOverlap
(tau, electron) );
95
}
96
}
97
}
98
99
return
StatusCode::SUCCESS;
100
}
101
102
//---------------------------------------------------------------------------
103
// Loose electron criteria
104
//---------------------------------------------------------------------------
105
StatusCode
TauLooseEleOverlapTool::
106
checkElectronID
(
columnar::Particle2Id
electron,
bool
& pass)
const
107
{
108
auto
& acc = *
m_accessors
;
109
// Try the configured ID string.
110
if
(acc.m_eleIDAcc.isAvailable(electron)) {
111
pass = acc.m_eleIDAcc(electron);
112
}
else
{
113
// If the ID wasn't found, try the fallback ID if provided.
114
if
(!
m_altEleID
.empty()) {
115
if
(acc.m_altEleIDAcc.isAvailable(electron)) {
116
pass = acc.m_altEleIDAcc(electron);
117
}
else
{
118
ATH_MSG_ERROR
(
"Electron IDs unavailable: "
<<
119
m_eleID
<<
", "
<<
m_altEleID
);
120
return
StatusCode::FAILURE;
121
}
122
}
else
{
123
ATH_MSG_ERROR
(
"Electron ID unavailable: "
<<
m_eleID
);
124
return
StatusCode::FAILURE;
125
}
126
}
127
128
return
StatusCode::SUCCESS;
129
}
130
131
}
// namespace ORUtils
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_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
ConstDataVector.h
DataVector adapter that acts like it holds const pointers.
taus
static Double_t taus
Definition
LArPhysWaveHECTool.cxx:37
TauLooseEleOverlapTool.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::isRejectedObject
bool isRejectedObject(columnar::Particle1Id obj) const
Definition
BaseOverlapTool.h:154
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::TauLooseEleOverlapTool::TauLooseEleOverlapTool
TauLooseEleOverlapTool(const std::string &name)
Create proper constructor for Athena.
Definition
TauLooseEleOverlapTool.cxx:20
ORUtils::TauLooseEleOverlapTool::m_useRapidity
bool m_useRapidity
Calculate delta-R using rapidity.
Definition
TauLooseEleOverlapTool.h:78
ORUtils::TauLooseEleOverlapTool::m_accessors
std::unique_ptr< Accessors > m_accessors
Definition
TauLooseEleOverlapTool.h:98
ORUtils::TauLooseEleOverlapTool::initializeDerived
virtual StatusCode initializeDerived() override
Initialize the tool.
Definition
TauLooseEleOverlapTool.cxx:36
ORUtils::TauLooseEleOverlapTool::checkElectronID
StatusCode checkElectronID(columnar::Particle2Id electron, bool &pass) const
Definition
TauLooseEleOverlapTool.cxx:106
ORUtils::TauLooseEleOverlapTool::m_maxDR
float m_maxDR
Maximum dR for objects flagged as overlap.
Definition
TauLooseEleOverlapTool.h:76
ORUtils::TauLooseEleOverlapTool::findOverlaps
virtual StatusCode findOverlaps(columnar::Particle1Range cont1, columnar::Particle2Range cont2, columnar::EventContextId eventContext) const override
Identify overlapping taus and loose electrons.
Definition
TauLooseEleOverlapTool.cxx:54
ORUtils::TauLooseEleOverlapTool::m_eleID
std::string m_eleID
Loose electron selection criteria string (e.g. Loose).
Definition
TauLooseEleOverlapTool.h:81
ORUtils::TauLooseEleOverlapTool::m_altEleID
std::string m_altEleID
Alternate fallback loose ID string; mainly convenient for testing.
Definition
TauLooseEleOverlapTool.h:85
ORUtils::TauLooseEleOverlapTool::m_dRMatcher
std::unique_ptr< DeltaRMatcher > m_dRMatcher
Delta-R matcher.
Definition
TauLooseEleOverlapTool.h:101
ORUtils::TauLooseEleOverlapTool::internalFindOverlaps
virtual StatusCode internalFindOverlaps(columnar::Particle1Range taus, columnar::Particle2Range electrons) const
Identify overlapping taus and loose electrons.
Definition
TauLooseEleOverlapTool.cxx:70
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
columnar::Particle2Id
ObjectId< Particle2Def > Particle2Id
Definition
ParticleDef.h:51
xAODType::Electron
@ Electron
The object is an electron.
Definition
ObjectType.h:46
xAODType::Tau
@ Tau
The object is a tau (jet).
Definition
ObjectType.h:49
Generated on
for ATLAS Offline Software by
1.17.0