ATLAS Offline Software
Loading...
Searching...
No Matches
TrigTauHypoTool Namespace Reference

Classes

class  TauCuts

Functions

 TrigTauPrecisionHypoToolFromDict (AthConfigFlags flags, dict[str, Any] chainDict)
 TrigTauPrecisionIDHypoToolFromDict (AthConfigFlags flags, dict[str, Any] chainDict)
 TrigTauPrecisionDiKaonHypoToolFromDict (AthConfigFlags flags, dict[str, Any] chainDict)
 TrigTauTrackingHypoToolFromDict (AthConfigFlags flags, dict[str, Any] chainDict)
 TrigTauCaloHitsHypoToolFromDict (AthConfigFlags flags, dict[str, Any] chainDict)
 TrigTauCaloMVAHypoToolFromDict (AthConfigFlags flags, dict[str, Any] chainDict)

Variables

 log = logging.getLogger('TrigHLTTauHypoTool')
 DiKaonCuts = namedtuple('DiKaonCuts', 'massTrkSysMin massTrkSysMax massTrkSysKaonMin massTrkSysKaonMax massTrkSysKaonPiMin massTrkSysKaonPiMax targetMassTrkSysKaonPi leadTrkPtMin PtMin EMPOverTrkSysPMax')
dict thresholds_dikaon
 SinglePionCuts = namedtuple('SinglePionCuts', 'leadTrkPtMin PtMin NTracksMax NIsoTracksMax dRmaxMax etOverPtLeadTrkMin etOverPtLeadTrkMax')
dict thresholds_singlepion

Function Documentation

◆ TrigTauCaloHitsHypoToolFromDict()

TrigTauHypoTool.TrigTauCaloHitsHypoToolFromDict ( AthConfigFlags flags,
dict[str, Any] chainDict )

Definition at line 265 of file TrigTauHypoTool.py.

265def TrigTauCaloHitsHypoToolFromDict(flags: AthConfigFlags, chainDict: dict[str, Any]):
266 name = chainDict['chainName']
267 chain_part = chainDict['chainParts'][0]
268
269 # Setup the Hypothesis tool
270 from AthenaConfiguration.ComponentFactory import CompFactory
271 currentHypo = CompFactory.TrigTauPrecisionIDHypoTool(
272 name,
273 HighPtSelectionIDThr=200*GeV,
274 HighPtSelectionJetThr=430*GeV,
275 )
276
277 id_score_monitoring = {}
278
279 from TriggerMenuMT.HLT.Tau.TauConfigurationTools import getChainCaloHitsPreselConfigName, getTauIDScoreVariables
280 id = getChainCaloHitsPreselConfigName(flags, chain_part)
281 if id == 'idperf':
282 currentHypo.AcceptAll = True
283
284 # Monitor all the included algorithms
285 from TriggerMenuMT.HLT.Tau.TauConfigurationTools import getChainPrecisionSeqName, getCaloHitsPreselAlgs
286 algs = getCaloHitsPreselAlgs(flags, getChainPrecisionSeqName(chain_part, True), getChainPrecisionSeqName(chain_part))
287 if algs:
288 for tau_id in algs:
289 id_score_monitoring[tau_id] = getTauIDScoreVariables(tau_id)
290
291 else:
292 currentHypo.IDMethod = 2 # Use decorators
293
294 id_wp = chain_part['calohitsPresel'].removesuffix(id).lower()
295
296 # Find the matching WP with the correct casing
297 def find_wp(wp: str, fail: bool = True) -> str:
298 for twp in getattr(flags.Trigger.Offline.Tau, id).TargetWPs.keys():
299 if twp.lower() == wp: return twp
300 else:
301 if fail: ValueError(f'Cannot find the "{id}" WP "{wp}"')
302 else: return ''
303
304 # Standard preselection WP
305 currentHypo.IDWP = find_wp(id_wp)
306
307 # High-pT ID WP
308 if id_wp.startswith('medium'): currentHypo.HighPtIDWP = find_wp(f'loose{id_wp[6:]}', True)
309 elif id_wp.startswith('tight'): currentHypo.HighPtIDWP = find_wp(f'loose{id_wp[5:]}', True)
310
311 # Monitor this algorithm only
312 id_score_monitoring[id] = getTauIDScoreVariables(id)
313
314 # Only monitor chains with the 'tauMon:online' groups
315 if 'tauMon:online' in chainDict['monGroups']:
316 currentHypo.MonTool = getTrigTauCaloHitsIDHypoToolMonitoring(flags, name, id_score_monitoring.keys())
317
318 # TauID Score monitoring
319 currentHypo.MonitoredIDScores = id_score_monitoring
320
321 return currentHypo
322
323
324
325#============================================================================================
326# CaloMVA step hypothesis tool
327#============================================================================================

