ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
DerivationFramework
DerivationFrameworkMuons
src
PflowIsolationDecorAlg.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 "
PflowIsolationDecorAlg.h
"
5
6
#include "
StoreGate/ReadHandle.h
"
7
#include "
xAODMuonViews/ContainerDecorator.h
"
8
9
10
#include <format>
11
//**********************************************************************
12
namespace
DerivationFramework
{
13
//**********************************************************************
14
15
StatusCode
PflowIsolationDecorAlg::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
) {
24
m_trkSel_keys
.emplace_back(
m_trk_key
, decor);
25
}
26
ATH_CHECK
(
m_trkSel_keys
.initialize());
27
m_neflowCone20_key
= std::format(
"neflowisol20{:}{:}"
,
m_customName
.empty() ?
""
:
"_"
,
m_customName
.value());
28
m_neflowCone30_key
= std::format(
"neflowisol30{:}{:}"
,
m_customName
.empty() ?
""
:
"_"
,
m_customName
.value());
29
m_neflowCone40_key
= std::format(
"neflowisol40{:}{:}"
,
m_customName
.empty() ?
""
:
"_"
,
m_customName
.value());
30
ATH_CHECK
(
m_neflowCone20_key
.initialize());
31
ATH_CHECK
(
m_neflowCone30_key
.initialize());
32
ATH_CHECK
(
m_neflowCone40_key
.initialize());
33
34
ATH_MSG_DEBUG
(
"Decorate "
<<
m_trk_key
.fullKey() <<
" using '"
<<
m_customName
<<
"' as suffix."
);
35
return
StatusCode::SUCCESS;
36
}
37
38
//**********************************************************************
39
40
StatusCode
PflowIsolationDecorAlg::execute
(
const
EventContext& ctx)
const
{
41
42
const
xAOD::TrackParticleContainer
* tracks{};
43
ATH_CHECK
(
SG::get
(tracks,
m_trk_key
, ctx));
44
45
46
using
FloatDecor =
xAOD::ContainerDecorator<xAOD::TrackParticleContainer, float>
;
47
using
SelDecorator =
SG::ReadDecorHandle<xAOD::TrackParticleContainer, std::uint8_t>
;
48
49
std::vector<SelDecorator> selDecors;
50
for
(
const
SG::ReadDecorHandleKey<xAOD::TrackParticleContainer>
& key :
m_trkSel_keys
){
51
selDecors.emplace_back(key, ctx);
52
}
53
FloatDecor neflowCone40_dec{
m_neflowCone40_key
, ctx, -Gaudi::Units::GeV};
54
FloatDecor neflowCone30_dec{
m_neflowCone30_key
, ctx, -Gaudi::Units::GeV};
55
FloatDecor neflowCone20_dec{
m_neflowCone20_key
, ctx, -Gaudi::Units::GeV};
56
57
58
for
(
const
xAOD::TrackParticle
* trk : *tracks) {
59
if
(trk->pt() <
m_pt_min
)
continue
;
60
if
(!selDecors.empty() && std::find_if(selDecors.begin(), selDecors.end(), [trk](
const
SelDecorator& dec){
61
return dec(*trk);
62
}) == selDecors.end())
continue
;
63
ATH_MSG_DEBUG
(
"Recomputing isolation by hand"
);
64
xAOD::CaloIsolation
resultCalo;
65
if
(!
m_isoTool
->neutralEflowIsolation(resultCalo, *trk,
m_pflow_isos
,
m_calo_corr
)) {
66
ATH_MSG_ERROR
(
"Failed to compute calorimeter isolation"
);
67
return
StatusCode::FAILURE;
68
}
69
neflowCone40_dec(*trk) = resultCalo.
etcones
[0];
70
neflowCone30_dec(*trk) = resultCalo.
etcones
[1];
71
neflowCone20_dec(*trk) = resultCalo.
etcones
[2];
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
ContainerDecorator.h
PflowIsolationDecorAlg.h
ReadHandle.h
Handle class for reading from StoreGate.
DerivationFramework::PflowIsolationDecorAlg::m_neflowCone30_key
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_neflowCone30_key
Definition
PflowIsolationDecorAlg.h:52
DerivationFramework::PflowIsolationDecorAlg::m_pt_min
Gaudi::Property< float > m_pt_min
pt threshold to apply
Definition
PflowIsolationDecorAlg.h:39
DerivationFramework::PflowIsolationDecorAlg::m_calo_corr
xAOD::CaloCorrection m_calo_corr
Definition
PflowIsolationDecorAlg.h:33
DerivationFramework::PflowIsolationDecorAlg::m_pflow_isos
std::vector< xAOD::Iso::IsolationType > m_pflow_isos
Definition
PflowIsolationDecorAlg.h:57
DerivationFramework::PflowIsolationDecorAlg::m_isoTool
ToolHandle< xAOD::INeutralEFlowIsolationTool > m_isoTool
Athena configured tools.
Definition
PflowIsolationDecorAlg.h:32
DerivationFramework::PflowIsolationDecorAlg::m_neflowCone40_key
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_neflowCone40_key
Definition
PflowIsolationDecorAlg.h:54
DerivationFramework::PflowIsolationDecorAlg::m_trk_key
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trk_key
track collection to decorate
Definition
PflowIsolationDecorAlg.h:36
DerivationFramework::PflowIsolationDecorAlg::m_trkSel_keys
SG::ReadDecorHandleKeyArray< xAOD::TrackParticleContainer > m_trkSel_keys
Definition
PflowIsolationDecorAlg.h:47
DerivationFramework::PflowIsolationDecorAlg::m_neflowCone20_key
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_neflowCone20_key
Definition
PflowIsolationDecorAlg.h:50
DerivationFramework::PflowIsolationDecorAlg::m_customName
Gaudi::Property< std::string > m_customName
Definition
PflowIsolationDecorAlg.h:41
DerivationFramework::PflowIsolationDecorAlg::initialize
StatusCode initialize() override
Athena algorithm's Hooks.
Definition
PflowIsolationDecorAlg.cxx:15
DerivationFramework::PflowIsolationDecorAlg::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
PflowIsolationDecorAlg.h:45
DerivationFramework::PflowIsolationDecorAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition
PflowIsolationDecorAlg.cxx:40
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::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
Generated on
for ATLAS Offline Software by
1.17.0