ATLAS Offline Software
TopoAlgoDefMultiplicity.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2 from collections import namedtuple
3 from AthenaCommon.Logging import logging
4 log = logging.getLogger(__name__)
5 
6 from ..Base.TopoAlgos import EMMultiplicityAlgo, TauMultiplicityAlgo, JetMultiplicityAlgo, XEMultiplicityAlgo, LArSaturationAlgo, ZeroBiasAlgo
7 from ..Base.TopoAlgorithms import AlgType, AlgCategory
8 
10  """
11  Defines the TopoAlgorithms that calculate multiplicities for L1Calo thresholds
12  The thresholds have to be explicitly defined here.
13  """
14  @staticmethod
16 
17  emThresholds_3bits = [
18  'eEM5', 'eEM7', 'eEM9', 'eEM10L',
19  ]
20  emThresholds_2bits = [
21  'eEM12L', 'eEM15', 'eEM18', 'eEM18L', 'eEM18M', 'eEM22M',
22  'eEM24L',
23  'eEM22A', 'eEM22C',
24  'eEM12',
25  ]
26  emVarThresholds_2bits = [
27  'eEM24VM', 'eEM26', 'eEM26L', 'eEM26M', 'eEM26T', 'eEM28M',
28  'eEM1', 'eEM2',
29  'eEM40L',
30  # spares
31  'eEMSPARE1',
32  ]
33 
34  for em in emThresholds_3bits:
35  alg = EMMultiplicityAlgo( name = em,
36  threshold = em,
37  nbits = 3, classtype='eEmMultiplicity')
38  tm.registerTopoAlgo(alg)
39 
40  for em in emThresholds_2bits:
41  alg = EMMultiplicityAlgo( name = em,
42  threshold = em,
43  nbits = 2, classtype='eEmMultiplicity')
44  tm.registerTopoAlgo(alg)
45 
46  for em in emVarThresholds_2bits:
47  alg = EMMultiplicityAlgo( name = em,
48  threshold = em,
49  nbits = 2, classtype='eEmVarMultiplicity')
50  tm.registerTopoAlgo(alg)
51 
52  emThresholds_2bits = [
53  'jEM20', 'jEM20M',
54 
55  #spares
56  'jEMSPARE1',
57  ]
58  for em in emThresholds_2bits:
59  alg = EMMultiplicityAlgo( name = em,
60  threshold = em,
61  nbits = 2, classtype='jEmMultiplicity')
62  tm.registerTopoAlgo(alg)
63 
64  etauThresholds_3bits = [
65  'eTAU1', 'eTAU12', 'eTAU20',
66 
67  # spares
68  ]
69  jtauThresholds_3bits = [
70  'jTAU20'
71  ]
72  ctauThresholds_3bits = [
73  'cTAU12M', 'cTAU20M',
74 
75  #spares
76  'cTAUSPARE1',
77  ]
78  etauThresholds_2bits = [
79  'eTAU20L', 'eTAU20M', 'eTAU30', 'eTAU30M', 'eTAU35', 'eTAU35M', 'eTAU40HM', 'eTAU60', 'eTAU80', 'eTAU140',
80 
81  #spares
82  'eTAU40HT', 'eTAU60HM','eTAU60HL', 'eTAU80HL', #'eTAUSPARE6', 'eTAUSPARE7',
83  ]
84  jtauThresholds_2bits = [
85  'jTAU1', 'jTAU30', 'jTAU30M',
86 
87  #spares
88  ]
89  ctauThresholds_2bits = [
90  'cTAU30M', 'cTAU35M',
91 
92  # spares
93  'cTAUSPARE2',
94  ]
95 
96  for tau in etauThresholds_3bits:
97  alg = TauMultiplicityAlgo( name = tau,
98  threshold = tau,
99  nbits = 3, classtype='eTauMultiplicity')
100  tm.registerTopoAlgo(alg)
101 
102  for tau in jtauThresholds_3bits:
103  alg = TauMultiplicityAlgo( name = tau,
104  threshold = tau,
105  nbits = 3, classtype='jTauMultiplicity')
106  tm.registerTopoAlgo(alg)
107 
108  for tau in ctauThresholds_3bits:
109  alg = TauMultiplicityAlgo( name = tau,
110  threshold = tau,
111  nbits = 3, classtype='cTauMultiplicity')
112  tm.registerTopoAlgo(alg)
113 
114  for tau in etauThresholds_2bits:
115  alg = TauMultiplicityAlgo( name = tau,
116  threshold = tau,
117  nbits = 2, classtype='eTauMultiplicity')
118  tm.registerTopoAlgo(alg)
119 
120  for tau in jtauThresholds_2bits:
121  alg = TauMultiplicityAlgo( name = tau,
122  threshold = tau,
123  nbits = 2, classtype='jTauMultiplicity')
124  tm.registerTopoAlgo(alg)
125 
126  for tau in ctauThresholds_2bits:
127  alg = TauMultiplicityAlgo( name = tau,
128  threshold = tau,
129  nbits = 2, classtype='cTauMultiplicity')
130  tm.registerTopoAlgo(alg)
131 
132 
133  jJThresholds_3bits = [
134  'jJ20', 'jJ30', 'jJ30p0ETA25', 'jJ40', 'jJ40p0ETA25', 'jJ50', 'jJ55', 'jJ55p0ETA23', 'jJ60',
135 
136  # spares
137  'jJSPARE1', 'jJSPARE2',
138  ]
139  jJThresholds_2bits = [
140  'jJ70p0ETA23', 'jJ80', 'jJ80p0ETA25', 'jJ85p0ETA21',
141  'jJ90', 'jJ125',
142  'jJ140', 'jJ160', 'jJ180', 'jJ500',
143 
144  'jJ15p30ETA49', 'jJ20p30ETA49',
145  'jJ40p30ETA49', 'jJ50p30ETA49', 'jJ60p30ETA49', 'jJ90p30ETA49', 'jJ125p30ETA49',
146 
147  # spares
148  'jJSPARE3', 'jJSPARE4',
149  ]
150 
151  for jJet in jJThresholds_3bits:
152  alg = JetMultiplicityAlgo( name = jJet,
153  threshold = jJet,
154  nbits = 3, classtype='jJetMultiplicity')
155  tm.registerTopoAlgo(alg)
156 
157  for jJet in jJThresholds_2bits:
158  alg = JetMultiplicityAlgo( name = jJet,
159  threshold = jJet,
160  nbits = 2, classtype='jJetMultiplicity')
161  tm.registerTopoAlgo(alg)
162 
163  jLJThresholds_2bits = [
164  # jLJ thresholds for commissioning
165  'jLJ80', 'jLJ120', 'jLJ140', 'jLJ180',
166 
167  # jLJ thresholds for production
168  'jLJ60', 'jLJ100', 'jLJ160', 'jLJ200',
169  ]
170 
171  for jLJet in jLJThresholds_2bits:
172  alg = JetMultiplicityAlgo( name = jLJet,
173  threshold = jLJet,
174  nbits = 2, classtype='jLJetMultiplicity')
175  tm.registerTopoAlgo(alg)
176 
177  gJThresholds_3bits = [ 'gJ20p0ETA25', 'gJ20p25ETA49', 'gJSPARE1',]
178  gJThresholds_2bits = [ 'gJ50p0ETA25', 'gJ100p0ETA25', 'gJ400p0ETA25']
179 
180  for gJet in gJThresholds_3bits:
181  alg = JetMultiplicityAlgo( name = gJet,
182  threshold = gJet,
183  nbits = 3, classtype='gJetMultiplicity')
184  tm.registerTopoAlgo(alg)
185 
186  for gJet in gJThresholds_2bits:
187  alg = JetMultiplicityAlgo( name = gJet,
188  threshold = gJet,
189  nbits = 2, classtype='gJetMultiplicity')
190  tm.registerTopoAlgo(alg)
191 
192  gLJThresholds_2bits = [
193  'gLJ80p0ETA25', 'gLJ100p0ETA25', 'gLJ140p0ETA25', 'gLJ160p0ETA25',
194 
195  # spares
196  'gLJSPARE1', 'gLJSPARE2', 'gLJSPARE3', 'gLJSPARE4',
197  ]
198 
199  for gLJet in gLJThresholds_2bits:
200  alg = JetMultiplicityAlgo( name = gLJet,
201  threshold = gLJet,
202  nbits = 2, classtype='gLJetMultiplicity')
203  tm.registerTopoAlgo(alg)
204 
205  XEThresholds = [
206  'gXEJWOJ60', 'gXEJWOJ70', 'gXEJWOJ80', 'gXEJWOJ100', 'gXEJWOJ110', 'gXEJWOJ120', 'gXEJWOJ500',
207  #'gXERHO70', 'gXERHO100',
208  'gXENC70', 'gXENC100',
209 
210  'jXE60', 'jXE70', 'jXE80', 'jXE90', 'jXE100', 'jXE110', 'jXE120', 'jXE500',
211 
212  'jXEC100', 'jTE200', 'jTEC200', 'jTEFWD100', 'jTEFWDA100', 'jTEFWDC100',
213  'gTE200',
214 
215  #additional jTE thresholds needed for 2023 heavy ion runs
216  'jTE3','jTE4','jTE5', 'jTE10', 'jTE20','jTE50',
217  'jTE100', 'jTE600', 'jTE1500', 'jTE3000', 'jTE10000',
218  'jTEFWDA1', 'jTEFWDC1', 'jTEFWDA5', 'jTEFWDC5',
219 
220  'gMHT500',
221 
222  'jXEPerf100',
223 
224  #spares (for any energy thresholds)
225  #replace jXESPARE16 - jXESPARE27 with heavy ion jTE threhsolds
226  'jXESPARE1', 'jXESPARE2', 'jXESPARE3', 'jXESPARE4',
227  'jXESPARE5', 'jXESPARE6', 'jXESPARE7', 'jXESPARE8', #'jXESPARE9',
228  #'jXESPARE10', 'jXESPARE11', 'jXESPARE12', 'jXESPARE13',
229  #'jXESPARE14',
230  #'jXESPARE15',
231 
232  ]
233 
234  for XE in XEThresholds:
235  alg = XEMultiplicityAlgo( name = XE,
236  threshold = XE,
237  nbits = 1)
238  tm.registerTopoAlgo(alg)
239 
240  tm.registerTopoAlgo(LArSaturationAlgo())
241 
242  tm.registerTopoAlgo(ZeroBiasAlgo("ZeroBiasA"))
243  tm.registerTopoAlgo(ZeroBiasAlgo("ZeroBiasB"))
244 
245  @staticmethod
247  """
248  List of the constraints in terms of multiplicity algorithms to make sure the menu fits
249  in the Topo1 FW
250  """
251 
252  multLimits = namedtuple('ML', "thrtype, conn, nbit, startbit, endbit")
253  multiplicities = [
254  multLimits( thrtype='eEM', conn='Topo1Opt0', nbit=3, startbit=0, endbit=11),
255  multLimits( thrtype='eEM', conn='Topo1Opt0', nbit=2, startbit=24, endbit=43),
256  multLimits( thrtype='eEMV', conn='Topo1Opt0', nbit=2, startbit=44, endbit=63),
257  multLimits( thrtype='ZeroBiasA', conn='Topo1Opt0', nbit=1, startbit=64, endbit=64),
258  multLimits( thrtype='eTAU', conn='Topo1Opt1', nbit=3, startbit=0, endbit=8 ),
259  multLimits( thrtype='eTAU', conn='Topo1Opt1', nbit=2, startbit=12, endbit=31),
260  multLimits( thrtype='gLJ', conn='Topo1Opt1', nbit=2, startbit=33, endbit=51),
261  multLimits( thrtype='gJ', conn='Topo1Opt1', nbit=3, startbit=54, endbit=62),
262  multLimits( thrtype='gJ', conn='Topo1Opt1', nbit=2, startbit=66, endbit=71),
263  multLimits( thrtype='eTAU', conn='Topo1Opt1', nbit=2, startbit=72, endbit=80),
264  multLimits( thrtype='jJ', conn='Topo1Opt2', nbit=3, startbit=0, endbit=32),
265  multLimits( thrtype='jJ', conn='Topo1Opt2', nbit=2, startbit=36, endbit=73),
266  multLimits( thrtype='jLJ', conn='Topo1Opt2', nbit=2, startbit=78, endbit=93),
267  multLimits( thrtype='jTAU', conn='Topo1Opt3', nbit=3, startbit=0, endbit=2 ),
268  multLimits( thrtype='jTAU', conn='Topo1Opt3', nbit=2, startbit=6, endbit=11),
269  multLimits( thrtype='cTAU', conn='Topo1Opt3', nbit=3, startbit=14, endbit=19),
270  multLimits( thrtype='cTAU', conn='Topo1Opt3', nbit=2, startbit=23, endbit=28),
271  multLimits( thrtype='jEM', conn='Topo1Opt3', nbit=2, startbit=31, endbit=36),
272  multLimits( thrtype='LArSaturation', conn='Topo1Opt3', nbit=1, startbit=37, endbit=37),
273  multLimits( thrtype='ZeroBiasB', conn='Topo1Opt3', nbit=1, startbit=38, endbit=38),
274  multLimits( thrtype='EN', conn='Topo1Opt3', nbit=1, startbit=39, endbit=86),
275 
276  ]
277 
278  for conn in l1menu.connectors:
279  if 'Topo1' not in conn.name or conn.legacy:
280  continue
281  for tl in conn.triggerLines:
282  if 'Perf' in tl.name:
283  continue
284  tl_name = 'Mult_'+tl.name
285  algo = l1menu.topoAlgos.topoAlgos[AlgCategory.MULTI][AlgType.MULT][tl_name]
286  goodAlgo = False
287  for ml in multiplicities:
288  thrtype = algo.input
289  if 'LArSaturation' in algo.name:
290  thrtype = 'LArSaturation'
291  elif 'XE' in algo.input or 'TE' in algo.input or 'MHT' in algo.input:
292  thrtype = 'EN'
293  if 'eEmVar' in algo.classtype:
294  thrtype = 'eEMV'
295  if conn.name==ml.conn and thrtype==ml.thrtype and algo.nbits==ml.nbit and tl.startbit>=ml.startbit and (tl.startbit+tl.nbits-1)<=ml.endbit:
296  goodAlgo = True
297  if not goodAlgo:
298  raise RuntimeError("The multiplicity algorithm %s with startbit %i does not fit with Topo1 and CTP FW. If this is intended, please correct the multiplicity constraints and communicate the new menu to the L1TOPO and CTP groups." % (algo.name, tl.startbit) )
299 
300 
python.L1.Base.TopoAlgos.JetMultiplicityAlgo
Definition: TopoAlgos.py:226
python.L1.Base.TopoAlgos.TauMultiplicityAlgo
Definition: TopoAlgos.py:216
python.L1.Base.TopoAlgos.XEMultiplicityAlgo
Definition: TopoAlgos.py:236
python.L1.Base.TopoAlgos.ZeroBiasAlgo
Definition: TopoAlgos.py:268
python.L1.Config.TopoAlgoDefMultiplicity.TopoAlgoDefMultiplicity
Definition: TopoAlgoDefMultiplicity.py:9
python.L1.Base.TopoAlgos.LArSaturationAlgo
Definition: TopoAlgos.py:263
python.L1.Config.TopoAlgoDefMultiplicity.TopoAlgoDefMultiplicity.registerTopoAlgos
def registerTopoAlgos(tm)
Definition: TopoAlgoDefMultiplicity.py:15
python.L1.Config.TopoAlgoDefMultiplicity.TopoAlgoDefMultiplicity.checkMultAlgoFWconstraints
def checkMultAlgoFWconstraints(l1menu)
Definition: TopoAlgoDefMultiplicity.py:246
pickleTool.object
object
Definition: pickleTool.py:30
python.L1.Base.TopoAlgos.EMMultiplicityAlgo
Definition: TopoAlgos.py:206