ATLAS Offline Software
Loading...
Searching...
No Matches
GenerateBeamspotChainDefs.py
Go to the documentation of this file.
1# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2
3from TriggerMenuMT.HLT.Config.Utility.ChainDictTools import splitChainDict
4from TriggerMenuMT.HLT.Config.Utility.ChainMerging import mergeChainDefs
5from TriggerMenuMT.HLT.CalibCosmicMon.BeamspotChainConfiguration import BeamspotChainConfiguration
6from TriggerMenuMT.HLT.Jet.JetChainConfiguration import JetChainConfiguration
7
8import pprint
9from AthenaCommon.Logging import logging
10log = logging.getLogger(__name__)
11log.debug("Importing %s",__name__)
12
13
14
15def 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