ATLAS Offline Software
METChainConfiguration.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaCommon.Logging import logging
4 
5 logging.getLogger().info("Importing %s", __name__)
6 log = logging.getLogger(__name__)
7 
8 from ..Config.ChainConfigurationBase import ChainConfigurationBase
9 from .ConfigHelpers import recoKeys, AlgConfig
10 from ..Menu.SignatureDicts import METChainParts_Default
11 
12 
13 def extractMETRecoDict(chainDict, fillDefaults=True):
14  """ Extract the keys relevant to reconstruction from a provided dictionary
15 
16  If fillDefaults is True then any missing keys will be taken from the
17  METChainParts_Default dictionary.
18  """
19  if fillDefaults:
20  return {k: chainDict.get(k, METChainParts_Default[k]) for k in recoKeys}
21  else:
22  return {k: chainDict[k] for k in recoKeys if k in chainDict}
23 
24 
25 # ----------------------------------------------------------------
26 # Class to configure chain
27 # ----------------------------------------------------------------
29  def __init__(self, chainDict):
30  ChainConfigurationBase.__init__(self, chainDict)
31  # Only some subset of keys in the METChainParts dictionary describe
32  # reconstruction details - only these keys are passed down into the menu
33  # sequence (the actual hypo tool is created later)
34  self.recoDict = extractMETRecoDict(self.chainPart)
35 
36  # ----------------------
37  # Assemble the chain depending on information from chainName
38  # ----------------------
39  def assembleChainImpl(self, flags):
40  log.debug("Assembling chain for %s", self.chainName)
41  conf = AlgConfig.fromRecoDict(**self.recoDict)
42  steps = conf.make_accumulator_steps(flags, self.dict)
43 
44  return self.buildChain(steps)
grepfile.info
info
Definition: grepfile.py:38
ChainConfigurationBase
Definition: ChainConfigurationBase.py:1
python.HLT.MET.METChainConfiguration.METChainConfiguration.__init__
def __init__(self, chainDict)
Definition: METChainConfiguration.py:29
python.HLT.MET.METChainConfiguration.extractMETRecoDict
def extractMETRecoDict(chainDict, fillDefaults=True)
Definition: METChainConfiguration.py:13
python.HLT.MET.METChainConfiguration.METChainConfiguration
Definition: METChainConfiguration.py:28
python.HLT.MET.METChainConfiguration.METChainConfiguration.recoDict
recoDict
Definition: METChainConfiguration.py:34
python.HLT.MET.METChainConfiguration.METChainConfiguration.assembleChainImpl
def assembleChainImpl(self, flags)
Definition: METChainConfiguration.py:39