◆ TrigTauCaloMVAHypoToolFromDict()

TrigTauHypoTool.TrigTauCaloMVAHypoToolFromDict ( AthConfigFlags flags,
dict[str, Any] chainDict )

Definition at line 328 of file TrigTauHypoTool.py.

328def TrigTauCaloMVAHypoToolFromDict(flags: AthConfigFlags, chainDict: dict[str, Any]):
329 name = chainDict['chainName']
330 threshold = float(chainDict['chainParts'][0]['threshold'])
331
332 from AthenaConfiguration.ComponentFactory import CompFactory
333 currentHypo = CompFactory.TrigTauCaloHypoTool(name)
334 currentHypo.PtMin = threshold * GeV
335
336 return currentHypo
337

◆ TrigTauPrecisionDiKaonHypoToolFromDict()

TrigTauHypoTool.TrigTauPrecisionDiKaonHypoToolFromDict ( AthConfigFlags flags,
dict[str, Any] chainDict )
TrigTauPrecisionDiKaonHypoTool configuration for the meson cut-based Tau triggers (ATR-22644)

Definition at line 210 of file TrigTauHypoTool.py.

210def TrigTauPrecisionDiKaonHypoToolFromDict(flags: AthConfigFlags, chainDict: dict[str, Any]):
211 '''TrigTauPrecisionDiKaonHypoTool configuration for the meson cut-based Tau triggers (ATR-22644)'''
212 name = chainDict['chainName']
213 chainPart = chainDict['chainParts'][0]
214
215 # Setup the Hypothesis tool
216 from AthenaConfiguration.ComponentFactory import CompFactory
217 currentHypo = CompFactory.TrigTauPrecisionDiKaonHypoTool(name)
218
219 key = (chainPart['selection'], int(chainPart['threshold']))
220 if key in thresholds_dikaon:
221 thr = thresholds_dikaon[key]
222 currentHypo.PtMin = thr.PtMin
223 currentHypo.leadTrkPtMin = thr.leadTrkPtMin
224 currentHypo.massTrkSysMin = thr.massTrkSysMin
225 currentHypo.massTrkSysMax = thr.massTrkSysMax
226 currentHypo.massTrkSysKaonMin = thr.massTrkSysKaonMin
227 currentHypo.massTrkSysKaonMax = thr.massTrkSysKaonMax
228 currentHypo.massTrkSysKaonPiMin = thr.massTrkSysKaonPiMin
229 currentHypo.massTrkSysKaonPiMax = thr.massTrkSysKaonPiMax
230 currentHypo.targetMassTrkSysKaonPi = thr.targetMassTrkSysKaonPi
231 currentHypo.EMPOverTrkSysPMax = thr.EMPOverTrkSysPMax
232
233 elif key in thresholds_singlepion:
234 thr = thresholds_singlepion[key]
235 currentHypo.PtMin = thr.PtMin
236 currentHypo.NTracksMax = thr.NTracksMax
237 currentHypo.NIsoTracksMax = thr.NIsoTracksMax
238 currentHypo.leadTrkPtMin = thr.leadTrkPtMin
239 currentHypo.dRmaxMax = thr.dRmaxMax
240 currentHypo.etOverPtLeadTrkMin = thr.etOverPtLeadTrkMin
241 currentHypo.etOverPtLeadTrkMax = thr.etOverPtLeadTrkMax
242
243 currentHypo.MonTool = getTrigTauPrecisionDiKaonHypoToolMonitoring(flags, name)
244
245 return currentHypo
246
247
248
249#============================================================================================
250# Tracking step hypothesis tool (without selection)
251#============================================================================================

