ATLAS Offline Software
Loading...
Searching...
No Matches
Utility functions to access the different RoI objects with a single interface

Typedefs

using HLTSeedingRoIToolDefs::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*>
 std::variant of const ptr to RoI types. Note identical types are only entered once in the template (e.g. no cTau which is same type as eFexTau)
using HLTSeedingRoIToolDefs::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>
 std::variant of RoI containers. Has to correspond directly to AnyRoIPointer types.

Functions

template<std::size_t I = 0>
std::optional< AnyRoIPointerHLTSeedingRoIToolDefs::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 HLTSeedingRoIToolDefs::roiPhi (const AnyRoIPointer &roi)
constexpr float HLTSeedingRoIToolDefs::roiEta (const AnyRoIPointer &roi)
constexpr unsigned int HLTSeedingRoIToolDefs::roiWord (const AnyRoIPointer &roi)
constexpr unsigned int HLTSeedingRoIToolDefs::roiTobEt (const AnyRoIPointer &roi)

Detailed Description

Typedef Documentation

◆ AnyRoIContainer

◆ AnyRoIPointer

std::variant of const ptr to RoI types. Note identical types are only entered once in the template (e.g. no cTau which is same type as eFexTau)

Definition at line 144 of file HLTSeedingRoIToolDefs.h.

Function Documentation

◆ roiEta()

float HLTSeedingRoIToolDefs::roiEta ( const AnyRoIPointer & roi)
constexpr

Definition at line 171 of file HLTSeedingRoIToolDefs.h.

171 {
172 return std::visit([](auto arg) -> float {return arg->eta();}, roi);
173 }

◆ roiFromLink()

template<std::size_t I = 0>
std::optional< AnyRoIPointer > HLTSeedingRoIToolDefs::roiFromLink ( const xAOD::TrigComposite & tc,
const std::string & linkName )
inline

Recursively try each type from AnyRoIPointer variant to retrieve an object from a TrigComposite link.

See https://stackoverflow.com/a/57643845

Definition at line 154 of file HLTSeedingRoIToolDefs.h.

154 {
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 }
static Double_t tc
#define I(x, y, z)
Definition MD5.cxx:116
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::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.

◆ roiPhi()

float HLTSeedingRoIToolDefs::roiPhi ( const AnyRoIPointer & roi)
constexpr

Definition at line 167 of file HLTSeedingRoIToolDefs.h.

167 {
168 return std::visit([](auto arg) -> float {return arg->phi();}, roi);
169 }

◆ roiTobEt()

unsigned int HLTSeedingRoIToolDefs::roiTobEt ( const AnyRoIPointer & roi)
constexpr

Definition at line 206 of file HLTSeedingRoIToolDefs.h.

206 {
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 }

◆ roiWord()

unsigned int HLTSeedingRoIToolDefs::roiWord ( const AnyRoIPointer & roi)
constexpr

Definition at line 175 of file HLTSeedingRoIToolDefs.h.

175 {
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 }