ATLAS Offline Software
Functions
TrigTauRecToolsConfig Namespace Reference

Functions

def trigTauVertexFinderCfg (flags, name='')
 
def trigTauTrackFinderCfg (flags, name='', TrackParticlesContainer='')
 
def tauVertexVariablesCfg (flags, name='')
 
def trigTauJetLVNNEvaluatorCfg (flags, tau_id='', use_taujet_rnnscore=True)
 
def trigTauJetONNXEvaluatorCfg (flags, tau_id='')
 
def trigTauWPDecoratorRNNCfg (flags, str tau_id, str precision_seq_name)
 
def trigTauWPDecoratorCfg (flags, str tau_id, str precision_seq_name)
 

Function Documentation

◆ tauVertexVariablesCfg()

def TrigTauRecToolsConfig.tauVertexVariablesCfg (   flags,
  name = '' 
)
Vertex variables calculation

Definition at line 57 of file TrigTauRecToolsConfig.py.

57 def tauVertexVariablesCfg(flags, name=''):
58  '''Vertex variables calculation'''
59  acc = ComponentAccumulator()
60 
61  from TrkConfig.TrkVertexFittersConfig import TauAdaptiveVertexFitterCfg
62  TauAdaptiveVertexFitter = acc.popToolsAndMerge(TauAdaptiveVertexFitterCfg(flags))
63 
64  from TrkConfig.TrkVertexSeedFinderToolsConfig import CrossDistancesSeedFinderCfg
65  CrossDistancesSeedFinder = acc.popToolsAndMerge(CrossDistancesSeedFinderCfg(flags))
66 
67  acc.setPrivateTools(CompFactory.TauVertexVariables(
68  name = name,
69  VertexFitter = TauAdaptiveVertexFitter,
70  SeedFinder = CrossDistancesSeedFinder,
71  ))
72 
73  return acc
74 

◆ trigTauJetLVNNEvaluatorCfg()

def TrigTauRecToolsConfig.trigTauJetLVNNEvaluatorCfg (   flags,
  tau_id = '',
  use_taujet_rnnscore = True 
)
TauJet identification inference based on LVNN models, for RNNs and DeepSets

Definition at line 75 of file TrigTauRecToolsConfig.py.

75 def trigTauJetLVNNEvaluatorCfg(flags, tau_id='', use_taujet_rnnscore=True):
76  '''TauJet identification inference based on LVNN models, for RNNs and DeepSets'''
77  acc = ComponentAccumulator()
78 
79  try: id_flags = getattr(flags.Trigger.Offline.Tau, tau_id)
80  except NameError: raise ValueError(f'Invalid LVNN (RNN, DeepSet) TauID configuration: {tau_id}')
81 
82  # For legacy mediumRNN/tightRNN_tracktwoMVA/tracktwoLLP/trackLRT chains
83  output_variable = 'RNNJetScore' if use_taujet_rnnscore else f'{tau_id}_Score'
84 
85  # This is to prevent clashes between the same ID running over the legacy chains, and the new decorator-based chains
86  sfx = '_RNNJetScore' if use_taujet_rnnscore else ''
87 
88  acc.setPrivateTools(CompFactory.TauJetRNNEvaluator(
89  name = f'TrigTau_TauJetLVNNEvaluator_{tau_id}{sfx}',
90 
91  # Network config:
92  NetworkFile0P = id_flags.NetworkConfig[0],
93  NetworkFile1P = id_flags.NetworkConfig[1],
94  NetworkFile3P = id_flags.NetworkConfig[2],
95  InputLayerScalar = 'scalar',
96  InputLayerTracks = 'tracks',
97  InputLayerClusters = 'clusters',
98  OutputLayer = 'rnnid_output',
99  OutputNode = 'sig_prob',
100 
101  # Inputs:
102  MaxTracks = id_flags.MaxTracks,
103  MaxClusters = id_flags.MaxClusters,
104  MaxClusterDR = 1.0,
105  VertexCorrection = False,
106  TrackClassification = False,
107 
108  # Decorated TauJet variable names:
109  OutputVarname = output_variable,
110  ))
111 
112  return acc
113 

