ATLAS Offline Software
Loading...
Searching...
No Matches
TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 > Class Template Reference

#include <Trigger.h>

Collaboration diagram for TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >:

Classes

struct  Optional

Public Member Functions

 Trigger ()
void setDefinition (const ImportData::TrigDef &def)
template<bool = true>
std::size_t operator() (void) const
std::size_t operator() (unsigned index) const
template<bool = true>
std::size_t operator< (const Trigger &rhs) const
 operator bool () const
bool operator== (const Trigger &rhs) const
template<xAOD::Type::ObjectType obj = object()>
constexpr auto cbegin () const
template<xAOD::Type::ObjectType obj = object()>
constexpr auto cend () const
template<typename Trig1L>
auto hiddenBy (const Trig1L trig) const -> typename std::enable_if< Trig1L::is1L(), bool >::type
template<typename Trig1L>
auto hiddenBy (const flat_set< Trig1L > &trigs) const -> typename std::enable_if< Trig1L::is1L(), bool >::type
template<xAOD::Type::ObjectType obj, bool anti = false>
auto side () const -> std::conditional_t< anti ^(CastType1::object()==obj), CastType1, CastType2 >
 Returns a pseudo trigger built only from the legs of flavour 'obj' If anti==true, uses instead only legs with flavours other than 'obj'.
template<typename TrigX>
auto side () const -> decltype(side< TrigX::object()>())
 Returns a pseudo trigger built only from the legs of the same flavour as the trigger 'TrigX'.
template<typename TrigX>
auto antiside () const -> decltype(side< TrigX::object(), true >())
 Complement to the previous function.
CastType1 side1 () const
 Returns a pseudo trigger of type CastType1/2.
CastType2 side2 () const
template<typename Trig1L>
auto addTo (const flat_set< Trig1L > &trigs1L) const -> std::enable_if_t< Trig1L::is1L() &&nDistinctLegs(Trig1L::object())==1, flat_set< Trig1L > >
template<bool = true>
bool symmetric () const
template<bool = true>
CastType1 to_symmetric () const
template<bool = true>
std::size_t asymLeg () const
template<bool = true>
std::size_t symLeg () const

Static Public Member Functions

static constexpr TriggerType type ()
static constexpr bool mixed ()
static constexpr unsigned nDistinctLegs ()
static constexpr unsigned nDistinctLegs (xAOD::Type::ObjectType obj)
static constexpr xAOD::Type::ObjectType object1 ()
static constexpr xAOD::Type::ObjectType object2 ()
static constexpr xAOD::Type::ObjectType object ()
static bool relevantFor (const Lepton &lepton)
static bool irrelevantFor (const Lepton &lepton)
static constexpr bool is1L ()
static constexpr bool is2Lnomix ()
static constexpr bool is2Lasym ()
static constexpr bool is2Lsym ()
static constexpr bool is3Lsym ()
static constexpr bool is3Lhalfsym ()
static constexpr bool is2Lmix ()
static constexpr bool is3Lmix ()
static constexpr bool is4Lsym ()
template<typename Trig1L>
static auto anonymize (const flat_set< Trig1L > &triggers) -> std::enable_if_t< is1L() &&tt==Trig1L::type(), const flat_set< std::size_t > & >

Public Attributes

std::array< std::size_t, nDistinctLegs()> legs

Static Private Member Functions

static constexpr bool extraCheck (xAOD::Type::ObjectType obj)

Detailed Description

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
class TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >

Definition at line 128 of file Trigger.h.

Constructor & Destructor Documentation

◆ Trigger()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::Trigger ( )
inlineexplicit

Definition at line 223 of file Trigger.h.

223{ std::fill(legs.begin(), legs.end(), 0); }
std::array< std::size_t, nDistinctLegs()> legs
Definition Trigger.h:221

Member Function Documentation

◆ addTo()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
template<typename Trig1L>
auto TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::addTo ( const flat_set< Trig1L > & trigs1L) const -> std::enable_if_t<Trig1L::is1L() && nDistinctLegs(Trig1L::object()) == 1, flat_set<Trig1L>>
inline

Definition at line 315 of file Trigger.h.

318 {
319 static_assert(mixed(),
320 "this function is not meaningful for this type of trigger, "
321 "hence should not be used.");
323 trigs.insert(side<Trig1L>());
324 return trigs;
325 }
static constexpr bool mixed()
Definition Trigger.h:141
auto side() const -> std::conditional_t< anti ^(CastType1::object()==obj), CastType1, CastType2 >
Returns a pseudo trigger built only from the legs of flavour 'obj' If anti==true, uses instead only l...
Definition Trigger.h:287

