ATLAS Offline Software
Loading...
Searching...
No Matches
HLTSeedingRoIToolDefs.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef HLTSEEDING_HLTSEEDINGROITOOLDEFS_H
6#define HLTSEEDING_HLTSEEDINGROITOOLDEFS_H
7
18#include <variant>
19#include <optional>
20
21template<typename T_RoI, typename T_RoIContainer, const char* N_RoIContainer, const char* N_ThresholdType>
23template<typename T_RoI, typename T_RoIContainer, auto F_RoIWordGetter, const char* N_RoIContainer, const char* N_ThresholdType>
25
26
33namespace HLTSeedingRoIToolDefs {
37 namespace eFexEM {
38 extern const char ContainerName[];
39 extern const char ThresholdType[];
46 }
47 namespace eFexTau {
48 extern const char ContainerName[];
49 extern const char ThresholdType[];
56 }
57 namespace jFexFwdEl {
58 extern const char ContainerName[];
59 extern const char ThresholdType[];
66 }
67 namespace jFexTau {
68 extern const char ContainerName[];
69 extern const char ThresholdType[];
76 }
77 namespace cTau {
78 extern const char ContainerName[];
79 extern const char ThresholdType[];
86 }
87 namespace jFexSRJet {
88 extern const char ContainerName[];
89 extern const char ThresholdType[];
96 }
97 namespace jFexLRJet {
98 extern const char ContainerName[];
99 extern const char ThresholdType[];
106 }
107 namespace gFexSRJet {
108 extern const char ContainerName[];
109 extern const char ThresholdType[];
116 }
117 namespace gFexLRJet {
118 extern const char ContainerName[];
119 extern const char ThresholdType[];
126 }
127 namespace Muon {
128 extern const char ContainerName[];
129 extern const char ThresholdType[];
133 constexpr auto F_TobEtGetter = &xAOD::MuonRoI::thrValue; // There is no uint pt / et getter for muons
136 } // end of Types
138
142
144 using AnyRoIPointer = std::variant<const eFexEM::T_RoI*, const eFexTau::T_RoI*, const jFexFwdEl::T_RoI*, const jFexTau::T_RoI*, const jFexSRJet::T_RoI*, const jFexLRJet::T_RoI*, const gFexSRJet::T_RoI*, const Muon::T_RoI*>;
146 using AnyRoIContainer = std::variant<eFexEM::T_RoIContainer, eFexTau::T_RoIContainer, jFexFwdEl::T_RoIContainer, jFexTau::T_RoIContainer, jFexSRJet::T_RoIContainer, jFexLRJet::T_RoIContainer, gFexSRJet::T_RoIContainer, Muon::T_RoIContainer>;
147
153 template <std::size_t I = 0>
154 inline std::optional<AnyRoIPointer> roiFromLink(const xAOD::TrigComposite& tc, const std::string& linkName) {
156 using T_RoIContainer = std::variant_alternative_t<I,AnyRoIContainer>;
157 using T_RoI_constptr = std::variant_alternative_t<I,AnyRoIPointer>;
158 using T_RoI = std::remove_const_t<std::remove_pointer_t<T_RoI_constptr>>;
159 if (tc.hasObjectLink(linkName,ClassID_traits<T_RoIContainer>::ID())) {
160 return AnyRoIPointer{tc.object<T_RoI>(linkName)};
161 }
162 return roiFromLink<I+1>(tc,linkName);
163 }
164 return std::nullopt;
165 }
166
167 constexpr float roiPhi(const AnyRoIPointer& roi) {
168 return std::visit([](auto arg) -> float {return arg->phi();}, roi);
169 }
170
171 constexpr float roiEta(const AnyRoIPointer& roi) {
172 return std::visit([](auto arg) -> float {return arg->eta();}, roi);
173 }
174
175 constexpr unsigned int roiWord(const AnyRoIPointer& roi) {
176 return std::visit([](auto arg) -> float {
177 using T = std::decay_t<decltype(arg)>;
178 if constexpr (std::is_same_v<T, const eFexEM::T_RoI*>) {
179 return (arg->*eFexEM::F_RoIWordGetter)();
180 }
181 if constexpr (std::is_same_v<T, const eFexTau::T_RoI*>) {
182 return (arg->*eFexTau::F_RoIWordGetter)();
183 }
184 if constexpr (std::is_same_v<T, const jFexFwdEl::T_RoI*>) {
185 return (arg->*jFexFwdEl::F_RoIWordGetter)();
186 }
187 if constexpr (std::is_same_v<T, const jFexTau::T_RoI*>) {
188 return (arg->*jFexTau::F_RoIWordGetter)();
189 }
190 if constexpr (std::is_same_v<T, const jFexSRJet::T_RoI*>) {
191 return (arg->*jFexSRJet::F_RoIWordGetter)();
192 }
193 if constexpr (std::is_same_v<T, const jFexLRJet::T_RoI*>) {
194 return (arg->*jFexLRJet::F_RoIWordGetter)();
195 }
196 if constexpr (std::is_same_v<T, const gFexSRJet::T_RoI*>) {
197 return (arg->*gFexSRJet::F_RoIWordGetter)();
198 }
199 if constexpr (std::is_same_v<T, const Muon::T_RoI*>) {
200 return (arg->*Muon::F_RoIWordGetter)();
201 }
202 return 0;
203 }, roi);
204 }
205
206 constexpr unsigned int roiTobEt(const AnyRoIPointer& roi) {
207 return std::visit([](auto arg) -> float {
208 using T = std::decay_t<decltype(arg)>;
209 if constexpr (std::is_same_v<T, const eFexEM::T_RoI*>) {
210 return (arg->*eFexEM::F_TobEtGetter)();
211 }
212 if constexpr (std::is_same_v<T, const eFexTau::T_RoI*>) {
213 return (arg->*eFexTau::F_TobEtGetter)();
214 }
215 if constexpr (std::is_same_v<T, const jFexFwdEl::T_RoI*>) {
216 return (arg->*jFexFwdEl::F_TobEtGetter)();
217 }
218 if constexpr (std::is_same_v<T, const jFexTau::T_RoI*>) {
219 return (arg->*jFexTau::F_TobEtGetter)();
220 }
221 if constexpr (std::is_same_v<T, const jFexSRJet::T_RoI*>) {
222 return (arg->*jFexSRJet::F_TobEtGetter)();
223 }
224 if constexpr (std::is_same_v<T, const jFexLRJet::T_RoI*>) {
225 return (arg->*jFexLRJet::F_TobEtGetter)();
226 }
227 if constexpr (std::is_same_v<T, const gFexSRJet::T_RoI*>) {
228 return (arg->*gFexSRJet::F_TobEtGetter)();
229 }
230 if constexpr (std::is_same_v<T, const Muon::T_RoI*>) {
231 return (arg->*Muon::F_TobEtGetter)();
232 }
233 return 0;
234 }, roi);
235 }
236 // end of Utils
238}
239
240#endif //> !HLTSEEDING_HLTSEEDINGROITOOLDEFS_H
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
static Double_t tc
#define I(x, y, z)
Definition MD5.cxx:116
Class template for all phase-1 L1 RoI unpacking tools.
float thrValue() const
The highest threshold value (in MeV) passed by the muon candidate.
uint32_t roiWord() const
The "raw" RoI word describing the muon candidate.
uint32_t word0() const
The "raw" 32-bit words describing the e/gamma candidate.
unsigned int etTOB() const
Cluster ET (TOB ET scale, 100 MeV/count)
uint32_t word0() const
The "raw" 32-bit words describing the e/gamma candidate.
unsigned int etTOB() const
Cluster ET (TOB ET scale, 100 MeV/count)
int16_t gFexTobEt() const
TOB ET (decoded from TOB, stored for convenience)
uint32_t word() const
The "raw" 32-bit word describing the object candidate.
uint32_t tobWord() const
The "raw" 32-bit word describing the object candidate, 27 bit-word used at hardware level.
uint16_t tobEt() const
Decoded from Tob (for convenience)
uint16_t tobEt() const
uint32_t tobWord() const
The "raw" 32-bit word describing the object candidate.
uint16_t tobEt() const
uint32_t tobWord() const
The "raw" 32-bit word describing the object candidate.
uint32_t tobWord() const
The "raw" 32-bit word describing the object candidate.
uint16_t tobEt() const
constexpr unsigned int roiTobEt(const AnyRoIPointer &roi)
constexpr unsigned int roiWord(const AnyRoIPointer &roi)
std::variant< const eFexEM::T_RoI *, const eFexTau::T_RoI *, const jFexFwdEl::T_RoI *, const jFexTau::T_RoI *, const jFexSRJet::T_RoI *, const jFexLRJet::T_RoI *, const gFexSRJet::T_RoI *, const Muon::T_RoI * > AnyRoIPointer
std::variant of const ptr to RoI types. Note identical types are only entered once in the template (e...
std::variant< eFexEM::T_RoIContainer, eFexTau::T_RoIContainer, jFexFwdEl::T_RoIContainer, jFexTau::T_RoIContainer, jFexSRJet::T_RoIContainer, jFexLRJet::T_RoIContainer, gFexSRJet::T_RoIContainer, Muon::T_RoIContainer > AnyRoIContainer
std::variant of RoI containers. Has to correspond directly to AnyRoIPointer types.
constexpr float roiPhi(const AnyRoIPointer &roi)
std::optional< AnyRoIPointer > roiFromLink(const xAOD::TrigComposite &tc, const std::string &linkName)
Recursively try each type from AnyRoIPointer variant to retrieve an object from a TrigComposite link.
constexpr float roiEta(const AnyRoIPointer &roi)
xAOD::MuonRoIContainer T_RoIContainer
RoIsUnpackingToolPhase1< T_RoI, T_RoIContainer, F_RoIWordGetter, ContainerName, ThresholdType > UnpackingBaseClass
RoIThresholdsTool< T_RoI, T_RoIContainer, ContainerName, ThresholdType > ThresholdBaseClass
RoIsUnpackingToolPhase1< T_RoI, T_RoIContainer, F_RoIWordGetter, ContainerName, ThresholdType > UnpackingBaseClass
xAOD::eFexTauRoIContainer T_RoIContainer
RoIThresholdsTool< T_RoI, T_RoIContainer, ContainerName, ThresholdType > ThresholdBaseClass
xAOD::eFexEMRoIContainer T_RoIContainer
RoIThresholdsTool< T_RoI, T_RoIContainer, ContainerName, ThresholdType > ThresholdBaseClass
RoIsUnpackingToolPhase1< T_RoI, T_RoIContainer, F_RoIWordGetter, ContainerName, ThresholdType > UnpackingBaseClass
RoIsUnpackingToolPhase1< T_RoI, T_RoIContainer, F_RoIWordGetter, ContainerName, ThresholdType > UnpackingBaseClass
RoIThresholdsTool< T_RoI, T_RoIContainer, ContainerName, ThresholdType > ThresholdBaseClass
xAOD::eFexTauRoIContainer T_RoIContainer
RoIsUnpackingToolPhase1< T_RoI, T_RoIContainer, F_RoIWordGetter, ContainerName, ThresholdType > UnpackingBaseClass
xAOD::gFexJetRoIContainer T_RoIContainer
RoIThresholdsTool< T_RoI, T_RoIContainer, ContainerName, ThresholdType > ThresholdBaseClass
RoIsUnpackingToolPhase1< T_RoI, T_RoIContainer, F_RoIWordGetter, ContainerName, ThresholdType > UnpackingBaseClass
RoIThresholdsTool< T_RoI, T_RoIContainer, ContainerName, ThresholdType > ThresholdBaseClass
xAOD::gFexJetRoIContainer T_RoIContainer
RoIsUnpackingToolPhase1< T_RoI, T_RoIContainer, F_RoIWordGetter, ContainerName, ThresholdType > UnpackingBaseClass
RoIThresholdsTool< T_RoI, T_RoIContainer, ContainerName, ThresholdType > ThresholdBaseClass
xAOD::jFexFwdElRoIContainer T_RoIContainer
RoIsUnpackingToolPhase1< T_RoI, T_RoIContainer, F_RoIWordGetter, ContainerName, ThresholdType > UnpackingBaseClass
xAOD::jFexLRJetRoIContainer T_RoIContainer
RoIThresholdsTool< T_RoI, T_RoIContainer, ContainerName, ThresholdType > ThresholdBaseClass
xAOD::jFexSRJetRoIContainer T_RoIContainer
RoIThresholdsTool< T_RoI, T_RoIContainer, ContainerName, ThresholdType > ThresholdBaseClass
RoIsUnpackingToolPhase1< T_RoI, T_RoIContainer, F_RoIWordGetter, ContainerName, ThresholdType > UnpackingBaseClass
xAOD::jFexTauRoIContainer T_RoIContainer
RoIsUnpackingToolPhase1< T_RoI, T_RoIContainer, F_RoIWordGetter, ContainerName, ThresholdType > UnpackingBaseClass
RoIThresholdsTool< T_RoI, T_RoIContainer, ContainerName, ThresholdType > ThresholdBaseClass
Collection of template parameter values for the RoIThresholdsTool and RoIsUnpackingToolPhase1 class t...
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
eFexEMRoIContainer_v1 eFexEMRoIContainer
jFexFwdElRoI_v1 jFexFwdElRoI
Define the latest version of the jFexFwdElJetRoI class.
eFexEMRoI_v1 eFexEMRoI
Define the latest version of the eFexEMRoI class.
Definition eFexEMRoI.h:17
gFexJetRoI_v1 gFexJetRoI
Define the latest version of the gFexJetRoI class.
Definition gFexJetRoI.h:16
MuonRoIContainer_v1 MuonRoIContainer
TrigComposite_v1 TrigComposite
Declare the latest version of the class.
jFexLRJetRoIContainer_v1 jFexLRJetRoIContainer
jFexFwdElRoIContainer_v1 jFexFwdElRoIContainer
jFexTauRoIContainer_v1 jFexTauRoIContainer
gFexJetRoIContainer_v1 gFexJetRoIContainer
jFexLRJetRoI_v1 jFexLRJetRoI
Define the latest version of the jFexLRJetRoI class.
eFexTauRoIContainer_v1 eFexTauRoIContainer
jFexTauRoI_v1 jFexTauRoI
Define the latest version of the jFexSRJetRoI class.
Definition jFexTauRoI.h:13
eFexTauRoI_v1 eFexTauRoI
Define the latest version of the eFexTauRoI class.
Definition eFexTauRoI.h:16
MuonRoI_v1 MuonRoI
Definition MuonRoI.h:15
jFexSRJetRoI_v1 jFexSRJetRoI
Define the latest version of the jFexSRJetRoI class.
jFexSRJetRoIContainer_v1 jFexSRJetRoIContainer