21def IDCalibHypoToolFromDict(flags, chainDict):
22
23 log = logging.getLogger('IDCalibHypoTool')
24
25 """ Use menu decoded chain dictionary to configure the tool """
26 cparts = [i for i in chainDict['chainParts'] if i['signature']=='Calib']
27
28 name = "default_chain_name"
29 if 'chainName' in chainDict:
30 name = chainDict['chainName']
31 else:
32 log.error("chainName not in chain dictionary")
33
34
35 m = re.search(r'trk(\d+)',[ cpart['hypo'] for cpart in cparts ][0])
36 threshold = m.group(1)
37
38 mult = [ cpart['multiplicity'] for cpart in cparts ][0]
39 thresholds = [ float(threshold) for x in range(0,int(mult)) ]
40 log.debug("Threshold values are: %s", ", ".join(str(THR) for THR in thresholds))
41
42 tool = CompFactory.IDCalibHypoTool(name,
43 cutTrackPtGeV = thresholds)
44 return tool