◆ anonymize()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
template<typename Trig1L>
auto TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::anonymize ( const flat_set< Trig1L > & triggers) -> std::enable_if_t<is1L() && tt == Trig1L::type(), const flat_set<std::size_t>&>
inlinestatic

Definition at line 328 of file Trigger.h.

330 {
331 static_assert(sizeof(Trig1L) == sizeof(std::size_t),
332 "invalid cast if the key sizes differ");
333 return reinterpret_cast<const flat_set<std::size_t>&>(triggers);
334 }

◆ antiside()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
template<typename TrigX>
auto TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::antiside ( ) const -> decltype(side<TrigX::object(), true>())
inline

Complement to the previous function.

Definition at line 307 of file Trigger.h.

307 {
309 }

◆ asymLeg()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
template<bool = true>
std::size_t TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::asymLeg ( ) const
inline

Definition at line 356 of file Trigger.h.

356 {
357 static_assert((tt & TT_MASK_SYMMETRY) == TT_HALFSYM,
358 "this function is not meaningful for this type of trigger, "
359 "hence should not be used.");
360 return legs[0];
361 }

◆ cbegin()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
template<xAOD::Type::ObjectType obj = object()>
auto TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::cbegin ( ) const
inlineconstexpr

Definition at line 255 of file Trigger.h.

255 {
256 return legs.cbegin() + TriggerProperties(tt).cbegin_offset(obj);
257 }

◆ cend()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
template<xAOD::Type::ObjectType obj = object()>
auto TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::cend ( ) const
inlineconstexpr

Definition at line 260 of file Trigger.h.

260 {
261 return legs.cend() + TriggerProperties(tt).cend_offset(obj);
262 }

◆ extraCheck()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
constexpr bool TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::extraCheck ( xAOD::Type::ObjectType obj)
inlinestaticconstexprprivate

Definition at line 132 of file Trigger.h.

132 {
133 return (object() == obj || obj == xAOD::Type::Other);
134 }

◆ hiddenBy() [1/2]

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
template<typename Trig1L>
auto TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::hiddenBy ( const flat_set< Trig1L > & trigs) const -> typename std::enable_if<Trig1L::is1L(), bool>::type
inline

Definition at line 275 of file Trigger.h.

276 {
277 static_assert(Trig1L::is1L(),
278 "this function is not meaningful for this type of trigger, "
279 "hence should not be used.");
280 return std::any_of(trigs.cbegin(), trigs.cend(),
281 [&](Trig1L t) -> bool { return hiddenBy(t); });
282 }
constexpr auto cbegin() const
Definition Trigger.h:255
constexpr auto cend() const
Definition Trigger.h:260

◆ hiddenBy() [2/2]

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
template<typename Trig1L>
auto TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::hiddenBy ( const Trig1L trig) const -> typename std::enable_if<Trig1L::is1L(), bool>::type
inline

Definition at line 265 of file Trigger.h.

266 {
267 static_assert(Trig1L::is1L(),
268 "this function is not meaningful for this type of trigger, "
269 "hence should not be used.");
270 constexpr auto obj = Trig1L::object();
271 return std::find(cbegin<obj>(), cend<obj>(), trig()) != cend<obj>();
272 }

◆ irrelevantFor()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
bool TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::irrelevantFor ( const Lepton & lepton)
inlinestatic

Definition at line 193 of file Trigger.h.

193 {
194 return !relevantFor(lepton);
195 }
static bool relevantFor(const Lepton &lepton)
Definition Trigger.h:190

◆ is1L()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
constexpr bool TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::is1L ( )
inlinestaticconstexpr

Definition at line 197 of file Trigger.h.

197{ return (tt & TT_SINGLELEPTON_FLAG); }

◆ is2Lasym()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
constexpr bool TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::is2Lasym ( )
inlinestaticconstexpr

Definition at line 201 of file Trigger.h.

201 {
202 return ((tt & TT_MASK_TYPE) == TT_DILEPTON_ASYM);
203 }

◆ is2Lmix()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
constexpr bool TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::is2Lmix ( )
inlinestaticconstexpr

Definition at line 213 of file Trigger.h.

213{ return (tt & TT_DILEPTON_FLAG) && mixed(); }

◆ is2Lnomix()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
constexpr bool TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::is2Lnomix ( )
inlinestaticconstexpr

Definition at line 198 of file Trigger.h.

198 {
199 return (tt & TT_DILEPTON_FLAG) && !mixed();
200 }

