5 Class to obtain the chain configuration dictionary from the short or long name
7 Authors of original code in TriggerMenu: Joerg Stelzer, Moritz Backes, Catrin Bernius
10 __author__ =
'Catrin Bernius'
12 __doc__=
"Decoding of chain name into a dictionary"
14 from TriggerMenuMT.HLT.Menu.EventBuildingInfo
import isRoIBasedPEB
15 from TrigConfHLTUtils.HLTUtils
import string2hash
16 from AthenaCommon.Logging
import logging
18 from copy
import deepcopy
20 import collections.abc
22 log = logging.getLogger( __name__ )
26 Extracts the L1 seed from the chain name, checks for issue in naming, if found, fails
28 In simple case the L1 items is just the last part of the name, after the _L1...
29 There are though more complicated names like ...._L1...._L1..._L1... in such cases the L1 seed item is the last one
31 assert '_L1' in chainName,
'ERROR IN CHAIN {}, missing L1 seed at the end i.e. _L1...' .
format(chainName)
33 from TriggerMenuMT.HLT.Menu.L1Seeds
import valid_multiseeds, getSpecificL1Seeds
34 from TrigConfigSvc.TriggerConfigAccess
import getL1MenuAccess
37 cNameParts = chainName.rsplit(
"_L1",1)
38 l1seed =
'L1_' + cNameParts[-1]
41 if l1seed ==
'L1_All':
43 if l1seed ==
'L1_test':
44 return 'L1_EM24VHI,L1_MU20'
45 if l1seed
in valid_multiseeds:
48 itemsDict = lvl1access.items(includeKeys = [
'name',
'ctpid',
'triggerType'])
60 Breaks the item name into parts separated by the _ and from each element extract the threshold name
62 Fails when used on topo items or ill formatted items
63 Examples: L1_MU4 returns [MU4]
64 L1_2MU4 returns [MU4, MU4]
65 L1_MU4_MU6 returns [MU4, MU6]
67 assert item.startswith(
"L1_"),
"The L1 item {} name does not start with L1".
format( item )
68 assert "-" not in item,
"The {} is Topo item and can not be parsed".
format( item )
70 multThressholds = item.split(
"_")[1:]
72 for mt
in multThressholds:
73 assert mt[0] !=
'1',
'Issue while parsing {}, multiplicity of 1, should not be configured, if multiplicity greater than 9 is needed then support for it needs to be added'.
format( mt )
74 if mt[0]
in '23456789':
75 thresholds.extend(
int(mt[0])*[mt[1:]] )
77 thresholds.append( mt )
82 As above but eliminates repeated thresholds
89 return [
_(t)
for t
in allThreshold
if t
not in s ]
93 If EB identifier is in the name, return it.
95 Checks if there is only one identifier
98 from TriggerMenuMT.HLT.Menu.EventBuildingInfo
import getAllEventBuildingIdentifiers
100 assert len(eventBuildTypes) <= 1,
'Chain {} has more than one Event Building identifier: {}, that is not supported'.
format( chainName, eventBuildTypes)
102 return eventBuildTypes.pop()
108 Decode threshold value from the chain name
111 from TriggerMenuMT.HLT.Menu.SignatureDicts
import getBasePattern
117 for cpart
in chainParts:
118 m = pattern.match( cpart )
120 log.debug(
"In getChainThresholdFromName: Pattern found in this string: %s", cpart)
121 groupdict = m.groupdict()
122 allThresh.append(groupdict[
'threshold'])
123 trigType.append(groupdict[
'trigType'])
124 if signature == groupdict[
'trigType']:
125 thresholdToPass = groupdict[
'threshold']
127 return thresholdToPass
131 Look for all multiplicities stored in chains
135 for cpart
in chainDict[
'chainParts']:
136 if cpart[
'multiplicity'] !=
'':
137 allMultis.append(
int(cpart[
'multiplicity']))
145 matchL1 = re.compile(
'L1([a-zA-Z0-9]+)(_.*)?')
147 assert len(L1thresholds)>0, f
'L1 thresholds cannot be inferred from L1 name for chain {chainname} with explicit L1 seed thresholds'
149 log.debug(
'Verifying explicit L1 thresholds for %s, received L1thresholds %s',chainname,L1thresholds)
152 for part, threshold
in zip(chainparts,L1thresholds):
154 matches = matchL1.findall(part)
155 assert len(matches)==1, f
"Inappropriate number of L1 thresholds {matches} in chain part '{part}'"
156 thisL1, remainder = matches[0]
157 assert remainder ==
'', f
"Explicit L1 threshold should be last element in chain part {part}"
158 log.verbose(
' ChainPart %s has explicit L1 threshold %s',part,thisL1)
159 assert 'PROBE' not in thisL1, f
"Omit 'PROBE' from explicit L1 threshold '{thisL1}'"
160 assert thisL1 == threshold.replace(
'PROBE',
''), f
"Explicit L1 threshold for chainpart '{thisL1}' does not match threshold '{threshold}' from list"
162 assert counter>0, f
"Did not find explicit L1 seeds in chain parts for {chainname}!"
165 from TriggerMenuMT.HLT.Menu.SignatureDicts
import getSignatureInformation, JetRecoKeys
168 Postprocess the jet chainParts to set all the reco config consistently
169 For formatting reasons, we extract these from the last jet chainPart
170 then propagate to all jet chainParts.
171 Any inconsistencies in non-default options are considered a malformed chain
172 Technically we can't tell if the default was explicitly set, though.
177 _jetRecoKeys = JetRecoKeys
178 jetChainParts = [cPart
for cPart
in chainParts
if cPart[
'signature']
in [
'Jet',
'Bjet']]
179 jetRecoDict = {k:jetChainParts[-1][k]
for k
in _jetRecoKeys}
182 for p
in jetChainParts[:-1]:
183 for k
in _jetRecoKeys:
185 if p[k] != jetDefaults[k]:
186 log.error(
'Inconsistent jet reco setting for %s in chainPart %s', k, p[
'chainPartName'])
187 log.error(
'Jet chainParts: %s', jetChainParts)
188 raise RuntimeError(
'Jet reco should be specified only in the last jet chainPart')
192 for cPart
in chainParts:
193 newCPart = deepcopy(cPart)
194 if newCPart[
'signature']
in [
'Jet',
'Bjet']:
195 for k
in _jetRecoKeys:
196 newCPart[k] = jetRecoDict[k]
197 newChainParts.append(newCPart)
203 Function to obtain the chain configuration dictionary from the short name by parsing its
204 components and finding the corresponding properties which are defined in SignatureDicts.
205 The naming convention is defined in https://twiki.cern.ch/twiki/bin/view/Atlas/TriggerNamingRun2
206 and https://twiki.cern.ch/twiki/bin/view/Atlas/TriggerNamingRun3
210 from TriggerMenuMT.HLT.Menu.SignatureDicts
import ChainDictTemplate
211 from TriggerMenuMT.HLT.Menu.SignatureDicts
import getSignatureInformation
212 from TriggerMenuMT.HLT.Jet.JetRecoCommon
import etaRangeAbbrev
213 genchainDict = deepcopy(ChainDictTemplate)
214 genchainDict[
'chainName'] = chainName
217 hltChainName = chainName.rsplit(
"_L1",1)[0]
220 if 'HLT_HLT' in hltChainName:
221 log.error(
"%s is incorrect, please fix the HLT_HLT part", hltChainName)
222 raise RuntimeError(
"[analyseChainName] chain name contains HLT_HLT, please fix in corresponding menu where this chain is included")
225 allChainProperties=[]
226 cparts = hltChainName.split(
"_")
227 if 'HLT' in hltChainName:
232 if genchainDict[
'eventBuildType']:
233 cparts.remove( genchainDict[
'eventBuildType'] )
235 hltChainNameShort =
'_'.
join(cparts)
238 from TriggerMenuMT.HLT.Menu.SignatureDicts
import AllowedTopos, AllowedTopos_comb, AllowedTopos_Bphysics_topoVariant, AllowedTopos_Bphysics_topoExtra
247 for cindex, cpart
in enumerate(cparts):
249 if cpart
in AllowedTopos:
250 log.debug(
'" %s" is in this part of the name %s -> topo alg', AllowedTopos, cpart)
253 toposIndexed.update({topo : topoindex})
254 hltChainNameShort=hltChainNameShort.replace(
'_'+cpart,
'')
256 elif cpart
in AllowedTopos_Bphysics_topoVariant:
257 log.debug(
'[analyseChainName] chain part %s is a BLS topo variant, adding to bphys_topoVariant', cpart)
258 bphys_topoVariant.append(cpart)
259 toposIndexed.update({cpart : cindex})
261 elif cpart
in AllowedTopos_Bphysics_topoExtra:
262 log.debug(
'[analyseChainName] chain part %s is a BLS extra topo hypo, adding to bphys_topoExtra', cpart)
263 bphys_topoExtra.append(cpart)
264 toposIndexed.update({cpart : cindex})
267 log.debug(
'[analyseChainName] chain part %s is not a general topo, BLS extra or variant topo hypo, checking comb topos next', cpart)
268 if cpart
in AllowedTopos_comb:
269 log.debug(
'[analyseChainName] chain part %s is a combined topo hypo, adding to extraComboHypo', cpart)
270 toposIndexed.update({cpart : cindex})
271 extraComboHypos.append(cpart)
273 genchainDict[
'topo'] = topos
274 genchainDict[
'extraComboHypos'] = extraComboHypos
276 if bphysTopos
is True:
277 genchainDict[
'topoVariant'] = bphys_topoVariant
278 genchainDict[
'topoExtra'] = bphys_topoExtra
281 for t, i
in enumerate(toposIndexed):
283 log.debug(
'topo %s with index %s is going to be deleted from chain parts', t, i)
292 from TriggerMenuMT.HLT.Menu.SignatureDicts
import getBasePattern
299 from TriggerMenuMT.HLT.Menu.SignatureDicts
import getSignatureNameFromToken, AllowedCosmicChainIdentifiers, \
300 AllowedCalibChainIdentifiers, AllowedMonitorChainIdentifiers, AllowedBeamspotChainIdentifiers
302 from TriggerMenuMT.HLT.Config.Utility.MenuAlignmentTools
import get_alignment_group_from_pattern
as getAlignmentGroupFromPattern
304 def buildDict(signature, sigToken ):
305 groupdict = {
'signature': signature,
'threshold':
'',
'multiplicity':
'',
306 'trigType': sigToken,
'extra':
''}
307 mdicts.append( groupdict )
311 log.debug(
"Looping over chain part: %s", cpart)
312 m = pattern.match(cpart)
315 log.debug(
"Pattern found in this string: %s", cpart)
316 groupdict = m.groupdict()
318 multiChainIndices = [i
for i
in range(len(hltChainNameShort))
if ( hltChainNameShort.startswith(cpart, i) ) ]
319 log.debug(
"MultiChainIndices: %s", multiChainIndices)
320 for theMultiChainIndex
in multiChainIndices:
324 if (theMultiChainIndex != 0) & (hltChainNameShort[theMultiChainIndex-1] !=
'_'):
327 if theMultiChainIndex
not in multichainindex:
328 multichainindex.append(theMultiChainIndex)
330 log.debug(
"HLTChainName: %s", hltChainName)
331 log.debug(
"HLTChainNameShort: %s", hltChainNameShort)
332 log.debug(
"cpart: %s", cpart)
333 log.debug(
"groupdict: %s", groupdict)
334 log.debug(
"multichainindex: %s", multichainindex)
338 groupdict[
'signature'] = sName
339 log.debug(
"groupdict['signature']: %s",groupdict[
'signature'])
341 mdicts.append(groupdict)
343 elif cpart ==
'noalg':
344 multichainindex.append(hltChainNameShort.index(cpart))
345 buildDict(
'Streaming',
'streamer')
347 elif cpart ==
'acceptedevts':
348 multichainindex.append(hltChainNameShort.index(cpart))
349 buildDict(
'Calib',
'calib')
352 for chainCategory
in [([
'mb'],
'MinBias',
'mb'),
353 ([
'hi'],
'HeavyIon',
'mb'),
354 (AllowedCosmicChainIdentifiers,
'Cosmic',
'cosmic'),
355 (AllowedCalibChainIdentifiers,
'Calib',
'calib'),
356 (AllowedMonitorChainIdentifiers,
'Monitor',
'calib'),
357 (AllowedBeamspotChainIdentifiers,
'Beamspot',
'beamspot'),
358 ([
'eb'],
'EnhancedBias',
'eb')]:
359 if cpart
in chainCategory[0]:
360 log.debug(
'Doing chain type %s', chainCategory[1])
361 multichainindex.append(hltChainNameShort.index(cpart))
362 buildDict(chainCategory[1], chainCategory[2])
368 multichainindex =
sorted(multichainindex, key=int)
369 cN = deepcopy(hltChainNameShort)
370 for i
in reversed(multichainindex):
372 log.debug(
'Appending to multichainparts (i!=0): %s', hltChainNameShort[i:len(cN)])
374 multichainparts.append(hltChainNameShort[i:len(cN)])
377 log.debug(
'Appending to multichainparts: %s', hltChainNameShort[i:len(cN)])
378 multichainparts.append(cN)
379 log.debug(
"multichainparts: %s",multichainparts)
383 multichainparts.reverse()
384 log.debug(
'multichainparts after reverse: %s', multichainparts)
388 if len(L1thresholds) != 0:
389 assert len(L1thresholds) == len(multichainparts),
'ERROR IN CHAIN {} definition, l1 thresholds specified {} have different length than chain parts {}'\
390 .
format(chainName,
str(L1thresholds),
str(multichainparts) )
399 if chainName.count(
"_L1") > 1:
402 for chainindex, chainparts
in enumerate(multichainparts):
404 chainpartsNoL1 = chainparts.rsplit(
'_L1',1)[0]
if 'L1' in chainparts
else chainparts
406 if len(L1thresholds) != 0:
407 chainProperties[
'L1threshold'] = L1thresholds[chainindex]
409 __th = getAllThresholdsFromItem ( L1item )
410 assert chainindex < len(__th),
"In defintion of the chain {chainName} there is not enough thresholds to be used, index: {chainindex} >= number of thresholds, thresholds are: {__th}"
411 chainProperties[
'L1threshold'] = __th[chainindex]
413 parts=chainpartsNoL1.split(
'_')
414 log.debug(
"[analyseChainName] chain parts w/o L1 are %s", parts)
416 log.error(
"[analyseChainName] chainpartsNoL1 -> parts: %s -> %s", chainpartsNoL1, parts)
417 raise Exception(
"[analyseChainName] parts contains None, please identify how this is happening")
419 log.debug(
"[analyseChainName] chainpartsNoL1 %s, parts %s", chainpartsNoL1, parts)
422 duplicateParts = ([item
for item, count
in collections.Counter(parts).
items()
if count > 1])
423 log.debug(
"[analyseChainName] chainpartsNoL1 %s contains duplicate strings %s", chainpartsNoL1, duplicateParts)
425 log.error(
"[analyseChainName] chain %s has duplicate strings %s, please fix!!", chainName, duplicateParts)
426 raise RuntimeError(
"[analyseChainName] Check the chain name, there are duplicate configurations: %s", duplicateParts)
428 chainProperties[
'trigType']=mdicts[chainindex][
'trigType']
429 if 'extra' in chainProperties:
430 raise RuntimeError(
"[analyseChainName] Overwrote 'extra' value, only one supported!")
432 chainProperties[
'extra']=mdicts[chainindex][
'extra']
433 multiplicity = mdicts[chainindex][
'multiplicity']
if not mdicts[chainindex][
'multiplicity'] ==
'' else '1'
434 chainProperties[
'multiplicity'] = multiplicity
435 chainProperties[
'threshold']=mdicts[chainindex][
'threshold']
436 chainProperties[
'signature']=mdicts[chainindex][
'signature']
441 chainProperties[
'chainPartName'] = chainparts
442 if (
'-' in L1item)
and (len(multichainparts) > 1):
443 chainProperties[
'chainPartName'] = chainpartsNoL1
445 if len(multichainparts) > 1
and L1item.count(
"_") > 1 :
446 chainProperties[
'chainPartName'] = chainpartsNoL1
448 log.debug(
'[analyseChainname] Chainparts: %s', chainparts)
449 if (chainProperties[
'signature'] !=
'Cosmic') \
450 & (chainProperties[
'signature'] !=
'Calib')\
451 & (chainProperties[
'signature'] !=
'Streaming') \
452 & (chainProperties[
'signature'] !=
'Beamspot') \
453 & (chainProperties[
'signature'] !=
'Monitor') :
458 from TriggerMenuMT.HLT.Menu.SignatureDicts
import AllAllowedTopos_Bphysics
459 for t
in genchainDict[
'topo']:
460 if (t
in AllAllowedTopos_Bphysics):
461 chainProperties[
'signature'] =
'Bphysics'
462 if "tnpInfo" in chainProperties.keys()
and chainProperties[
'tnpInfo'] !=
"":
463 chainProperties[
'alignmentGroup'] = getAlignmentGroupFromPattern(
'Bphysics',chainProperties[
'tnpInfo'])
465 chainProperties[
'alignmentGroup'] = getAlignmentGroupFromPattern(
'Bphysics',chainProperties[
'extra'])
468 SignatureDefaultValues, allowedSignaturePropertiesAndValues =
getSignatureInformation(chainProperties[
'signature'])
469 log.debug(
'SignatureDefaultValues: %s', SignatureDefaultValues)
470 allDefaults =
list(SignatureDefaultValues.values())
471 log.debug(
'All default values in a list')
474 result = deepcopy(SignatureDefaultValues)
475 result.update(chainProperties)
476 chainProperties = result
479 overlaps = [x
for x
in parts
if x
in allDefaults]
480 log.debug(
"parts that are also in defaults: %s ", overlaps)
484 log.warning(
"[analyseChainName] The following chainpart %s contains the string(s) %s which is/are already defined as defaults, please remove!", chainparts, overlaps)
489 log.debug(
"[analyseChainname] parts to match are %s", parts)
490 for pindex, part
in enumerate(parts):
491 for prop, allowedValues
in allowedSignaturePropertiesAndValues.items():
492 if part
in allowedValues:
493 if type(chainProperties[prop])
is list:
494 chainProperties[prop] += [part]
496 chainProperties[prop] = part
497 matchedparts.append(part)
500 if chainProperties[
'signature']==
'Jet':
503 if chainProperties[
'bTag'] !=
'':
504 log.debug(
'Setting b-jet chain defaults')
507 for prop, value
in bJetDefaultValues.items():
509 for value
in allowedbJetPropertiesAndValues[prop]:
510 if value
in matchedparts:
516 log.debug(
'Changing %s from %s to %s', prop,
str(chainProperties[prop]),
str(bJetDefaultValues[prop]))
517 chainProperties[prop] = bJetDefaultValues[prop]
520 if chainProperties[
'signature'] ==
'Jet' and chainProperties[
'beamspotChain'] !=
'':
521 log.debug(
'Setting beamspot chain defaults')
524 for prop, value
in BeamspotDefaultValues.items():
526 for value
in allowedBeamspotPropertiesAndValues[prop]:
527 if value
in matchedparts:
533 log.debug(
'Changing %s from %s to %s', prop,
str(chainProperties[prop]),
str(BeamspotDefaultValues[prop]))
534 chainProperties[prop] = BeamspotDefaultValues[prop]
538 if chainProperties[
'extra']:
541 etarange = etaRangeAbbrev[chainProperties[
'extra']]
542 chainProperties[
'etaRange'] = etarange
544 raise RuntimeError(f
"Invalid jet 'extra' value {chainProperties['extra']} in {chainProperties['chainPartName']}. Only [a,c,f] allowed")
547 log.debug(
"matched parts %s", matchedparts)
548 leftoverparts =
set(parts)-
set(matchedparts)
549 log.debug(
'leftoverparts %s', leftoverparts)
550 for pindex, part
in enumerate(leftoverparts):
551 for prop, allowedValues
in allowedSignaturePropertiesAndValues.items():
552 if prop
in chainProperties.keys():
554 for aV
in allowedValues:
556 if (chainProperties[
'signature']
in [
'Egamma',
'Muon'] )& (prop
in [
'trkInfo',
'hypoInfo']):
557 chainProperties[prop] = part
558 part = part.replace(part,
'')
560 chainProperties[prop] = aV
561 part = part.replace(aV,
'')
564 assert len(part.split()) == 0,
"These parts of the chain name {} are not understood: {}".
format(chainpartsNoL1,part)
568 forbiddenProperties =
set(chainProperties.keys()) -
set(allowedSignaturePropertiesAndValues.keys())
569 log.debug(
'chainProperties: %s',
sorted(
set(chainProperties.keys())))
570 log.debug(
'allowedSignaturePropertiesAndValues: %s',
sorted(
set(allowedSignaturePropertiesAndValues.keys())))
571 for fb
in forbiddenProperties:
572 forbiddenValue = chainProperties.pop(fb)
573 assert forbiddenValue ==
'',
"Property {} not allowed for signature '{}', but specified '{}'".format (fb, chainProperties[
'signature'], forbiddenValue)
578 if any(x
in chainName
for x
in (
'larnoiseburst',
'idcalib',
'metcalo',
'mettrk')):
579 chainProperties[
'alignmentGroup'] =
'JetMET'
581 if 'tnpInfo' in chainProperties.keys()
and chainProperties[
'tnpInfo'] !=
"":
582 chainProperties[
'alignmentGroup'] = getAlignmentGroupFromPattern(mdicts[chainindex][
'signature'],chainProperties[
'tnpInfo'])
584 chainProperties[
'alignmentGroup'] = getAlignmentGroupFromPattern(mdicts[chainindex][
'signature'],chainProperties[
'extra'])
587 allChainProperties.append(chainProperties)
591 genchainDict[
'chainParts'] = allChainProperties
592 for cPart
in allChainProperties:
593 if cPart[
'signature'] ==
'Jet' and cPart[
'bTag'] !=
'':
594 cPart[
'signature'] =
'Bjet'
595 if 'tnpInfo' in cPart.keys()
and cPart[
'tnpInfo'] !=
"":
596 cPart[
'alignmentGroup'] = getAlignmentGroupFromPattern(
'Bjet', cPart[
'tnpInfo'])
598 cPart[
'alignmentGroup'] = getAlignmentGroupFromPattern(
'Bjet', cPart[
'extra'])
599 genchainDict[
'signatures'] += [cPart[
'signature']]
600 genchainDict[
'alignmentGroups'] += [cPart[
'alignmentGroup']]
604 if len(genchainDict[
'chainParts'])>1:
605 if 'Jet' in genchainDict[
'signatures']
or 'Bjet' in genchainDict[
'signatures']:
621 if len(myStream) == 1:
622 if myStream[0] ==
'express':
628 Transforms ChainProp into the ChainDict
631 ---- Loop over all chains (keys) in dictionary ----
632 ---- Then complete the dict with other info ----
633 Default input format will be a ChainProp object:
634 ChainProp(name: str, groups: list[str], l1SeedThresholds: list[str] = [], stream: list[str] = ['Main'],
635 monGroups: list[str] = [], mergingStrategy: str = 'auto', mergingOrder: list[str] = [], mergingOffset: int = -1),
636 but for nwo plain chain name is also supported
640 if type(chainInfo)
is str:
641 chainName = chainInfo
645 mergingStrategy =
'parallel'
650 elif 'ChainProp' in str(
type(chainInfo)):
652 chainName = chainInfo.name
653 l1Thresholds = chainInfo.l1SeedThresholds
654 stream = chainInfo.stream
656 mergingStrategy = chainInfo.mergingStrategy
657 mergingOffset = chainInfo.mergingOffset
658 mergingOrder = chainInfo.mergingOrder
659 monGroups = chainInfo.monGroups
662 raise RuntimeError(
"Format of chainInfo passed to genChainDict not known")
666 raise RuntimeError(
"Chain {}, format of chainInfo:stream {} is not valid".
format(chainName, stream))
670 log.debug(
"Analysing chain with name: %s", chainName)
672 log.debug(
'ChainProperties: %s', chainDict)
674 for chainPart
in chainDict[
'chainParts']:
676 for sf
in chainPart[
'sigFolder']:
677 if sf
in chainDict[
'sigDicts']:
678 chainDict[
'sigDicts'][sf].
extend(chainPart[
'subSigs'])
680 chainDict[
'sigDicts'].
update({sf:chainPart[
'subSigs']})
682 chainDict[
'sigDicts'].
update({
'Jet':[
'Jet']})
685 thisSignature = chainPart[
'signature']
686 thisAlignGroup = chainPart[
'alignmentGroup']
687 thisExtra = chainPart[
'extra']
688 thisL1 = chainPart[
'L1threshold']
689 thisChainPartName = chainPart[
'chainPartName']
691 if thisSignature
in [
'Muon',
'Bphysics']:
692 if 'MuonnoL1' in thisAlignGroup
or 'lateMu' in thisExtra:
693 if 'FSNOSEED' not in thisL1:
694 log.error(
"Muon noL1 and lateMu chain should be seeded from FSNOSEED. Check %s seeded from %s (defined L1: %s), signature %s",chainDict[
'chainName'],thisL1,l1Thresholds,thisSignature)
696 if 'MU' not in thisL1:
697 log.error(
"Standard muon and Bphysics chain should be seeded from L1_MU. Check %s seeded from %s (defined L1: %s), signature %s",chainDict[
'chainName'],thisL1,l1Thresholds,thisSignature)
700 if thisSignature
in [
'Electron',
'Photon']
and not (
'UPC' in stream):
701 if 'EM' not in thisL1
and 'BKee' not in thisL1
and 'All' not in thisL1:
702 log.error(
"Standard egamma chains should be seeded from L1_EM. Check %s seeded from %s (defined L1: %s), signature %s",chainDict[
'chainName'],thisL1,l1Thresholds,thisSignature)
705 if thisSignature
in [
'Tau']:
706 if 'TAU' not in thisL1:
707 log.error(
"Standard tau chains should be seeded from L1_TAU. Check %s seeded from %s (defined L1: %s), signature %s",chainDict[
'chainName'],thisL1,l1Thresholds,thisSignature)
710 if thisSignature
in [
'Jet',
'Bjet',
'MET',
'UnconventionalTracking']:
711 if 'FSNOSEED' not in thisL1:
712 log.error(
"Jet, b-jet, MET chains should be seeded from FSNOSEED. Check %s seeded from %s (defined L1: %s), signature %s",chainDict[
'chainName'],thisL1,l1Thresholds,thisSignature)
715 if thisChainPartName
in [
'noalg']:
717 if 'FSNOSEED' not in thisL1
and not isRoIBasedPEB(chainDict[
'eventBuildType']):
718 log.error(
"noalg chains should be seeded from FSNOSEED. Check %s seeded from %s (defined L1: %s), signature %s",chainDict[
'chainName'],thisL1,l1Thresholds,thisSignature)
725 log.debug(
'Parts: signature %s, align %s, extra %s, L1 %s', thisSignature, thisAlignGroup, thisExtra, thisL1)
730 chainDict[
'L1item'] = L1item
731 chainDict[
'stream'] = stream
732 chainDict[
'groups'] = groups
733 chainDict[
'mergingStrategy'] = mergingStrategy
734 chainDict[
'mergingOffset'] = mergingOffset
735 chainDict[
'mergingOrder'] = mergingOrder
736 chainDict[
'monGroups'] = monGroups
737 chainDict[
'chainNameHash'] =
string2hash(chainDict[
'chainName'])
741 chainDict[
'chainMultiplicities'] = allChainMultiplicities
742 log.debug(
'Setting chain multiplicities: %s ', allChainMultiplicities)
753 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
756 parser = flags.getArgumentParser()
760 help=
'Chain name to be parsed into chain dictionary')
762 '-t',
'--thresholds',
764 help=
'L1 thresholds, needed for multileg or fullscan chains')
765 args = flags.fillFromArgs(parser=parser)
769 from TriggerMenuMT.HLT.Config.Utility.ChainDefInMenu
import ChainProp
770 cd =
dictFromChainName(flags, ChainProp(args.chain,l1SeedThresholds=args.thresholds,groups=[]))
774 from pprint
import pprint
778 with open(f
'{args.chain}.dict.json',
'w')
as f:
779 json.dump(cd, f, indent=2)
783 if __name__==
'__main__':