◆ trigTauJetONNXEvaluatorCfg()

def TrigTauRecToolsConfig.trigTauJetONNXEvaluatorCfg (   flags,
  tau_id = '' 
)
TauJet identification inference based on ONNX models, for GNNs, transformers, etc...

Definition at line 114 of file TrigTauRecToolsConfig.py.

114 def trigTauJetONNXEvaluatorCfg(flags, tau_id=''):
115  '''TauJet identification inference based on ONNX models, for GNNs, transformers, etc...'''
116  acc = ComponentAccumulator()
117 
118  try: id_flags = getattr(flags.Trigger.Offline.Tau, tau_id)
119  except NameError: raise ValueError(f'Invalid ONNX TauID configuration: {tau_id}')
120 
121  acc.setPrivateTools(CompFactory.TauGNNEvaluator(
122  name = f'TrigTau_TauJetONNXEvaluator_{tau_id}',
123 
124  # Network config:
125  NetworkFile0P = id_flags.ONNXConfig[0],
126  NetworkFile1P = id_flags.ONNXConfig[1],
127  NetworkFile3P = id_flags.ONNXConfig[2],
128  InputLayerScalar = 'tau_vars',
129  InputLayerTracks = 'track_vars',
130  InputLayerClusters = 'cluster_vars',
131  NodeNameTau = 'pTau',
132  NodeNameJet = 'pJet',
133 
134  # Inputs:
135  MaxTracks = id_flags.MaxTracks,
136  MaxClusters = id_flags.MaxClusters,
137  MaxClusterDR = 1.0,
138  VertexCorrection = False,
139  TrackClassification = False,
140 
141  # Decorated TauJet variable names:
142  OutputVarname = f'{tau_id}_Score',
143  OutputPTau = f'{tau_id}_ProbTau',
144  OutputPJet = f'{tau_id}_ProbJet',
145 
146  # Tau prongness selection
147  MinProngTrackPt = id_flags.MinProngTrackPt if hasattr(id_flags, 'MinProngTrackPt') else 0,
148  ))
149 
150  return acc
151 

◆ trigTauTrackFinderCfg()

def TrigTauRecToolsConfig.trigTauTrackFinderCfg (   flags,
  name = '',
  TrackParticlesContainer = '' 
)
Tau track association

Definition at line 23 of file TrigTauRecToolsConfig.py.

23 def trigTauTrackFinderCfg(flags, name='', TrackParticlesContainer=''):
24  '''Tau track association'''
25  acc = ComponentAccumulator()
26 
27  from TrkConfig.TrkVertexFitterUtilsConfig import AtlasTrackToVertexIPEstimatorCfg
28  AtlasTrackToVertexIPEstimator = acc.popToolsAndMerge(AtlasTrackToVertexIPEstimatorCfg(flags))
29 
30  from TrackToVertex.TrackToVertexConfig import TrackToVertexCfg
31  TrackToVertexTool = acc.popToolsAndMerge(TrackToVertexCfg(flags))
32 
33  from TrackToCalo.TrackToCaloConfig import ParticleCaloExtensionToolCfg
34  ParticleCaloExtensionTool = acc.popToolsAndMerge(ParticleCaloExtensionToolCfg(flags))
35 
36  from InDetConfig.InDetTrackSelectorToolConfig import TrigTauInDetTrackSelectorToolCfg
37  TrigTauInDetTrackSelectorTool = acc.popToolsAndMerge(TrigTauInDetTrackSelectorToolCfg(flags))
38 
39  acc.setPrivateTools(CompFactory.TauTrackFinder(
40  name = name,
41  MaxJetDrTau = 0.2,
42  MaxJetDrWide = 0.4,
43  TrackSelectorToolTau = TrigTauInDetTrackSelectorTool,
44  TrackToVertexTool = TrackToVertexTool,
45  Key_trackPartInputContainer = TrackParticlesContainer,
46  maxDeltaZ0wrtLeadTrk = 0.75*mm,
47  removeTracksOutsideZ0wrtLeadTrk = True,
48  ParticleCaloExtensionTool = ParticleCaloExtensionTool,
49  BypassSelector = False,
50  BypassExtrapolator = True,
51  tauParticleCache = "",
52  TrackToVertexIPEstimator = AtlasTrackToVertexIPEstimator,
53  ))
54 
55  return acc
56 

