2 from collections
import namedtuple
3 from AthenaCommon.Logging
import logging
4 log = logging.getLogger(__name__)
6 from ..Base.TopoAlgos
import EMMultiplicityAlgo, TauMultiplicityAlgo, JetMultiplicityAlgo, XEMultiplicityAlgo, LArSaturationAlgo, ZeroBiasAlgo
7 from ..Base.TopoAlgorithms
import AlgType, AlgCategory
11 Defines the TopoAlgorithms that calculate multiplicities for L1Calo thresholds
12 The thresholds have to be explicitly defined here.
17 emThresholds_3bits = [
18 'eEM5',
'eEM7',
'eEM9',
'eEM10L',
20 emThresholds_2bits = [
21 'eEM12L',
'eEM15',
'eEM18',
'eEM18L',
'eEM18M',
'eEM22M',
26 emVarThresholds_2bits = [
27 'eEM24VM',
'eEM26',
'eEM26L',
'eEM26M',
'eEM26T',
'eEM28M',
35 for em
in emThresholds_3bits:
38 nbits = 3, classtype=
'eEmMultiplicity')
39 tm.registerTopoAlgo(alg)
41 for em
in emThresholds_2bits:
44 nbits = 2, classtype=
'eEmMultiplicity')
45 tm.registerTopoAlgo(alg)
47 for em
in emVarThresholds_2bits:
50 nbits = 2, classtype=
'eEmVarMultiplicity')
51 tm.registerTopoAlgo(alg)
53 emThresholds_2bits = [
59 for em
in emThresholds_2bits:
62 nbits = 2, classtype=
'jEmMultiplicity')
63 tm.registerTopoAlgo(alg)
65 etauThresholds_3bits = [
66 'eTAU1',
'eTAU12',
'eTAU20',
68 jtauThresholds_3bits = [
71 ctauThresholds_3bits = [
72 'cTAU12M',
'cTAU20M',
'cTAUSPARE1',
74 etauThresholds_2bits = [
75 'eTAU20L',
'eTAU20M',
'eTAU30',
'eTAU30M',
'eTAU35',
'eTAU35M',
'eTAU40HM',
'eTAU60',
'eTAU80',
'eTAU140',
76 'eTAU40HT',
'eTAU60HM',
'eTAU60HL',
'eTAU80HL',
78 jtauThresholds_2bits = [
81 ctauThresholds_2bits = [
89 for tau
in etauThresholds_3bits:
92 nbits = 3, classtype=
'eTauMultiplicity')
93 tm.registerTopoAlgo(alg)
95 for tau
in jtauThresholds_3bits:
98 nbits = 3, classtype=
'jTauMultiplicity')
99 tm.registerTopoAlgo(alg)
101 for tau
in ctauThresholds_3bits:
104 nbits = 3, classtype=
'cTauMultiplicity')
105 tm.registerTopoAlgo(alg)
107 for tau
in etauThresholds_2bits:
110 nbits = 2, classtype=
'eTauMultiplicity')
111 tm.registerTopoAlgo(alg)
113 for tau
in jtauThresholds_2bits:
116 nbits = 2, classtype=
'jTauMultiplicity')
117 tm.registerTopoAlgo(alg)
119 for tau
in ctauThresholds_2bits:
122 nbits = 2, classtype=
'cTauMultiplicity')
123 tm.registerTopoAlgo(alg)
126 jJThresholds_3bits = [
127 'jJ5',
'jJ10',
'jJ20',
'jJ30',
'jJ30p0ETA25',
'jJ40',
'jJ40p0ETA25',
'jJ50',
'jJ55',
'jJ55p0ETA23',
'jJ60',
129 jJThresholds_2bits = [
130 'jJ70p0ETA23',
'jJ80',
'jJ80p0ETA25',
'jJ85p0ETA21',
132 'jJ140',
'jJ160',
'jJ180',
'jJ500',
134 'jJ40p30ETA49',
'jJ50p30ETA49',
'jJ60p30ETA49',
'jJ90p30ETA49',
'jJ125p30ETA49',
145 for jJet
in jJThresholds_3bits:
148 nbits = 3, classtype=
'jJetMultiplicity')
149 tm.registerTopoAlgo(alg)
151 for jJet
in jJThresholds_2bits:
154 nbits = 2, classtype=
'jJetMultiplicity')
155 tm.registerTopoAlgo(alg)
157 jLJThresholds_2bits = [
159 'jLJ80',
'jLJ120',
'jLJ140',
'jLJ180',
162 'jLJ60',
'jLJ100',
'jLJ160',
'jLJ200',
165 for jLJet
in jLJThresholds_2bits:
168 nbits = 2, classtype=
'jLJetMultiplicity')
169 tm.registerTopoAlgo(alg)
171 gJThresholds_3bits = [
'gJ20p0ETA25',
'gJ20p25ETA49',
'gJSPARE1', ]
172 gJThresholds_2bits = [
'gJ50p0ETA25',
'gJ100p0ETA25',
'gJ400p0ETA25' ]
174 for gJet
in gJThresholds_3bits:
177 nbits = 3, classtype=
'gJetMultiplicity')
178 tm.registerTopoAlgo(alg)
180 for gJet
in gJThresholds_2bits:
183 nbits = 2, classtype=
'gJetMultiplicity')
184 tm.registerTopoAlgo(alg)
186 gLJThresholds_2bits = [
187 'gLJ80p0ETA25',
'gLJ100p0ETA25',
'gLJ140p0ETA25',
'gLJ160p0ETA25',
190 'gLJSPARE1',
'gLJSPARE2',
'gLJSPARE3',
'gLJSPARE4',
193 for gLJet
in gLJThresholds_2bits:
196 nbits = 2, classtype=
'gLJetMultiplicity')
197 tm.registerTopoAlgo(alg)
200 'gXEJWOJ60',
'gXEJWOJ70',
'gXEJWOJ80',
'gXEJWOJ100',
'gXEJWOJ110',
'gXEJWOJ120',
'gXEJWOJ500',
202 'gXENC70',
'gXENC100',
204 'jXE60',
'jXE70',
'jXE80',
'jXE90',
'jXE100',
'jXE110',
'jXE120',
'jXE500',
206 'jXEC100',
'jTE200',
'jTEC200',
'jTEFWD100',
'jTEFWDA100',
'jTEFWDC100',
207 'gTE3',
'gTE5',
'gTE10',
'gTE200',
210 'jTE3',
'jTE4',
'jTE5',
'jTE10',
'jTE20',
'jTE50',
211 'jTE100',
'jTE600',
'jTE1500',
'jTE4000',
'jTE6500',
'jTE8300',
'jTE9000',
'jTE10000',
'jTE12000',
212 'jTEFWDA1',
'jTEFWDC1',
'jTEFWDA5',
'jTEFWDC5',
223 for XE
in XEThresholds:
227 tm.registerTopoAlgo(alg)
238 List of the constraints in terms of multiplicity algorithms, to make sure the menu fits
241 The Phase-I L1Topo boards contain 2 FPGAs, with 2 output fibers each (connected to the CTP).
242 Up to 96 bits per fiber.
254 multLimits = namedtuple(
'ML', [
'thrtype',
'conn',
'nbit',
'startbit',
'endbit'])
257 multLimits(thrtype=
'eEM', conn=
'Topo1Opt0', nbit=3, startbit=0, endbit=11),
258 multLimits(thrtype=
'eEM', conn=
'Topo1Opt0', nbit=2, startbit=24, endbit=43),
259 multLimits(thrtype=
'eEMV', conn=
'Topo1Opt0', nbit=2, startbit=44, endbit=63),
260 multLimits(thrtype=
'ZeroBiasA', conn=
'Topo1Opt0', nbit=1, startbit=64, endbit=64),
263 multLimits(thrtype=
'eTAU', conn=
'Topo1Opt1', nbit=3, startbit=0, endbit=8 ),
264 multLimits(thrtype=
'eTAU', conn=
'Topo1Opt1', nbit=2, startbit=12, endbit=35),
265 multLimits(thrtype=
'gLJ', conn=
'Topo1Opt1', nbit=2, startbit=40, endbit=55),
266 multLimits(thrtype=
'gJ', conn=
'Topo1Opt1', nbit=3, startbit=58, endbit=66),
267 multLimits(thrtype=
'gJ', conn=
'Topo1Opt1', nbit=2, startbit=70, endbit=75),
268 multLimits(thrtype=
'eTAU', conn=
'Topo1Opt1', nbit=2, startbit=78, endbit=81),
271 multLimits(thrtype=
'jJ', conn=
'Topo1Opt2', nbit=3, startbit=0, endbit=32),
272 multLimits(thrtype=
'jJ', conn=
'Topo1Opt2', nbit=2, startbit=36, endbit=73),
273 multLimits(thrtype=
'jLJ', conn=
'Topo1Opt2', nbit=2, startbit=78, endbit=93),
276 multLimits(thrtype=
'jTAU', conn=
'Topo1Opt3', nbit=3, startbit=0, endbit=2 ),
277 multLimits(thrtype=
'jTAU', conn=
'Topo1Opt3', nbit=2, startbit=6, endbit=7 ),
278 multLimits(thrtype=
'cTAU', conn=
'Topo1Opt3', nbit=3, startbit=14, endbit=22),
279 multLimits(thrtype=
'cTAU', conn=
'Topo1Opt3', nbit=2, startbit=23, endbit=30),
280 multLimits(thrtype=
'jEM', conn=
'Topo1Opt3', nbit=2, startbit=31, endbit=36),
281 multLimits(thrtype=
'LArSaturation', conn=
'Topo1Opt3', nbit=1, startbit=37, endbit=37),
282 multLimits(thrtype=
'ZeroBiasB', conn=
'Topo1Opt3', nbit=1, startbit=38, endbit=38),
283 multLimits(thrtype=
'EN', conn=
'Topo1Opt3', nbit=1, startbit=39, endbit=86),
286 for conn
in l1menu.connectors:
287 if 'Topo1' not in conn.name
or conn.legacy:
continue
289 for tl
in conn.triggerLines:
290 if 'Perf' in tl.name:
continue
292 algo = l1menu.topoAlgos.topoAlgos[AlgCategory.MULTI][AlgType.MULT][f
'Mult_{tl.name}']
295 if 'LArSaturation' in algo.name:
296 thrtype =
'LArSaturation'
297 elif 'XE' in algo.input
or 'TE' in algo.input
or 'MHT' in algo.input:
299 elif 'eEmVar' in algo.classtype:
302 for ml
in multiplicities:
303 if conn.name == ml.conn
and thrtype == ml.thrtype
and algo.nbits == ml.nbit
and tl.startbit >= ml.startbit
and tl.endbit <= ml.endbit:
306 raise RuntimeError(f
'The multiplicity algorithm {algo.name} with startbit {tl.startbit} does not fit in the current Topo1 and CTP FWs. If this is intended, please correct the multiplicity constraints and communicate the new menu to the L1Topo and CTP groups.')
309 for etl
in conn.emptyTriggerLines:
310 log.debug(
'Empty Multiplicity placeholder in bits %i-%i of %s', etl.startbit, etl.endbit, conn.name)
311 for ml
in multiplicities:
313 if conn.name == ml.conn
and etl.startbit >= ml.startbit
and etl.endbit <= ml.endbit:
314 raise RuntimeError(f
'One of the Empty or (Empty, nbits) Multiplicity algorithm placeholders in the L1 Menu is overlapping with the declared multiplicity algorithm bit ranges ({conn.name}, bits {etl.startbit}-{etl.endbit}). Check the bit mapping and algorithm alignments!')