ATLAS Offline Software
Loading...
Searching...
No Matches
GenerateBjetChainDefs.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 .BjetChainConfiguration import BjetChainConfiguration
5from ..Jet.JetChainConfiguration import JetChainConfiguration
6from TriggerMenuMT.HLT.Config.Utility.ChainMerging import mergeChainDefs
7
8import pprint
9from AthenaCommon.Logging import logging
10log = logging.getLogger(__name__)
11log.debug("Importing %s",__name__)
12
13def generateChainConfigs(flags, chainDict ):
14
15 if log.isEnabledFor(logging.DEBUG): # pprint.pformat is expensive
16 log.debug('bjet full dictionary is: %s\n', pprint.pformat(chainDict))
17
18 listOfChainDicts = splitChainDict(chainDict)
19 listOfChainDefs = []
20
21 for subChainDict in listOfChainDicts:
22
23 jet_cfg = JetChainConfiguration(chainDict)
24 jet_cfg.prepareDataDependencies(flags)
25 jet = jet_cfg.assembleChain(flags)
26 jet_name = jet_cfg.jetName
27
28 # don't setup btagging for legs that are jet-only
29 # happens for bjet + normal jet chains
30 if subChainDict['chainParts'][0]['signature'] != 'Bjet':
31 listOfChainDefs += [jet]
32 else:
33 log.debug('input jet collection name is: %s\n', jet_name)
34 Bjet = BjetChainConfiguration(subChainDict, jet_name).assembleChain(flags)
35 jet.append_bjet_steps(Bjet.steps)
36 listOfChainDefs += [ jet ]
37
38 if len(listOfChainDefs)>1:
39 theBjetChainDef = mergeChainDefs(listOfChainDefs, chainDict)
40 else:
41 theBjetChainDef = listOfChainDefs[0]
42
43 return theBjetChainDef