5 from TriggerMenuMT.HLT.Config.MenuComponents
import MenuSequence, SelectionCA, InEventRecoCA
6 from AthenaConfiguration.ComponentFactory
import CompFactory
7 from AthenaConfiguration.AccumulatorCache
import AccumulatorCache
8 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
10 from ..CommonSequences.FullScanDefs
import trkFSRoI, fs_towers
11 from ..Config.MenuComponents
import parOR
12 from .JetRecoCommon
import jetDefToString, jetCalibFromJetDef
13 from TrigEDMConfig.TriggerEDM
import recordable
16 from TrigHLTJetHypo.TrigJetHypoToolConfig
import trigJetHypoToolFromDict
17 from .JetPresel
import caloPreselJetHypoToolFromDict, roiPreselJetHypoToolFromDict
18 from TrigCaloRec.TrigCaloRecConfig
import jetmetTopoClusteringCfg, jetmetTopoClusteringCfg_LC, HICaloTowerCfg
19 from AthenaConfiguration.AthConfigFlags
import AthConfigFlags
20 from TrigGenericAlgs.TrigGenericAlgsConfig
import TrigEventInfoRecorderAlgCfg
22 from AthenaCommon.Logging
import logging
23 logging.getLogger().
info(
"Importing %s",__name__)
24 log = logging.getLogger(__name__)
32 from TrigT2CaloCommon.CaloDef
import clusterFSInputMaker
41 log.debug(
"jet FS tracking: useDynamicRoiZWidth: %s", flags.Trigger.InDetTracking.fullScan.useDynamicRoiZWidth )
44 if flags.Trigger.InDetTracking.fullScan.useDynamicRoiZWidth:
45 roiUpdater = CompFactory.RoiUpdaterTool( useBeamSpot=
True )
47 log.info( roiUpdater )
49 InputMakerAlg = CompFactory.InputMakerForRoI(
50 "IM_Jet_TrackingStep",
51 mergeUsingFeature =
False,
52 RoITool = CompFactory.ViewCreatorFSROITool(
54 RoiUpdater=roiUpdater,
55 RoisWriteHandleKey=
recordable( flags.Trigger.InDetTracking.fullScan.roi )
60 InputMakerAlg = CompFactory.InputMakerForRoI(
61 "IM_Jet_TrackingStep",
62 mergeUsingFeature =
False,
63 RoITool = CompFactory.ViewCreatorInitialROITool(),
67 elif trkopt==
"roiftf":
68 InputMakerAlg = CompFactory.EventViewCreatorAlgorithm(
70 mergeUsingFeature =
False,
71 RoITool = CompFactory.ViewCreatorJetSuperROITool(
72 'ViewCreatorJetSuperRoI',
73 RoisWriteHandleKey =
recordable( flags.Trigger.InDetTracking.jetSuper.roi ),
74 RoIEtaWidth = flags.Trigger.InDetTracking.jetSuper.etaHalfWidth,
75 RoIPhiWidth = flags.Trigger.InDetTracking.jetSuper.phiHalfWidth,
76 RoIZWidth = flags.Trigger.InDetTracking.jetSuper.zedHalfWidth,
78 Views =
"JetSuperRoIViews",
79 InViewRoIs =
"InViewRoIs",
80 RequireParentView =
False,
81 ViewFallThrough =
True,
84 raise RuntimeError(f
"Unrecognised trkopt '{trkopt}' provided, choices are ['ftf','roiftf']")
117 """constructs CA with hypo alg given arguments """
118 if hypoType==JetHypoAlgType.PASSTHROUGH:
119 hyponame = f
"TrigStreamerHypoAlg_{jetDefStr}_passthrough"
120 hypo = CompFactory.TrigStreamerHypoAlg(hyponame)
122 assert jetsIn
is not None
123 if hypoType==JetHypoAlgType.CALOPRESEL:
124 hyponame = f
"TrigJetHypoAlg_{jetDefStr}_calopresel"
125 hypo = CompFactory.TrigJetHypoAlg(hyponame, Jets=jetsIn, DoPresel=
True)
126 elif hypoType==JetHypoAlgType.ROIPRESEL:
127 hyponame = f
"TrigJetHypoAlg_{jetDefStr}_roipresel"
128 hypo = CompFactory.TrigJetHypoAlg(hyponame, Jets=jetsIn, DoPresel=
True)
130 hyponame = f
"TrigJetHypoAlg_{jetDefStr}"
131 hypo = CompFactory.TrigJetHypoAlg(hyponame, Jets=jetsIn)
133 ca.addEventAlgo(hypo)
136 def selName(recoSequenceName, hypoType=JetHypoAlgType.STANDARD):
137 """Construct selection (the name passed to SelectionCA) given reco sequence and hypo type"""
138 selname = recoSequenceName.replace(
'RecoSequence',
'MenuSequence')
139 if hypoType==JetHypoAlgType.PASSTHROUGH:
140 selname +=
"_passthrough"
142 if hypoType==JetHypoAlgType.CALOPRESEL:
143 selname +=
"_calopresel"
144 elif hypoType==JetHypoAlgType.ROIPRESEL:
145 selname +=
"_roipresel"
150 """returns function (that in turn returns hypo tool) for menu sequence"""
151 def trigStreamerHypoTool(chainDict):
152 return CompFactory.TrigStreamerHypoTool(chainDict[
"chainName"])
154 JetHypoAlgType.STANDARD: trigJetHypoToolFromDict,
155 JetHypoAlgType.PASSTHROUGH: trigStreamerHypoTool,
156 JetHypoAlgType.CALOPRESEL: caloPreselJetHypoToolFromDict,
157 JetHypoAlgType.ROIPRESEL: roiPreselJetHypoToolFromDict,
171 jetsOut, jetDef = jetDefDict[
'final']
173 reco = InEventRecoCA(f
"jetSeqCaloPresel_{jetDefStr}_RecoSequence", inputMaker=
getCaloInputMaker())
175 if 'LC' in jetDef.inputdef.label:
180 from .JetRecoSequencesConfig
import JetRecoCfg
182 reco.mergeReco(jetreco)
184 log.debug(
"Generating jet preselection menu sequence for reco %s",jetDef.fullname())
185 selAcc = SelectionCA(
selName(reco.name, hypoType=JetHypoAlgType.CALOPRESEL))
186 selAcc.mergeReco(reco)
187 selAcc.mergeHypo(
jetSelectionCfg(flags, jetDefStr=jetDefStr, jetsIn=jetsOut, hypoType=JetHypoAlgType.CALOPRESEL))
189 return MenuSequence(flags, selAcc, HypoToolGen=
hypoToolGenerator(hypoType=JetHypoAlgType.CALOPRESEL))
195 reco = InEventRecoCA(f
"jetSeqCaloReco_{clusterCalib}_RecoSequence", inputMaker=
getCaloInputMaker())
197 if clusterCalib==
'lcw':
202 selAcc = SelectionCA(
selName(reco.name, hypoType=JetHypoAlgType.PASSTHROUGH))
203 selAcc.mergeReco(reco)
204 selAcc.mergeHypo(
jetSelectionCfg(flags, jetDefStr=
"caloreco", jetsIn=
None, hypoType=JetHypoAlgType.PASSTHROUGH))
206 return MenuSequence(flags, selAcc, HypoToolGen=
hypoToolGenerator(hypoType=JetHypoAlgType.PASSTHROUGH))
214 jetsOut, jetDef = jetDefDict[
'final']
216 reco = InEventRecoCA(f
"jetSeqCaloHypo_{jetDefStr}{'_perf' if isPerf else ''}_RecoSequence", inputMaker=
getCaloInputMaker())
218 if 'LC' in jetDef.inputdef.label:
223 from .JetRecoSequencesConfig
import JetRecoCfg
225 reco.mergeReco(jetreco)
226 log.debug(
"Generating jet calo hypo menu sequence for reco %s",jetDef.fullname())
228 hypoType = JetHypoAlgType.PASSTHROUGH
if isPerf
else JetHypoAlgType.STANDARD
229 selAcc = SelectionCA(
selName(reco.name, hypoType=hypoType))
230 selAcc.mergeReco(reco)
231 selAcc.mergeHypo(
jetSelectionCfg(flags, jetDefStr=jetDefStr, jetsIn=jetsOut, hypoType=hypoType))
241 reco = InEventRecoCA(f
"jetSeqHICaloHypo_{jetRecoDict['jetDefStr']}{'_perf' if isPerf else ''}_RecoSequence", inputMaker=
getCaloInputMaker())
245 from .JetHIConfig
import jetHIRecoSequenceCA
246 jetreco, jetsOut, jetDef =
jetHIRecoSequenceCA(flags, clustersKey=
"HLT_HICaloClustersFS",towerKey = fs_towers, **jetRecoDict)
247 reco.mergeReco(jetreco)
248 log.debug(
"Generating jet HI calo hypo menu sequence for reco %s",jetDef.fullname())
249 hypoType = JetHypoAlgType.PASSTHROUGH
if isPerf
else JetHypoAlgType.STANDARD
250 selAcc = SelectionCA(
selName(reco.name, hypoType=hypoType))
251 selAcc.mergeReco(reco)
252 selAcc.mergeHypo(
jetSelectionCfg(flags, jetDefStr=jetRecoDict[
'jetDefStr'], jetsIn=jetsOut, hypoType=hypoType))
261 jetsOut, jetDef = jetDefDict[
'final']
263 trkopt = jetDef.context
264 reco = InEventRecoCA(f
"jetFSTrackingHypo_{jetDefStr}{'_perf' if isPerf else ''}_RecoSequence", inputMaker=
getTrackingInputMaker(flags,trkopt))
266 assert trkopt !=
"notrk"
267 from .JetTrackingConfig
import JetFSTrackingCfg
269 reco.mergeReco(trk_acc)
271 from .JetRecoSequencesConfig
import JetRecoCfg
273 reco.mergeReco(jetreco)
274 log.debug(
"Generating jet tracking hypo menu sequence for reco %s",jetDef.fullname())
276 if 'PFlow' in jetDef.basename
and jetDef.basename.startswith(
'AntiKt4')
and 'sub' in jetCalibFromJetDef(jetDef):
277 pvKey = flags.Trigger.InDetTracking.fullScan.vertex_jet
278 trig_evt_info_key =
recordable(
"HLT_TCEventInfo_jet")
285 name=
"TrigEventInfoRecorderAlg_jet",
286 decoratePFlowInfo=
True,
287 decorateEMTopoInfo=
False,
288 trigEventInfoKey=trig_evt_info_key, primaryVertexInputName=pvKey,
289 RhoKey_EMTopo=
'HLT_Kt4EMTopoEventShape', RhoKey_PFlow=
'HLT_Kt4EMPFlowEventShape'
293 hypoType = JetHypoAlgType.PASSTHROUGH
if isPerf
else JetHypoAlgType.STANDARD
294 selAcc = SelectionCA(
selName(reco.name, hypoType=hypoType))
295 selAcc.mergeReco(reco)
296 selAcc.mergeHypo(
jetSelectionCfg(flags, jetDefStr=jetDefStr, jetsIn=jetsOut, hypoType=hypoType))
312 reco = InEventRecoCA(
313 f
"jetRoITrackJetTagHypo_{jetDefStr}_RecoSequence",
318 from TrigGenericAlgs.TrigGenericAlgsConfig
import ROBPrefetchingAlgCfg_Si
322 from .JetRecoSequencesConfig
import (
323 FastFtaggedJetCopyAlgCfg, JetRoITrackJetTagSequenceCfg, JetViewAlgCfg, formatFilteredJetsName, JET_DEFAULT_VIEW_PT_MIN_GEV
326 ftaggedJetName =
recordable(ftaggedJetDef.fullname())
327 reco.mergeReco(ftagjet_acc)
333 RoIs=reco.inputMaker().InViewRoIs)
335 seqname = f
"JetRoITrackJetTag_{trkopt}_RecoSequence"
336 reco.addSequence(
parOR(seqname),primary=
True)
337 reco.merge(track_acc,seqname)
338 reco.inputMaker().ViewNodeName = seqname
344 reco.merge(jetview_Acc)
347 hypoType = JetHypoAlgType.ROIPRESEL
if isPresel
else JetHypoAlgType.STANDARD
348 selAcc = SelectionCA(
selName(reco.name, hypoType=hypoType))
349 selAcc.mergeReco(reco)
350 selAcc.mergeHypo(
jetSelectionCfg(flags, jetDefStr=jetDefStr, jetsIn=filtered_jetsIn, hypoType=hypoType))
351 return selAcc, hypoType