ATLAS Offline Software
Loading...
Searching...
No Matches
python.HLT.MET.METRecoSequencesConfig Namespace Reference

Functions

dict[str, Any] jetRecoDictForMET (**recoDict)
StepOutput cellInputCfg (flags, **recoDict)
StepOutput clusterInputCfg (flags, **recoDict)
StepOutput trackingInputCfg (flags, **recoDict)
StepOutput pfoInputCfg (flags, **recoDict)
StepOutput mergedPFOInputCfg (flags, **recoDict)
StepOutput cvfClusterInputCfg (flags, **recoDict)
StepOutput jetInputCfg (flags, bool force_tracks=False, **recoDict)

Detailed Description

Configuration sequences for the MET input reconstruction

By convention all of these functions return two values: first a defaultdict mapping from
reco step to the component accumulators containing the reconstruction sequences and
second the name(s) of the key outputs created. The names can either be a single string
if there is only one output or a tuple otherwise. Which outputs are returned and their
order should be clearly documented in the method documentation

Function Documentation

◆ cellInputCfg()

StepOutput cellInputCfg ( flags,
** recoDict )
Create the cell inputs

Definition at line 60 of file METRecoSequencesConfig.py.

60def cellInputCfg(flags, **recoDict) -> StepOutput:
61 """Create the cell inputs"""
62 acc = hltCaloCellMakerCfg(flags, name="HLTCaloCellMakerFS", roisKey="")
63 return StepOutput.create(acc, Cells=acc.getPrimary().CellsName)
64
65
66@AccumulatorCache

◆ clusterInputCfg()

StepOutput clusterInputCfg ( flags,
** recoDict )
Create the cluster inputs

Definition at line 67 of file METRecoSequencesConfig.py.

67def clusterInputCfg(flags, **recoDict) -> StepOutput:
68 """Create the cluster inputs"""
69 if recoDict["calib"] == "em":
70 acc = jetmetTopoClusteringCfg(flags, RoIs="")
71 clusters = em_clusters
72 elif recoDict["calib"] == "lcw":
73 acc = jetmetTopoClusteringCfg_LC(flags, RoIs="")
74 clusters = lc_clusters
75 else:
76 raise ValueError(f"Invalid cluster calibration '{recoDict['calib']}'")
77
78 if recoDict.get("constitmod"):
79 # Force the constituent type to topoclusters
80 jetRecoDict = jetRecoDictForMET(**(recoDict | {"constitType": "tc"}))
81 constit = defineJetConstit(jetRecoDict, clustersKey=clusters)
82 acc.addEventAlgo(
83 getConstitModAlg_nojetdef(
84 constit, flags, context=jetRecoDict.get("trkopt", "default"),
85 )
86 )
87 clusters = constit.containername
88
89 return StepOutput.create(acc, Clusters=clusters)
90
91
92@AccumulatorCache

◆ cvfClusterInputCfg()

StepOutput cvfClusterInputCfg ( flags,
** recoDict )
Create the clusters with CVF decorated

Definition at line 161 of file METRecoSequencesConfig.py.

161def cvfClusterInputCfg(flags, **recoDict) -> StepOutput:
162 """Create the clusters with CVF decorated"""
163 inputs = StepOutput.merge(
164 clusterInputCfg(flags, **recoDict),
165 trackingInputCfg(flags),
166 )
167 acc = ComponentAccumulator()
168 acc.addEventAlgo(
169 CompFactory.HLT.MET.CVFAlg(
170 f"{recoDict['calib']}ftfClusterCVFAlg",
171 InputClusterKey=inputs["Clusters"],
172 InputTrackKey=inputs["Tracks"],
173 InputVertexKey=inputs["Vertices"],
174 OutputCVFKey="CVF",
175 TrackSelectionTool=CompFactory.InDet.InDetTrackSelectionTool(
176 CutLevel="TightPrimary"
177 ),
178 TVATool=acc.popToolsAndMerge(
179 CVF_TTVAToolCfg(
180 flags,
181 TrackContName=inputs["Tracks"],
182 VertexContName=inputs["Vertices"]
183 )
184 ),
185 ExtensionTool=CompFactory.ApproximateTrackToLayerTool(),
186 )
187 )
188 acc.addEventAlgo(
189 CompFactory.HLT.MET.CVFPrepAlg(
190 f"{recoDict['calib']}ftfClusterCVFPrepAlg",
191 InputClusterKey=inputs["Clusters"],
192 InputCVFKey="CVF",
193 OutputCategoryKey="PUClassification",
194 )
195 )
196 return StepOutput.create(acc, inputs, CVF="CVF", PUCategory="PUClassification")
197
198
199@AccumulatorCache

◆ jetInputCfg()

StepOutput jetInputCfg ( flags,
bool force_tracks = False,
** recoDict )
Create the input jets

Set force_tracks to True to require tracks and ensure that they are ghost-associated
to the jets.

Returns the accumulators and (jets, jetDef)

Definition at line 200 of file METRecoSequencesConfig.py.

200def jetInputCfg(flags, force_tracks: bool = False, **recoDict) -> StepOutput:
201 """Create the input jets
202
203 Set force_tracks to True to require tracks and ensure that they are ghost-associated
204 to the jets.
205
206 Returns the accumulators and (jets, jetDef)
207 """
208 if force_tracks:
209 recoDict["trkopt"] = "ftf"
210 # hard code to em (for now) - there are no LC jets in EDM
211 jrd = jetRecoDictForMET(
212 **(
213 recoDict
214 | {"calib": "em"}
215 )
216 )
217
218 inputs = StepOutput()
219 if jrd["trkopt"] == "ftf":
220 inputs.merge_other(trackingInputCfg(flags))
221 if jrd["constitType"] == "pf":
222 inputs.merge_other(pfoInputCfg(flags))
223 else:
224 # Always use EM clusters for jets
225 inputs.merge_other(clusterInputCfg(flags, calib="em"))
226
227 acc = ComponentAccumulator()
228 jetDefDict = JetRecoDataDeps(flags, **jrd)
229 jetName, jetDef = jetDefDict['final']
230 jet_acc = JetRecoCfg(flags, **jetDefDict)
231 acc.merge(jet_acc)
232 return StepOutput.create(
233 acc, inputs, Jets=jetName, JetDef=jetDef, **jetDef._contextDic
234 )

