ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
RecoTools
IsolationTool
src
IsolationTool_AthTest.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// IsolationTool includes
6
#include "
IsolationTool_AthTest.h
"
7
// #include "xAODTracking/TrackingPrimitives.h"
8
// #include "xAODTracking/TrackParticleContainer.h"
9
10
static
const
int
NDIFF
=
xAOD::Iso::ptvarcone20
-
xAOD::Iso::ptcone20
;
11
12
IsolationTool_AthTest::IsolationTool_AthTest
(
const
std::string& name, ISvcLocator* pSvcLocator ) :
AthAlgorithm
( name, pSvcLocator ),
13
m_trackIsolationTool
(),
14
m_caloIsolationTool
(),
15
m_decorators
(
xAOD
::Iso::numIsolationTypes, nullptr)
16
{
17
18
//declareProperty( "Property", m_nProperty ); //example property declaration
19
declareProperty
(
"TrackIsolationTool"
,
m_trackIsolationTool
);
20
declareProperty
(
"CaloIsolationTool"
,
m_caloIsolationTool
);
21
declareProperty
(
"TargetContainer"
,
m_containerName
=
"InDetTrackParticles"
);
22
declareProperty
(
"ptcones"
,
m_ptcones
);
23
declareProperty
(
"topoetcones"
,
m_topoetcones
);
24
declareProperty
(
"Prefix"
,
m_prefix
=
""
);
25
}
26
27
28
IsolationTool_AthTest::~IsolationTool_AthTest
() =
default
;
29
30
31
StatusCode
IsolationTool_AthTest::initialize
() {
32
ATH_MSG_INFO
(
"Initializing "
<< name() <<
"..."
);
33
34
// load the matching tool
35
if
( !
m_caloIsolationTool
.empty() ) {
36
CHECK
(
m_caloIsolationTool
.retrieve() );
37
ATH_MSG_INFO
(
"Successfully retrieved the CaloIsolationTool!"
);
38
}
39
40
if
( !
m_trackIsolationTool
.empty() ) {
41
CHECK
(
m_trackIsolationTool
.retrieve() );
42
ATH_MSG_INFO
(
"Successfully retrived the CaloIsolationTool!"
);
43
}
44
45
m_trkCorrList
.trackbitset.set(
static_cast<
unsigned
int
>
(
xAOD::Iso::coreTrackPtr
));
46
m_caloCorrList
.calobitset.set(
static_cast<
unsigned
int
>
(
xAOD::Iso::coreCone
));
47
m_caloCorrList
.calobitset.set(
static_cast<
unsigned
int
>
(
xAOD::Iso::pileupCorrection
));
48
50
m_ptconeTypes
.clear();
51
for
(
auto
c:
m_ptcones
){
52
xAOD::Iso::IsolationType
t =
static_cast<
xAOD::Iso::IsolationType
>
(c);
53
m_decorators
[c] =
new
SG::AuxElement::Decorator< float >(
m_prefix
+
xAOD::Iso::toCString
(t));
54
m_decorators
[c+
NDIFF
] =
new
SG::AuxElement::Decorator< float >(
m_prefix
+
xAOD::Iso::toCString
(
static_cast<
xAOD::Iso::IsolationType
>
(c+
NDIFF
)));
55
m_ptconeTypes
.push_back(t);
56
}
57
m_topoetconeTypes
.clear();
58
for
(
auto
c:
m_topoetcones
) {
59
xAOD::Iso::IsolationType
t =
static_cast<
xAOD::Iso::IsolationType
>
(c);
60
m_decorators
[c] =
new
SG::AuxElement::Decorator< float >(
m_prefix
+
xAOD::Iso::toCString
(t));
61
m_topoetconeTypes
.push_back(t);
62
}
63
64
return
StatusCode::SUCCESS;
65
}
66
67
StatusCode
IsolationTool_AthTest::finalize
() {
68
ATH_MSG_INFO
(
"Finalizing "
<< name() <<
"..."
);
69
70
for
(
auto
*d:
m_decorators
) {
if
(d)
delete
d;}
71
72
return
StatusCode::SUCCESS;
73
}
74
75
StatusCode
IsolationTool_AthTest::execute
(
const
EventContext&
/*ctx*/
) {
76
ATH_MSG_DEBUG
(
"Executing "
<< name() <<
"..."
);
77
78
// retrieve tag (muon) container
79
const
xAOD::IParticleContainer
* toDecorate =
nullptr
;
80
if
(
evtStore
()->retrieve(toDecorate,
m_containerName
).isFailure()) {
81
ATH_MSG_FATAL
(
"Unable to retrieve "
<<
m_containerName
);
82
return
StatusCode::FAILURE;
83
}
84
86
for
(
const
auto
*particle : *toDecorate) {
87
89
xAOD::TrackIsolation
resultTrack;
90
if
(
m_trackIsolationTool
->trackIsolation(resultTrack, *particle,
m_ptconeTypes
,
m_trkCorrList
)){
91
for
(
unsigned
int
i=0; i<
m_ptcones
.size(); i++){
92
(*(
m_decorators
[
m_ptcones
[i]]))(*particle) = resultTrack.
ptcones
[i];
93
(*(
m_decorators
[
m_ptcones
[i]+
NDIFF
]))(*particle) = resultTrack.
ptvarcones_10GeVDivPt
[i];
94
ATH_MSG_DEBUG
(
"ptcone"
<< i <<
" "
<< resultTrack.
ptcones
[i] <<
" & "
<< resultTrack.
ptvarcones_10GeVDivPt
[i]);
95
}
96
}
else
{
97
ATH_MSG_WARNING
(
"Failed to apply the track isolation for a particle"
);
98
}
99
101
xAOD::CaloIsolation
resultCalo;
102
if
(
m_caloIsolationTool
->caloTopoClusterIsolation(resultCalo, *particle,
m_topoetconeTypes
,
m_caloCorrList
)){
103
for
(
unsigned
int
i=0; i<
m_topoetcones
.size(); i++){
104
(*(
m_decorators
[
m_topoetcones
[i]]))(*particle) = resultCalo.
etcones
[i];
105
ATH_MSG_DEBUG
(
"topoetcone"
<< i <<
" "
<< resultCalo.
etcones
[i]);
106
}
107
}
else
{
108
ATH_MSG_WARNING
(
"Failed to apply the calo isolation for a particle"
);
109
}
110
}
111
112
return
StatusCode::SUCCESS;
113
}
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
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
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
NDIFF
static const int NDIFF
Definition
IsolationTool_AthTest.cxx:10
IsolationTool_AthTest.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
IsolationTool_AthTest::m_ptcones
std::vector< int > m_ptcones
Definition
IsolationTool_AthTest.h:30
IsolationTool_AthTest::m_topoetcones
std::vector< int > m_topoetcones
Definition
IsolationTool_AthTest.h:33
IsolationTool_AthTest::m_decorators
std::vector< SG::AuxElement::Decorator< float > * > m_decorators
Definition
IsolationTool_AthTest.h:36
IsolationTool_AthTest::m_ptconeTypes
std::vector< xAOD::Iso::IsolationType > m_ptconeTypes
Definition
IsolationTool_AthTest.h:29
IsolationTool_AthTest::m_caloCorrList
xAOD::CaloCorrection m_caloCorrList
Definition
IsolationTool_AthTest.h:34
IsolationTool_AthTest::~IsolationTool_AthTest
virtual ~IsolationTool_AthTest()
IsolationTool_AthTest::m_caloIsolationTool
ToolHandle< xAOD::ICaloTopoClusterIsolationTool > m_caloIsolationTool
Definition
IsolationTool_AthTest.h:28
IsolationTool_AthTest::m_containerName
std::string m_containerName
Definition
IsolationTool_AthTest.h:24
IsolationTool_AthTest::initialize
virtual StatusCode initialize()
Definition
IsolationTool_AthTest.cxx:31
IsolationTool_AthTest::IsolationTool_AthTest
IsolationTool_AthTest(const std::string &name, ISvcLocator *pSvcLocator)
Definition
IsolationTool_AthTest.cxx:12
IsolationTool_AthTest::execute
virtual StatusCode execute(const EventContext &ctx)
Execute method.
Definition
IsolationTool_AthTest.cxx:75
IsolationTool_AthTest::finalize
virtual StatusCode finalize()
Definition
IsolationTool_AthTest.cxx:67
IsolationTool_AthTest::m_prefix
std::string m_prefix
Definition
IsolationTool_AthTest.h:25
IsolationTool_AthTest::m_trkCorrList
xAOD::TrackCorrection m_trkCorrList
Definition
IsolationTool_AthTest.h:31
IsolationTool_AthTest::m_topoetconeTypes
std::vector< xAOD::Iso::IsolationType > m_topoetconeTypes
Definition
IsolationTool_AthTest.h:32
IsolationTool_AthTest::m_trackIsolationTool
ToolHandle< xAOD::ITrackIsolationTool > m_trackIsolationTool
Definition
IsolationTool_AthTest.h:27
xAOD::Iso::IsolationType
IsolationType
Overall enumeration for isolation types in xAOD files.
Definition
IsolationType.h:26
xAOD::Iso::ptcone20
@ ptcone20
Track isolation.
Definition
IsolationType.h:40
xAOD::Iso::ptvarcone20
@ ptvarcone20
Mini-Isolation http://arxiv.org/abs/1007.2221.
Definition
IsolationType.h:55
xAOD::Iso::coreTrackPtr
@ coreTrackPtr
tracks pointer
Definition
Event/xAOD/xAODPrimitives/xAODPrimitives/IsolationCorrection.h:66
xAOD::Iso::toCString
static const char * toCString(IsolationConeSize conesize)
Definition
IsolationConeSize.h:30
xAOD::Iso::pileupCorrection
@ pileupCorrection
fully corrected
Definition
Event/xAOD/xAODPrimitives/xAODPrimitives/IsolationCorrection.h:35
xAOD::Iso::coreCone
@ coreCone
core energy (in dR<0.1).
Definition
Event/xAOD/xAODPrimitives/xAODPrimitives/IsolationCorrection.h:29
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition
ICaloAffectedTool.h:24
xAOD::IParticleContainer
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
Definition
xAOD/xAODBase/xAODBase/IParticleContainer.h:32
xAOD::CaloIsolation
Definition
IsolationCommon.h:22
xAOD::CaloIsolation::etcones
std::vector< float > etcones
Definition
IsolationCommon.h:30
xAOD::TrackIsolation
Definition
IsolationCommon.h:33
xAOD::TrackIsolation::ptcones
std::vector< float > ptcones
Definition
IsolationCommon.h:36
xAOD::TrackIsolation::ptvarcones_10GeVDivPt
std::vector< float > ptvarcones_10GeVDivPt
Definition
IsolationCommon.h:37
Generated on
for ATLAS Offline Software by
1.17.0