ATLAS Offline Software
Loading...
Searching...
No Matches
L1Seeds.py
Go to the documentation of this file.
1# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
2
3from AthenaCommon.Logging import logging
4log = logging.getLogger(__name__)
5
6
9from TriggerMenuMT.L1.Config.TriggerTypeDef import TT
10rpcout_type = TT.muon | TT.phys
11rpcin_type = TT.muon | TT.phys
12cl_type = TT.calo | TT.phys
13
14
15calo_exceptions = set([])
16
17
18
22def Lvl1ItemByTriggerType(l1object, triggertype_pattern, triggertype_bitmask):
23 """
24 The function returns those items where the items triggertype, after applying the mask, matches the pattern.
25 With this one can also select items where a certain bit is disabled
26 """
27 if triggertype_pattern<0 or triggertype_pattern>0xFF:
28 raise RuntimeError('TriggerPythonConfig.Lvl1ItemByTriggerType(triggertype_pattern,triggertype_bitmask) needs to be called with 0<=triggertype_pattern<=0xFF, ' + \
29 + 'but is called with triggertype_pattern=%i' % triggertype_pattern)
30 if triggertype_bitmask<0 or triggertype_bitmask>0xFF:
31 raise RuntimeError('TriggerPythonConfig.Lvl1ItemByTriggerType(triggertype_pattern,triggertype_bitmask) needs to be called with 0<=triggertype_bitmask<=0xFF, ' + \
32 + 'but is called with triggertype_bitmask=%i' % triggertype_bitmask)
33 itemsForMenu = [item for item in l1object if l1object[item]['ctpid'] != -1]
34 if not itemsForMenu:
35 log.error('No item defined for the L1 Menu, the TriggerConfL1 object does not contain items')
36 res = [item for item in itemsForMenu if ( (triggertype_bitmask & int(l1object[item]['triggerType'],2)) == triggertype_pattern)]
37 return res
38
39
43 return [
44 'L1_BCM_2A_2C_BGRP12', 'L1_BCM_2A_2C_UNPAIRED_ISO',
45 'L1_BCM_Wide_CALIB', 'L1_BCM_Wide_BGRP12', 'L1_BCM_Wide_EMPTY', 'L1_BCM_Wide_UNPAIREDB1', 'L1_BCM_Wide_UNPAIREDB2',
46 'L1_BCM_2A_CALIB', 'L1_BCM_2C_CALIB',
47 'L1_BCM_2A_EMPTY', 'L1_BCM_2C_EMPTY',
48 'L1_BCM_2A_UNPAIREDB1', 'L1_BCM_2C_UNPAIREDB1', 'L1_BCM_2A_UNPAIREDB2', 'L1_BCM_2C_UNPAIREDB2',
49 'L1_BCM_2A_FIRSTINTRAIN', 'L1_BCM_2C_FIRSTINTRAIN',
50 'L1_jJ30_UNPAIREDB1', 'L1_jJ30_UNPAIREDB2',
51 'L1_jJ30_UNPAIRED_ISO', 'L1_jJ30_UNPAIRED_NONISO',
52 'L1_jJ90_UNPAIRED_ISO', 'L1_jJ90_UNPAIRED_NONISO',
53 'L1_jJ30_EMPTY', 'L1_jJ60_EMPTY', 'L1_jJ30_FIRSTEMPTY', 'L1_jJ30_BGRP12',
54 ]
55
56
57def getL1StandbySeed(l1items):
58 standby_seeds = [ x for x in l1items if \
59 "_EMPTY" not in x and "CALREQ" not in x and "ZB" not in x and \
60 "-" not in x and "CMU" not in x and "RD" not in x and \
61 "BCM" not in x and "BGRP12" not in x
62 ]
63 return standby_seeds
64
65
66def getL1TopoSeed(l1items):
67 return [ x for x in l1items if "-" in x or "CMU" in x ]
68
69
70def getL1CaloSeed(l1seed, l1object):
71 if ('EMPTY' in l1seed):
72 #l1calo_seeds = ','.join([ x for x in Lvl1ItemByTriggerType(l1object, cl_type, cl_type) \
73 # if (x not in calo_exceptions) ])
74 l1calo_seeds = [ x for x in Lvl1ItemByTriggerType(l1object, cl_type, cl_type) \
75 if ('EMPTY' in x and 'FIRSTEMPTY' not in x) ]
76 else:
77 l1calo_seeds = [ x for x in Lvl1ItemByTriggerType(l1object, cl_type, cl_type) if ("EMPTY" not in x or "FIRSTEMPTY" in x) \
78 and (x not in calo_exceptions) ]
79 return l1calo_seeds
80
81
82def getL1TauSeed(l1items):
83 tau_seeds = [ x for x in l1items if "TAU" in x and "-" not in x and "EMPTY" not in x and "ISO" not in x]
84 return tau_seeds
85
86
88 return ['L1_J15','L1_3J15','L1_3J10','L1_4J10']
89
91 return ['L1_J15','L1_3J15','L1_3J10','L1_4J10']
92
93
94def getL1MuonSeed(l1seed, l1object):
95 if ('EMPTY' in l1seed): # to only get MU*_EMPTY items
96 muon_seeds_list = [ x for x in Lvl1ItemByTriggerType(l1object, rpcout_type, rpcout_type) if ('MU' in x and '_EMPTY' in x ) ]
97 muon_seeds_list = list(set(muon_seeds_list))
98 muon_seeds = muon_seeds_list
99 else: #this one does NOT include the EMPTY items
100 muon_seeds_list = [ x for x in Lvl1ItemByTriggerType(l1object, rpcout_type, rpcout_type) if ('MU' in x and 'FIRSTEMPTY' in x ) ]
101 muon_seeds_list += [ x for x in Lvl1ItemByTriggerType(l1object, rpcin_type, rpcin_type) ]
102 muon_seeds_list = list(set(muon_seeds_list))
103 muon_seeds = muon_seeds_list
104
105 return muon_seeds
106
107
108def getEBnoL1PSSeed(l1items, l1seedname):
109
110 ebitem = l1seedname.strip('L1_').rstrip('_noPS')
111 # All of these L1 items must be PS=1 for an EB campaign
112 l1EBitems = {
113 'PhysicsHigh':
114 [
115 'L1_eEM18L_MU8F','L1_eEM26M', 'L1_eEM26T', 'L1_eEM28M','L1_2eEM10L_MU8F', 'L1_2eEM18M',
116 'L1_4jJ40', 'L1_jJ160', 'L1_jXE100', 'L1_2jJ40_jXE110',
117 'L1_eTAU140',
118 'L1_cTAU30M_3DR35-MU8F-eTAU30', 'L1_MU14FCH', 'L1_MU18VFCH', 'L1_MU10BOM',
119 'L1_5jJ40p0ETA25',
120 'L1_MU8F_2jJ40_jJ50',
121 'L1_jJ80p0ETA25_2jJ55_jJ50p30ETA49',
122 'L1_2MU5VF_3MU3V','L1_MU8VF_2MU5VF',
123 'L1_jMJJ-500-NFF', 'L1_jJ85p0ETA21_3jJ40p0ETA25', 'L1_SC175-SCjJ10',
124 'L1_HT190-jJ40s5pETA21', 'L1_cTAU30M_2cTAU20M_4jJ30p0ETA25',
125 'L1_cTAU30M_2cTAU20M_DR-eTAU30eTAU20-jJ55', 'L1_eEM18M_2cTAU20M_jXE70',
126 'L1_ZAFB-04DPHIM-eEM18M','L1_eEM18M_jEM25',
127 'L1_jJ55p0ETA23_2jJ40p30ETA49','L1_jJ125p30ETA49','L1_3MU5VF',
128 'L1_eEM24L_3eEM12L', 'L1_LATE-MU8F_jJ90', 'L1_LATE-MU8F_jXE70',
129 'L1_110INVM150-eEM50s-eEM10s-2DISAMB-jJ60s'
130
131 ],
132 'PhysicsVeryHigh':
133 [
134 'L1_jJ500', 'L1_jXE500'
135 ],
136 'EMPTY':
137 [
138 'L1_jJ30_EMPTY', 'L1_jJ60_EMPTY', 'L1_MU8VF_EMPTY', 'L1_eTAU12_EMPTY', 'L1_eTAU60_EMPTY', 'L1_eEM15_EMPTY'
139 ],
140 'FIRSTEMPTY':
141 [
142 'L1_jJ30_FIRSTEMPTY',
143 ],
144 'UNPAIRED_ISO':
145 [
146 'L1_jJ30_UNPAIRED_ISO', 'L1_jJ40p30ETA49_UNPAIRED_ISO',
147 'L1_MU3V_UNPAIRED_ISO', 'L1_eEM9_UNPAIRED_ISO', 'L1_eTAU12_UNPAIRED_ISO', 'L1_eTAU60_UNPAIRED_ISO'
148 ],
149 'UNPAIRED_NONISO':
150 [
151 'L1_jJ30_UNPAIRED_NONISO',
152 ],
153 'ABORTGAPNOTCALIB': [] # No more items defined in this historical bunchgroup
154 }[ebitem]
155
156 return l1EBitems
157
158
160 return [
161 'L1_eEM24L',
162 'L1_2EM10VH',
163 'L1_2MU5VF', 'L1_3MU3V',
164 'L1_eEM18L_MU8F',
165 'L1_2eEM10L_MU8F',
166 'L1_TAU60',
167 'L1_cTAU30M_2cTAU20M_jJ55_2jJ50_3jJ30',
168 'L1_EM15HI_2TAU12IM_XE35',
169 'L1_MU8F_cTAU20M_jXE70',
170 'L1_TAU20_2TAU12_XE35',
171 'L1_cTAU30M_2cTAU20M_jXE70',
172 'L1_EM15HI_2TAU12IM', 'L1_EM15HI_2TAU12IM_J25_3J12',
173 'L1_EM15HI_TAU40_2TAU15',
174 'L1_MU8F_cTAU20M_jJ55_2jJ30',
175 'L1_MU8F_cTAU20M',
176 'L1_J75', #'L1_4J15',
177 'L1_XE50', 'L1_3J25p0ETA23',
178 'L1_3J40', 'L1_2jJ40_jXE110',
179 'L1_MU5VF_jJ80', 'L1_J75p31ETA49'
180 ]
181
182
183
185 return [
186 # Unprescaled
187 'L1_eEM15',
188 # 'L1_2eEM9', # Added for low-µ runs - removed for HI to make space
189 'L1_JPSI-1M5-eEM9',
190 # Next Higher Thresholds for Buffer
191 'L1_eEM18',
192 'L1_2eEM12',
193 # Prescaled
194 'L1_eEM9',
195 'L1_eEM9_VjTE200',
196 # 'L1_2eEM5_jTE200' # Added for low-µ runs - removed for HI to make space
197 ]
198
199
200
202
203 return [
204 'L1_eEM24L_3eEM12L',
205 'L1_eEM22M_jMJJ-300', # legacy 'L1_EM18VHI_MJJ-300'
206 'L1_eEM18L_MU8F',
207 'L1_BPH-0M9-eEM9-eEM7_2MU3V', # legacy 'L1_BPH-0M9-EM7-EM5_2MU3V'
208 'L1_MU14FCH',
209 'L1_MU8VF_2MU5VF', # Replacing 'L1_MU8F_2MU5VF'
210 'L1_BPH-2M9-2DR15-2MU5VF',
211 'L1_cTAU30M_3DR35-MU8F-eTAU30',
212 'L1_MU8F_cTAU20M_3jJ30',
213 'L1_jXE100', # legacy 'L1_XE50',
214 'L1_eTAU60_2cTAU20M_jXE80', # legacy 'L1_TAU40_2TAU12IM_XE40', TriggerMenuMT:L1Seeds ERROR L1 item L1_eTAU60_2cTAU20M_jXE80 from L1_BKeePrimary seeds is not in current L1 menu
215 'L1_eEM18M_2cTAU20M_jXE70', # legacy 'L1_EM15VHI_2TAU12IM_XE35'
216 'L1_cTAU35M_2cTAU30M_2jJ55_3jJ50', # legacy 'L1_TAU25IM_2TAU20IM_2J25_3J20'
217 'L1_cTAU30M_2cTAU20M_4jJ30p0ETA25', # legacy 'L1_TAU20IM_2TAU12IM_4J12p0ETA25'
218 'L1_eEM18M_2cTAU20M_4jJ30', # legacy 'L1_EM15VHI_2TAU12IM_4J12'
219 'L1_jMJJ-700', # legacy 'L1_MJJ-700'
220 'L1_jMJJ-500-NFF', # legacy 'L1_MJJ-500-NFF'
221 'L1_jJ140_3jJ60', # legacy 'L1_J85_3J30',
222 'L1_jJ80p0ETA25_2jJ55_jJ50p30ETA49', # legacy 'L1_J40p0ETA25_2J25_J20p31ETA49'
223 'L1_jJ55p0ETA23_2jJ40p30ETA49', # legacy 'L1_J25p0ETA23_2J15p31ETA49'
224 'L1_jJ160', # legacy 'L1_J100'
225 'L1_4jJ40', # legacy 'L1_4J15'
226 'L1_3jJ70p0ETA23', # legacy 'L1_3J35p0ETA23'
227 'L1_3jJ40p0ETA25_jXE80', # legacy 'L1_3J15p0ETA25_XE40'
228 'L1_2eEM24L',
229 'L1_2eEM18', 'L1_2eEM18M',
230 'L1_eEM26M',
231 'L1_eEM28M',
232 'L1_2eEM10L_MU8F',
233 'L1_MU18VFCH',
234 'L1_eTAU80_2eTAU60',
235 'L1_cTAU30M_2cTAU20M_DR-eTAU30eTAU20-jJ55'
236 ]
237
238
241
242 return [
243 'L1_JPSI-1M5-eEM9', 'L1_JPSI-1M5-eEM15',
244 'L1_BPH-0M9-eEM9-eEM7_MU5VF',
245 'L1_eEM24L_3eEM12L',
246 'L1_EM18VHI_MJJ-300',
247 'L1_eEM18L_MU8F',
248 'L1_BPH-0M9-EM7-EM5_2MU3V',
249 'L1_MU14FCH',
250 'L1_MU8F_2MU5VF',
251 'L1_MU8F_TAU20IM',
252 'L1_MU8F_TAU12IM_3J12',
253 'L1_XE50',
254 'L1_TAU60_2TAU40',
255 'L1_TAU40_2TAU12IM_XE40',
256 'L1_EM15VHI_2TAU12IM_XE35',
257 'L1_TAU25IM_2TAU20IM_2J25_3J20',
258 'L1_TAU20IM_2TAU12IM_4J12p0ETA25',
259 'L1_EM15VHI_2TAU12IM_4J12',
260 'L1_DR-TAU20ITAU12I-J25',
261 'L1_MJJ-700',
262 'L1_MJJ-500-NFF',
263 'L1_J85_3J30',
264 'L1_J40p0ETA25_2J25_J20p31ETA49',
265 'L1_J25p0ETA23_2J15p31ETA49',
266 'L1_J100',
267 #'L1_4J15',
268 'L1_3J35p0ETA23',
269 'L1_3J15p0ETA25_XE40',
270 'L1_2eEM24L',
271 'L1_eEM18','L1_2eEM18', 'L1_2eEM18M', 'L1_2eEM18L',
272 'L1_eEM26M', 'L1_eEM26L',
273 'L1_eEM28M',
274 'L1_eEM24L_3eEM12L',
275 'L1_eEM22M_jMJJ-300',
276 'L1_eEM18L_MU8F',
277 'L1_2eEM10L_MU8F',
278 'L1_BPH-0M9-eEM9-eEM7_2MU3V',
279 'L1_MU18VFCH',
280 'L1_eTAU80_2eTAU60',
281 'L1_jJ160'
282 ]
283
284
286
287 return [
288 'L1_LFV-MU5VF',
289 'L1_BPH-2M9-0DR15-MU5VFMU3V', # disabled
290 'L1_BPH-2M9-0DR15-C-MU5VFMU3V',
291 'L1_BPH-2M9-0DR15-2MU3V', #disabled
292 'L1_BPH-2M9-0DR15-2MU3VF',
293 'L1_BPH-0M9-eEM9-eEM7_MU5VF', # legacy 'L1_BPH-0M9-EM7-EM5_MU5VF',
294 'L1_JPSI-1M5-eEM9', # legacy 'L1_JPSI-1M5-EM7'
295 'L1_JPSI-1M5-eEM15', # legacy 'L1_JPSI-1M5-EM12'
296 'L1_jJ90', # legacy 'L1_J50'
297 'L1_jJ90_DETA20-jJ90J', # legacy 'L1_J50_DETA20-J50J'
298 'L1_jJ80', # legacy 'L1_J40'
299 'L1_3jJ55p0ETA23', # 'L1_3J25p0ETA23', # exist in menu
300 'L1_eEM22M_3jJ50', # legacy L1_EM18VHI_3J20
301 'L1_eEM24L_3jJ50', # legacy L1_EM20VH_3J20
302 'L1_eTAU80',
303 'L1_eEM26L',
304 'L1_eEM18',
305 'L1_2eEM18L'
306 ]
307
308
311
312 return [
313 'L1_LFV-MU5VF',
314 'L1_BPH-2M9-0DR15-MU5VFMU3V',
315 'L1_BPH-2M9-0DR15-2MU3V',
316 'L1_BPH-2M9-0DR15-2MU3V',
317 'L1_BPH-0M9-EM7-EM5_MU5VF',
318 'L1_BPH-0DR3-EM7J15_MU5VF',
319 'L1_BPH-0DR3-EM7J15_2MU3V',
320 'L1_JPSI-1M5-EM7',
321 'L1_JPSI-1M5-EM12',
322 'L1_TAU60',
323 'L1_J50',
324 'L1_J50_DETA20-J50J',
325 'L1_J40',
326 'L1_3J25p0ETA23', # exist in menu, but currently not used at HLT. We may drop as CTP output
327 'L1_EM20VH_3J20', # exist in menu, but currently not used at HLT. We may drop as CTP output
328 'L1_EM18VHI_3J20', # exist in menu, but currently not used at HLT. We may drop as CTP output
329 'L1_eTAU80',
330 'L1_eEM26L',
331 'L1_eEM18',
332 'L1_2eEM18L'
333 ]
334
335
338
339L1_multiseed_simple_getters = {
340 'L1_J': getL1JetBS,
341 'L1_Bkg': getL1BackgroundSeed,
342 'L1_BS': getL1BSSeed,
343 'L1_LowLumi': getL1LowLumi,
344 'L1_BKeeLowMu': getL1BKeeLowMu,
345 'L1_BKeePrimary': getL1BKeePrimary,
346 'L1_BKeePrimaryLegacy': getL1BKeePrimaryLegacy,
347 'L1_BKeePrescaled': getL1BKeePrescaled,
348 'L1_BKeePrescaledLegacy': getL1BKeePrescaledLegacy,
349}
350
351valid_multiseeds = [
352 'L1_All',
353 # EnhancedBias
354 'L1_PhysicsHigh_noPS', 'L1_PhysicsVeryHigh_noPS',
355 'L1_EMPTY_noPS', 'L1_FIRSTEMPTY_noPS',
356 'L1_UNPAIRED_ISO_noPS', 'L1_UNPAIRED_NONISO_noPS', 'L1_UNPAIREDB1_noPS', 'L1_UNPAIREB2_noPS', 'L1_ABORTGAPNOTCALIB_noPS',
357 # Trigger types
358 'L1_Calo', 'L1_Calo_EMPTY',
359 'L1_Muon', 'L1_Muon_EMPTY',
360 # Other groups defined by matching
361 'L1_Standby', 'L1_Topo', 'L1_TAU'
362] + list(L1_multiseed_simple_getters.keys())
363
364def getSpecificL1Seeds(l1seedname, l1itemobject, menu_name):
365 l1items = l1itemobject.keys()
366 L1Seed = ''
367
368 if l1seedname == '':
369 log.error('No L1item name given!')
370 raise RuntimeError('No name provided to multiseed getter')
371
372 if l1seedname in L1_multiseed_simple_getters:
373 L1Seed = L1_multiseed_simple_getters[l1seedname]()
374 elif l1seedname == 'L1_Standby':
375 L1Seed = getL1StandbySeed(l1items)
376 elif l1seedname == 'L1_Topo':
377 L1Seed = getL1TopoSeed(l1items)
378 elif l1seedname == 'L1_TAU':
379 L1Seed = getL1TauSeed(l1items)
380 elif (l1seedname in ['L1_PhysicsHigh_noPS', 'L1_PhysicsVeryHigh_noPS', 'L1_EMPTY_noPS', 'L1_FIRSTEMPTY_noPS', 'L1_UNPAIRED_ISO_noPS', 'L1_UNPAIRED_NONISO_noPS', 'L1_UNPAIREDB1_noPS', 'L1_UNPAIREB2_noPS', 'L1_ABORTGAPNOTCALIB_noPS']):
381 L1Seed = getEBnoL1PSSeed(l1items, l1seedname)
382 elif (l1seedname in ['L1_Calo', 'L1_Calo_EMPTY']):
383 L1Seed = getL1CaloSeed(l1seedname, l1itemobject)
384 elif (l1seedname in ['L1_Muon', 'L1_Muon_EMPTY']):
385 L1Seed = getL1MuonSeed(l1seedname, l1itemobject)
386 elif (l1seedname == 'L1_All'):
387 return []
388 else:
389 log.error('Given seed %s could not be found!', l1seedname)
390 raise RuntimeError(f'Failed to retrieve L1 item list for {l1seedname}')
391
392 # check if all the l1 background seeds given are in the current L1 menu
393 for item in L1Seed:
394 if item not in l1items:
395 log.error('L1 item %s from %s seeds is not in current L1 menu', item, l1seedname)
396
397 L1Seed.sort()
398 L1Seed = ",".join(L1Seed)
399
400 return L1Seed
401
402
405def getInputTEfromL1Item(l1item, menu_name):
406
407 L1Map = {
408 'L1_TAU8_EMPTY' : ['HA8'],
409 'L1_TAU8_FIRSTEMPTY' : ['HA8'],
410 'L1_TAU8_UNPAIRED_ISO' : ['HA8'],
411 'L1_TAU8_UNPAIRED_NONISO': ['HA8'],
412 'L1_TAU12_EMPTY' : ['HA12'],
413 'L1_TAU12_FIRSTEMPTY' : ['HA12'],
414 'L1_TAU12_UNPAIRED_ISO' : ['HA12'],
415 'L1_RD0_FIRSTEMPTY' : [''],
416 'L1_TAU30' : ['HA30'],
417 'L1_TAU30_EMPTY' : ['HA30'],
418 'L1_TAU30_UNPAIRED_ISO' : ['HA30'],
419 'L1_TAU40' : ['HA40'],
420 'L1_TAU60' : ['HA60'],
421 'L1_TAU100' : ['HA100'],
422 }
423
424 L1Map['L1_CALREQ2']=['CAL2']
425
426 if l1item in L1Map:
427 TE = L1Map[l1item]
428 log.debug('Mapped L1 input TE from %s to %s.', l1item, TE)
429 return TE
430 else:
431 TE = l1item.replace("L1_","").split("_")[0]
432 TE = TE[1:] if TE[0].isdigit() else TE
433 return TE
434
STL class.
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:179
getL1StandbySeed(l1items)
Definition L1Seeds.py:57
getInputTEfromL1Item(l1item, menu_name)
map from l1item name to inputTE
Definition L1Seeds.py:405
Lvl1ItemByTriggerType(l1object, triggertype_pattern, triggertype_bitmask)
obtain the l1 items according to the the trigger type function taken originally from TriggerPythonCon...
Definition L1Seeds.py:22
getL1BKeePrimaryLegacy()
DO NOT EDIT IT: this function is to save L1_BKeePrimary seeds for data23, Athena,23....
Definition L1Seeds.py:240
getL1BKeePrescaledLegacy()
DO NOT EDIT IT: this function is to save L1_BKeePrescaled seeds for data23 with Athena,...
Definition L1Seeds.py:310
getSpecificL1Seeds(l1seedname, l1itemobject, menu_name)
Definition L1Seeds.py:364
getL1MuonSeed(l1seed, l1object)
Definition L1Seeds.py:94
getEBnoL1PSSeed(l1items, l1seedname)
Definition L1Seeds.py:108
getL1BackgroundSeed()
define the various seeds
Definition L1Seeds.py:42
getL1CaloSeed(l1seed, l1object)
Definition L1Seeds.py:70