ATLAS Offline Software
Loading...
Searching...
No Matches
FEAssociationTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ASSOCIATIONUTILS_FEASSOCIATIONTOOL_H
6#define ASSOCIATIONUTILS_FEASSOCIATIONTOOL_H
7
8#include "AsgTools/AsgTool.h"
10
13#ifndef XAOD_STANDALONE
15#endif
16
21
27
28#include <string>
29#include <unordered_map>
30#include <unordered_set>
31#include <vector>
32
33class EventContext;
34
35namespace ORUtils
36{
37
39 virtual public IFEAssociationTool
40{
42
43public:
44 FEAssociationTool(const std::string& name);
45 virtual ~FEAssociationTool() override = default;
46
47 virtual StatusCode initialize() override;
48
49#ifndef XAOD_STANDALONE
50 virtual StatusCode buildAssociations(const EventContext& ctx) const override;
51#else
52 virtual StatusCode buildAssociations() override;
53#endif
54
55private:
56 struct ObjView
57 {
66
67 ObjView(Type t, const xAOD::IParticleContainer* c, std::size_t i)
68 : type(t), cont(c), idx(i) {}
69
72 std::size_t idx = 0;
73
74 std::unordered_set<const xAOD::FlowElement*> cSet;
75 std::unordered_set<const xAOD::FlowElement*> nSet;
76
77 float EcTot = 0.f;
78 float EnTot = 0.f;
79 };
80
81 struct PairKey
82 {
83 const xAOD::IParticleContainer* c1 = nullptr;
84 std::size_t i1 = 0;
85 const xAOD::IParticleContainer* c2 = nullptr;
86 std::size_t i2 = 0;
87
88 static PairKey make(const xAOD::IParticleContainer* a, std::size_t ia,
89 const xAOD::IParticleContainer* b, std::size_t ib);
90
91 bool operator==(const PairKey& o) const noexcept;
92 };
93
95 {
96 std::size_t operator()(const PairKey& k) const noexcept;
97 };
98
99 struct SharedAcc
100 {
101 float Ec = 0.f;
102 float En = 0.f;
103
104 float AcTot = 0.f;
105 float AnTot = 0.f;
106 float BcTot = 0.f;
107 float BnTot = 0.f;
108
109 int typeA = 0;
110 int typeB = 0;
111 };
112
113#ifndef XAOD_STANDALONE
114 virtual StatusCode collectObjects(const EventContext& ctx,
115 std::vector<ObjView>& objects) const;
116#else
117 virtual StatusCode collectObjects(std::vector<ObjView>& objects) const;
118#endif
119
120#ifndef XAOD_STANDALONE
121 void collectFEsFromIndex(const EventContext& ctx,
122 const ObjView::Type type,
123 const xAOD::IParticleContainer* cont,
124 std::size_t idx,
125 ObjView& view) const;
126#else
128 const xAOD::IParticleContainer* cont,
129 std::size_t idx,
130 ObjView& view) const;
131#endif
132
133#ifndef XAOD_STANDALONE
134 virtual StatusCode buildMapFromPairs(const EventContext& ctx,
135 const std::vector<ObjView>& objects) const;
136#else
137 virtual StatusCode buildMapFromPairs(const std::vector<ObjView>& objects);
138#endif
139
141 this, "ElectronContainer", "Electrons", "Input electron container"
142 };
144 this, "MuonContainer", "Muons", "Input muon container"
145 };
147 this, "PhotonContainer", "Photons", "Input photon container"
148 };
150 this, "TauContainer", "TauJets", "Input tau container"
151 };
153 this, "SmallRJetContainer", "AntiKt4EMPFlowJets", "Input small-R jet container"
154 };
156 this, "LargeRJetContainer", "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets", "Input large-R jet container"
157 };
158
159#ifndef XAOD_STANDALONE
161 this, "ElectronChargedFELinksDecorKey",
162 "Electrons.chargedGlobalFELinks",
163 "Electron charged global FE links decoration"
164 };
166 this, "ElectronNeutralFELinksDecorKey",
167 "Electrons.neutralGlobalFELinks",
168 "Electron neutral global FE links decoration"
169 };
170
172 this, "MuonChargedFELinksDecorKey",
173 "Muons.chargedGlobalFELinks",
174 "Muon charged global FE links decoration"
175 };
177 this, "MuonNeutralFELinksDecorKey",
178 "Muons.neutralGlobalFELinks",
179 "Muon neutral global FE links decoration"
180 };
181
183 this, "PhotonChargedFELinksDecorKey",
184 "Photons.chargedGlobalFELinks",
185 "Photon charged global FE links decoration"
186 };
188 this, "PhotonNeutralFELinksDecorKey",
189 "Photons.neutralGlobalFELinks",
190 "Photon neutral global FE links decoration"
191 };
192
194 this, "TauChargedFELinksDecorKey",
195 "TauJets.chargedGlobalFELinks",
196 "Tau charged global FE links decoration"
197 };
199 this, "TauNeutralFELinksDecorKey",
200 "TauJets.neutralGlobalFELinks",
201 "Tau neutral global FE links decoration"
202 };
203
205 this, "SmallRJetChargedFELinksDecorKey",
206 "AntiKt4EMPFlowJets.chargedGlobalFELinks",
207 "Small-R jet charged global FE links decoration"
208 };
210 this, "SmallRJetNeutralFELinksDecorKey",
211 "AntiKt4EMPFlowJets.neutralGlobalFELinks",
212 "Small-R jet neutral global FE links decoration"
213 };
214
216 this, "LargeRJetChargedFELinksDecorKey",
217 "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets.chargedGlobalFELinks",
218 "Large-R jet charged global FE links decoration"
219 };
221 this, "LargeRJetNeutralFELinksDecorKey",
222 "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets.neutralGlobalFELinks",
223 "Large-R jet neutral global FE links decoration"
224 };
225
227 this, "OriginalObjectLinkDecorKey",
228 "JetETMissChargedParticleFlowObjects.originalObjectLink",
229 "FlowElement originalObjectLink decoration"
230 };
231#endif
232
234 this, "OutputMap", "FEAssociationMap", "Output MissingETAssociationMap"
235 };
236};
237
238} // namespace ORUtils
239
240#endif
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
static Double_t a
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
FEAssociationTool(const std::string &name)
SG::ReadDecorHandleKey< xAOD::FlowElementContainer > m_originalObjectLinkKey
void collectFEsFromIndex(const EventContext &ctx, const ObjView::Type type, const xAOD::IParticleContainer *cont, std::size_t idx, ObjView &view) const
SG::ReadDecorHandleKey< xAOD::JetContainer > m_srjChargedFELinksKey
SG::WriteHandleKey< xAOD::MissingETAssociationMap > m_outputMapKey
SG::ReadDecorHandleKey< xAOD::PhotonContainer > m_phNeutralFELinksKey
virtual StatusCode collectObjects(const EventContext &ctx, std::vector< ObjView > &objects) const
SG::ReadHandleKey< xAOD::JetContainer > m_srjKey
SG::ReadDecorHandleKey< xAOD::PhotonContainer > m_phChargedFELinksKey
virtual ~FEAssociationTool() override=default
SG::ReadHandleKey< xAOD::MuonContainer > m_muKey
SG::ReadDecorHandleKey< xAOD::ElectronContainer > m_elNeutralFELinksKey
SG::ReadDecorHandleKey< xAOD::ElectronContainer > m_elChargedFELinksKey
SG::ReadHandleKey< xAOD::ElectronContainer > m_elKey
SG::ReadHandleKey< xAOD::TauJetContainer > m_tauKey
virtual StatusCode buildMapFromPairs(const EventContext &ctx, const std::vector< ObjView > &objects) const
SG::ReadDecorHandleKey< xAOD::TauJetContainer > m_tauNeutralFELinksKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_srjNeutralFELinksKey
SG::ReadDecorHandleKey< xAOD::TauJetContainer > m_tauChargedFELinksKey
virtual StatusCode buildAssociations(const EventContext &ctx) const override
SG::ReadHandleKey< xAOD::PhotonContainer > m_phKey
SG::ReadDecorHandleKey< xAOD::MuonContainer > m_muNeutralFELinksKey
SG::ReadHandleKey< xAOD::JetContainer > m_lrjKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_lrjChargedFELinksKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_lrjNeutralFELinksKey
SG::ReadDecorHandleKey< xAOD::MuonContainer > m_muChargedFELinksKey
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
std::unordered_set< const xAOD::FlowElement * > cSet
const xAOD::IParticleContainer * cont
std::unordered_set< const xAOD::FlowElement * > nSet
ObjView(Type t, const xAOD::IParticleContainer *c, std::size_t i)
std::size_t operator()(const PairKey &k) const noexcept
const xAOD::IParticleContainer * c2
static PairKey make(const xAOD::IParticleContainer *a, std::size_t ia, const xAOD::IParticleContainer *b, std::size_t ib)
const xAOD::IParticleContainer * c1
bool operator==(const PairKey &o) const noexcept