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