◆ TrigTauPrecisionHypoToolFromDict()

TrigTauHypoTool.TrigTauPrecisionHypoToolFromDict ( AthConfigFlags flags,
dict[str, Any] chainDict )

Definition at line 21 of file TrigTauHypoTool.py.

21def TrigTauPrecisionHypoToolFromDict(flags: AthConfigFlags, chainDict: dict[str, Any]):
22 chainPart = chainDict['chainParts'][0]
23
24 identification = getChainIDConfigName(flags, chainPart)
25
26 if identification == 'MesonCuts':
27 # Meson cut-based triggers (ATR-22644)
28 return TrigTauPrecisionDiKaonHypoToolFromDict(flags, chainDict)
29 else:
30 # Everything else
31 return TrigTauPrecisionIDHypoToolFromDict(flags, chainDict)
32
33
34#-----------------------------------------------------------------
35# Standard tau triggers configuration
36#-----------------------------------------------------------------

◆ TrigTauPrecisionIDHypoToolFromDict()

TrigTauHypoTool.TrigTauPrecisionIDHypoToolFromDict ( AthConfigFlags flags,
dict[str, Any] chainDict )
TrigTauPrecisionIDHypoTool configuration for the standard Tau triggers

Definition at line 113 of file TrigTauHypoTool.py.

113def TrigTauPrecisionIDHypoToolFromDict(flags: AthConfigFlags, chainDict: dict[str, Any]):
114 '''TrigTauPrecisionIDHypoTool configuration for the standard Tau triggers'''
115 name = chainDict['chainName']
116 chainPart = chainDict['chainParts'][0]
117 cuts = TauCuts(flags, chainPart)
118
119 # Setup the Hypothesis tool
120 from AthenaConfiguration.ComponentFactory import CompFactory
121 currentHypo = CompFactory.TrigTauPrecisionIDHypoTool(
122 name,
123 PtMin=cuts.pt_min,
124 NTracksMax=cuts.n_track_max,
125 NIsoTracksMax=cuts.n_iso_track_max,
126 IDWP=cuts.id_wp_decor,
127 HighPtIDWP=cuts.highpt_id_wp_decor,
128 )
129
130 from TriggerMenuMT.HLT.Tau.TauConfigurationTools import getChainPrecisionSeqName, useBuiltInTauJetRNNScore, getPrecisionSequenceTauIDs, getTauIDScoreVariables
131
132 id_score_monitoring = {}
133
134 precision_seq_name = getChainPrecisionSeqName(chainPart)
135 identification = getChainIDConfigName(flags, chainPart)
136 if identification in ['idperf', 'noperf', 'perf', 'perfcore', 'perfiso']:
137 if identification == 'idperf':
138 # Disable everything, even the pT cut
139 currentHypo.AcceptAll = True
140
141 # Monitor all the included algorithms
142 used_builtin_rnnscore = False
143 for tau_id in getPrecisionSequenceTauIDs(flags, precision_seq_name):
144 # Skip algs without inference scores
145 if tau_id in ['MesonCuts']: continue
146
147 # We can only have at most one alg. using the built-in TauJet RNN score variables
148 if useBuiltInTauJetRNNScore(tau_id):
149 if used_builtin_rnnscore:
150 raise ValueError('Cannot have two TauID algorithms with scores stored in the built-in TauJet RNN score variables')
151 used_builtin_rnnscore = True
152
153 id_score_monitoring[tau_id] = getTauIDScoreVariables(tau_id)
154
155 else:
156 if useBuiltInTauJetRNNScore(identification):
157 # To support the legacy tracktwoMVA/LLP/LRT chains, only in those cases we store the
158 # ID score and passed WPs in the native TauJet variables
159 currentHypo.IDMethod = 1 # TauJet built-in RNN score
160 else:
161 # Decorator-based triggers
162 currentHypo.IDMethod = 2 # Use decorators
163
164 # Monitor this algorithm only
165 id_score_monitoring[identification] = getTauIDScoreVariables(identification)
166
167 # For any triggers following the tracktwoMVA reconstruction (2023+ DeepSet and GNTau)
168 if chainPart['reconstruction'] == 'tracktwoMVA':
169 currentHypo.TrackPtCut = 1.5*GeV
170 currentHypo.HighPtSelectionIDThr = 200*GeV
171 currentHypo.HighPtSelectionJetThr = 430*GeV
172
173 # Only monitor chains with the 'tauMon:online' groups
174 if 'tauMon:online' in chainDict['monGroups']:
175 currentHypo.MonTool = getTrigTauPrecisionIDHypoToolMonitoring(flags, name, id_score_monitoring.keys())
176
177 # TauID Score monitoring
178 currentHypo.MonitoredIDScores = id_score_monitoring
179
180 return currentHypo
181
182
183#-----------------------------------------------------------------
184# Meson cut-based triggers configuration (ATR-22644 + ATR-23239)
185#-----------------------------------------------------------------

