8 Reconstruct the precision TauJet, from the first-step CaloMVA TauJet and precision-refitted tracks.
10 :param flags: Config flags.
11 :param name: Suffix for the main TrigTauRecMerged algorithm name.
12 :param tau_ids: List of inference algorithms to execute.
13 The specific configuration will be loaded from the matching ConfigFlags (Trigger.Offline.Tau.<alg-name>)
14 Currently, only the `DeepSet` and `RNNLLP` algorithms will use the LVNN inference setup (json config files);
15 all other ID algorithms will use the ONNX inference setup by default.
16 If the algorithm name (`name` input variable) is `MVA`, `LLP` or `LRT`, and `tau_ids=['DeepSet', 'MesonCuts']` or `tau_ids=['RNNLLP']`,
17 then the default TauJet RNN score and WP `isTau` decorators will be used (for the legacy
18 `mediumRNN/tightRNN_tracktwoMVA/tracktwoLLP/trackLRT` triggers).
19 Otherwise, all scores and WPs will be stored as `{tau_id}_Score`, `{tau_id}_ScoreSigTrans`, and `{tau_id}_{wp_name}`.
20 :param input_rois: RoIs container, where the reconstruction will be run.
21 :param input_tracks: TrackParticle container, with the refitted precision tracks.
22 :param output_name: Suffix for the output TauJet and TauTrack collections. If `None`, `name` will be used.
24 :return: CA with the TauJet Precision reconstruction sequence.
28 if output_name
is None: output_name = name
29 from TrigEDMConfig.TriggerEDM
import recordable
30 trigTauJetOutputContainer =
recordable(f
'HLT_TrigTauRecMerged_{output_name}')
31 trigTauTrackOutputContainer =
recordable(f
'HLT_tautrack_{output_name}')
34 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
47 from TrigTauRec.TrigTauRecToolsConfig
import trigTauVertexFinderCfg, trigTauTrackFinderCfg, tauVertexVariablesCfg
48 from AthenaConfiguration.ComponentFactory
import CompFactory
54 tools_beforetf.append(CompFactory.TauAxisSetter(name=
'TrigTau_TauAxis', VertexCorrection=
False))
57 tftools.append(acc.popToolsAndMerge(
trigTauTrackFinderCfg(flags, name=
'TrigTauTightDZ_TauTrackFinder', TrackParticlesContainer=input_tracks)))
60 tools.append(CompFactory.TauClusterFinder(name=
'TrigTau_TauClusterFinder', UseOriginalCluster=
False))
61 tools.append(CompFactory.TauVertexedClusterDecorator(name=
'TrigTau_TauVertexedClusterDecorator', SeedJet=
''))
64 tools.append(CompFactory.TauCellVariables(name=
'TrigTau_CellVariables', VertexCorrection=
False))
67 tools.append(CompFactory.MvaTESVariableDecorator(name=
'TrigTau_MvaTESVariableDecorator', Key_vertexInputContainer=
'', EventShapeKey=
'', VertexCorrection=
False))
68 acc.addPublicTool(tools[-1])
69 tools.append(CompFactory.MvaTESEvaluator(name=
'TrigTau_MvaTESEvaluator', WeightFileName=flags.Trigger.Offline.Tau.MvaTESConfig))
70 acc.addPublicTool(tools[-1])
76 idtools.append(CompFactory.TauCommonCalcVars(name=
'TrigTau_TauCommonCalcVars'))
79 idtools.append(CompFactory.TauSubstructureVariables(name=
'TrigTau_TauSubstructure', VertexCorrection=
False))
88 tau_ids =
list(
set(tau_ids
if tau_ids
else []) - {
'perf',
'idperf',
'MesonCuts'})
90 from TriggerMenuMT.HLT.Tau.TauConfigurationTools
import getTauIDScoreVariables
91 id_score_monitoring = {}
94 used_builtin_rnnscore =
False
96 for tau_id
in tau_ids:
98 try: id_flags = getattr(flags.Trigger.Offline.Tau, tau_id)
99 except NameError:
raise ValueError(f
'Missing TauID ConfigFlags: Trigger.Offline.Tau.{tau_id}')
102 is_onnx = hasattr(id_flags,
'ONNXConfig')
105 log.debug(
'Configuring TrigTauRecMerged with the ONNX Tau ID score inference: %s', tau_id)
107 from TrigTauRec.TrigTauRecToolsConfig
import trigTauJetONNXEvaluatorCfg, trigTauWPDecoratorCfg
111 acc.addPublicTool(idtools[-1])
114 idtools.append(acc.popToolsAndMerge(
trigTauWPDecoratorCfg(flags, tau_id=tau_id, precision_seq_name=name)))
115 acc.addPublicTool(idtools[-1])
119 log.debug(
'Configuring TrigTauRecMerged with the LVNN Tau ID score inference: %s', tau_id)
121 from TriggerMenuMT.HLT.Tau.TauConfigurationTools
import useBuiltInTauJetRNNScore
126 if use_builtin_rnnscore:
127 if used_builtin_rnnscore:
128 log.error(
'Cannot store more than one TauID score in the built-in TauJet RNN score variables')
130 used_builtin_rnnscore =
True
133 from TrigTauRec.TrigTauRecToolsConfig
import trigTauJetLVNNEvaluatorCfg
134 idtools.append(acc.popToolsAndMerge(
trigTauJetLVNNEvaluatorCfg(flags, tau_id=tau_id, use_taujet_rnnscore=use_builtin_rnnscore)))
135 acc.addPublicTool(idtools[-1])
138 if use_builtin_rnnscore:
139 from TrigTauRec.TrigTauRecToolsConfig
import trigTauWPDecoratorRNNCfg
141 acc.addPublicTool(idtools[-1])
143 from TrigTauRec.TrigTauRecToolsConfig
import trigTauWPDecoratorCfg
144 idtools.append(acc.popToolsAndMerge(
trigTauWPDecoratorCfg(flags, tau_id=tau_id, precision_seq_name=name)))
145 acc.addPublicTool(idtools[-1])
151 for tool
in vftools + tools_beforetf + tftools + tools + vvtools + idtools:
152 tool.inTrigger =
True
153 tool.calibFolder = flags.Trigger.Offline.Tau.tauRecToolsCVMFSPath
156 from TrigTauRec.TrigTauRecMonitoring
import tauMonitoringPrecision
157 acc.addEventAlgo(CompFactory.TrigTauRecMerged(
158 name=f
'TrigTauRecMerged_Precision_{name}',
159 VertexFinderTools=vftools,
160 CommonToolsBeforeTF=tools_beforetf,
161 TrackFinderTools=tftools,
163 VertexVarsTools=vvtools,
165 MonTool=
tauMonitoringPrecision(flags, RoI_name=
'tauLRT' if 'LRT' in name
else 'tauIso', tau_ids=id_score_monitoring.keys(), alg_name=name),
166 MonitoredIDScores=id_score_monitoring,
167 InputRoIs=input_rois,
168 InputVertexContainer=flags.Tracking.ActiveConfig.vertex,
169 InputTauTrackContainer=
'HLT_tautrack_dummy',
170 InputTauJetContainer=
'HLT_TrigTauRecMerged_CaloMVAOnly',
171 OutputTauTrackContainer=trigTauTrackOutputContainer,
172 OutputTauJetContainer=trigTauJetOutputContainer,