7#ifndef TRIGGLOBALEFFICIENCYCORRECTION_TRIGGER_H
8#define TRIGGLOBALEFFICIENCYCORRECTION_TRIGGER_H 1
17template <
typename Key>
81 template <
typename Array>
84 throw std::runtime_error(
87 std::fill(dest.begin(), dest.end(), 0);
135 template <
typename T>
235 template <
bool = true>
238 "this function is not meaningful for this type of trigger, "
239 "hence should not be used.");
245 template <
bool = true>
247 static_assert(
is1L(),
248 "this function is not meaningful for this type of trigger, "
249 "hence should not be used.");
253 explicit operator bool()
const {
254 return std::all_of(
legs.cbegin(),
legs.cend(),
255 [](std::size_t
x) ->
bool { return x; });
260 template <xAOD::Type::ObjectType obj =
object()>
265 template <xAOD::Type::ObjectType obj =
object()>
270 template <
typename Trig1L>
272 typename std::enable_if<Trig1L::is1L(),
bool>
::type {
273 static_assert(Trig1L::is1L(),
274 "this function is not meaningful for this type of trigger, "
275 "hence should not be used.");
276 constexpr auto obj = Trig1L::object();
280 template <
typename Trig1L>
282 typename std::enable_if<Trig1L::is1L(),
bool>
::type {
283 static_assert(Trig1L::is1L(),
284 "this function is not meaningful for this type of trigger, "
285 "hence should not be used.");
286 return std::any_of(trigs.cbegin(), trigs.cend(),
287 [&](Trig1L t) ->
bool { return hiddenBy(t); });
292 template <xAOD::Type::ObjectType obj,
bool anti = false>
293 auto side()
const ->
std::conditional_t<anti ^ (CastType1::
object() == obj),
294 CastType1, CastType2> {
295 static_assert(
mixed(),
296 "this function is not meaningful for this type of trigger, "
297 "hence should not be used.");
301 std::copy_n(this->
cbegin<CastType::object()>(),
307 template <
typename TrigX>
312 template <
typename TrigX>
320 template <
typename Trig1L>
322 -> std::enable_if_t<Trig1L::is1L() &&
325 static_assert(
mixed(),
326 "this function is not meaningful for this type of trigger, "
327 "hence should not be used.");
333 template <
typename Trig1L>
335 -> std::enable_if_t<
is1L() && tt == Trig1L::type(),
337 static_assert(
sizeof(Trig1L) ==
sizeof(std::size_t),
338 "invalid cast if the key sizes differ");
342 template <
bool = true>
344 static_assert(!std::is_same<CastType1, UnusedArg>::value,
345 "this function is not meaningful for this type of trigger, "
346 "hence should not be used.");
347 return std::all_of(
legs.cbegin() + 1,
legs.cend(),
348 [&](std::size_t l) ->
bool { return l == legs[0]; });
351 template <
bool = true>
353 static_assert(!std::is_same<CastType1, UnusedArg>::value,
354 "this function is not meaningful for this type of trigger, "
355 "hence should not be used.");
357 trig.legs[0] = this->legs[0];
361 template <
bool = true>
364 "this function is not meaningful for this type of trigger, "
365 "hence should not be used.");
369 template <
bool = true>
372 "this function is not meaningful for this type of trigger, "
373 "hence should not be used.");
378template <TriggerType, TriggerType = TT_UNKNOWN>
381template <TriggerType
object_flag>
388 struct T_1 :
public Trigger<addObjFlag(TT_SINGLELEPTON_FLAG)> {};
402template <TriggerType
object1_flag, TriggerType
object2_flag>
407 return static_cast<TriggerType>(tt | object1_flag | object2_flag);
412 struct T_1_1 :
public Trigger<addObjFlags(TT_DILEPTON_FLAG), typename A::T_1,
416 typename A::T_2sym, typename B::T_1> {};
419 typename A::T_2asym, typename B::T_1> {};
422 typename A::T_1, typename B::T_2sym> {};
425 typename A::T_1, typename B::T_2asym> {};
CxxUtils::flat_set< Key > flat_set
xAOD::Type::ObjectType type() const
constexpr TriggerType type() const
constexpr auto cbegin(xAOD::Type::ObjectType obj) const
constexpr int cbegin_offset(xAOD::Type::ObjectType obj) const
constexpr unsigned nDistinctLegs() const
TriggerProperties(const ImportData::TrigDef &def)
constexpr auto cend(xAOD::Type::ObjectType obj) const
std::array< std::size_t, 4 > m_legs
constexpr bool mixed() const
void loadLegs(const ImportData::TrigDef &src, Array &dest)
constexpr unsigned nDistinctLegs(xAOD::Type::ObjectType obj) const
constexpr TriggerProperties(TriggerType tt)
constexpr int cend_offset(xAOD::Type::ObjectType obj) const
constexpr bool valid() const
static bool irrelevantFor(const Lepton &lepton)
static constexpr unsigned nDistinctLegs(xAOD::Type::ObjectType obj)
static constexpr bool mixed()
std::array< std::size_t, nDistinctLegs()> legs
auto addTo(const flat_set< Trig1L > &trigs1L) const -> std::enable_if_t< Trig1L::is1L() &&nDistinctLegs(Trig1L::object())==1, flat_set< Trig1L > >
static constexpr xAOD::Type::ObjectType object1()
static constexpr bool is3Lhalfsym()
CastType1 to_symmetric() const
static constexpr xAOD::Type::ObjectType object2()
static constexpr bool is2Lmix()
static constexpr TriggerType type()
auto hiddenBy(const flat_set< Trig1L > &trigs) const -> typename std::enable_if< Trig1L::is1L(), bool >::type
auto hiddenBy(const Trig1L trig) const -> typename std::enable_if< Trig1L::is1L(), bool >::type
CastType1 side1() const
Returns a pseudo trigger of type CastType1/2.
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...
void setDefinition(const ImportData::TrigDef &def)
static constexpr bool is2Lsym()
static constexpr bool is2Lnomix()
std::size_t operator()(unsigned index) const
static constexpr bool is4Lsym()
std::size_t operator()(void) const
constexpr auto cbegin() const
static constexpr unsigned nDistinctLegs()
static constexpr bool is3Lmix()
auto antiside() const -> decltype(side< TrigX::object(), true >())
Complement to the previous function.
std::size_t asymLeg() const
constexpr auto cend() const
Trigger(const ImportData::TrigDef &def)
static auto anonymize(const flat_set< Trig1L > &triggers) -> std::enable_if_t< is1L() &&tt==Trig1L::type(), const flat_set< std::size_t > & >
static constexpr bool is1L()
static constexpr xAOD::Type::ObjectType object()
static constexpr bool is3Lsym()
std::size_t operator<(const Trigger &rhs) const
static constexpr bool is2Lasym()
static constexpr bool extraCheck(xAOD::Type::ObjectType obj)
bool operator==(const Trigger &rhs) const
auto side() const -> decltype(side< TrigX::object()>())
Returns a pseudo trigger built only from the legs of the same flavour as the trigger 'TrigX'.
std::size_t symLeg() const
static bool relevantFor(const Lepton &lepton)
static constexpr xAOD::Type::ObjectType object()
Wrapper for C++23 std::flat_set.
boost::container::flat_set< KEY, COMPARE, KEYCONTAINER > flat_set
the template specializations below must be enclosed in this namespace
ObjectType
Type of objects that have a representation in the xAOD EDM.
@ Photon
The object is a photon.
@ Other
An object not falling into any of the other categories.
@ Muon
The object is a muon.
@ Electron
The object is an electron.
mixed-flavour dilepton trigger (e17_lhloose_nod0_mu14, e7_lhmedium_mu24, ...):
mixed-flavour trilepton trigger type x_y_y
mixed-flavour trilepton trigger type x_2y (e12_lhloose_2mu10, ...)
mixed-flavour trilepton trigger type x_x_y
mixed-flavour trilepton trigger type 2x_y (2e12_lhloose_mu10, ...)
single-lepton trigger (e24_lhmedium_L1EM20VH, mu24_imedium_OR_mu40...)
asymmetric dilepton trigger (mu18_mu8noL1, g35_loose_g25_loose, ...):
symmetric dilepton trigger (2e17_lhvloose_nod0, 2mu14...)
half-symmetric trilepton trigger (e17_lhloose_2e9_lhloose, mu6_2mu4, ...):
symmetric trilepton trigger (3mu6, ...):
symmetric tetralepton trigger (4mu4, ...):
static constexpr auto addObjFlag(int tt)
TriggerClass< object2_flag > B
static constexpr auto addObjFlags(int tt)
TriggerClass< object1_flag > A