◆ is2Lsym()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
constexpr bool TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::is2Lsym ( )
inlinestaticconstexpr

Definition at line 204 of file Trigger.h.

204 {
205 return ((tt & TT_MASK_TYPE) == TT_DILEPTON_SYM);
206 }

◆ is3Lhalfsym()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
constexpr bool TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::is3Lhalfsym ( )
inlinestaticconstexpr

Definition at line 210 of file Trigger.h.

210 {
211 return ((tt & TT_MASK_TYPE) == TT_TRILEPTON_HALFSYM) && !mixed();
212 }

◆ is3Lmix()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
constexpr bool TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::is3Lmix ( )
inlinestaticconstexpr

Definition at line 214 of file Trigger.h.

214 {
215 return (tt & TT_TRILEPTON_FLAG) && mixed();
216 }

◆ is3Lsym()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
constexpr bool TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::is3Lsym ( )
inlinestaticconstexpr

Definition at line 207 of file Trigger.h.

207 {
208 return ((tt & TT_MASK_TYPE) == TT_TRILEPTON_SYM) && !mixed();
209 }

◆ is4Lsym()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
constexpr bool TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::is4Lsym ( )
inlinestaticconstexpr

Definition at line 217 of file Trigger.h.

217 {
218 return ((tt & TT_MASK_TYPE) == TT_TETRALEPTON_SYM);
219 }

◆ mixed()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
constexpr bool TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::mixed ( )
inlinestaticconstexpr

Definition at line 141 of file Trigger.h.

141{ return TriggerProperties(tt).mixed(); }

◆ nDistinctLegs() [1/2]

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
constexpr unsigned TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::nDistinctLegs ( )
inlinestaticconstexpr

Definition at line 143 of file Trigger.h.

143 {
145 }
static constexpr unsigned nDistinctLegs()
Definition Trigger.h:143

◆ nDistinctLegs() [2/2]

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
constexpr unsigned TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::nDistinctLegs ( xAOD::Type::ObjectType obj)
inlinestaticconstexpr

Definition at line 147 of file Trigger.h.

147 {
149 }

◆ object()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
constexpr xAOD::Type::ObjectType TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::object ( )
inlinestaticconstexpr

Definition at line 184 of file Trigger.h.

184 {
185 if (mixed())
186 return xAOD::Type::Other;
187 return object1();
188 }
static constexpr xAOD::Type::ObjectType object1()
Definition Trigger.h:151

◆ object1()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
constexpr xAOD::Type::ObjectType TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::object1 ( )
inlinestaticconstexpr

Definition at line 151 of file Trigger.h.

151 {
152 if (!is3Lmix()) {
153 if (tt & TT_ELECTRON_FLAG)
155 if (tt & TT_MUON_FLAG)
156 return xAOD::Type::Muon;
157 if (tt & TT_PHOTON_FLAG)
158 return xAOD::Type::Photon;
159 return xAOD::Type::Other;
160 }
161 if ((tt & TT_ELECTRON_FLAG) && !(tt & TT_X2Y_FLAG))
163 if ((tt & TT_PHOTON_FLAG) && (tt & TT_X2Y_FLAG))
164 return xAOD::Type::Photon;
166 }
static constexpr bool is3Lmix()
Definition Trigger.h:214

◆ object2()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
constexpr xAOD::Type::ObjectType TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::object2 ( )
inlinestaticconstexpr

Definition at line 168 of file Trigger.h.

168 {
169 if (is2Lmix()) {
170 if ((tt & TT_ELECTRON_FLAG) && (tt & TT_MUON_FLAG))
171 return xAOD::Type::Muon;
173 return xAOD::Type::Photon;
174 return xAOD::Type::Other;
175 } else if (!is3Lmix())
176 return xAOD::Type::Other;
177 if ((tt & TT_ELECTRON_FLAG) && (tt & TT_X2Y_FLAG))
179 if ((tt & TT_PHOTON_FLAG) && !(tt & TT_X2Y_FLAG))
180 return xAOD::Type::Photon;
182 }
static constexpr bool is2Lmix()
Definition Trigger.h:213

◆ operator bool()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::operator bool ( ) const
inlineexplicit

Definition at line 247 of file Trigger.h.

247 {
248 return std::all_of(legs.cbegin(), legs.cend(),
249 [](std::size_t x) -> bool { return x; });
250 }

◆ operator()() [1/2]

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
std::size_t TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::operator() ( unsigned index) const
inline

Definition at line 237 of file Trigger.h.

237{ return legs[index]; }

