|
ATLAS Offline Software
|
Go to the documentation of this file.
2 from __future__
import annotations
4 from DQDefects
import DEFECT_IOV
5 from functools
import reduce
7 from typing
import Mapping
11 self.
name = defect_iov.channel
21 raise RuntimeError(
"bad_evaluator should never be called")
30 from operator
import truth, not_
38 def _populate(self, defect_logics: Mapping[str, DefectLogic]) ->
None:
40 Populate the dependencies with logic objects, and the primary defects.
43 if name
in defect_logics]
47 if c
not in defect_logics)
49 def evaluate_full(self, states: Mapping[str, DEFECT_IOV]) -> DEFECT_IOV:
51 Evaluate this defect logic for a point in time.
56 from operator
import not_
57 inputs = [(op, states[c])
for op, c
in self.
operations if c
in states
if states[c]]
59 uninverted = [_
for _
in self.
inverting if _
not in states
or not states[_]]
60 if not inputs
and not uninverted:
63 present =
reduce(bool.__or__, (op(i.present)
for op, i
in inputs),
False)
or len(uninverted),
64 recoverable=
reduce(bool.__and__, (
not not i.recoverable
for op, i
in inputs
65 if op(i.present)),
False),
67 comment=
" ".
join(
sorted([((
'!' if op == not_
else '') + i.channel)
for op, i
in inputs
if op(i.present)]
68 +[
'!'+_
for _
in uninverted]))
73 Evaluate this defect logic for a point in time.
78 inputs = [(op, states[c])
for op, c
in self.
operations if c
in states
and states[c]]
80 uninverted = [_
for _
in self.
inverting if _
not in states
or not states[_]]
81 if not inputs
and not uninverted:
84 present =
reduce(bool.__or__, (op(i.present)
for op, i
in inputs),
False)
or len(uninverted),
def DEFECT_IOV(channel, present, recoverable, user, comment)
None _populate(self, Mapping[str, DefectLogic] defect_logics)
void reduce(HepMC::GenEvent *ge, std::vector< HepMC::GenParticlePtr > toremove)
Remove unwanted particles from the event, collapsing the graph structure consistently.
bool add(const std::string &hname, TKey *tobj)
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
std::string join(const std::vector< std::string > &v, const char c=',')
None __init__(self, defect_iov)
DEFECT_IOV evaluate_full(self, Mapping[str, DEFECT_IOV] states)
None _operations_parse(self)
None set_evaluation(self, bool full)
DEFECT_IOV bad_evaluator(self, states)
DEFECT_IOV evaluate_partial(self, Mapping[str, DEFECT_IOV] states)