 |
ATLAS Offline Software
|
Go to the documentation of this file.
7 #ifndef TRIGGLOBALEFFICIENCYCORRECTION_TRIGGER_H
8 #define TRIGGLOBALEFFICIENCYCORRECTION_TRIGGER_H 1
12 #include <boost/container/flat_set.hpp>
13 #include <type_traits>
17 template <
typename Key>
18 using flat_set = boost::container::flat_set<Key>;
81 template <
typename Array>
84 throw std::runtime_error(
133 return (
object() ==
obj ||
obj == xAOD::Type::Other);
135 template <
typename T>
159 return xAOD::Type::Other;
174 return xAOD::Type::Other;
176 return xAOD::Type::Other;
186 return xAOD::Type::Other;
229 template <
bool = true>
232 "this function is not meaningful for this type of trigger, "
233 "hence should not be used.");
239 template <
bool = true>
241 static_assert(
is1L(),
242 "this function is not meaningful for this type of trigger, "
243 "hence should not be used.");
247 explicit operator bool()
const {
248 return std::all_of(
legs.cbegin(),
legs.cend(),
249 [](std::size_t
x) ->
bool { return x; });
254 template <xAOD::Type::ObjectType obj =
object()>
259 template <xAOD::Type::ObjectType obj =
object()>
264 template <
typename Trig1L>
266 typename std::enable_if<Trig1L::is1L(),
bool>
::type {
267 static_assert(Trig1L::is1L(),
268 "this function is not meaningful for this type of trigger, "
269 "hence should not be used.");
271 return std::find(cbegin<obj>(), cend<obj>(), trig()) != cend<obj>();
274 template <
typename Trig1L>
276 typename std::enable_if<Trig1L::is1L(),
bool>
::type {
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); });
286 template <xAOD::Type::ObjectType obj,
bool anti = false>
287 auto side()
const -> std::conditional_t<anti ^ (CastType1::
object() ==
obj),
288 CastType1, CastType2> {
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>());
301 template <
typename TrigX>
303 return side<TrigX::object()>();
306 template <
typename TrigX>
308 return side<TrigX::object(), true>();
311 CastType1
side1()
const {
return side<CastType1::object()>(); }
312 CastType2
side2()
const {
return side<CastType2::object()>(); }
314 template <
typename Trig1L>
316 -> std::enable_if_t<Trig1L::is1L() &&
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>());
327 template <
typename Trig1L>
331 static_assert(
sizeof(Trig1L) ==
sizeof(std::size_t),
332 "invalid cast if the key sizes differ");
336 template <
bool = true>
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]; });
345 template <
bool = true>
348 "this function is not meaningful for this type of trigger, "
349 "hence should not be used.");
351 trig.legs[0] = this->legs[0];
355 template <
bool = true>
358 "this function is not meaningful for this type of trigger, "
359 "hence should not be used.");
363 template <
bool = true>
366 "this function is not meaningful for this type of trigger, "
367 "hence should not be used.");
372 template <TriggerType, TriggerType = TT_UNKNOWN>
375 template <TriggerType
object_flag>
382 struct T_1 :
public Trigger<addObjFlag(TT_SINGLELEPTON_FLAG)> {};
384 struct T_2sym :
public Trigger<addObjFlag(TT_DILEPTON_SYM)> {};
386 struct T_2asym :
public Trigger<addObjFlag(TT_DILEPTON_ASYM), T_2sym> {};
388 struct T_3sym :
public Trigger<addObjFlag(TT_TRILEPTON_SYM)> {};
390 struct T_3halfsym :
public Trigger<addObjFlag(TT_TRILEPTON_HALFSYM), T_3sym> {
393 struct T_4sym :
public Trigger<addObjFlag(TT_TETRALEPTON_SYM)> {};
396 template <TriggerType
object1_flag, TriggerType
object2_flag>
401 return static_cast<TriggerType>(
tt | object1_flag | object2_flag);
406 struct T_1_1 :
public Trigger<addObjFlags(TT_DILEPTON_FLAG), typename A::T_1,
410 typename A::T_2sym, typename B::T_1> {};
413 typename A::T_2asym, typename B::T_1> {};
416 typename A::T_1, typename B::T_2sym> {};
419 typename A::T_1, typename B::T_2asym> {};
constexpr int cend_offset(xAOD::Type::ObjectType obj) const
auto addTo(const flat_set< Trig1L > &trigs1L) const -> std::enable_if_t< Trig1L::is1L() &&nDistinctLegs(Trig1L::object())==1, flat_set< Trig1L >>
constexpr auto cend() const
std::array< std::size_t, 4 > m_legs
static constexpr TriggerType type()
static constexpr xAOD::Type::ObjectType object()
constexpr bool mixed() const
Electron_v1 Electron
Definition of the current "egamma version".
auto hiddenBy(const Trig1L trig) const -> typename std::enable_if< Trig1L::is1L(), bool >::type
CastType1 to_symmetric() const
static constexpr bool is2Lasym()
std::string find(const std::string &s)
return a remapped string
constexpr unsigned nDistinctLegs(xAOD::Type::ObjectType obj) const
the template specializations below must be enclosed in this namespace
static constexpr unsigned nDistinctLegs()
static constexpr xAOD::Type::ObjectType object2()
std::size_t symLeg() const
constexpr unsigned nDistinctLegs() const
static constexpr bool is2Lmix()
std::size_t operator()(void) const
bool const RAWDATA *ch2 const
static constexpr bool is1L()
static auto anonymize(const flat_set< Trig1L > &triggers) -> std::enable_if_t< is1L() &&tt==Trig1L::type(), const flat_set< std::size_t > & >
void loadLegs(const ImportData::TrigDef &src, Array &dest)
static constexpr xAOD::Type::ObjectType object()
boost::container::flat_set< Key > flat_set
std::size_t operator()(unsigned index) const
CastType1 side1() const
Returns a pseudo trigger of type CastType1/2.
static constexpr bool is4Lsym()
static bool irrelevantFor(const Lepton &lepton)
static constexpr bool is3Lsym()
static bool relevantFor(const Lepton &lepton)
std::size_t asymLeg() const
static constexpr bool is3Lmix()
static constexpr bool extraCheck(xAOD::Type::ObjectType obj)
auto antiside() const -> decltype(side< TrigX::object(), true >())
Complement to the previous function.
static constexpr bool is3Lhalfsym()
constexpr TriggerProperties(TriggerType tt)
constexpr TriggerType type() const
TriggerProperties(const ImportData::TrigDef &def)
std::size_t operator<(const Trigger &rhs) const
mixed-flavour trilepton trigger type x_y_y
static constexpr bool is2Lsym()
static constexpr auto addObjFlags(int tt)
void setDefinition(const ImportData::TrigDef &def)
bool operator==(const Trigger &rhs) const
mixed-flavour trilepton trigger type x_x_y
static constexpr auto addObjFlag(int tt)
mixed-flavour trilepton trigger type 2x_y (2e12_lhloose_mu10, ...)
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...
constexpr auto cend(xAOD::Type::ObjectType obj) const
constexpr auto cbegin() const
xAOD::Type::ObjectType type() const
Photon_v1 Photon
Definition of the current "egamma version".
struct TBPatternUnitContext Muon
mixed-flavour trilepton trigger type x_2y (e12_lhloose_2mu10, ...)
std::array< std::size_t, nDistinctLegs()> legs
constexpr bool valid() const
constexpr int cbegin_offset(xAOD::Type::ObjectType obj) const
static constexpr bool mixed()
auto hiddenBy(const flat_set< Trig1L > &trigs) const -> typename std::enable_if< Trig1L::is1L(), bool >::type
static constexpr xAOD::Type::ObjectType object1()
mixed-flavour dilepton trigger (e17_lhloose_nod0_mu14, e7_lhmedium_mu24, ...):
auto side() const -> decltype(side< TrigX::object()>())
Returns a pseudo trigger built only from the legs of the same flavour as the trigger 'TrigX'.
setBGCode setTAP setLVL2ErrorBits bool
constexpr auto cbegin(xAOD::Type::ObjectType obj) const
static constexpr unsigned nDistinctLegs(xAOD::Type::ObjectType obj)
static constexpr bool is2Lnomix()