Loading [MathJax]/extensions/MathMenu.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
7 #ifndef TRIGGLOBALEFFICIENCYCORRECTION_TRIGGER_H
8 #define TRIGGLOBALEFFICIENCYCORRECTION_TRIGGER_H 1
15 #include <type_traits>
16 #include <boost/container/flat_set.hpp>
17 template<
typename Key>
using flat_set = boost::container::flat_set<Key>;
69 template<
typename Array>
72 if(
src.type !=
m_type)
throw std::runtime_error (
"Calculator bug");
112 template<TriggerType tt,
typename CastType1 = UnusedArg,
typename CastType2 = UnusedArg>
139 return xAOD::Type::Other;
152 return xAOD::Type::Other;
154 else if(!
is3Lmix())
return xAOD::Type::Other;
162 if(
mixed())
return xAOD::Type::Other;
194 static_assert(
nDistinctLegs()==1,
"this function is not meaningful for this type of trigger, hence should not be used.");
205 static_assert(
is1L(),
"this function is not meaningful for this type of trigger, hence should not be used.");
211 return std::all_of(
legs.cbegin(),
legs.cend(), [](std::size_t
x)->bool{ return x; });
219 template<xAOD::Type::ObjectType obj =
object()> constexpr
auto cbegin()
const
224 template<xAOD::Type::ObjectType obj =
object()> constexpr
auto cend()
const
229 template<
typename Trig1L>
auto hiddenBy(
const Trig1L trig)
const
230 ->
typename std::enable_if<Trig1L::is1L(),
bool>
::type
232 static_assert(Trig1L::is1L(),
"this function is not meaningful for this type of trigger, hence should not be used.");
234 return std::find(cbegin<obj>(), cend<obj>(), trig()) != cend<obj>();
238 ->
typename std::enable_if<Trig1L::is1L(),
bool>
::type
240 static_assert(Trig1L::is1L(),
"this function is not meaningful for this type of trigger, hence should not be used.");
241 return std::any_of(trigs.cbegin(), trigs.cend(), [&](Trig1L
t)->bool{ return hiddenBy(t); });
246 template<xAOD::Type::ObjectType obj,
bool anti=false>
auto side()
const
247 -> std::conditional_t<anti ^ (CastType1::
object()==
obj), CastType1, CastType2>
249 static_assert(
mixed(),
"this function is not meaningful for this type of trigger, hence should not be used.");
250 static_assert(
obj != xAOD::Type::Other,
"implementation incomplete");
251 using CastType = decltype(side<obj, anti>());
257 template<
typename TrigX>
auto side()
const -> decltype(
side<TrigX::
object()>()) {
return side<TrigX::object()>(); }
259 template<
typename TrigX>
auto antiside()
const -> decltype(
side<TrigX::
object(),true>()) {
return side<TrigX::object(),true>(); }
261 CastType1
side1()
const {
return side<CastType1::object()>(); }
262 CastType2
side2()
const {
return side<CastType2::object()>(); }
267 static_assert(
mixed(),
"this function is not meaningful for this type of trigger, hence should not be used.");
269 trigs.insert(side<Trig1L>());
276 static_assert(
sizeof(Trig1L)==
sizeof(std::size_t),
"invalid cast if the key sizes differ");
283 return std::all_of(
legs.cbegin()+1,
legs.cend(), [&](std::size_t
l)->bool{ return l==legs[0]; });
290 trig.legs[0] = this->legs[0];
294 template<
bool=true> std::size_t
asymLeg()
const
296 static_assert((
tt&
TT_MASK_SYMMETRY)==
TT_HALFSYM,
"this function is not meaningful for this type of trigger, hence should not be used.");
300 template<
bool=true> std::size_t
symLeg()
const
302 static_assert((
tt&
TT_MASK_SYMMETRY)==
TT_HALFSYM,
"this function is not meaningful for this type of trigger, hence should not be used.");
309 template<TriggerType
object_flag>
315 struct T_1 :
public Trigger<addObjFlag(TT_SINGLELEPTON_FLAG)> {};
317 struct T_2sym :
public Trigger<addObjFlag(TT_DILEPTON_SYM)> {};
319 struct T_2asym :
public Trigger<addObjFlag(TT_DILEPTON_ASYM), T_2sym> {};
321 struct T_3sym :
public Trigger<addObjFlag(TT_TRILEPTON_SYM)> {};
323 struct T_3halfsym :
public Trigger<addObjFlag(TT_TRILEPTON_HALFSYM), T_3sym> {};
325 struct T_4sym :
public Trigger<addObjFlag(TT_TETRALEPTON_SYM)> {};
328 template<TriggerType
object1_flag, TriggerType
object2_flag>
336 struct T_1_1 :
public Trigger<addObjFlags(TT_DILEPTON_FLAG), typename A::T_1, typename B::T_1> {};
338 struct T_2sym_1 :
public Trigger<addObjFlags(TT_TRILEPTON_SYM), typename A::T_2sym, typename B::T_1> {};
340 struct T_2asym_1:
public Trigger<addObjFlags(TT_TRILEPTON_ASYM), typename A::T_2asym, typename B::T_1> {};
342 struct T_1_2sym:
public Trigger<addObjFlags(TT_TRILEPTON_SYM|TT_X2Y_FLAG), typename A::T_1, typename B::T_2sym> {};
344 struct T_1_2asym:
public Trigger<addObjFlags(TT_TRILEPTON_SYM|TT_X2Y_FLAG), 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
void fill(H5::Group &out_file, size_t iterations)
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()