ATLAS Offline Software
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 
21 template<typename T_RoI, typename T_RoIContainer, const char* N_RoIContainer, const char* N_ThresholdType>
22 class RoIThresholdsTool;
23 template<typename T_RoI, typename T_RoIContainer, auto F_RoIWordGetter, const char* N_RoIContainer, const char* N_ThresholdType>
25 
26 
33 namespace 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 
143  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) {
155  if constexpr (I < std::variant_size_v<AnyRoIPointer>) {
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>>;
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
HLTSeedingRoIToolDefs::roiWord
constexpr unsigned int roiWord(const AnyRoIPointer &roi)
Definition: HLTSeedingRoIToolDefs.h:175
jFexFwdElRoIContainer.h
xAOD::jFexTauRoI_v1
Class describing properties of a LVL1 jFEX global Trigger Object (TOB) in the xAOD format.
Definition: jFexTauRoI_v1.h:22
HLTSeedingRoIToolDefs::jFexFwdEl::F_TobEtGetter
constexpr auto F_TobEtGetter
Definition: HLTSeedingRoIToolDefs.h:63
xAOD::jFexSRJetRoI_v1
Class describing properties of a LVL1 jFEX global Trigger Object (TOB) in the xAOD format.
Definition: jFexSRJetRoI_v1.h:22
HLTSeedingRoIToolDefs::jFexTau::F_TobEtGetter
constexpr auto F_TobEtGetter
Definition: HLTSeedingRoIToolDefs.h:73
HLTSeedingRoIToolDefs::jFexSRJet::F_TobEtGetter
constexpr auto F_TobEtGetter
Definition: HLTSeedingRoIToolDefs.h:93
HLTSeedingRoIToolDefs::eFexTau::F_RoIWordGetter
constexpr auto F_RoIWordGetter
Definition: HLTSeedingRoIToolDefs.h:52
xAOD::jFexTauRoIContainer
jFexTauRoIContainer_v1 jFexTauRoIContainer
Definition: jFexTauRoIContainer.h:13
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 * > AnyRoIPointer
std::variant of const ptr to RoI types. Note identical types are only entered once in the template (e...
Definition: HLTSeedingRoIToolDefs.h:144
HLTSeedingRoIToolDefs::roiPhi
constexpr float roiPhi(const AnyRoIPointer &roi)
Definition: HLTSeedingRoIToolDefs.h:167
HLTSeedingRoIToolDefs::roiEta
constexpr float roiEta(const AnyRoIPointer &roi)
Definition: HLTSeedingRoIToolDefs.h:171
xAOD::jFexLRJetRoI
jFexLRJetRoI_v1 jFexLRJetRoI
Define the latest version of the jFexLRJetRoI class
Definition: jFexLRJetRoI.h:13
xAOD::jFexSRJetRoIContainer
jFexSRJetRoIContainer_v1 jFexSRJetRoIContainer
Definition: jFexSRJetRoIContainer.h:13
MuonRoIContainer.h
HLTSeedingRoIToolDefs::jFexSRJet::F_RoIWordGetter
constexpr auto F_RoIWordGetter
Definition: HLTSeedingRoIToolDefs.h:92
HLTSeedingRoIToolDefs::gFexLRJet::ContainerName
const char ContainerName[]
Definition: HLTSeedingRoIToolDefs.cxx:41
xAOD::jFexLRJetRoIContainer
jFexLRJetRoIContainer_v1 jFexLRJetRoIContainer
Definition: jFexLRJetRoIContainer.h:13
HLTSeedingRoIToolDefs::jFexLRJet::F_TobEtGetter
constexpr auto F_TobEtGetter
Definition: HLTSeedingRoIToolDefs.h:103
eFexTauRoIContainer.h
xAOD::TrigComposite_v1::hasObjectLink
bool hasObjectLink(const std::string &name, const CLID clid=CLID_NULL) const
Check if a link to an object with a given name and type exists. CLID_NULL to not check type.
Definition: TrigComposite_v1.cxx:246
xAOD::eFexTauRoI_v1::word0
uint32_t word0() const
The "raw" 32-bit words describing the e/gamma candidate.
xAOD::jFexFwdElRoIContainer
jFexFwdElRoIContainer_v1 jFexFwdElRoIContainer
Definition: jFexFwdElRoIContainer.h:13
xAOD::TrigComposite_v1::object
const OBJECT * object(const std::string &name) const
Get a bare pointer with the requested name.
xAOD::gFexJetRoIContainer
gFexJetRoIContainer_v1 gFexJetRoIContainer
Definition: gFexJetRoIContainer.h:15
HLTSeedingRoIToolDefs::eFexEM::F_RoIWordGetter
constexpr auto F_RoIWordGetter
Definition: HLTSeedingRoIToolDefs.h:42
xAOD::eFexTauRoIContainer
eFexTauRoIContainer_v1 eFexTauRoIContainer
Definition: eFexTauRoIContainer.h:15
xAOD::MuonRoI_v1::thrValue
float thrValue() const
The highest threshold value (in MeV) passed by the muon candidate.
xAOD::gFexJetRoI_v1::word
uint32_t word() const
The "raw" 32-bit word describing the object candidate.
xAOD::gFexJetRoI_v1::gFexTobEt
int16_t gFexTobEt() const
TOB ET (decoded from TOB, stored for convenience)
HLTSeedingRoIToolDefs::Muon::F_TobEtGetter
constexpr auto F_TobEtGetter
Definition: HLTSeedingRoIToolDefs.h:133
xAOD::jFexSRJetRoI_v1::tobWord
uint32_t tobWord() const
The "raw" 32-bit word describing the object candidate.
HLTSeedingRoIToolDefs::gFexSRJet::ContainerName
const char ContainerName[]
Definition: HLTSeedingRoIToolDefs.cxx:37
xAOD::eFexEMRoI_v1
Class describing a LVL1 eFEX EM region of interest.
Definition: eFexEMRoI_v1.h:33
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:45
xAOD::eFexTauRoI
eFexTauRoI_v1 eFexTauRoI
Define the latest version of the eFexTauRoI class.
Definition: eFexTauRoI.h:16
jFexTauRoIContainer.h
HLTSeedingRoIToolDefs::jFexFwdEl::F_RoIWordGetter
constexpr auto F_RoIWordGetter
Definition: HLTSeedingRoIToolDefs.h:62
xAOD::eFexEMRoI
eFexEMRoI_v1 eFexEMRoI
Define the latest version of the eFexEMRoI class.
Definition: eFexEMRoI.h:17
xAOD::eFexEMRoI_v1::word0
uint32_t word0() const
The "raw" 32-bit words describing the e/gamma candidate.
jFexLRJetRoIContainer.h
xAOD::jFexLRJetRoI_v1
Class describing properties of a LVL1 jFEX global Trigger Object (TOB) in the xAOD format.
Definition: jFexLRJetRoI_v1.h:22
xAOD::jFexLRJetRoI_v1::tobWord
uint32_t tobWord() const
The "raw" 32-bit word describing the object candidate.
HLTSeedingRoIToolDefs::jFexLRJet::F_RoIWordGetter
constexpr auto F_RoIWordGetter
Definition: HLTSeedingRoIToolDefs.h:102
gFexJetRoIContainer.h
xAOD::jFexTauRoI_v1::tobEt
uint16_t tobEt() const
ClassID_traits.h
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
HLTSeedingRoIToolDefs::jFexTau::ContainerName
const char ContainerName[]
Definition: HLTSeedingRoIToolDefs.cxx:21
HLTSeedingRoIToolDefs::Muon::ThresholdType
const char ThresholdType[]
Definition: HLTSeedingRoIToolDefs.cxx:46
jFexSRJetRoIContainer.h
xAOD::eFexTauRoI_v1
Class describing a LVL1 eFEX tau region of interest.
Definition: eFexTauRoI_v1.h:29
HLTSeedingRoIToolDefs::jFexTau::ThresholdType
const char ThresholdType[]
Definition: HLTSeedingRoIToolDefs.cxx:22
HLTSeedingRoIToolDefs::jFexSRJet::ContainerName
const char ContainerName[]
Definition: HLTSeedingRoIToolDefs.cxx:29
xAOD::jFexLRJetRoI_v1::tobEt
uint16_t tobEt() const
HLTSeedingRoIToolDefs::gFexLRJet::ThresholdType
const char ThresholdType[]
Definition: HLTSeedingRoIToolDefs.cxx:42
xAOD::gFexJetRoI_v1
Class describing properties of a LVL1 gFEX jet Trigger Object (TOB) in the xAOD format.
Definition: gFexJetRoI_v1.h:25
xAOD::jFexSRJetRoI_v1::tobEt
uint16_t tobEt() const
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
HLTSeedingRoIToolDefs::eFexEM::ThresholdType
const char ThresholdType[]
Definition: HLTSeedingRoIToolDefs.cxx:10
HLTSeedingRoIToolDefs::cTau::ThresholdType
const char ThresholdType[]
Definition: HLTSeedingRoIToolDefs.cxx:26
xAOD::MuonRoI_v1
Class describing a LVL1 muon region of interest.
Definition: MuonRoI_v1.h:29
xAOD::jFexTauRoI_v1::tobWord
uint32_t tobWord() const
The "raw" 32-bit word describing the object candidate.
HLTSeedingRoIToolDefs::gFexSRJet::ThresholdType
const char ThresholdType[]
Definition: HLTSeedingRoIToolDefs.cxx:38
xAOD::jFexSRJetRoI
jFexSRJetRoI_v1 jFexSRJetRoI
Define the latest version of the jFexSRJetRoI class
Definition: jFexSRJetRoI.h:14
HLTSeedingRoIToolDefs::Muon::ContainerName
const char ContainerName[]
Definition: HLTSeedingRoIToolDefs.cxx:45
HLTSeedingRoIToolDefs::gFexSRJet::F_TobEtGetter
constexpr auto F_TobEtGetter
Definition: HLTSeedingRoIToolDefs.h:113
xAOD::eFexEMRoI_v1::etTOB
unsigned int etTOB() const
Cluster ET (TOB ET scale, 100 MeV/count)
Definition: eFexEMRoI_v1.cxx:157
HLTSeedingRoIToolDefs::eFexTau::ThresholdType
const char ThresholdType[]
Definition: HLTSeedingRoIToolDefs.cxx:14
HLTSeedingRoIToolDefs::Muon::T_RoI
xAOD::MuonRoI T_RoI
Definition: HLTSeedingRoIToolDefs.h:130
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
HLTSeedingRoIToolDefs::roiFromLink
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.
Definition: HLTSeedingRoIToolDefs.h:154
create_dcsc_inputs_sqlite.arg
list arg
Definition: create_dcsc_inputs_sqlite.py:48
HLTSeedingRoIToolDefs::Muon::T_RoIContainer
xAOD::MuonRoIContainer T_RoIContainer
Definition: HLTSeedingRoIToolDefs.h:131
HLTSeedingRoIToolDefs::jFexFwdEl::ContainerName
const char ContainerName[]
Definition: HLTSeedingRoIToolDefs.cxx:17
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 > AnyRoIContainer
std::variant of RoI containers. Has to correspond directly to AnyRoIPointer types.
Definition: HLTSeedingRoIToolDefs.h:146
xAOD::MuonRoI
MuonRoI_v1 MuonRoI
Definition: MuonRoI.h:15
xAOD::jFexFwdElRoI_v1::tobEt
uint16_t tobEt() const
Decoded from Tob (for convenience)
xAOD::gFexJetRoI
gFexJetRoI_v1 gFexJetRoI
Define the latest version of the gFexJetRoI class.
Definition: gFexJetRoI.h:16
RoIThresholdsTool
Definition: IRoIThresholdsTool.h:22
HLTSeedingRoIToolDefs::jFexTau::F_RoIWordGetter
constexpr auto F_RoIWordGetter
Definition: HLTSeedingRoIToolDefs.h:72
xAOD::jFexFwdElRoI
jFexFwdElRoI_v1 jFexFwdElRoI
Define the latest version of the jFexFwdElJetRoI class
Definition: jFexFwdElRoI.h:13
HLTSeedingRoIToolDefs::eFexTau::F_TobEtGetter
constexpr auto F_TobEtGetter
Definition: HLTSeedingRoIToolDefs.h:53
HLTSeedingRoIToolDefs::jFexLRJet::ThresholdType
const char ThresholdType[]
Definition: HLTSeedingRoIToolDefs.cxx:34
xAOD::eFexTauRoI_v1::etTOB
unsigned int etTOB() const
Cluster ET (TOB ET scale, 100 MeV/count)
Definition: eFexTauRoI_v1.cxx:155
HLTSeedingRoIToolDefs::gFexSRJet::F_RoIWordGetter
constexpr auto F_RoIWordGetter
Definition: HLTSeedingRoIToolDefs.h:112
HLTSeedingRoIToolDefs::eFexTau::ContainerName
const char ContainerName[]
Definition: HLTSeedingRoIToolDefs.cxx:13
HLTSeedingRoIToolDefs::cTau::F_RoIWordGetter
constexpr auto F_RoIWordGetter
Definition: HLTSeedingRoIToolDefs.h:82
HLTSeedingRoIToolDefs::cTau::ContainerName
const char ContainerName[]
Definition: HLTSeedingRoIToolDefs.cxx:25
HLTSeedingRoIToolDefs::eFexEM::ContainerName
const char ContainerName[]
Definition: HLTSeedingRoIToolDefs.cxx:9
HLTSeedingRoIToolDefs::Muon::F_RoIWordGetter
constexpr auto F_RoIWordGetter
Definition: HLTSeedingRoIToolDefs.h:132
xAOD::jFexTauRoI
jFexTauRoI_v1 jFexTauRoI
Define the latest version of the jFexSRJetRoI class
Definition: jFexTauRoI.h:13
HLTSeedingRoIToolDefs::gFexLRJet::F_RoIWordGetter
constexpr auto F_RoIWordGetter
Definition: HLTSeedingRoIToolDefs.h:122
HLTSeedingRoIToolDefs::roiTobEt
constexpr unsigned int roiTobEt(const AnyRoIPointer &roi)
Definition: HLTSeedingRoIToolDefs.h:206
HLTSeedingRoIToolDefs::eFexEM::F_TobEtGetter
constexpr auto F_TobEtGetter
Definition: HLTSeedingRoIToolDefs.h:43
xAOD::jFexFwdElRoI_v1::tobWord
uint32_t tobWord() const
The "raw" 32-bit word describing the object candidate, 27 bit-word used at hardware level.
I
#define I(x, y, z)
Definition: MD5.cxx:116
RoIsUnpackingToolPhase1
Definition: HLTSeedingRoIToolDefs.h:24
HLTSeedingRoIToolDefs::jFexLRJet::ContainerName
const char ContainerName[]
Definition: HLTSeedingRoIToolDefs.cxx:33
TrigComposite.h
xAOD::jFexFwdElRoI_v1
Class describing properties of a LVL1 jFEX global Trigger Object (TOB) in the xAOD format.
Definition: jFexFwdElRoI_v1.h:22
xAOD::MuonRoIContainer
MuonRoIContainer_v1 MuonRoIContainer
Definition: MuonRoIContainer.h:16
HLTSeedingRoIToolDefs
Definition: HLTSeedingRoIToolDefs.cxx:7
HLTSeedingRoIToolDefs::cTau::F_TobEtGetter
constexpr auto F_TobEtGetter
Definition: HLTSeedingRoIToolDefs.h:83
HLTSeedingRoIToolDefs::gFexLRJet::F_TobEtGetter
constexpr auto F_TobEtGetter
Definition: HLTSeedingRoIToolDefs.h:123
xAOD::MuonRoI_v1::roiWord
uint32_t roiWord() const
The "raw" RoI word describing the muon candidate.
HLTSeedingRoIToolDefs::jFexFwdEl::ThresholdType
const char ThresholdType[]
Definition: HLTSeedingRoIToolDefs.cxx:18
HLTSeedingRoIToolDefs::jFexSRJet::ThresholdType
const char ThresholdType[]
Definition: HLTSeedingRoIToolDefs.cxx:30
xAOD::eFexEMRoIContainer
eFexEMRoIContainer_v1 eFexEMRoIContainer
Definition: eFexEMRoIContainer.h:16
eFexEMRoIContainer.h