ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
AnalysisCommon
AssociationUtils
Root
DeltaROverlapTool.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
// Primary include
6
#include "
AssociationUtils/DeltaROverlapTool.h
"
7
8
namespace
ORUtils
9
{
10
11
//---------------------------------------------------------------------------
12
// Constructor
13
//---------------------------------------------------------------------------
14
DeltaROverlapTool::DeltaROverlapTool
(
const
std::string& name)
15
:
BaseOverlapTool
(name)
16
{
17
declareProperty
(
"DR"
,
m_dR
= 0.4,
"Maximum dR for overlap match"
);
18
declareProperty
(
"UseRapidity"
,
m_useRapidity
=
true
,
19
"Calculate delta-R using rapidity"
);
20
declareProperty
(
"SwapContainerPrecedence"
,
m_swapContainerPrecedence
=
false
,
21
"Use second container for flagging overlaps"
);
22
}
23
24
//---------------------------------------------------------------------------
25
// Initialize
26
//---------------------------------------------------------------------------
27
StatusCode
DeltaROverlapTool::initializeDerived
()
28
{
29
ATH_MSG_DEBUG
(
"Setting up dR matching with cone size "
<<
m_dR
);
30
31
// Initialize the dR matcher
32
m_dRMatcher
= std::make_unique<DeltaRMatcher>(
m_dR
,
m_useRapidity
);
33
if
(
m_objectType1
.value() != 0 &&
m_objectType2
.value() != 0) {
34
ATH_CHECK
(
m_dRMatcher
->setObjectTypes (
static_cast<
xAODType::ObjectType
>
(
m_objectType1
.value()),
35
static_cast<
xAODType::ObjectType
>
(
m_objectType2
.value())));
36
}
else
if
(!
columnar::ColumnarModeDefault::isXAOD
) {
37
ATH_MSG_INFO
(
"Object types not set, please set ObjectType1 and ObjectType2 properties"
);
38
}
39
addSubtool(*
m_dRMatcher
);
40
return
StatusCode::SUCCESS;
41
}
42
43
//---------------------------------------------------------------------------
44
// Identify overlaps
45
//---------------------------------------------------------------------------
46
template
<columnar::ContainerIdConcept CI1,columnar::RegularContainerIdConcept CI2,
typename
CM>
47
StatusCode
DeltaROverlapTool::
48
internalFindOverlaps
(
columnar::ObjectRange<CI1,CM>
testCont,
columnar::ObjectRange<CI2,CM>
refCont)
const
49
{
50
// Loop over surviving input objects
51
for
(
const
auto
testPar : testCont){
52
if
(
isSurvivingObject
(testPar)){
53
for
(
const
auto
refPar : refCont){
54
if
(
isSurvivingObject
(refPar)){
55
// Check for duplicates and overlap
56
if
constexpr
(CM::isXAOD) {
57
if
(&testPar.getXAODObject() == &refPar.getXAODObject())
continue
;
58
}
59
if
(
m_dRMatcher
->objectsMatch(testPar, refPar)){
60
ATH_CHECK
(
handleOverlap
(testPar, refPar) );
61
}
62
}
63
}
64
}
65
}
66
return
StatusCode::SUCCESS;
67
}
68
69
70
StatusCode
DeltaROverlapTool::
71
findOverlaps
(
columnar::Particle1Range
cont1,
72
columnar::Particle2Range
cont2,
73
columnar::EventContextId
/*eventContext*/
)
const
74
{
75
ATH_MSG_DEBUG
(
"Removing overlaps"
);
76
77
// Initialize output decoration if necessary
78
initializeDecorations
(cont1);
79
initializeDecorations
(cont2);
80
81
if
(
m_swapContainerPrecedence
)
82
ATH_CHECK
(
internalFindOverlaps
(cont2, cont1) );
83
else
84
ATH_CHECK
(
internalFindOverlaps
(cont1, cont2) );
85
return
StatusCode::SUCCESS;
86
}
87
88
}
// namespace ORUtils
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
DeltaROverlapTool.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::DeltaROverlapTool::findOverlaps
virtual StatusCode findOverlaps(columnar::Particle1Range cont1, columnar::Particle2Range cont2, columnar::EventContextId eventContext) const override
Identify overlaps with simple dR check.
Definition
DeltaROverlapTool.cxx:71
ORUtils::DeltaROverlapTool::m_useRapidity
bool m_useRapidity
Calculate delta-R using rapidity.
Definition
DeltaROverlapTool.h:60
ORUtils::DeltaROverlapTool::m_swapContainerPrecedence
bool m_swapContainerPrecedence
In default configuration, the first container is the one that gets tested for object rejection.
Definition
DeltaROverlapTool.h:67
ORUtils::DeltaROverlapTool::m_dRMatcher
std::unique_ptr< DeltaRMatcher > m_dRMatcher
Delta-R matcher.
Definition
DeltaROverlapTool.h:80
ORUtils::DeltaROverlapTool::initializeDerived
virtual StatusCode initializeDerived() override
Initialize the tool.
Definition
DeltaROverlapTool.cxx:27
ORUtils::DeltaROverlapTool::m_objectType2
Gaudi::Property< unsigned > m_objectType2
Definition
DeltaROverlapTool.h:71
ORUtils::DeltaROverlapTool::m_dR
float m_dR
Delta-R cone for flagging objects as overlap.
Definition
DeltaROverlapTool.h:58
ORUtils::DeltaROverlapTool::internalFindOverlaps
StatusCode internalFindOverlaps(columnar::ObjectRange< CI1, CM > testCont, columnar::ObjectRange< CI2, CM > refCont) const
Definition
DeltaROverlapTool.cxx:48
ORUtils::DeltaROverlapTool::DeltaROverlapTool
DeltaROverlapTool(const std::string &name)
Create proper constructor for Athena.
Definition
DeltaROverlapTool.cxx:14
ORUtils::DeltaROverlapTool::m_objectType1
Gaudi::Property< unsigned > m_objectType1
Definition
DeltaROverlapTool.h:69
columnar::ObjectRange
a class representing a continuous sequence of objects (a.k.a. a container)
Definition
ContainerId.h:204
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
xAODType::ObjectType
ObjectType
Type of objects that have a representation in the xAOD EDM.
Definition
ObjectType.h:32
columnar::ColumnarModeXAOD::isXAOD
static constexpr bool isXAOD
Whether this is the xAOD mode.
Definition
ColumnarCore/ColumnarCore/ColumnarDef.h:23
Generated on
for ATLAS Offline Software by
1.17.0