ATLAS Offline Software
Loading...
Searching...
No Matches
PflowIsolationDecorAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
5
8
9
10#include <format>
11//**********************************************************************
12namespace DerivationFramework {
13//**********************************************************************
14
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
40StatusCode PflowIsolationDecorAlg::execute(const EventContext& ctx) const {
41
42 const xAOD::TrackParticleContainer* tracks{};
43 ATH_CHECK(SG::get(tracks,m_trk_key, ctx));
44
45
48
49 std::vector<SelDecorator> selDecors;
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//**********************************************************************
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
Handle class for reading from StoreGate.
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_neflowCone30_key
Gaudi::Property< float > m_pt_min
pt threshold to apply
std::vector< xAOD::Iso::IsolationType > m_pflow_isos
ToolHandle< xAOD::INeutralEFlowIsolationTool > m_isoTool
Athena configured tools.
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_neflowCone40_key
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trk_key
track collection to decorate
SG::ReadDecorHandleKeyArray< xAOD::TrackParticleContainer > m_trkSel_keys
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_neflowCone20_key
StatusCode initialize() override
Athena algorithm's Hooks.
Gaudi::Property< std::vector< std::string > > m_trkSel_Decors
Optional list of decorators to select only the good tracks for the isolation decoration.
StatusCode execute(const EventContext &ctx) const override
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Handle class for reading a decoration on an object.
Auxiliary class to instantiate WriteDecorHandles.The handles can be created in an empty state.
THE reconstruction tool.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
std::vector< float > etcones