4 This temporarily holds CTP sizes
7 from AthenaCommon.Logging
import logging
8 log = logging.getLogger(__name__)
11 """Metaclass to implement __getattr__ for class variables"""
13 if cls.ctpDataFormat
is None:
14 raise RuntimeError(
"CTP version has not been set, you need to call Limits.setLimits(CTPVersion) before you can use the limits")
16 if hasattr(cls.ctpDataFormat, key):
17 return getattr( cls.ctpDataFormat, key)
18 elif hasattr(cls.l1common, key):
19 return getattr( cls.l1common, key)
21 raise AttributeError(
"Neither class 'CTPdataformat' nor class 'L1Common' have an attribute '%s'" % key)
24 if cls.ctpDataFormat
is None:
27 s =
"CTP DataFormat version %i\n" % cls.CTPVersion
28 varnames = [
'MaxTrigItems',
'NumBunchgroups',
'NumRndmTriggers']
29 for varname
in varnames:
30 s +=
" %s = %r\n" % (varname, getattr( cls.ctpDataFormat, varname))
31 s +=
"L1Common version %i\n" % cls.L1CommonVersion
32 varnames = [
'MUON_bitnum',
'EM_bitnum',
'TAU_bitnum',
'JET_bitnum',
'JE_bitnum',
'JB_bitnum',
'JF_bitnum',
'TE_bitnum',
'XE_bitnum',
'XS_bitnum',
33 'MBTS_bitnum',
'MBTSSI_bitnum',
'NIM_bitnum',
'ZDC_bitnum',
'TRT_bitnum',
'BCM_bitnum',
'BCMCMB_bitnum',
'LUCID_bitnum',
'CALREQ_bitnum',
34 'MUON_cable',
'EM_cable',
'TAU_cable',
'JET_cable',
'JE_cable',
'JB_cable',
'JF_cable',
'TE_cable',
'XE_cable',
'XS_cable',
'MBTS_cable',
35 'MBTSSI_cable',
'NIM_cable',
'ZDC_cable',
'TRT_cable',
'BCM_cable',
'BCMCMB_cable',
'LUCID_cable',
'CALREQ_cable']
36 for varname
in varnames:
37 s +=
" %s = %r\n" % (varname, getattr( cls.l1common, varname))
45 L1CommonVersion =
None
52 module = __import__(
'CTPfragment.CTPdataformat_v%i' % version, globals(), locals(), [
'CTPdataformat_v%i' % version], 0)
53 return getattr(module,
"CTPdataformat_v%i" % version)
57 module = __import__(
'L1Common.L1Common_v%i' % version, globals(), locals(), [
'L1Common_v%i' % version], 0)
58 return getattr(module,
"L1Common_v%i" % version)
62 Limits.CTPVersion = CTPVersion
63 Limits.L1CommonVersion = 0
if CTPVersion <= 3
else 1
65 Limits.ctpDataFormat = Limits.getCTPdataformat( Limits.CTPVersion )
66 Limits.l1common = Limits.getL1Common( Limits.L1CommonVersion )