◆ TrigTauTrackingHypoToolFromDict()

TrigTauHypoTool.TrigTauTrackingHypoToolFromDict ( AthConfigFlags flags,
dict[str, Any] chainDict )

Definition at line 252 of file TrigTauHypoTool.py.

252def TrigTauTrackingHypoToolFromDict(flags: AthConfigFlags, chainDict: dict[str, Any]):
253 name = chainDict['chainName']
254
255 from AthenaConfiguration.ComponentFactory import CompFactory
256 currentHypo = CompFactory.TrigTauTrackingHypoTool(name)
257
258 return currentHypo
259
260
261
262#============================================================================================
263# CaloHits step hypothesis tool
264#============================================================================================

Variable Documentation

◆ DiKaonCuts

TrigTauHypoTool.DiKaonCuts = namedtuple('DiKaonCuts', 'massTrkSysMin massTrkSysMax massTrkSysKaonMin massTrkSysKaonMax massTrkSysKaonPiMin massTrkSysKaonPiMax targetMassTrkSysKaonPi leadTrkPtMin PtMin EMPOverTrkSysPMax')

Definition at line 188 of file TrigTauHypoTool.py.

◆ log

TrigTauHypoTool.log = logging.getLogger('TrigHLTTauHypoTool')

Definition at line 15 of file TrigTauHypoTool.py.

◆ SinglePionCuts

TrigTauHypoTool.SinglePionCuts = namedtuple('SinglePionCuts', 'leadTrkPtMin PtMin NTracksMax NIsoTracksMax dRmaxMax etOverPtLeadTrkMin etOverPtLeadTrkMax')

Definition at line 205 of file TrigTauHypoTool.py.

◆ thresholds_dikaon

dict TrigTauHypoTool.thresholds_dikaon
Initial value:
1= {
2 ('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),
3 ('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),
4
5 ('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),
6 ('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),
7
8 ('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),
9 ('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),
10
11 ('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),
12 ('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),
13 ('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),
14 ('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),
15}

Definition at line 189 of file TrigTauHypoTool.py.

◆ thresholds_singlepion

dict TrigTauHypoTool.thresholds_singlepion
Initial value:
1= {
2 ('singlepion', 25): SinglePionCuts(30.0*GeV, 25.0*GeV, 1, 0, 0.06, 0.4, 0.85),
3}

Definition at line 206 of file TrigTauHypoTool.py.