3"""Configuration sequences for the MET input reconstruction
5By convention all of these functions return two values: first a defaultdict mapping from
6reco step to the component accumulators containing the reconstruction sequences and
7second the name(s) of the key outputs created. The names can either be a single string
8if there is only one output or a tuple otherwise. Which outputs are returned and their
9order should be clearly documented in the method documentation
14from AthenaConfiguration.AccumulatorCache
import AccumulatorCache
15from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
16from AthenaConfiguration.ComponentFactory
import CompFactory
17from eflowRec.PFHLTConfig
import PFCfg
18from JetRecConfig.JetRecConfig
import getConstitModAlg_nojetdef
19from TrigCaloRec.TrigCaloRecConfig
import (
21 jetmetTopoClusteringCfg,
22 jetmetTopoClusteringCfg_LC,
24from ..CommonSequences.FullScanDefs
import em_clusters, lc_clusters, trkFSRoI
25from ..Jet.JetRecoCommon
import (
28from ..Jet.JetRecoSequencesConfig
import JetRecoDataDeps, JetRecoCfg
29from ..Jet.JetTrackingConfig
import JetFSTrackingCfg
30from .StepOutput
import StepOutput
31from TrackVertexAssociationTool.TrackVertexAssociationToolConfig
import CVF_TTVAToolCfg
35 """Get a jet reco dict that's usable for the MET slice"""
36 from ..Jet.JetRecoCommon
import getJetCalibDefaultString, jetRecoDictToString
37 from ..Jet.JetRecoCommon
import recoKeys
as jetRecoKeys
38 from ..Menu.SignatureDicts
import JetChainParts_Default
40 jrd = {k: recoDict.get(k, JetChainParts_Default[k])
for k
in jetRecoKeys}
43 jrd[
"clusterCalib"] = recoDict[
"calib"]
47 jrd[
"constitMod"] = recoDict.get(
"constitmod",
"")
49 if jrd[
"constitType"] ==
"pf":
50 jrd[
"clusterCalib"] =
"em"
52 if jrd[
"jetCalib"] ==
"default":
53 jrd[
"jetCalib"] = getJetCalibDefaultString(jrd[
'recoAlg'],jrd[
'constitType'],jrd[
'trkopt'])
54 if jrd[
"constitType"] !=
"tc" or "gsc" in jrd[
"jetCalib"]:
56 jrd[
"jetDefStr"] = jetRecoDictToString(jrd)
62 """Create the cell inputs"""
63 acc = hltCaloCellMakerCfg(flags, name=
"HLTCaloCellMakerFS", roisKey=
"")
64 return StepOutput.create(acc, Cells=acc.getPrimary().CellsName)
69 """Create the cluster inputs"""
70 if recoDict[
"calib"] ==
"em":
71 acc = jetmetTopoClusteringCfg(flags, RoIs=
"")
72 clusters = em_clusters
73 elif recoDict[
"calib"] ==
"lcw":
74 acc = jetmetTopoClusteringCfg_LC(flags, RoIs=
"")
75 clusters = lc_clusters
77 raise ValueError(f
"Invalid cluster calibration '{recoDict['calib']}'")
79 if recoDict.get(
"constitmod"):
82 constit = defineJetConstit(jetRecoDict, clustersKey=clusters)
84 getConstitModAlg_nojetdef(
85 constit, flags, context=jetRecoDict.get(
"trkopt",
"default"),
88 clusters = constit.containername
90 return StepOutput.create(acc, Clusters=clusters)
95 """Get the tracking inputs"""
96 return StepOutput.create(
97 JetFSTrackingCfg(flags,
"ftf", RoIs=trkFSRoI),
99 **flags.Jet.Context.ftf,
105 """Get the PFO inputs"""
106 inputs = StepOutput.merge(
114 clustersin=inputs[
"Clusters"],
116 tracksin=inputs[
"Tracks"],
117 verticesin=inputs[
"Vertices"],
118 cellsin=inputs[
"Cells"],
125 **(recoDict | {
"trkopt":
"ftf",
"constitType":
"pf"})
127 constit = defineJetConstit(jetRecoDict, pfoPrefix=
"HLT_ftf")
129 getConstitModAlg_nojetdef(constit, flags, context=jetRecoDict.get(
"trkopt",
"default"))
131 pfoPrefix = constit.containername
132 if pfoPrefix.endswith(
"ParticleFlowObjects"):
133 pfoPrefix = pfoPrefix[:-19]
134 return StepOutput.create(
138 cPFOs=pfoPrefix +
"ChargedParticleFlowObjects",
139 nPFOs=pfoPrefix +
"NeutralParticleFlowObjects",
145 """Create the merged PFO inputs"""
147 alg = CompFactory.HLT.MET.FlowElementPrepAlg(
148 f
"{pfos['PFOPrefix']}METTrigPFOPrepAlg",
149 InputNeutralKey=pfos[
"nPFOs"],
150 InputChargedKey=pfos[
"cPFOs"],
151 OutputKey=f
"{pfos['PFOPrefix']}METTrigCombinedParticleFlowObjects",
152 OutputCategoryKey=
"PUClassification",
154 acc = ComponentAccumulator()
155 acc.addEventAlgo(alg, primary=
True)
156 return StepOutput.create(
157 acc, pfos, MergedPFOs=alg.OutputKey, PUCategory=alg.OutputCategoryKey
163 """Create the clusters with CVF decorated"""
164 inputs = StepOutput.merge(
168 acc = ComponentAccumulator()
170 CompFactory.HLT.MET.CVFAlg(
171 f
"{recoDict['calib']}ftfClusterCVFAlg",
172 InputClusterKey=inputs[
"Clusters"],
173 InputTrackKey=inputs[
"Tracks"],
174 InputVertexKey=inputs[
"Vertices"],
176 TrackSelectionTool=CompFactory.InDet.InDetTrackSelectionTool(
177 CutLevel=
"TightPrimary"
179 TVATool=acc.popToolsAndMerge(
182 TrackContName=inputs[
"Tracks"],
183 VertexContName=inputs[
"Vertices"]
186 ExtensionTool=CompFactory.ApproximateTrackToLayerTool(),
190 CompFactory.HLT.MET.CVFPrepAlg(
191 f
"{recoDict['calib']}ftfClusterCVFPrepAlg",
192 InputClusterKey=inputs[
"Clusters"],
194 OutputCategoryKey=
"PUClassification",
197 return StepOutput.create(acc, inputs, CVF=
"CVF", PUCategory=
"PUClassification")
201def jetInputCfg(flags, force_tracks: bool =
False, **recoDict) -> StepOutput:
202 """Create the input jets
204 Set force_tracks to True to require tracks and ensure that they are ghost-associated
207 Returns the accumulators and (jets, jetDef)
210 recoDict[
"trkopt"] =
"ftf"
220 if jrd[
"trkopt"] ==
"ftf":
222 if jrd[
"constitType"] ==
"pf":
228 acc = ComponentAccumulator()
229 jetDefDict = JetRecoDataDeps(flags, **jrd)
230 jetName, jetDef = jetDefDict[
'final']
231 jet_acc = JetRecoCfg(flags, **jetDefDict)
233 return StepOutput.create(
234 acc, inputs, Jets=jetName, JetDef=jetDef, **jetDef._contextDic
StepOutput mergedPFOInputCfg(flags, **recoDict)
StepOutput trackingInputCfg(flags, **recoDict)
StepOutput cellInputCfg(flags, **recoDict)
StepOutput clusterInputCfg(flags, **recoDict)
dict[str, Any] jetRecoDictForMET(**recoDict)
StepOutput pfoInputCfg(flags, **recoDict)
StepOutput cvfClusterInputCfg(flags, **recoDict)
StepOutput jetInputCfg(flags, bool force_tracks=False, **recoDict)