◆ trigTauVertexFinderCfg()

def TrigTauRecToolsConfig.trigTauVertexFinderCfg (   flags,
  name = '' 
)
Algorithm that overwrites numTrack() and charge() of tauJets in container

Definition at line 7 of file TrigTauRecToolsConfig.py.

7 def trigTauVertexFinderCfg(flags, name=''):
8  '''Algorithm that overwrites numTrack() and charge() of tauJets in container'''
10 
11  acc.setPrivateTools(CompFactory.TauVertexFinder(
12  name = name,
13  UseTJVA = False,
14  AssociatedTracks = 'GhostTrack',
15  InDetTrackSelectionToolForTJVA = '',
16  Key_trackPartInputContainer = '',
17  Key_vertexInputContainer = '',
18  TVATool = '',
19  ))
20 
21  return acc
22 

◆ trigTauWPDecoratorCfg()

def TrigTauRecToolsConfig.trigTauWPDecoratorCfg (   flags,
str  tau_id,
str  precision_seq_name 
)
TauJet signal transformed score and ID WPs decorator tool

Definition at line 192 of file TrigTauRecToolsConfig.py.

192 def trigTauWPDecoratorCfg(flags, tau_id: str, precision_seq_name: str):
193  '''TauJet signal transformed score and ID WPs decorator tool'''
194  acc = ComponentAccumulator()
195 
196  try: id_flags = getattr(flags.Trigger.Offline.Tau, tau_id)
197  except NameError: raise ValueError(f'Invalid TauID configuration: {tau_id}')
198 
199  acc.setPrivateTools(CompFactory.TauWPDecorator(
200  name=f'TrigTau_TauWPDecoratorRNN_{precision_seq_name}_{tau_id}',
201  flatteningFile0Prong=id_flags.ScoreFlatteningConfig[0],
202  flatteningFile1Prong=id_flags.ScoreFlatteningConfig[1],
203  flatteningFile3Prong=id_flags.ScoreFlatteningConfig[2],
204  DecorWPNames=[f'{tau_id}_{wp}' for wp in id_flags.WPNames],
205  DecorWPCutEffs0P=id_flags.TargetEff[0],
206  DecorWPCutEffs1P=id_flags.TargetEff[1],
207  DecorWPCutEffs3P=id_flags.TargetEff[2],
208  ScoreName=f'{tau_id}_Score',
209  NewScoreName=f'{tau_id}_ScoreSigTrans',
210  DefineWPs=True,
211  ))
212 
213  return acc

◆ trigTauWPDecoratorRNNCfg()

def TrigTauRecToolsConfig.trigTauWPDecoratorRNNCfg (   flags,
str  tau_id,
str  precision_seq_name 
)
TauJet signal transformed score and ID WPs decorator tool,
for the legacy mediumRNN/tightRNN_tracktwoMVA/tracktwoLLP/trackLRT chains ONLY!

Definition at line 152 of file TrigTauRecToolsConfig.py.

