3 __doc__=
"Level 1 specific configuration for L1 Run 3"
5 from .Limits
import Limits
6 from collections
import OrderedDict
7 from collections.abc
import Iterable
12 this is to support the old functionality of calling and setting statusOn for flags
21 return self.
name in self.
cls.statusOn
24 self.
cls.statusOn.add(self.
name)
26 self.
cls.statusOn.remove(self.
name)
31 def __init__( self, val_type, val_default = None, val_check = None, action = None ):
41 "CTPVersion" :
FlagArgs( int, 4, val_check =
lambda x: x
in range(5), action =
lambda x: Limits.setLimits(x) ),
42 "BunchGroupPartitioning" :
FlagArgs( Iterable, val_check =
lambda x: len(
list(
filter(
lambda y: y
not in range(16), x)))==0 ),
43 "BunchGroupNames" :
FlagArgs( Iterable, val_check =
lambda x: len(
list(
filter(
lambda y:
not isinstance(y, str), x)))==0),
44 "MenuPartitioning" :
FlagArgs( Iterable, val_check =
lambda x: len(
list(
filter(
lambda y: y
not in range(512), x)))==0 ),
45 "items" :
FlagArgs( Iterable, val_check =
lambda x: len(
list(
filter(
lambda y:
not isinstance(y, str), x)))==0),
46 "boards" :
FlagArgs( OrderedDict, OrderedDict() ),
47 "legacyBoards" :
FlagArgs( OrderedDict, OrderedDict() ),
48 "prescales" :
FlagArgs( dict, dict() ),
49 "RemapThresholdsAsListed" :
FlagArgs( bool,
False ),
50 "CtpIdMap" :
FlagArgs( dict, dict() ),
51 "ThresholdMap" :
FlagArgs( dict, dict() ),
52 "ItemMap" :
FlagArgs( dict, dict() ),
57 object.__setattr__(self, attr, value)
58 d = L1MenuFlagsCont.__slots__[attr]
60 if not isinstance(value, d.val_type):
61 raise TypeError(
"L1MenuFlags.%s type check failed for %r. Type needs to be '%s'" % ( attr, value, d.valtype.__name__))
63 if d.val_check
and not d.val_check(value):
64 raise ValueError(
"L1MenuFlags.%s value check failed for %r" % ( attr, value))
68 L1MenuFlagsCont.statusOn.add(attr)
71 if attr
in L1MenuFlagsCont.__slots__:
73 object.__getattribute__(self,attr)
74 except AttributeError:
75 if L1MenuFlagsCont.__slots__[attr].val_default
is not None:
76 object.__setattr__(self, attr, L1MenuFlagsCont.__slots__[attr].val_default)
77 return FlagWrapper(attr, object.__getattribute__(self,attr), L1MenuFlagsCont)
79 return object.__getattribute__(self,attr)