◆ jetRecoDictForMET()

dict[str, Any] jetRecoDictForMET ( ** recoDict)
Get a jet reco dict that's usable for the MET slice

Definition at line 35 of file METRecoSequencesConfig.py.

35def jetRecoDictForMET(**recoDict) -> dict[str, Any]:
36 """Get a jet reco dict that's usable for the MET slice"""
37 from ..Jet.JetRecoCommon import getJetCalibDefaultString, jetRecoDictToString
38 from ..Jet.JetRecoCommon import recoKeys as jetRecoKeys
39 from ..Menu.SignatureDicts import JetChainParts_Default
40
41 jrd = {k: recoDict.get(k, JetChainParts_Default[k]) for k in jetRecoKeys}
42 # Rename the cluster calibration
43 with contextlib.suppress(KeyError):
44 jrd["clusterCalib"] = recoDict["calib"]
45 # Fill constitMod
46 jrd["constitMod"] = recoDict.get("constitmod", "")
47 # We only use em calibration for PFOs
48 if jrd["constitType"] == "pf":
49 jrd["clusterCalib"] = "em"
50 # Interpret jet calibration
51 if jrd["jetCalib"] == "default":
52 jrd["jetCalib"] = getJetCalibDefaultString(jrd['recoAlg'],jrd['constitType'],jrd['trkopt'])
53 if jrd["constitType"] != "tc" or "gsc" in jrd["jetCalib"]:
54 jrd["trkopt"] = "ftf"
55 jrd["jetDefStr"] = jetRecoDictToString(jrd)
56 return jrd
57
58
59@AccumulatorCache

◆ mergedPFOInputCfg()

StepOutput mergedPFOInputCfg ( flags,
** recoDict )
Create the merged PFO inputs

Definition at line 143 of file METRecoSequencesConfig.py.

143def mergedPFOInputCfg(flags, **recoDict) -> StepOutput:
144 """Create the merged PFO inputs"""
145 pfos = pfoInputCfg(flags, **recoDict)
146 alg = CompFactory.HLT.MET.FlowElementPrepAlg(
147 f"{pfos['PFOPrefix']}METTrigPFOPrepAlg",
148 InputNeutralKey=pfos["nPFOs"],
149 InputChargedKey=pfos["cPFOs"],
150 OutputKey=f"{pfos['PFOPrefix']}METTrigCombinedParticleFlowObjects",
151 OutputCategoryKey="PUClassification",
152 )
153 acc = ComponentAccumulator()
154 acc.addEventAlgo(alg, primary=True)
155 return StepOutput.create(
156 acc, pfos, MergedPFOs=alg.OutputKey, PUCategory=alg.OutputCategoryKey
157 )
158
159
160@AccumulatorCache

◆ pfoInputCfg()

StepOutput pfoInputCfg ( flags,
** recoDict )
Get the PFO inputs

Definition at line 103 of file METRecoSequencesConfig.py.

103def pfoInputCfg(flags, **recoDict) -> StepOutput:
104 """Get the PFO inputs"""
105 inputs = StepOutput.merge(
106 cellInputCfg(flags),
107 clusterInputCfg(flags, calib="em"),
108 trackingInputCfg(flags),
109 )
110 acc = PFCfg(
111 flags,
112 tracktype="ftf",
113 clustersin=inputs["Clusters"],
114 calclustersin="",
115 tracksin=inputs["Tracks"],
116 verticesin=inputs["Vertices"],
117 cellsin=inputs["Cells"],
118 )
119
120 # The jet constituent modifier sequence here is to apply the correct weights and
121 # decorate the PV matching decoration. If we've specified constituent modifiers
122 # those are also applied.
123 jetRecoDict = jetRecoDictForMET(
124 **(recoDict | {"trkopt": "ftf", "constitType": "pf"})
125 )
126 constit = defineJetConstit(jetRecoDict, pfoPrefix="HLT_ftf")
127 acc.addEventAlgo(
128 getConstitModAlg_nojetdef(constit, flags, context=jetRecoDict.get("trkopt", "default"))
129 )
130 pfoPrefix = constit.containername
131 if pfoPrefix.endswith("ParticleFlowObjects"):
132 pfoPrefix = pfoPrefix[:-19]
133 return StepOutput.create(
134 acc,
135 inputs,
136 PFOPrefix=pfoPrefix,
137 cPFOs=pfoPrefix + "ChargedParticleFlowObjects",
138 nPFOs=pfoPrefix + "NeutralParticleFlowObjects",
139 )
140
141
142@AccumulatorCache
Definition PFCfg.py:1

◆ trackingInputCfg()

StepOutput trackingInputCfg ( flags,
** recoDict )
Get the tracking inputs

Definition at line 93 of file METRecoSequencesConfig.py.

93def trackingInputCfg(flags, **recoDict) -> StepOutput:
94 """Get the tracking inputs"""
95 return StepOutput.create(
96 JetFSTrackingCfg(flags, "ftf", RoIs=trkFSRoI),
97 step_idx=2,
98 **flags.Jet.Context.ftf,
99 )
100
101
102@AccumulatorCache