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 ],
130 'PhysicsVeryHigh':
131 [
132 'L1_jJ500', 'L1_jXE500'
133 ],
134 'EMPTY':
135 [
136 'L1_jJ30_EMPTY', 'L1_jJ60_EMPTY', 'L1_MU8VF_EMPTY', 'L1_eTAU12_EMPTY', 'L1_eTAU60_EMPTY', 'L1_eEM15_EMPTY'
137 ],
138 'FIRSTEMPTY':
139 [
140 'L1_jJ30_FIRSTEMPTY', 'L1_eTAU12_FIRSTEMPTY', 'L1_eEM9_FIRSTEMPTY'
141 ],
142 'UNPAIRED_ISO':
143 [
144 'L1_jJ30_UNPAIRED_ISO', 'L1_jJ40p30ETA49_UNPAIRED_ISO',
145 'L1_MU3V_UNPAIRED_ISO', 'L1_eEM9_UNPAIRED_ISO', 'L1_eTAU12_UNPAIRED_ISO', 'L1_eTAU60_UNPAIRED_ISO'
146 ],
147 'UNPAIRED_NONISO':
148 [
149 'L1_jJ30_UNPAIRED_NONISO',
150 ],
151 'ABORTGAPNOTCALIB': [] # No more items defined in this historical bunchgroup
152 }[ebitem]
153
154 return l1EBitems
155
156
158 return [
159 'L1_eEM24L',
160 'L1_2EM10VH',
161 'L1_2MU5VF', 'L1_3MU3V',
162 'L1_eEM18L_MU8F',
163 'L1_2eEM10L_MU8F',
164 'L1_TAU60',
165 'L1_cTAU30M_2cTAU20M_jJ55_2jJ50_3jJ30',
166 'L1_EM15HI_2TAU12IM_XE35',
167 'L1_MU8F_cTAU20M_jXE70',
168 'L1_TAU20_2TAU12_XE35',
169 'L1_cTAU30M_2cTAU20M_jXE70',
170 'L1_EM15HI_2TAU12IM', 'L1_EM15HI_2TAU12IM_J25_3J12',
171 'L1_EM15HI_TAU40_2TAU15',
172 'L1_MU8F_cTAU20M_jJ55_2jJ30',
173 'L1_MU8F_cTAU20M',
174 'L1_J75', #'L1_4J15',
175 'L1_XE50', 'L1_3J25p0ETA23',
176 'L1_3J40', 'L1_2jJ40_jXE110',
177 'L1_MU5VF_jJ80', 'L1_J75p31ETA49'
178 ]
179
180
182
183 return [
184 'L1_eEM24L_3eEM12L',
185 'L1_eEM22M_jMJJ-300', # legacy 'L1_EM18VHI_MJJ-300'
186 'L1_eEM18L_MU8F',
187 'L1_BPH-0M9-eEM9-eEM7_2MU3V', # legacy 'L1_BPH-0M9-EM7-EM5_2MU3V'
188 'L1_MU14FCH',
189 'L1_MU8VF_2MU5VF', # Replacing 'L1_MU8F_2MU5VF'
190 'L1_BPH-2M9-2DR15-2MU5VF',
191 'L1_cTAU30M_3DR35-MU8F-eTAU30',
192 'L1_MU8F_cTAU20M_3jJ30',
193 'L1_jXE100', # legacy 'L1_XE50',
194 '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
195 'L1_eEM18M_2cTAU20M_jXE70', # legacy 'L1_EM15VHI_2TAU12IM_XE35'
196 'L1_cTAU35M_2cTAU30M_2jJ55_3jJ50', # legacy 'L1_TAU25IM_2TAU20IM_2J25_3J20'
197 'L1_cTAU30M_2cTAU20M_4jJ30p0ETA25', # legacy 'L1_TAU20IM_2TAU12IM_4J12p0ETA25'
198 'L1_eEM18M_2cTAU20M_4jJ30', # legacy 'L1_EM15VHI_2TAU12IM_4J12'
199 'L1_jMJJ-700', # legacy 'L1_MJJ-700'
200 'L1_jMJJ-500-NFF', # legacy 'L1_MJJ-500-NFF'
201 'L1_jJ140_3jJ60', # legacy 'L1_J85_3J30',
202 'L1_jJ80p0ETA25_2jJ55_jJ50p30ETA49', # legacy 'L1_J40p0ETA25_2J25_J20p31ETA49'
203 'L1_jJ55p0ETA23_2jJ40p30ETA49', # legacy 'L1_J25p0ETA23_2J15p31ETA49'
204 'L1_jJ160', # legacy 'L1_J100'
205 'L1_4jJ40', # legacy 'L1_4J15'
206 'L1_3jJ70p0ETA23', # legacy 'L1_3J35p0ETA23'
207 'L1_3jJ40p0ETA25_jXE80', # legacy 'L1_3J15p0ETA25_XE40'
208 'L1_2eEM24L',
209 'L1_2eEM18', 'L1_2eEM18M',
210 'L1_eEM26M',
211 'L1_eEM28M',
212 'L1_2eEM10L_MU8F',
213 'L1_MU18VFCH',
214 'L1_eTAU80_2eTAU60',
215 'L1_cTAU30M_2cTAU20M_DR-eTAU30eTAU20-jJ55'
216 ]
217
218
221
222 return [
223 'L1_JPSI-1M5-eEM9', 'L1_JPSI-1M5-eEM15',
224 'L1_BPH-0M9-eEM9-eEM7_MU5VF',
225 'L1_eEM24L_3eEM12L',
226 'L1_EM18VHI_MJJ-300',
227 'L1_eEM18L_MU8F',
228 'L1_BPH-0M9-EM7-EM5_2MU3V',
229 'L1_MU14FCH',
230 'L1_MU8F_2MU5VF',
231 'L1_MU8F_TAU20IM',
232 'L1_MU8F_TAU12IM_3J12',
233 'L1_XE50',
234 'L1_TAU60_2TAU40',
235 'L1_TAU40_2TAU12IM_XE40',
236 'L1_EM15VHI_2TAU12IM_XE35',
237 'L1_TAU25IM_2TAU20IM_2J25_3J20',
238 'L1_TAU20IM_2TAU12IM_4J12p0ETA25',
239 'L1_EM15VHI_2TAU12IM_4J12',
240 'L1_DR-TAU20ITAU12I-J25',
241 'L1_MJJ-700',
242 'L1_MJJ-500-NFF',
243 'L1_J85_3J30',
244 'L1_J40p0ETA25_2J25_J20p31ETA49',
245 'L1_J25p0ETA23_2J15p31ETA49',
246 'L1_J100',
247 #'L1_4J15',
248 'L1_3J35p0ETA23',
249 'L1_3J15p0ETA25_XE40',
250 'L1_2eEM24L',
251 'L1_eEM18','L1_2eEM18', 'L1_2eEM18M', 'L1_2eEM18L',
252 'L1_eEM26M', 'L1_eEM26L',
253 'L1_eEM28M',
254 'L1_eEM24L_3eEM12L',
255 'L1_eEM22M_jMJJ-300',
256 'L1_eEM18L_MU8F',
257 'L1_2eEM10L_MU8F',
258 'L1_BPH-0M9-eEM9-eEM7_2MU3V',
259 'L1_MU18VFCH',
260 'L1_eTAU80_2eTAU60',
261 'L1_jJ160'
262 ]
263
264
266
267 return [
268 'L1_LFV-MU5VF',
269 'L1_BPH-2M9-0DR15-MU5VFMU3V', # disabled
270 'L1_BPH-2M9-0DR15-C-MU5VFMU3V',
271 'L1_BPH-2M9-0DR15-2MU3V', #disabled
272 'L1_BPH-2M9-0DR15-2MU3VF',
273 'L1_BPH-0M9-eEM9-eEM7_MU5VF', # legacy 'L1_BPH-0M9-EM7-EM5_MU5VF',
274 'L1_JPSI-1M5-eEM9', # legacy 'L1_JPSI-1M5-EM7'
275 'L1_JPSI-1M5-eEM15', # legacy 'L1_JPSI-1M5-EM12'
276 'L1_jJ90', # legacy 'L1_J50'
277 'L1_jJ90_DETA20-jJ90J', # legacy 'L1_J50_DETA20-J50J'
278 'L1_jJ80', # legacy 'L1_J40'
279 'L1_3jJ55p0ETA23', # 'L1_3J25p0ETA23', # exist in menu
280 'L1_eEM22M_3jJ50', # legacy L1_EM18VHI_3J20
281 'L1_eEM24L_3jJ50', # legacy L1_EM20VH_3J20
282 'L1_eTAU80',
283 'L1_eEM26L',
284 'L1_eEM18',
285 'L1_2eEM18L'
286 ]
287
288
291
292 return [
293 'L1_LFV-MU5VF',
294 'L1_BPH-2M9-0DR15-MU5VFMU3V',
295 'L1_BPH-2M9-0DR15-2MU3V',
296 'L1_BPH-2M9-0DR15-2MU3V',
297 'L1_BPH-0M9-EM7-EM5_MU5VF',
298 'L1_BPH-0DR3-EM7J15_MU5VF',
299 'L1_BPH-0DR3-EM7J15_2MU3V',
300 'L1_JPSI-1M5-EM7',
301 'L1_JPSI-1M5-EM12',
302 'L1_TAU60',
303 'L1_J50',
304 'L1_J50_DETA20-J50J',
305 'L1_J40',
306 'L1_3J25p0ETA23', # exist in menu, but currently not used at HLT. We may drop as CTP output
307 'L1_EM20VH_3J20', # exist in menu, but currently not used at HLT. We may drop as CTP output
308 'L1_EM18VHI_3J20', # exist in menu, but currently not used at HLT. We may drop as CTP output
309 'L1_eTAU80',
310 'L1_eEM26L',
311 'L1_eEM18',
312 'L1_2eEM18L'
313 ]
314
315
318
319L1_multiseed_simple_getters = {
320 'L1_J': getL1JetBS,
321 'L1_Bkg': getL1BackgroundSeed,
322 'L1_BS': getL1BSSeed,
323 'L1_LowLumi': getL1LowLumi,
324 'L1_BKeePrimary': getL1BKeePrimary,
325 'L1_BKeePrimaryLegacy': getL1BKeePrimaryLegacy,
326 'L1_BKeePrescaled': getL1BKeePrescaled,
327 'L1_BKeePrescaledLegacy': getL1BKeePrescaledLegacy,
328}
329
330valid_multiseeds = [
331 'L1_All',
332 # EnhancedBias
333 'L1_PhysicsHigh_noPS', 'L1_PhysicsVeryHigh_noPS',
334 'L1_EMPTY_noPS', 'L1_FIRSTEMPTY_noPS',
335 'L1_UNPAIRED_ISO_noPS', 'L1_UNPAIRED_NONISO_noPS', 'L1_UNPAIREDB1_noPS', 'L1_UNPAIREB2_noPS', 'L1_ABORTGAPNOTCALIB_noPS',
336 # Trigger types
337 'L1_Calo', 'L1_Calo_EMPTY',
338 'L1_Muon', 'L1_Muon_EMPTY',
339 # Other groups defined by matching
340 'L1_Standby', 'L1_Topo', 'L1_TAU'
341] + list(L1_multiseed_simple_getters.keys())
342
343def getSpecificL1Seeds(l1seedname, l1itemobject, menu_name):
344 l1items = l1itemobject.keys()
345 L1Seed = ''
346
347 if l1seedname == '':
348 log.error('No L1item name given!')
349 raise RuntimeError('No name provided to multiseed getter')
350
351 if l1seedname in L1_multiseed_simple_getters:
352 L1Seed = L1_multiseed_simple_getters[l1seedname]()
353 elif l1seedname == 'L1_Standby':
354 L1Seed = getL1StandbySeed(l1items)
355 elif l1seedname == 'L1_Topo':
356 L1Seed = getL1TopoSeed(l1items)
357 elif l1seedname == 'L1_TAU':
358 L1Seed = getL1TauSeed(l1items)
359 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']):
360 L1Seed = getEBnoL1PSSeed(l1items, l1seedname)
361 elif (l1seedname in ['L1_Calo', 'L1_Calo_EMPTY']):
362 L1Seed = getL1CaloSeed(l1seedname, l1itemobject)
363 elif (l1seedname in ['L1_Muon', 'L1_Muon_EMPTY']):
364 L1Seed = getL1MuonSeed(l1seedname, l1itemobject)
365 elif (l1seedname == 'L1_All'):
366 return []
367 else:
368 log.error('Given seed %s could not be found!', l1seedname)
369 raise RuntimeError(f'Failed to retrieve L1 item list for {l1seedname}')
370
371 # check if all the l1 background seeds given are in the current L1 menu
372 for item in L1Seed:
373 if item not in l1items:
374 log.error('L1 item %s from %s seeds is not in current L1 menu', item, l1seedname)
375
376 L1Seed.sort()
377 L1Seed = ",".join(L1Seed)
378
379 return L1Seed
380
381
384def getInputTEfromL1Item(l1item, menu_name):
385
386 L1Map = {
387 'L1_TAU8_EMPTY' : ['HA8'],
388 'L1_TAU8_FIRSTEMPTY' : ['HA8'],
389 'L1_TAU8_UNPAIRED_ISO' : ['HA8'],
390 'L1_TAU8_UNPAIRED_NONISO': ['HA8'],
391 'L1_TAU12_EMPTY' : ['HA12'],
392 'L1_TAU12_FIRSTEMPTY' : ['HA12'],
393 'L1_TAU12_UNPAIRED_ISO' : ['HA12'],
394 'L1_RD0_FIRSTEMPTY' : [''],
395 'L1_TAU30' : ['HA30'],
396 'L1_TAU30_EMPTY' : ['HA30'],
397 'L1_TAU30_UNPAIRED_ISO' : ['HA30'],
398 'L1_TAU40' : ['HA40'],
399 'L1_TAU60' : ['HA60'],
400 'L1_TAU100' : ['HA100'],
401 }
402
403 L1Map['L1_CALREQ2']=['CAL2']
404
405 if l1item in L1Map:
406 TE = L1Map[l1item]
407 log.debug('Mapped L1 input TE from %s to %s.', l1item, TE)
408 return TE
409 else:
410 TE = l1item.replace("L1_","").split("_")[0]
411 TE = TE[1:] if TE[0].isdigit() else TE
412 return TE
413
STL class.
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177
getL1StandbySeed(l1items)
Definition L1Seeds.py:57
getInputTEfromL1Item(l1item, menu_name)
map from l1item name to inputTE
Definition L1Seeds.py:384
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:220
getL1BKeePrescaledLegacy()
DO NOT EDIT IT: this function is to save L1_BKeePrescaled seeds for data23 with Athena,...
Definition L1Seeds.py:290
getSpecificL1Seeds(l1seedname, l1itemobject, menu_name)
Definition L1Seeds.py:343
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