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

Classes

class  AlgConfig

Functions

 streamer_hypo_tool (flags, chainDict)
str metRecoDictToString (dict[str, str] recoDict, bool skipDefaults=True)
dict[str, Any] stringToMETRecoDict (str string, bool onlyRecoKeys=False)
 make_MET_menu_sequenceGenCfg (flags, sel_acc, hypo_tool)

Variables

 log = logging.getLogger(__name__)
list recoKeys
list metFSRoIs = ["", None, trkFSRoI]

Detailed Description

Helper functions for configuring MET chains

Function Documentation

◆ make_MET_menu_sequenceGenCfg()

python.HLT.MET.ConfigHelpers.make_MET_menu_sequenceGenCfg ( flags,
sel_acc,
hypo_tool )

Definition at line 301 of file ConfigHelpers.py.

301def make_MET_menu_sequenceGenCfg(flags, sel_acc, hypo_tool):
302 return MenuSequence(flags, selectionCA=sel_acc, HypoToolGen=hypo_tool)
303
304# Load all the defined configurations

◆ metRecoDictToString()

str python.HLT.MET.ConfigHelpers.metRecoDictToString ( dict[str, str] recoDict,
bool skipDefaults = True )
Convert a dictionary containing reconstruction keys to a string

Any key (from recoKeys) missing will just be skipped.

Parameters
----------
recoDict : dict[str, str]
    The reconstruction dictionary
skipDefaults : bool, optional
    If true, skip any values that match the default, by default True

Returns
-------
str
    The fixed string representation

Definition at line 48 of file ConfigHelpers.py.

48def metRecoDictToString(recoDict: dict[str, str], skipDefaults: bool = True) -> str:
49 """Convert a dictionary containing reconstruction keys to a string
50
51 Any key (from recoKeys) missing will just be skipped.
52
53 Parameters
54 ----------
55 recoDict : dict[str, str]
56 The reconstruction dictionary
57 skipDefaults : bool, optional
58 If true, skip any values that match the default, by default True
59
60 Returns
61 -------
62 str
63 The fixed string representation
64 """
65 return "_".join(
66 recoDict[k]
67 for k in recoKeys
68 if k in recoDict
69 and (not skipDefaults or recoDict[k] != METChainParts_Default[k])
70 )
71
72

◆ streamer_hypo_tool()

python.HLT.MET.ConfigHelpers.streamer_hypo_tool ( flags,
chainDict )

Definition at line 27 of file ConfigHelpers.py.

27def streamer_hypo_tool(flags, chainDict):
28 return CompFactory.TrigStreamerHypoTool(chainDict["chainName"])
29
30

◆ stringToMETRecoDict()

dict[str, Any] python.HLT.MET.ConfigHelpers.stringToMETRecoDict ( str string,
bool onlyRecoKeys = False )
Convert a string to a MET reco dict. Optionally only keep entries contained in recoKeys. 
Necessary for correctly configuring algorithms as inputs to NN.

Definition at line 73 of file ConfigHelpers.py.

73def stringToMETRecoDict(string: str, onlyRecoKeys: bool = False) -> dict[str, Any]:
74 """Convert a string to a MET reco dict. Optionally only keep entries contained in recoKeys.
75 Necessary for correctly configuring algorithms as inputs to NN.
76 """
77 defaults = copy(METChainParts_Default)
78 if onlyRecoKeys:
79 defaults = {key: defaults[key] for key in recoKeys}
80 # Now go through the parts of the string and fill in the dict
81 for part in string.split("_"):
82 for key, values in METChainParts.items():
83 if not isinstance(values, list):
84 continue
85 if part in values:
86 if isinstance(defaults[key], list):
87 defaults[key].append(part) # type: ignore[attr-defined]
88 else:
89 defaults[key] = part
90 return defaults
91
92

Variable Documentation

◆ log

python.HLT.MET.ConfigHelpers.log = logging.getLogger(__name__)

Definition at line 31 of file ConfigHelpers.py.

◆ metFSRoIs

list python.HLT.MET.ConfigHelpers.metFSRoIs = ["", None, trkFSRoI]

Definition at line 45 of file ConfigHelpers.py.

◆ recoKeys

list python.HLT.MET.ConfigHelpers.recoKeys
Initial value:
1= [
2 "EFrecoAlg",
3 "calib",
4 "constitType",
5 "constitmod",
6 "jetCalib",
7 "nSigma",
8 "addInfo",
9]

Definition at line 36 of file ConfigHelpers.py.