3 from copy
import deepcopy
5 from AthenaCommon.Logging
import logging
6 log = logging.getLogger( __name__ )
10 listOfSplitChainDicts = []
12 move_jets =
'Bjet' in chainDict[
'signatures']
16 for chainPart
in chainDict[
'chainParts']:
17 thisSignature = chainPart[
'signature']
18 chainPartAdded =
False
20 for splitChainDict
in listOfSplitChainDicts:
21 splitSignature = splitChainDict[
'chainParts'][0][
'signature']
22 if thisSignature == splitSignature
or \
23 (move_jets
and thisSignature ==
'Jet' and splitSignature ==
'Bjet')
or \
24 (move_jets
and thisSignature ==
'Bjet' and splitSignature ==
'Jet'):
25 splitChainDict[
'chainParts'] += [chainPart]
28 if not chainPartAdded:
29 newSplitChainDict = deepcopy(chainDict)
30 newSplitChainDict[
'chainParts'] = [chainPart]
31 newSplitChainDict[
'signature'] = chainPart[
'signature']
32 listOfSplitChainDicts += [newSplitChainDict]
35 for newDict
in listOfSplitChainDicts:
36 if newDict[
'signature'] ==
'Jet':
37 newDict[
'signature'] =
'Bjet'
42 for splitChainDict
in listOfSplitChainDicts:
43 if 'AND' in [part[
'extra']
for part
in splitChainDict[
'chainParts']]:
44 log.info(
"Implement extra splitting, triggered by AND key (%s.)", chainDict[
'chainName'])
46 listOfSplitChainDicts=[]
48 for chainPart
in chainDict[
'chainParts']:
49 thisSignature = chainPart[
'signature']
50 chainPartAdded =
False
55 thisSignature =
'extraSplit'
60 if 'AND' in chainPart[
'extra']:
64 for splitChainDict
in listOfSplitChainDicts:
66 if 'AND' in [part[
'extra']
for part
in splitChainDict[
'chainParts']]:
68 if thisSignature == splitChainDict[
'chainParts'][0][
'signature']:
70 splitChainDict[
'chainParts'] += [chainPart]
73 if not chainPartAdded:
74 newSplitChainDict = deepcopy(chainDict)
75 newSplitChainDict[
'chainParts'] = [chainPart]
76 newSplitChainDict[
'signature'] = chainPart[
'signature']
77 listOfSplitChainDicts += [newSplitChainDict]
83 orderedListOfSplitChainDicts = []
84 if "mergingOrder" not in chainDict:
85 log.debug(
"No merging order given for chain %s.", chainDict[
'chainName'])
86 elif chainDict[
"mergingOrder"] == []:
87 log.debug(
"No merging order given for chain %s.", chainDict[
'chainName'])
89 for chainPartName
in chainDict[
"mergingOrder"]:
90 for splitChainDict
in listOfSplitChainDicts:
91 if splitChainDict[
'chainParts'][0][
'chainPartName'] == chainPartName:
92 orderedListOfSplitChainDicts += [splitChainDict]
94 if not len(orderedListOfSplitChainDicts) == len(listOfSplitChainDicts):
95 for chainPartName
in chainDict[
"mergingOrder"]:
96 log.error(
"Ordering of split chain dicts failed. Please check that orderedListOfSplitChainDicts and listOfSplitChainDicts contain the same elements!!")
99 return orderedListOfSplitChainDicts
101 return listOfSplitChainDicts
105 listOfChainDicts = []
106 for chainPart
in chainDict[
'chainParts']:
107 newChainDict = deepcopy(chainDict)
108 newChainDict[
'chainParts'] = [chainPart]
109 listOfChainDicts += [newChainDict]
110 return listOfChainDicts
113 from TrigCompositeUtils.TrigCompositeUtils
import legName
114 if len(chainDict[
'chainParts']) ==1:
117 chainName= chainDict[
'chainName']
118 listOfChainDicts = []
119 for count, chainDictPart
in enumerate(chainDict[
'chainParts']):
120 onePartChainDict = deepcopy( chainDict )
121 onePartChainDict[
'chainParts'] = [ chainDictPart ]
122 onePartChainDict[
'chainName'] =
legName(chainName, count)
123 listOfChainDicts += [onePartChainDict]
124 return listOfChainDicts
128 from TriggerMenuMT.HLT.Config.Utility.HLTMenuConfig
import HLTMenuConfig
129 from TrigCompositeUtils.TrigCompositeUtils
import legName
130 chainDict = HLTMenuConfig.getChainDictFromChainName(chainName)
131 if len(chainDict[
'chainParts']) ==1:
132 return [deepcopy(chainDict)]
134 listOfChainDicts = []
135 for count, chainDictPart
in enumerate(chainDict[
'chainParts']):
136 onePartChainDict = deepcopy( chainDict )
137 onePartChainDict[
'chainParts'] = [ chainDictPart ]
138 onePartChainDict[
'chainName'] =
legName(chainName, count)
139 listOfChainDicts += [onePartChainDict]
140 return listOfChainDicts