Skip to content
Snippets Groups Projects
Forked from atlas / athena
79877 commits behind the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
GenerateMETChainDefs.py 1.16 KiB
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration

from ..Menu.ChainDictTools import splitChainDict
from .METChainConfiguration import METChainConfiguration
from ..Menu.ChainMerging import mergeChainDefs

import pprint
from AthenaCommon.Logging import logging
log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.MET.generateChainConfigs' )
log.info("Importing %s",__name__)



def generateChainConfigs( chainDict ):
    log.debug('dictionary is: %s\n', pprint.pformat(chainDict))

    
    listOfChainDicts = splitChainDict(chainDict)
    log.debug("Implement case for met chain with %d legs ",len(listOfChainDicts))
        
    listOfChainDefs = []

    for subChainDict in listOfChainDicts:
        
        MET = METChainConfiguration(subChainDict).assembleChain() 

        listOfChainDefs += [MET]
        log.debug('length of chaindefs %s', len(listOfChainDefs) )
        

    if len(listOfChainDefs)>1:
        log.debug("Implement case for mulit-leg met chain")
        theChainDef = mergeChainDefs(listOfChainDefs, chainDict)
    else:
        theChainDef = listOfChainDefs[0]

    log.debug("theChainDef %s" , theChainDef)

    return theChainDef