152 def trigTauWPDecoratorRNNCfg(flags, tau_id: str, precision_seq_name: str):
153  '''
154  TauJet signal transformed score and ID WPs decorator tool,
155  for the legacy mediumRNN/tightRNN_tracktwoMVA/tracktwoLLP/trackLRT chains ONLY!
156  '''
157 
158  acc = ComponentAccumulator()
159 
160  try: id_flags = getattr(flags.Trigger.Offline.Tau, tau_id)
161  except NameError: raise ValueError(f'Invalid TauID configuration: {tau_id}')
162 
163  # In this version we store the WPs as flags accessable through
164  # tau->isTau(xAOD::TauJetParameters::IsTauFlags::JetRNNSig...)
165  import PyUtils.RootUtils as ru
166  ROOT = ru.import_root()
167  import cppyy
168  cppyy.load_library('libxAODTau_cDict')
169  WPEnumVals = [
170  ROOT.xAOD.TauJetParameters.IsTauFlag.JetRNNSigVeryLoose,
171  ROOT.xAOD.TauJetParameters.IsTauFlag.JetRNNSigLoose,
172  ROOT.xAOD.TauJetParameters.IsTauFlag.JetRNNSigMedium,
173  ROOT.xAOD.TauJetParameters.IsTauFlag.JetRNNSigTight,
174  ]
175 
176  acc.setPrivateTools(CompFactory.TauWPDecorator(
177  name=f'TrigTau_TauWPDecoratorRNN_{precision_seq_name}_{tau_id}',
178  flatteningFile0Prong=id_flags.ScoreFlatteningConfig[0],
179  flatteningFile1Prong=id_flags.ScoreFlatteningConfig[1],
180  flatteningFile3Prong=id_flags.ScoreFlatteningConfig[2],
181  CutEnumVals=WPEnumVals,
182  SigEff0P=id_flags.TargetEff[0],
183  SigEff1P=id_flags.TargetEff[1],
184  SigEff3P=id_flags.TargetEff[2],
185  ScoreName='RNNJetScore',
186  NewScoreName='RNNJetScoreSigTrans',
187  DefineWPs=True,
188  ))
189 
190  return acc
191 
python.TrkVertexFittersConfig.TauAdaptiveVertexFitterCfg
def TauAdaptiveVertexFitterCfg(flags, name="TauAdaptiveVertexFitter", **kwargs)
Definition: TrkVertexFittersConfig.py:97
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.TrkVertexFitterUtilsConfig.AtlasTrackToVertexIPEstimatorCfg
def AtlasTrackToVertexIPEstimatorCfg(flags, name='AtlasTrackToVertexIPEstimator', **kwargs)
Definition: TrkVertexFitterUtilsConfig.py:63
TrigTauRecToolsConfig.trigTauTrackFinderCfg
def trigTauTrackFinderCfg(flags, name='', TrackParticlesContainer='')
Definition: TrigTauRecToolsConfig.py:23
TrigTauRecToolsConfig.trigTauWPDecoratorRNNCfg
def trigTauWPDecoratorRNNCfg(flags, str tau_id, str precision_seq_name)
Definition: TrigTauRecToolsConfig.py:152
TrigTauRecToolsConfig.trigTauVertexFinderCfg
def trigTauVertexFinderCfg(flags, name='')
Definition: TrigTauRecToolsConfig.py:7
TrigTauRecToolsConfig.trigTauWPDecoratorCfg
def trigTauWPDecoratorCfg(flags, str tau_id, str precision_seq_name)
Definition: TrigTauRecToolsConfig.py:192
TrigTauRecToolsConfig.tauVertexVariablesCfg
def tauVertexVariablesCfg(flags, name='')
Definition: TrigTauRecToolsConfig.py:57
TrigTauRecToolsConfig.trigTauJetLVNNEvaluatorCfg
def trigTauJetLVNNEvaluatorCfg(flags, tau_id='', use_taujet_rnnscore=True)
Definition: TrigTauRecToolsConfig.py:75
python.InDetTrackSelectorToolConfig.TrigTauInDetTrackSelectorToolCfg
def TrigTauInDetTrackSelectorToolCfg(flags, name="TrigTau_InDetTrackSelectorTool", **kwargs)
Definition: InDetTrackSelectorToolConfig.py:294
TrackToVertexConfig.TrackToVertexCfg
def TrackToVertexCfg(flags, name="AtlasTrackToVertexTool", **kwargs)
Definition: TrackToVertexConfig.py:6
TrigTauRecToolsConfig.trigTauJetONNXEvaluatorCfg
def trigTauJetONNXEvaluatorCfg(flags, tau_id='')
Definition: TrigTauRecToolsConfig.py:114
python.TrkVertexSeedFinderToolsConfig.CrossDistancesSeedFinderCfg
def CrossDistancesSeedFinderCfg(flags, name="CrossDistancesSeedFinder", **kwargs)
Definition: TrkVertexSeedFinderToolsConfig.py:33
TrackToCaloConfig.ParticleCaloExtensionToolCfg
def ParticleCaloExtensionToolCfg(flags, name='ParticleCaloExtensionTool', **kwargs)
Definition: TrackToCaloConfig.py:10