ATLAS Offline Software
GenerateBeamspotChainDefs.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 from TriggerMenuMT.HLT.Config.Utility.ChainDictTools import splitChainDict
4 from TriggerMenuMT.HLT.Config.Utility.ChainMerging import mergeChainDefs
5 from TriggerMenuMT.HLT.CalibCosmicMon.BeamspotChainConfiguration import BeamspotChainConfiguration
6 from TriggerMenuMT.HLT.Jet.JetChainConfiguration import JetChainConfiguration
7 
8 import pprint
9 from AthenaCommon.Logging import logging
10 log = logging.getLogger(__name__)
11 log.debug("Importing %s",__name__)
12 
13 
14 
15 def generateChainConfigs(flags, chainDict):
16 
17  if log.isEnabledFor(logging.DEBUG): # pprint.pformat is expensive
18  log.debug('dictionary is: %s\n', pprint.pformat(chainDict))
19 
20  listOfChainDicts = splitChainDict(chainDict)
21  log.debug("Will generate Config for chain: %s", chainDict['chainName'])
22 
23  listOfChainDefs = []
24 
25  #streamers will never have more than one chainPart but this is still
26  #needed to move to the correct format [{}]->{}
27  for subChainDict in listOfChainDicts:
28 
29  if subChainDict['chainParts'][0]['beamspotChain'] != '':
30 
31  log.debug("Jet tracking based beamspot chain")
32  log.debug("chainDict %s", chainDict)
33 
34  jetConfig = JetChainConfiguration(chainDict)
35  jetConfig.prepareDataDependencies(flags)
36  jetName = jetConfig.jetName
37  log.debug("Jet name %s", jetConfig.jetName)
38  jet = jetConfig.assembleChain(flags)
39  log.debug('Input jet collection name is %s \n', jetName)
40 
41  Beamspot = BeamspotChainConfiguration(subChainDict, jetName).assembleChain(flags)
42  jet.append_step_to_jet(Beamspot.steps)
43 
44  listOfChainDefs += [ jet ]
45  log.debug('length of chaindefs %s', len(listOfChainDefs) )
46 
47  else:
48  log.debug("Traditional beamspot chain")
49  Beamspot = BeamspotChainConfiguration(subChainDict).assembleChain(flags)
50 
51  listOfChainDefs += [Beamspot]
52  log.debug('length of chaindefs %s', len(listOfChainDefs) )
53 
54 
55  if len(listOfChainDefs)>1:
56  log.warning("This is a chain with more than one chainPart, is this really intended?")
57  theChainDef = mergeChainDefs(listOfChainDefs, chainDict)
58  else:
59  theChainDef = listOfChainDefs[0]
60 
61  log.debug("theChainDef %s" , theChainDef)
62 
63  return theChainDef
python.HLT.CalibCosmicMon.GenerateBeamspotChainDefs.generateChainConfigs
def generateChainConfigs(flags, chainDict)
Definition: GenerateBeamspotChainDefs.py:15
ChainDictTools.splitChainDict
def splitChainDict(chainDict)
Definition: ChainDictTools.py:104
ChainMerging.mergeChainDefs
def mergeChainDefs(listOfChainDefs, chainDict, perSig_lengthOfChainConfigs=None)
Definition: ChainMerging.py:15