6from AthenaConfiguration.AthConfigFlags
import AthConfigFlags
8from .TrigTauHypoMonitoring
import getTrigTauPrecisionIDHypoToolMonitoring, getTrigTauPrecisionDiKaonHypoToolMonitoring
10from AthenaCommon.Logging
import logging
11log = logging.getLogger(
'TrigHLTTauHypoTool')
17 chainPart = chainDict[
'chainParts'][0]
19 from TriggerMenuMT.HLT.Tau.TauConfigurationTools
import getChainIDConfigName
20 identification = getChainIDConfigName(chainPart)
22 if identification ==
'MesonCuts':
33 def __init__(self, chain_part: dict[str, Any]):
49 if sel ==
'perf' or sel ==
'idperf':
return -1
50 elif sel.startswith(
'veryloose'):
return 0
51 elif sel.startswith(
'loose'):
return 1
52 elif sel.startswith(
'medium'):
return 2
53 elif sel.startswith(
'tight'):
return 3
55 raise ValueError(f
'Invalid selection: {sel}')
58 '''TrigTauPrecisionIDHypoTool configuration for the standard Tau triggers'''
59 name = chainDict[
'chainName']
60 chainPart = chainDict[
'chainParts'][0]
64 from AthenaConfiguration.ComponentFactory
import CompFactory
65 currentHypo = CompFactory.TrigTauPrecisionIDHypoTool(
68 NTracksMax=cuts.n_track_max,
69 NIsoTracksMax=cuts.n_iso_track_max,
73 from TriggerMenuMT.HLT.Tau.TauConfigurationTools
import getChainIDConfigName, getChainPrecisionSeqName, useBuiltInTauJetRNNScore, getPrecisionSequenceTauIDs, getTauIDScoreVariables
75 id_score_monitoring = {}
77 precision_seq_name = getChainPrecisionSeqName(chainPart)
78 identification = getChainIDConfigName(chainPart)
79 if identification
in [
'perf',
'idperf']:
80 if identification ==
'idperf':
81 currentHypo.AcceptAll =
True
84 used_builtin_rnnscore =
False
85 for tau_id
in getPrecisionSequenceTauIDs(flags, precision_seq_name):
87 if tau_id
in [
'MesonCuts']:
continue
90 if useBuiltInTauJetRNNScore(tau_id, precision_seq_name):
91 if used_builtin_rnnscore:
92 raise ValueError(
'Cannot have two TauID algorithms with scores stored in the built-in TauJet RNN score variables')
93 used_builtin_rnnscore =
True
95 id_score_monitoring[tau_id] = getTauIDScoreVariables(tau_id, precision_seq_name)
98 if useBuiltInTauJetRNNScore(identification, precision_seq_name):
101 currentHypo.IDMethod = 1
104 currentHypo.IDMethod = 2
105 currentHypo.IDWPNames = [f
'{identification}_{wp}' for wp
in getattr(flags.Trigger.Offline.Tau, identification).WPNames]
108 id_score_monitoring[identification] = getTauIDScoreVariables(identification, precision_seq_name)
111 if chainPart[
'reconstruction'] ==
'tracktwoMVA':
112 currentHypo.TrackPtCut = 1.5*GeV
113 currentHypo.HighPtSelectionLooseIDThr = 200*GeV
114 currentHypo.HighPtSelectionJetThr = 430*GeV
117 if 'tauMon:online' in chainDict[
'monGroups']:
118 currentHypo.MonTool = getTrigTauPrecisionIDHypoToolMonitoring(flags, name, id_score_monitoring.keys())
121 currentHypo.MonitoredIDScores = id_score_monitoring
129from collections
import namedtuple
131DiKaonCuts = namedtuple(
'DiKaonCuts',
'massTrkSysMin massTrkSysMax massTrkSysKaonMin massTrkSysKaonMax massTrkSysKaonPiMin massTrkSysKaonPiMax targetMassTrkSysKaonPi leadTrkPtMin PtMin EMPOverTrkSysPMax')
133 (
'dikaonmass', 25):
DiKaonCuts(0.0*GeV, 1000.0*GeV, 0.987*GeV, 1.060*GeV, 0.0*GeV, 1000.0*GeV, 0.0*GeV, 15.0*GeV, 25.0*GeV, 1.5),
134 (
'dikaonmass', 35):
DiKaonCuts(0.0*GeV, 1000.0*GeV, 0.987*GeV, 1.060*GeV, 0.0*GeV, 1000.0*GeV, 0.0*GeV, 25.0*GeV, 35.0*GeV, 1.5),
136 (
'kaonpi1', 25):
DiKaonCuts(0.0*GeV, 1000.0*GeV, 0.0*GeV, 1000.0*GeV, 0.79*GeV, 0.99*GeV, 0.89*GeV, 15.0*GeV, 25.0*GeV, 1.0),
137 (
'kaonpi1', 35):
DiKaonCuts(0.0*GeV, 1000.0*GeV, 0.0*GeV, 1000.0*GeV, 0.79*GeV, 0.99*GeV, 0.89*GeV, 25.0*GeV, 35.0*GeV, 1.0),
139 (
'kaonpi2', 25):
DiKaonCuts(0.0*GeV, 1000.0*GeV, 0.0*GeV, 1000.0*GeV, 1.8*GeV, 1.93*GeV, 1.865*GeV, 15.0*GeV, 25.0*GeV, 1.0),
140 (
'kaonpi2', 35):
DiKaonCuts(0.0*GeV, 1000.0*GeV, 0.0*GeV, 1000.0*GeV, 1.8*GeV, 1.93*GeV, 1.865*GeV, 25.0*GeV, 35.0*GeV, 1.0),
142 (
'dipion1', 25):
DiKaonCuts(0.475*GeV, 1.075*GeV, 0.0*GeV, 1000.0*GeV, 0.0*GeV, 1000.0*GeV, 0.0*GeV, 15.0*GeV, 25.0*GeV, 1.0),
143 (
'dipion2', 25):
DiKaonCuts(0.460*GeV, 0.538*GeV, 0.0*GeV, 1000.0*GeV, 0.0*GeV, 1000.0*GeV, 0.0*GeV, 15.0*GeV, 25.0*GeV, 1.0),
144 (
'dipion3', 25):
DiKaonCuts(0.279*GeV, 0.648*GeV, 0.0*GeV, 1000.0*GeV, 0.0*GeV, 1000.0*GeV, 0.0*GeV, 25.0*GeV, 25.0*GeV, 2.2),
145 (
'dipion4', 25):
DiKaonCuts(0.460*GeV, 1.075*GeV, 0.0*GeV, 1000.0*GeV, 0.0*GeV, 1000.0*GeV, 0.0*GeV, 15.0*GeV, 25.0*GeV, 1.0),
148SinglePionCuts = namedtuple(
'SinglePionCuts',
'leadTrkPtMin PtMin NTracksMax NIsoTracksMax dRmaxMax etOverPtLeadTrkMin etOverPtLeadTrkMax')
149thresholds_singlepion = {
150 (
'singlepion', 25):
SinglePionCuts(30.0*GeV, 25.0*GeV, 1, 0, 0.06, 0.4, 0.85),
154 '''TrigTauPrecisionDiKaonHypoTool configuration for the meson cut-based Tau triggers (ATR-22644)'''
155 name = chainDict[
'chainName']
156 chainPart = chainDict[
'chainParts'][0]
159 from AthenaConfiguration.ComponentFactory
import CompFactory
160 currentHypo = CompFactory.TrigTauPrecisionDiKaonHypoTool(name)
162 key = (chainPart[
'selection'], int(chainPart[
'threshold']))
163 if key
in thresholds_dikaon:
164 thr = thresholds_dikaon[key]
165 currentHypo.PtMin = thr.PtMin
166 currentHypo.leadTrkPtMin = thr.leadTrkPtMin
167 currentHypo.massTrkSysMin = thr.massTrkSysMin
168 currentHypo.massTrkSysMax = thr.massTrkSysMax
169 currentHypo.massTrkSysKaonMin = thr.massTrkSysKaonMin
170 currentHypo.massTrkSysKaonMax = thr.massTrkSysKaonMax
171 currentHypo.massTrkSysKaonPiMin = thr.massTrkSysKaonPiMin
172 currentHypo.massTrkSysKaonPiMax = thr.massTrkSysKaonPiMax
173 currentHypo.targetMassTrkSysKaonPi = thr.targetMassTrkSysKaonPi
174 currentHypo.EMPOverTrkSysPMax = thr.EMPOverTrkSysPMax
176 elif key
in thresholds_singlepion:
177 thr = thresholds_singlepion[key]
178 currentHypo.PtMin = thr.PtMin
179 currentHypo.NTracksMax = thr.NTracksMax
180 currentHypo.NIsoTracksMax = thr.NIsoTracksMax
181 currentHypo.leadTrkPtMin = thr.leadTrkPtMin
182 currentHypo.dRmaxMax = thr.dRmaxMax
183 currentHypo.etOverPtLeadTrkMin = thr.etOverPtLeadTrkMin
184 currentHypo.etOverPtLeadTrkMax = thr.etOverPtLeadTrkMax
186 currentHypo.MonTool = getTrigTauPrecisionDiKaonHypoToolMonitoring(flags, name)
196 name = chainDict[
'chainName']
198 from AthenaConfiguration.ComponentFactory
import CompFactory
199 currentHypo = CompFactory.TrigTauTrackingHypoTool(name)
209 name = chainDict[
'chainName']
210 threshold = float(chainDict[
'chainParts'][0][
'threshold'])
212 from AthenaConfiguration.ComponentFactory
import CompFactory
213 currentHypo = CompFactory.TrigTauCaloHypoTool(name)
214 currentHypo.PtMin = threshold * GeV