ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
DerivationFramework
DerivationFrameworkMuons
src
CaloIsolationDecorAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
CaloIsolationDecorAlg.h
"
5
6
#include "
StoreGate/ReadHandle.h
"
7
#include "
StoreGate/WriteDecorHandle.h
"
8
9
#include "
xAODMuonViews/ContainerDecorator.h
"
10
#include <format>
11
//**********************************************************************
12
namespace
DerivationFramework
{
13
//**********************************************************************
14
15
StatusCode
CaloIsolationDecorAlg::initialize
() {
16
ATH_CHECK
(
m_isoTool
.retrieve());
17
18
m_calo_corr
.calobitset.set(
static_cast<
unsigned
int
>
(
xAOD::Iso::coreCone
));
19
m_calo_corr
.calobitset.set(
static_cast<
unsigned
int
>
(
xAOD::Iso::pileupCorrection
));
20
// isolation types to run. The ptcones each also imply the respective ptvarcone.
21
22
ATH_CHECK
(
m_trk_key
.initialize());
23
for
(
const
std::string& decor :
m_trkSel_Decors
)
m_trkSel_keys
.emplace_back(
m_trk_key
, decor);
24
ATH_CHECK
(
m_trkSel_keys
.initialize());
25
m_topocone20_key
= std::format(
"topoetcone20{:}{:}"
,
m_customName
.empty() ?
""
:
"_"
,
m_customName
.value());
26
m_topocone30_key
= std::format(
"topoetcone30{:}{:}"
,
m_customName
.empty() ?
""
:
"_"
,
m_customName
.value());
27
m_topocone40_key
= std::format(
"topoetcone40{:}{:}"
,
m_customName
.empty() ?
""
:
"_"
,
m_customName
.value());
28
m_corr_key
= std::format(
"etcore_correction{:}{:}"
,
m_customName
.empty() ?
""
:
"_"
,
m_customName
.value());
29
ATH_CHECK
(
m_topocone20_key
.initialize());
30
ATH_CHECK
(
m_topocone30_key
.initialize());
31
ATH_CHECK
(
m_topocone40_key
.initialize());
32
ATH_CHECK
(
m_corr_key
.initialize());
33
ATH_MSG_DEBUG
(
"Decorate "
<<
m_trk_key
.fullKey() <<
" using '"
<<
m_customName
<<
"' as suffix."
);
34
return
StatusCode::SUCCESS;
35
}
36
37
//**********************************************************************
38
39
StatusCode
CaloIsolationDecorAlg::execute
(
const
EventContext& ctx)
const
{
40
const
xAOD::TrackParticleContainer
* tracks{
nullptr
};
41
ATH_CHECK
(
SG::get
(tracks,
m_trk_key
, ctx));
42
43
44
using
FloatDecor =
xAOD::ContainerDecorator<xAOD::TrackParticleContainer, float>
;
45
using
SelDecorator =
SG::ReadDecorHandle<xAOD::TrackParticleContainer, std::uint8_t>
;
46
47
std::vector<SelDecorator> selDecors;
48
for
(
const
SG::ReadDecorHandleKey<xAOD::TrackParticleContainer>
& key :
m_trkSel_keys
) {
49
selDecors.emplace_back(key, ctx);
50
}
51
52
FloatDecor topocone40_dec{
m_topocone40_key
, ctx, -Gaudi::Units::GeV};
53
FloatDecor topocone30_dec{
m_topocone30_key
, ctx, -Gaudi::Units::GeV};
54
FloatDecor topocone20_dec{
m_topocone20_key
, ctx, -Gaudi::Units::GeV};
55
FloatDecor corr_dec{
m_corr_key
, ctx};
56
57
for
(
const
xAOD::TrackParticle
* trk : *tracks) {
58
if
(trk->pt() <
m_pt_min
)
continue
;
59
if
(!selDecors.empty() && std::find_if(selDecors.begin(), selDecors.end(), [trk](
const
SelDecorator& dec){
60
return dec(*trk);
61
}) == selDecors.end())
continue
;
62
ATH_MSG_DEBUG
(
"Recomputing isolation by hand"
);
63
xAOD::CaloIsolation
resultCalo;
64
if
(!
m_isoTool
->caloTopoClusterIsolation(resultCalo, *trk,
m_calo_isos
,
m_calo_corr
)) {
65
ATH_MSG_ERROR
(
"Failed to compute calorimeter isolation"
);
66
return
StatusCode::FAILURE;
67
}
68
topocone40_dec(*trk) = resultCalo.
etcones
[0];
69
topocone30_dec(*trk) = resultCalo.
etcones
[1];
70
topocone20_dec(*trk) = resultCalo.
etcones
[2];
71
corr_dec(*trk) = resultCalo.
coreCorrections
[
xAOD::Iso::coreCone
][
xAOD::Iso::coreEnergy
];
72
}
73
return
StatusCode::SUCCESS;
74
}
75
}
76
//**********************************************************************
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
CaloIsolationDecorAlg.h
ContainerDecorator.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteDecorHandle.h
Handle class for adding a decoration to an object.
DerivationFramework::CaloIsolationDecorAlg::m_trkSel_Decors
Gaudi::Property< std::vector< std::string > > m_trkSel_Decors
Optional list of decorators to select only the good tracks for the isolation decoration.
Definition
CaloIsolationDecorAlg.h:44
DerivationFramework::CaloIsolationDecorAlg::m_pt_min
Gaudi::Property< float > m_pt_min
pt threshold to apply
Definition
CaloIsolationDecorAlg.h:38
DerivationFramework::CaloIsolationDecorAlg::m_trk_key
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trk_key
track collection to decorate
Definition
CaloIsolationDecorAlg.h:35
DerivationFramework::CaloIsolationDecorAlg::m_topocone20_key
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_topocone20_key
Definition
CaloIsolationDecorAlg.h:49
DerivationFramework::CaloIsolationDecorAlg::m_corr_key
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_corr_key
Definition
CaloIsolationDecorAlg.h:55
DerivationFramework::CaloIsolationDecorAlg::m_calo_corr
xAOD::CaloCorrection m_calo_corr
Definition
CaloIsolationDecorAlg.h:32
DerivationFramework::CaloIsolationDecorAlg::m_topocone30_key
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_topocone30_key
Definition
CaloIsolationDecorAlg.h:51
DerivationFramework::CaloIsolationDecorAlg::m_customName
Gaudi::Property< std::string > m_customName
Definition
CaloIsolationDecorAlg.h:40
DerivationFramework::CaloIsolationDecorAlg::m_trkSel_keys
SG::ReadDecorHandleKeyArray< xAOD::TrackParticleContainer > m_trkSel_keys
Definition
CaloIsolationDecorAlg.h:46
DerivationFramework::CaloIsolationDecorAlg::initialize
StatusCode initialize() override
Athena algorithm's Hooks.
Definition
CaloIsolationDecorAlg.cxx:15
DerivationFramework::CaloIsolationDecorAlg::m_calo_isos
std::vector< xAOD::Iso::IsolationType > m_calo_isos
Definition
CaloIsolationDecorAlg.h:58
DerivationFramework::CaloIsolationDecorAlg::m_isoTool
ToolHandle< xAOD::ICaloTopoClusterIsolationTool > m_isoTool
Athena configured tools.
Definition
CaloIsolationDecorAlg.h:31
DerivationFramework::CaloIsolationDecorAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition
CaloIsolationDecorAlg.cxx:39
DerivationFramework::CaloIsolationDecorAlg::m_topocone40_key
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_topocone40_key
Definition
CaloIsolationDecorAlg.h:53
SG::ReadDecorHandleKey
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Definition
StoreGate/StoreGate/ReadDecorHandleKey.h:86
SG::ReadDecorHandle
Handle class for reading a decoration on an object.
Definition
StoreGate/StoreGate/ReadDecorHandle.h:94
xAOD::ContainerDecorator
Auxiliary class to instantiate WriteDecorHandles.The handles can be created in an empty state.
Definition
ContainerDecorator.h:18
DerivationFramework
THE reconstruction tool.
Definition
CascadeTools.h:16
SG::get
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Definition
ReadCondHandle.h:282
xAOD::Iso::coreEnergy
@ coreEnergy
energy stored for this correction
Definition
Event/xAOD/xAODPrimitives/xAODPrimitives/IsolationCorrection.h:93
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::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition
Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
xAOD::TrackParticleContainer
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
Definition
Event/xAOD/xAODTracking/xAODTracking/TrackParticleContainer.h:14
xAOD::CaloIsolation
Definition
IsolationCommon.h:22
xAOD::CaloIsolation::etcones
std::vector< float > etcones
Definition
IsolationCommon.h:30
xAOD::CaloIsolation::coreCorrections
std::map< Iso::IsolationCaloCorrection, std::map< Iso::IsolationCorrectionParameter, float > > coreCorrections
Definition
IsolationCommon.h:26
Generated on
for ATLAS Offline Software by
1.17.0