5 from __future__
import annotations
10 from typing
import Any
13 from .ConfigHelpers
import AlgConfig, stringToMETRecoDict
14 from .METRecoSequencesConfig
import (
24 from .StepOutput
import StepOutput
25 from ..Menu.SignatureDicts
import METChainParts
26 import GaudiKernel.SystemOfUnits
as Units
27 import TrigEFMissingET.PUClassification
as PUClassification
28 from AthenaConfiguration.ComponentFactory
import CompFactory
29 from AthenaCommon.Utils.unixtools
import find_datafile
32 from AthenaCommon.Logging
import logging
34 log = logging.getLogger(__name__)
38 """Make sure that all algorithms defined in the METChainParts have
41 Really, this is mainly to have something sensible to call in the
42 ConfigHelpers file to succeed the ctest :(
45 for alg
in METChainParts[
"EFrecoAlg"]:
46 for subcls
in AlgConfig._get_subclasses():
47 if subcls.algType() == alg:
50 unknown_algs.append(alg)
52 len(unknown_algs) == 0
53 ),
"The following EFrecoAlgs do not have AlgConfig classes: " "{}".
format(
64 super(CellConfig, self).
__init__(**recoDict)
71 CompFactory.HLT.MET.CellFex(self.
fexName, CellName=cells[
"Cells"]),
82 super(TCConfig, self).
__init__(calib=calib, **recoDict)
88 CompFactory.HLT.MET.TCFex(self.
fexName, ClusterName=clusters[
"Clusters"]),
99 super(TCPufitConfig, self).
__init__(nSigma=nSigma, **recoDict)
100 if nSigma ==
"default":
109 CompFactory.HLT.MET.TCPufitFex(
110 self.
fexName, ClusterName=clusters[
"Clusters"], NSigma=self.
n_sigma
123 return self.
recoDict | {
"calib":
"em"}
128 flags, CompFactory.HLT.MET.MHTFex(self.
fexName, JetName=jets[
"Jets"]), jets
146 inputs = StepOutput.merge(
152 CompFactory.HLT.MET.TrkMHTFex(
154 JetName=inputs[
"Jets"],
155 TrackName=inputs[
"Tracks"],
156 VertexName=inputs[
"Vertices"],
157 TVAName=inputs[
"TVA"],
158 TrackLinkName=inputs[
"GhostTracksLabel"],
159 TrackSelTool=CompFactory.InDet.InDetTrackSelectionTool(
179 CompFactory.HLT.MET.PFSumFex(
180 self.
fexName, NeutralPFOName=pfos[
"nPFOs"], ChargedPFOName=pfos[
"cPFOs"]
192 super(PFOPufitConfig, self).
__init__(nSigma=nSigma, **recoDict)
193 if nSigma ==
"default":
202 CompFactory.HLT.MET.PUSplitPufitFex(
204 InputName=pfos[
"MergedPFOs"],
205 InputCategoryName=pfos[
"PUCategory"],
206 NeutralThresholdMode=PUClassification.NeutralForward,
219 super(CVFPufitConfig, self).
__init__(nSigma=nSigma, **recoDict)
220 if nSigma ==
"default":
229 CompFactory.HLT.MET.PUSplitPufitFex(
231 InputName=clusters[
"Clusters"],
232 InputCategoryName=clusters[
"PUCategory"],
233 NeutralThresholdMode=PUClassification.NeutralForward,
246 super(MHTPufitConfig, self).
__init__(nSigma=nSigma, **recoDict)
247 if nSigma ==
"default":
255 if dct[
"jetCalib"] ==
"default":
256 dct[
"jetCalib"] =
"subjesgscIS"
260 inputs = StepOutput.merge(
jetInputCfg(flags, **recoDict))
262 calibHasAreaSub =
"sub" in jrd[
"jetCalib"]
263 calibHasAreaSub =
False
265 from JetRecConfig.JetRecConfig
import instantiateAliases
266 from JetRecConfig.JetInputConfig
import getEventShapeName
268 instantiateAliases(inputs[
"JetDef"])
272 if recoDict[
"constitType"] ==
"pf":
274 input_key =
"MergedPFOs"
277 input_key =
"Clusters"
280 CompFactory.HLT.MET.MHTPufitFex(
282 InputJetsName=inputs[
"Jets"],
283 InputName=inputs[input_key],
284 JetCalibIncludesAreaSub=calibHasAreaSub,
285 JetEventShapeName=rhoKey,
298 self.
file_name =
"TrigEFMissingET/20220429/NNsingleLayerRed.json"
303 if full_name
is None:
304 raise FileNotFoundError(
305 errno.ENOENT,
"File not found on CALIBPATH", self.
file_name
307 with open(full_name,
"r")
as fp:
308 network = json.load(fp)
315 for dct
in network[
"inputs"]:
316 for dct2
in dct[
"variables"]:
317 met = dct2[
"name"].removeprefix(
"HLT_MET_").
partition(
".")[0]
325 met_names: list[str] = []
328 met_names.append(cfg.outputKey)
329 output = cfg.make_reco_algs(flags, **cfg.interpret_reco_dict())
330 output.add_output_prefix(f
"{alg}.")
331 inputs.merge_other(output)
334 CompFactory.HLT.MET.NNHLTFex(