Definition at line 9 of file virtual_logic.py.
◆ __init__()
None python.virtual_logic.DefectLogic.__init__ |
( |
|
self, |
|
|
|
defect_iov |
|
) |
| |
Definition at line 10 of file virtual_logic.py.
10 def __init__(self, defect_iov) -> None:
11 self.name = defect_iov.channel
12 self.clauses = defect_iov.clauses.split()
13 self.operations =
set()
14 self.inverting =
set()
15 self._operations_parse()
16 self.realclauses =
set(_[1]
for _
in self.operations)
17 self.primary_defects =
set()
18 self.evaluate = self.bad_evaluator
◆ _operations_parse()
None python.virtual_logic.DefectLogic._operations_parse |
( |
|
self | ) |
|
|
private |
Definition at line 29 of file virtual_logic.py.
29 def _operations_parse(self) -> None:
30 from operator
import truth, not_
31 for name
in self.clauses:
33 self.operations.
add((not_, name[1:]))
34 self.inverting.
add(name[1:])
36 self.operations.
add((truth, name))
◆ _populate()
None python.virtual_logic.DefectLogic._populate |
( |
|
self, |
|
|
Mapping[str, DefectLogic] |
defect_logics |
|
) |
| |
|
private |
Populate the dependencies with logic objects, and the primary defects.
Definition at line 38 of file virtual_logic.py.
38 def _populate(self, defect_logics: Mapping[str, DefectLogic]) ->
None:
40 Populate the dependencies with logic objects, and the primary defects.
42 self.dependencies = [defect_logics[name]
for _, name
in self.operations
43 if name
in defect_logics]
46 self.primary_defects =
set(c
for _, c
in self.operations
47 if c
not in defect_logics)
◆ bad_evaluator()
DEFECT_IOV python.virtual_logic.DefectLogic.bad_evaluator |
( |
|
self, |
|
|
|
states |
|
) |
| |
Definition at line 20 of file virtual_logic.py.
20 def bad_evaluator(self, states) -> DEFECT_IOV:
21 raise RuntimeError(
"bad_evaluator should never be called")
◆ evaluate_full()
DEFECT_IOV python.virtual_logic.DefectLogic.evaluate_full |
( |
|
self, |
|
|
Mapping[str, DEFECT_IOV] |
states |
|
) |
| |
Evaluate this defect logic for a point in time.
Parameters
`states` :
Definition at line 49 of file virtual_logic.py.
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]))
◆ evaluate_partial()
DEFECT_IOV python.virtual_logic.DefectLogic.evaluate_partial |
( |
|
self, |
|
|
Mapping[str, DEFECT_IOV] |
states |
|
) |
| |
Evaluate this defect logic for a point in time.
Parameters
`states` :
Definition at line 71 of file virtual_logic.py.
71 def evaluate_partial(self, states: Mapping[str, DEFECT_IOV]) -> DEFECT_IOV:
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),
◆ set_evaluation()
None python.virtual_logic.DefectLogic.set_evaluation |
( |
|
self, |
|
|
bool |
full |
|
) |
| |
Definition at line 23 of file virtual_logic.py.
23 def set_evaluation(self, full: bool) ->
None:
25 self.evaluate = self.evaluate_full
27 self.evaluate = self.evaluate_partial
◆ clauses
python.virtual_logic.DefectLogic.clauses |
◆ dependencies
python.virtual_logic.DefectLogic.dependencies |
◆ evaluate
python.virtual_logic.DefectLogic.evaluate |
◆ inverting
python.virtual_logic.DefectLogic.inverting |
◆ name
python.virtual_logic.DefectLogic.name |
◆ operations
python.virtual_logic.DefectLogic.operations |
◆ primary_defects
python.virtual_logic.DefectLogic.primary_defects |
◆ realclauses
python.virtual_logic.DefectLogic.realclauses |
The documentation for this class was generated from the following file:
void reduce(HepMC::GenEvent *ge, std::vector< HepMC::GenParticlePtr > toremove)
Remove unwanted particles from the event, collapsing the graph structure consistently.
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.