◆ operator()() [2/2]

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
template<bool = true>
std::size_t TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::operator() ( void ) const
inline

Definition at line 230 of file Trigger.h.

230 {
231 static_assert(nDistinctLegs() == 1,
232 "this function is not meaningful for this type of trigger, "
233 "hence should not be used.");
234 return legs[0];
235 }

◆ operator<()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
template<bool = true>
std::size_t TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::operator< ( const Trigger< tt, CastType1, CastType2 > & rhs) const
inline

Definition at line 240 of file Trigger.h.

240 {
241 static_assert(is1L(),
242 "this function is not meaningful for this type of trigger, "
243 "hence should not be used.");
244 return legs[0] < rhs.legs[0];
245 }
static constexpr bool is1L()
Definition Trigger.h:197

◆ operator==()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
bool TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::operator== ( const Trigger< tt, CastType1, CastType2 > & rhs) const
inline

Definition at line 252 of file Trigger.h.

252{ return legs == rhs.legs; }

◆ relevantFor()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
bool TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::relevantFor ( const Lepton & lepton)
inlinestatic

Definition at line 190 of file Trigger.h.

190 {
191 return lepton.type() == object();
192 }
static constexpr TriggerType type()
Definition Trigger.h:139
static constexpr xAOD::Type::ObjectType object()
Definition Trigger.h:184

◆ setDefinition()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
void TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::setDefinition ( const ImportData::TrigDef & def)
inline

Definition at line 225 of file Trigger.h.

225 {
226 TriggerProperties(tt).loadLegs(def, legs);
227 }

◆ side() [1/2]

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
template<typename TrigX>
auto TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::side ( ) const -> decltype(side<TrigX::object()>())
inline

Returns a pseudo trigger built only from the legs of the same flavour as the trigger 'TrigX'.

Definition at line 302 of file Trigger.h.

302 {
303 return side<TrigX::object()>();
304 }

◆ side() [2/2]

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
template<xAOD::Type::ObjectType obj, bool anti = false>
auto TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::side ( ) const -> std::conditional_t<anti ^ (CastType1::object() == obj), CastType1, CastType2>
inline

Returns a pseudo trigger built only from the legs of flavour 'obj' If anti==true, uses instead only legs with flavours other than 'obj'.

Definition at line 287 of file Trigger.h.

288 {
289 static_assert(mixed(),
290 "this function is not meaningful for this type of trigger, "
291 "hence should not be used.");
292 static_assert(obj != xAOD::Type::Other, "implementation incomplete");
293 using CastType = decltype(side<obj, anti>());
297 return trig;
298 }

◆ side1()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
CastType1 TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::side1 ( ) const
inline

Returns a pseudo trigger of type CastType1/2.

Definition at line 311 of file Trigger.h.

311{ return side<CastType1::object()>(); }

◆ side2()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
CastType2 TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::side2 ( ) const
inline

Definition at line 312 of file Trigger.h.

312{ return side<CastType2::object()>(); }

◆ symLeg()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
template<bool = true>
std::size_t TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::symLeg ( ) const
inline

Definition at line 364 of file Trigger.h.

364 {
365 static_assert((tt & TT_MASK_SYMMETRY) == TT_HALFSYM,
366 "this function is not meaningful for this type of trigger, "
367 "hence should not be used.");
368 return legs[1];
369 }

◆ symmetric()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
template<bool = true>
bool TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::symmetric ( ) const
inline

Definition at line 337 of file Trigger.h.

337 {
339 "this function is not meaningful for this type of trigger, "
340 "hence should not be used.");
341 return std::all_of(legs.cbegin() + 1, legs.cend(),
342 [&](std::size_t l) -> bool { return l == legs[0]; });
343 }

◆ to_symmetric()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
template<bool = true>
CastType1 TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::to_symmetric ( ) const
inline

Definition at line 346 of file Trigger.h.

346 {
348 "this function is not meaningful for this type of trigger, "
349 "hence should not be used.");
351 trig.legs[0] = this->legs[0];
352 return trig;
353 }

◆ type()

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
constexpr TriggerType TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::type ( )
inlinestaticconstexpr

Definition at line 139 of file Trigger.h.

139{ return tt; }

Member Data Documentation

◆ legs

template<TriggerType tt, typename CastType1 = UnusedArg, typename CastType2 = UnusedArg>
std::array<std::size_t, nDistinctLegs()> TrigGlobEffCorr::Trigger< tt, CastType1, CastType2 >::legs

Definition at line 221 of file Trigger.h.


The documentation for this class was generated from the following file: