35 def __init__(self, flags, chain_part: dict[str, Any]):
36 self._id = getChainIDConfigName(flags, chain_part)
37 self._chain_part = chain_part
38
39 self._id_wp = ''
40 self._highpt_id_wp = ''
41 self._do_perfcore = True
42 self._do_perfiso = True
43
44 self._use_rnn_selection = False
45
46 if self._id in ['idperf', 'noperf', 'perfcore', 'perfiso', 'perf']:
47 self._do_perfcore = self._id in ['perfcore', 'perf']
48 self._do_perfiso = self._id in ['perfiso', 'perf']
49
50 else:
51 if self._id in ['DeepSet', 'RNNLLP'] and self._chain_part['selection'].endswith('RNN'):
52
53 self._use_rnn_selection = True
54 self._id_wp = self._chain_part['selection'][:-3]
55 if self._id_wp in ['medium', 'tight']: self._highpt_id_wp = 'loose'
56
57 else:
58 id_wp = self._chain_part['selection'].removesuffix(self._id).lower()
59
60
61 sfx = id_wp[-2:]
62 if sfx in ['np', 'pc', 'pi']: id_wp = id_wp[:-2]
63 if sfx in ['np', 'pi']: self._do_perfcore = False
64 if sfx in ['np', 'pc']: self._do_perfiso = False
65
66
67 def find_wp(wp: str, fail: bool = True) -> str:
68 for twp in getattr(flags.Trigger.Offline.Tau, self._id).TargetWPs.keys():
69 if twp.lower() == wp: return twp
70 else:
71 if fail: ValueError(f'Cannot find the "{self._id}" WP "{wp}"')
72 else: return ''
73
74
75 self._id_wp = find_wp(id_wp)
76
77
78 if id_wp.startswith('medium'): self._highpt_id_wp = find_wp(f'loose{id_wp[6:]}', True)
79 elif id_wp.startswith('tight'): self._highpt_id_wp = find_wp(f'loose{id_wp[5:]}', True)
80