diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureHypoTools.py b/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureHypoTools.py index a402198f5aa0a7e0cc5d225216902f67d2822a77..b6163673e65def6ea31280c819a87f737dc26c45 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureHypoTools.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureHypoTools.py @@ -11,18 +11,26 @@ def TestHypoTool(name, prop, threshold_value): return h def MuTestHypoTool(name, conf): - threshold = conf.replace("HLT_mu","") + #threshold = conf.replace("HLT_mu","") + threshold = getThreshold(conf, 'mu') return TestHypoTool(name,prop="pt", threshold_value=threshold) def ElTestHypoTool(name,conf): - threshold = conf.replace("HLT_e","") + #threshold = conf.replace("HLT_e","") + threshold = getThreshold(conf, 'e') return TestHypoTool(name,prop="et", threshold_value=threshold) def GammTestHypoTool(name,conf): - threshold = conf.replace("HLT_g","") + threshold = getThreshold(conf, 'g') return TestHypoTool(name,prop="et", threshold_value=threshold) def MuTest2HypoTool(name, conf): - threshold = conf.replace("HLT_mu","") + threshold = getThreshold(conf, 'mu') return TestHypoTool(name,prop="pt2", threshold_value=threshold) + + +def getThreshold(name, signature): + from TriggerMenuMT.HLTMenuConfig.Menu import DictFromChainName + dictDecoding = DictFromChainName.DictFromChainName() + return dictDecoding.getChainThresholdFromName(name, signature) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessing.ref b/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessing.ref index 5b81f38f4ed6b42c88d75588bf6b2c7ff8a3ffb9..e602c1cc22492c7f50600e4389825ffb9dcde626 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessing.ref +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessing.ref @@ -12,7 +12,7 @@ TrigSignatureMoniMT INFO HLT_mu20 TrigSignatureMoniMT INFO HLT_mu20 decisions 0 0 TrigSignatureMoniMT INFO HLT_mu8 2 2 2 2 2 TrigSignatureMoniMT INFO HLT_mu8 decisions 2 2 -TrigSignatureMoniMT INFO HLT_mu81step 2 2 2 0 2 -TrigSignatureMoniMT INFO HLT_mu81step decisions 2 0 +TrigSignatureMoniMT INFO HLT_mu8_1step 2 2 2 0 2 +TrigSignatureMoniMT INFO HLT_mu8_1step decisions 2 0 TrigSignatureMoniMT INFO HLT_mu8_e8 1 1 1 1 1 TrigSignatureMoniMT INFO HLT_mu8_e8 decisions 4 4 diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessingTest.py b/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessingTest.py index c990c0acb764475cb22db3695a7b48bf66eb666f..8af36ddf767f5b3cf4347ba4450d889e317fcaa0 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessingTest.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessingTest.py @@ -33,8 +33,8 @@ data['msmu'] = [';', data['ctp'] = [ 'HLT_e20 HLT_e5_e8 HLT_e5 HLT_e8 HLT_g5', 'HLT_e20 HLT_e5_e8 HLT_e5 HLT_e8 HLT_g5', - 'HLT_mu8 HLT_mu81step HLT_e20 HLT_e8 HLT_mu8_e8 HLT_e3_e5', - 'HLT_mu20 HLT_mu8 HLT_mu81step HLT_2mu8 HLT_e8' ] + 'HLT_mu8 HLT_mu8_1step HLT_e20 HLT_e8 HLT_mu8_e8 HLT_e3_e5', + 'HLT_mu20 HLT_mu8 HLT_mu8_1step HLT_2mu8 HLT_e8' ] data['l1emroi'] = [ ';', @@ -100,7 +100,7 @@ if doMuon: MuChains = [ Chain(name='HLT_mu20', Seed="L1_MU10", ChainSteps=[ChainStep("Step1_mu", [muStep1]) , ChainStep("Step2_mu", [muStep2] )]) , - Chain(name='HLT_mu81step', Seed="L1_MU6", ChainSteps=[ChainStep("Step1_mu", [muStep1]) ]) , + Chain(name='HLT_mu8_1step', Seed="L1_MU6", ChainSteps=[ChainStep("Step1_mu", [muStep1]) ]) , Chain(name='HLT_mu8', Seed="L1_MU6", ChainSteps=[ChainStep("Step1_mu", [muStep1]) , ChainStep("Step2_mu", [muStep2] ) ] ) ] diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py index 71e10d6a454270263a9f82c52a3707459df9c023..396c86fbb55e7f487ea7bdf144c75172807439c3 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py @@ -49,9 +49,8 @@ class ElectronChainConfiguration(ChainConfigurationBase): if 'etcut' in self.chainName: myStepNames += ["Step1_etcut"] myStepNames += ["Step2_etcut"] - for step in myStepNames: + for step in myStepNames: chainSteps += [self.getEtCutStep(step)] - log.debug("chainSteps are: ", chainSteps ) else: raise RuntimeError("Chain configuration unknown for chain: " + self.chainName ) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py index 3bab299532cc42896e98b7d247005cbddf22e136..88662f5a83ac3de17ae96c8d31cdde490fc50005 100755 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py @@ -1,16 +1,15 @@ # Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration """ - Class to obtain the chain configuration dictionary from the short or long name -Authors: Catrin Bernius, Joerg Stelzer, Moritz Backes -Written in December 2013 +Author: Catrin Bernius +Original code from TriggerMenu with CB, Joerg Stelzer, Moritz Backes """ -__author__ = 'Moritz Backes & Catrin Bernius & Joerg Stelzer' +__author__ = 'Catrin Bernius' __version__="" -__doc__="Obtaining Dictionaries from Chain Names" +__doc__="Decoding of chain name into a dictionary" import re @@ -19,6 +18,7 @@ from AthenaCommon.Logging import logging logging.getLogger().info("Importing %s",__name__) logDict = logging.getLogger('TriggerMenu.menu.DictFromChainName') + class DictFromChainName(object): def getChainDict(self,chainInfo): @@ -26,17 +26,27 @@ class DictFromChainName(object): # ---- Loop over all chains (keys) in dictionary ---- # ---- Then complete the dict with other info ---- - # ---- of formate: # chainName : ---- + # ---- of format: # chainName : ---- # ---- chainCounter (int), L1item (str), Stream (str), EBstep (str)] ---- # ---- chainName = chainInfo[0] - m_chainName = chainInfo[0] - m_L1item = chainInfo[1] - m_L1items_chainParts = chainInfo[2] - m_stream = chainInfo[3] - m_groups = chainInfo[4] - m_EBstep = chainInfo[5] - + if type(chainInfo) == str: + m_chainName = chainInfo + m_L1item = '' + m_L1items_chainParts = [] + m_stream = '' + m_groups = [] + m_EBstep = '' + + elif type(chainInfo) == list: + m_chainName = chainInfo[0] + m_L1item = chainInfo[1] + m_L1items_chainParts = chainInfo[2] + m_stream = chainInfo[3] + m_groups = chainInfo[4] + m_EBstep = chainInfo[5] + else: + logDict.error("Format of chainInfo passed to genChainDict not known") logDict.debug("Analysing chain with name: %s", m_chainName) chainProp = self.analyseShortName(m_chainName, m_L1items_chainParts, m_L1item) @@ -46,8 +56,13 @@ class DictFromChainName(object): chainProp['EBstep'] = m_EBstep chainProp['groups'] = m_groups + logDict.debug('Setting chain multiplicities') + allChainMultiplicities = self.getChainMultFromDict(chainProp) + + chainProp['chainMultiplicities'] = allChainMultiplicities + # for additional options: mergingStrategy and topoStartFrom - if len(chainInfo) > 6: + if len(chainInfo) > 6 and type(chainInfo) == list: for i in xrange(6, len(chainInfo)): mergingInfoFilled = False tsfInfoFilled = False @@ -60,21 +75,13 @@ class DictFromChainName(object): m_mergingOrder = chainInfo[i][2] if(len(chainInfo[i]) >3): m_preserveL2EFOrder = chainInfo[i][3] - #print "Setting m_preserveL2EFOrder to " + str(chainInfo[i][3] ) else: m_preserveL2EFOrder = True - #print "Setting m_preserveL2EFOrder to True" - - # if(len(chainInfo[i]) >4): - # m_noTEreplication = chainInfo[i][4] - # else: - # m_noTEreplication = False chainProp['mergingStrategy'] = m_mergingStrategy chainProp['mergingOffset'] = m_mergingOffset chainProp['mergingOrder'] = m_mergingOrder chainProp['mergingPreserveL2EFOrder'] = m_preserveL2EFOrder - # chainProp['mergingNoTEreplication'] = m_noTEreplication mergingInfoFilled = True else: logDict.error("Something went wrong here....topoStartFrom has already been filled!") @@ -95,9 +102,62 @@ class DictFromChainName(object): pp = pprint.PrettyPrinter(indent=4, depth=8) logDict.debug('FINAL dictionary: %s', pp.pformat(chainProp)) + return chainProp + def getChainMultFromDict(self, chainDict): + allMultis = [] + for cpart in chainDict['chainParts']: + if cpart['multiplicity'] != '': + allMultis.append(cpart['multiplicity']) + return allMultis + + + def getChainMultFromName(self, chainName): + cNameParts = chainName.split("_") + + from SignatureDicts import getBasePattern + pattern = getBasePattern() + mdicts=[] + multichainindex=[] + signatureNames = [] + + allMultis = [] + for cpart in cNameParts: + m = pattern.match(cpart) + if m: + logDict.debug("In getChainMultFromName: Pattern found in this string: %s", cpart) + m_groupdict = m.groupdict() + if m_groupdict['multiplicity'] == '': + multiplicity = 1 + allMultis.append(multiplicity) + return allMultis + + def getChainThresholdFromName(self, chainName, signature): + cNameParts = chainName.split("_") + + from SignatureDicts import getBasePattern + pattern = getBasePattern() + mdicts=[] + multichainindex=[] + signatureNames = [] + trigType = [] + thresholdToPass = 0 + + allThresh = [] + for cpart in cNameParts: + m = pattern.match(cpart) + if m: + logDict.debug("In getChainMultFromName: Pattern found in this string: %s", cpart) + m_groupdict = m.groupdict() + allThresh.append(m_groupdict['threshold']) + trigType.append(m_groupdict['trigType']) + if signature == m_groupdict['trigType']: + thresholdToPass = m_groupdict['threshold'] + break + return thresholdToPass + def analyseShortName(self, chainName, L1items_chainParts, L1item_main): """ @@ -114,33 +174,11 @@ class DictFromChainName(object): genchainDict = deepcopy(ChainDictTemplate) genchainDict['chainName'] = chainName - - # ---- check for L1Topo in chain name ---- - # This is not necessary, as CTP item names with L1Topo are extracted in the same way as the normal CTP items. (ATR-9264) - ''' - L1topoitemFromChainName = ''; L1topoitem = ''; L1topoindex = -5 - L1topoindex = [n for n in xrange(len(chainName)) if chainName.find('L1', n) == n] - if (L1topoindex): - logDict.debug('L1topindex: '+ str(L1topoindex)) - - if (len(L1topoindex) == 1): - L1topoitemfromChainName = chainName[L1topoindex[0]:] - if ('-' in L1topoitemfromChainName): - if (L1topoitemfromChainName[2]=='_'): - raise RuntimeError('NOT FOLLOWING THE NAMING CONVENTION: L1 items in chainNames are specified e.g. L1EM4_MU4, not L1_EM4_MU4') - else: - L1topoitem = L1topoitemfromChainName[:2]+'_'+L1topoitemfromChainName[2:] - logDict.debug('L1topoitem: ', str(L1topoitem)) - chainName = chainName[:L1topoindex[0]-1] # -1 to also remove _ - # build in a check to compare l1 item given with the one found - genchainDict['L1item'] = L1topoitem - else: - logDict.debug('L1 item in name is not a L1Topo item') - ''' - # ---- specific chain part information ---- allChainProperties=[] cparts = chainName.split("_") + if 'HLT' in chainName: + cparts.remove('HLT') # ---- identify the topo algorithm and add to genchainDict ----- @@ -376,9 +414,7 @@ class DictFromChainName(object): # ---- assign L1 to chain parts from L1 item list in menu ---- # ---- check if enough L1 items given for chain parts ---- - #print "BETTA: ", L1items_chainParts if (len(L1items_chainParts) > 0): - #print "BETTA: ",len(L1items_chainParts), len(multichainparts) if (len(L1items_chainParts) != len(multichainparts)): logDict.info("Not enough L1 items for chain parts of chain %s defined => fix in menu please!", genchainDict['chainName']) @@ -391,15 +427,9 @@ class DictFromChainName(object): else: logDict.debug('No L1 item specified in the name') - - #print 'chainpartsNoL1', chainpartsNoL1 parts=chainpartsNoL1.split('_') parts = filter(None,parts) - #print 'parts after L1 string removal = ',parts - # ---- start with first pattern and write into dict and remove it afterwards ---- - #print 'MOO chainindex', chainindex - #print 'MOO mdicts', mdicts chainProperties['trigType']=mdicts[chainindex]['trigType'] chainProperties['extra']=mdicts[chainindex]['extra'] multiplicity = mdicts[chainindex]['multiplicity'] if not mdicts[chainindex]['multiplicity'] == '' else '1' @@ -490,8 +520,6 @@ class DictFromChainName(object): forbiddenValue = chainProperties.pop(fb) if forbiddenValue != '': raise RuntimeError("Property %s not allowed for signature '%s', but specified '%s'" % (fb, chainProperties['signature'], forbiddenValue)) - - # ---- the info of the general and the specific chain parts dict ---- allChainProperties.append(chainProperties) @@ -499,16 +527,10 @@ class DictFromChainName(object): # ---- depending on if signatures are different in this chain, break up the chainProperties dictionary ---- # ---- finally also taking care of the signatrue key ---- - #if len(signatureNames) == 1: genchainDict['chainParts'] = allChainProperties - - # CB DELETE FROM DICTIONARY???? genchainDict['signature'] = allChainProperties[0]['signature'] logDict.debug('genchainDict that is passed as Final dict %s', genchainDict) - #for cprop in allChainProperties: del cprop['signature'] - - return genchainDict diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py index d728c80107d55d94baafdcf3e8f5a412c543784d..882b7e405c0f40965c53776f298e8f115af12ce2 100755 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py @@ -72,7 +72,8 @@ class GenerateMenuMT: self.doEgammaChains = False listOfChainConfigs = [] - chainDicts = splitInterSignatureChainDict(chainDicts) + chainDicts = splitInterSignatureChainDict(chainDicts) + if log.isEnabledFor(logging.DEBUG): import pprint pp = pprint.PrettyPrinter(indent=4, depth=8) @@ -198,7 +199,7 @@ class GenerateMenuMT: - def generateChainConfigs(self): + def generateAllChainConfigs(self): # get all chain names from menu log.debug ("getting chains from Menu") @@ -211,6 +212,8 @@ class GenerateMenuMT: for chain in chainsInMenu: log.debug("Currently processing chain: %s ", chain) chainDict = decodeChainName.getChainDict(chain) + self.triggerConfigHLT.allChainDicts.append(chainDict) + chainCounter += 1 chainDict['chainCounter'] = chainCounter @@ -244,7 +247,7 @@ class GenerateMenuMT: # -------------------------------------------------------------------- # HLT menu generation # -------------------------------------------------------------------- - finalListOfChainConfigs = self.generateChainConfigs() + finalListOfChainConfigs = self.generateAllChainConfigs() log.debug("Length of FinalListofChainConfigs %s", len(finalListOfChainConfigs)) log.debug("finalListOfChainConfig %s", finalListOfChainConfigs) @@ -255,7 +258,7 @@ class GenerateMenuMT: for step in cc.steps: print step - makeHLTTree(finalListOfChainConfigs) + makeHLTTree(finalListOfChainConfigs, self.triggerConfigHLT) # the return values used for debugging, might be removed later return finalListOfChainConfigs diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py index 1fd4cb0cd4cef374984e1b3e0332e41f8894ed16..aea1926e3c44ca83b1e336c316f1037b3225226c 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py @@ -41,6 +41,7 @@ def generateMenu( flags ): counter = 0 signatureToGenerator = {} menuChains = [] + allChainDicts =[] menuAcc = ComponentAccumulator() mainSequenceName = 'HLTAllSteps' @@ -66,6 +67,7 @@ def generateMenu( flags ): counter += 1 chainDict['chainCounter'] = counter + allChainDicts.append(chainDict) # TODO topo threshold # call generating function and pass to CF builder @@ -78,8 +80,8 @@ def generateMenu( flags ): # pass all menuChain to CF builder - chainsAcc = generateDecisionTree(menuAcc.getSequence(mainSequenceName), menuChains) + chainsAcc = generateDecisionTree(menuAcc.getSequence(mainSequenceName), menuChains, allChainDicts) chainsAcc.printConfig() menuAcc.merge( chainsAcc ) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py index ced2f3a1314a9faddd2718159e97488c87644fbe..e131666ca923f8df81353dd7a33d63b09fb4b2c4 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py @@ -106,7 +106,28 @@ def createCFTree(CFseq): -def makeHLTTree(HLTChains): +def makeHLTTree(HLTChains, triggerConfigHLT = None): + + # Check if triggerConfigHLT exits, if yes, derive information from this + # this will be in use once TrigUpgrade test has migrated to TriggerMenuMT completely + allChainDicts = [] + allChainConfigs = [] + if triggerConfigHLT: + log.info("Obtaining chain dictionaries and configuration from triggerConfigHLT") + allChainConfigs = triggerConfigHLT.allChainConfigs + allChainDicts = triggerConfigHLT.allChainDicts + else: + log.info("No triggerConfigHLT was passed, only relying on HLTChains now") + log.info("Creating necessary chainDict info now") + allChainConfigs = HLTChains + # call dictfrom chain name maybe here once to obtain list of dictionaries for all chains + # loop over HLT Chains + from TriggerMenuMT.HLTMenuConfig.Menu import DictFromChainName + decodeChainName = DictFromChainName.DictFromChainName() + for chain in allChainConfigs: + chainDict = decodeChainName.getChainDict(chain.name) + allChainDicts.append(chainDict) + """ creates the full HLT tree""" # lock flags @@ -138,9 +159,10 @@ def makeHLTTree(HLTChains): hltTop += steps # make CF tree - finalDecisions = decisionTree_From_Chains(steps, HLTChains) + + finalDecisions = decisionTree_From_Chains(steps, allChainConfigs, allChainDicts) + EnabledChainNames = [c.name for c in allChainConfigs] - # make Final Summary flatDecisions=[] for step in finalDecisions: flatDecisions.extend (step) summary= makeSummary("TriggerSummaryFinal", flatDecisions) @@ -203,7 +225,7 @@ def matrixDisplay( allSeq ): -def decisionTree_From_Chains(HLTNode, chains): +def decisionTree_From_Chains(HLTNode, chains, allDicts): """ creates the decision tree, given the starting node and the chains containing the sequences """ log.debug("Run decisionTree_From_Chains on %s", HLTNode.name()) @@ -215,11 +237,13 @@ def decisionTree_From_Chains(HLTNode, chains): chainWithMaxSteps = max(chains, key=lambda chain: len(chain.steps)) NSTEPS = len(chainWithMaxSteps.steps) + # add chains to multiplicity map (new step here, as this was originally in the __init__ of Chain class + #loop over chains to configure hypotools # must be done after all chains are created, to avoid conflicts log.debug("Loop over chains to decode hypo tools") for chain in chains: - chain.decodeHypoToolConfs() + chain.decodeHypoToolConfs(allDicts) finalDecisions = [] # needed for monitor allSeq_list = [] @@ -332,7 +356,7 @@ def decisionTree_From_Chains(HLTNode, chains): return finalDecisions -def generateDecisionTree(HLTNode, chains): +def generateDecisionTree(HLTNode, chains, allChainDicts): log.debug("Run decisionTree_From_Chains on %s", HLTNode.name()) from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator acc = ComponentAccumulator() @@ -343,7 +367,7 @@ def generateDecisionTree(HLTNode, chains): ## Fill chain steps matrix for chain in chains: - chain.decodeHypoToolConfs() + chain.decodeHypoToolConfs(allChainDicts) for stepNumber, chainStep in enumerate(chain.steps): chainName = chainStep.name.split('_')[0] chainStepsMatrix[stepNumber][chainName].append(chain) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuChains.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuChains.py deleted file mode 100644 index 780cea06d69ec3b01806c839e3f26ce12844be47..0000000000000000000000000000000000000000 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuChains.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -# - -## chain name, HypoTool confname (for combined chains there is more than one) - -ChainDictionary ={ 'HLT_e8' : ['HLT_e8'], - 'HLT_e5' : ['HLT_e5'], - 'HLT_e20' : ['HLT_e20'], - 'HLT_g5' : ['HLT_g5'], - 'HLT_mu6' : ['HLT_mu6'], - 'HLT_mu6fast' : ['HLT_mu6'], - 'HLT_mu6Comb' : ['HLT_mu6'], - 'HLT_mu6msonly' : ['HLT_mu6'], - 'HLT_mu8' : ['HLT_mu8'], - 'HLT_mu81step' : ['HLT_mu8'], - 'HLT_mu20' : ['HLT_mu20'], - 'HLT_mu20_ivar' : ['HLT_mu20'], - 'HLT_2mu6' : ['HLT_2mu6'], # review double object - 'HLT_2mu6Comb' : ['HLT_2mu6'], # review double object - 'HLT_mu8_e8' : ['HLT_mu8','HLT_e8'], - 'HLT_e5_e8' : ['HLT_e5', 'HLT_e8'], - 'HLT_e3_etcut' : ['HLT_e3_etcut'], - 'HLT_e3_etcut1step': ['HLT_e3_etcut'], - 'HLT_e5_etcut' : ['HLT_e5_etcut'], - 'HLT_e7_etcut' : ['HLT_e7_etcut'], - 'HLT_mu6_e3_etcut' : ['HLT_mu6', 'HLT_e3_etcut'], - 'HLT_e3_etcut_mu6' : ['HLT_e3_etcut', 'HLT_mu6'], - 'HLT_g5_etcut' : ['HLT_g5_etcut'], - 'HLT_e3_g5_etcut' : ['HLT_e3_etcut', 'HLT_g5_etcut'], - 'HLT_j85' : ['HLT_j85'], - 'HLT_j100' : ['HLT_j100'], - 'HLT_j35_gsc45_boffperf_split' : ['HLT_j35_gsc45_boffperf_split'], - 'HLT_j35_gsc45_bmv2c1070_split' : ['HLT_j35_gsc45_bmv2c1070_split'], - 'HLT_j35_gsc45_bmv2c1070' : ['HLT_j35_gsc45_bmv2c1070'], - 'HLT_xe65_L1XE50': ['HLT_xe65_L1XE50'], - 'HLT_xe30_L1XE10': ['HLT_xe30_L1XE10'] - } - - - -def getConfFromChainName(name): - if name in ChainDictionary: - print "MenuChains.getConfFromChainName: Called chain "+name+" and hypoTool conf "+ str(ChainDictionary[name]) - return ChainDictionary[name] - else: - return [name] - log.error("MenuChains.getConfFromChainName: Wrong chain name given: found %s",name) - sys.exit("ERROR, in getConfFromChainName: Wrong chain configuration") - - - diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py index 9cce67cbb558b9c7b4f8b4b994b7c997ba8c119c..278b4c6f4507e196ed8c6d876aacc91743e4a376 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py @@ -10,6 +10,7 @@ logLevel=DEBUG from DecisionHandling.DecisionHandlingConf import RoRSeqFilter from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponentsNaming import CFNaming + class Node(): """ base class representing one Alg + inputs + outputs, to be used to Draw dot diagrams and connect objects""" def __init__(self, Alg): @@ -165,7 +166,6 @@ class HypoAlgNode(AlgNode): - class SequenceFilterNode(AlgNode): """Node for any kind of sequence filter""" def __init__(self, Alg, inputProp, outputProp): @@ -206,33 +206,29 @@ class ComboMaker(AlgNode): self.prop="MultiplicitiesMap" - def addChain(self, chain): + def addChain(self, chain): log.debug("ComboMaker %s adding chain %s"%(self.Alg.name(),chain)) - from TriggerMenuMT.HLTMenuConfig.Menu.MenuChains import getConfFromChainName - confs=getConfFromChainName(chain) - for conf in confs: - seed=conf.replace("HLT_", "") - integers = map(int, re.findall(r'^\d+', seed)) - multi=0 - if len(integers)== 0: - multi=1 - elif len(integers)==1: - multi=integers[0] - re.sub('^\d+',"",seed) #remove the multiplicity form the string - else: - sys.exit("ERROR in decoding combined chain %s"%(chain)) - - newdict={chain:[multi]} - cval = self.Alg.getProperties()[self.prop] + from TriggerMenuMT.HLTMenuConfig.Menu import DictFromChainName + dictDecoding = DictFromChainName.DictFromChainName() + allMultis = dictDecoding.getChainMultFromName(chain) + print "chain ", chain + print "WOOF allMultis", allMultis + newdict = {chain : allMultis} + + for i in range(1, len(allMultis)): + print "MEOW multiplicity ", allMultis[i] + cval = self.Alg.getProperties()[self.prop] # check necessary to see if chain was added already? + print "MEOW cval ", cval if type(cval) == type(dict()): + ##cval[chain] = allMultis if chain in cval.keys(): - cval[chain].append(multi) + cval[chain].append(allMultis[i]) else: - cval[chain]=[multi] + cval[chain]=[allMultis[i]] else: cval=newdict setattr(self.Alg, self.prop, cval) - + ######################################################### @@ -381,11 +377,10 @@ class Chain: self.setSeedsToSequences() # save seed of each menuseq log.debug("Chain " + name + " with seeds: %s "%str( self.vseeds)) - for step in self.steps: + for step in self.steps: if step.isCombo: step.combo.addChain(self.name) - - + def setSeedsToSequences(self): # set the seed to the menusequences sequences1=self.steps[0].sequences @@ -404,10 +399,10 @@ class Chain: log.error("found %d sequences in this chain and %d seeds. What to do??", tot_seq, tot_seed) sys.exit("ERROR, in chain configuration") - def decodeHypoToolConfs(self): + def decodeHypoToolConfs(self, allChainDicts): """ This is extrapolating the hypotool configuration from the (combined) chain name""" - from TriggerMenuMT.HLTMenuConfig.Menu.MenuChains import getConfFromChainName - signatures = getConfFromChainName(self.name) #currently a lis of chainPart names + from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import getConfFromChainName + signatures = getConfFromChainName(self.name, allChainDicts) for step in self.steps: if len(signatures) != len(step.sequences): log.error("Error in step %s: found %d signatures and %d sequences"%(step.name, len(signatures), len(step.sequences))) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py index 0e3eba336294e394d04b7cc524b6f924486f5529..4f3e2c3edb37ae2271bbfb69c40467c68dcaec19 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py @@ -184,9 +184,9 @@ MuonChainParts = { 'trigType' : ['mu'], 'etaRange' : ['0eta2550', ], 'threshold' : '', - 'extra' : ['noL1'], + 'extra' : ['noL1', 'Comb'], 'IDinfo' : [], - 'isoInfo' : [], + 'isoInfo' : ['ivar',], 'reccalibInfo' : [], 'trkInfo' : [], 'hypoInfo' : [], @@ -195,7 +195,7 @@ MuonChainParts = { 'L2SAAlg' : ['l2muonSA',], 'L2CBAlg' : ['muComb',], 'EFAlg' : ['SuperEF'], - 'addInfo' : [], + 'addInfo' : ['1step'], 'overlapRemoval' : ['wOvlpRm',], 'topo' : AllowedTopos_mu, 'flavour' : [], @@ -256,8 +256,8 @@ TauChainParts = { 'L1item' : '', 'chainPartName': '', 'threshold' : '', - 'preselection' : ['tracktwo',], - 'selection' : ['medium1',], + 'preselection' : ['tracktwo', 'ptonly', ], + 'selection' : ['medium1', 'perf', ], 'multiplicity' : '', 'trigType' : ['tau'], 'trkInfo' : [], diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerConfigHLT.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerConfigHLT.py index 9fbb2bfada605804052a17b23a5fdee56faf0af1..76141fa52238d5aa4eb0f2f5850536a1a935807c 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerConfigHLT.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerConfigHLT.py @@ -6,10 +6,13 @@ # ######################################################################################### +import sys + from AthenaCommon.Logging import logging log = logging.getLogger( 'TriggerConfigHLT' ) class TriggerConfigHLT: + sCurrentTriggerConfig = None def currentTriggerConfig(): return TriggerConfigHLT.sCurrentTriggerConfig @@ -20,6 +23,7 @@ class TriggerConfigHLT: self.__HLTFile = hltfile self.allChainConfigs = [] + self.allChainDicts = [] self.allThresholds = {} self.allItems = {} @@ -40,7 +44,6 @@ class TriggerConfigHLT: else: self.allChains[chainName] = [ chainConfig ] - def getHLTConfigFile(self): return self.__HLTFile @@ -54,3 +57,42 @@ class TriggerConfigHLT: +############################## +# this function was supposed to be part of the class but doesn't work for now +# hope to be able to integrate it at a later stage +############################## +def getConfFromChainName(chainName, allChainDicts = None): + # expects something like this: 'HLT_mu8_e8' : ['HLT_mu8','HLT_e8'], + chainPartNames = [] + + # This should be not needed once all TrigUpgrade code is transferred to TriggerMenuMT + dictToUse = [] + if allChainDicts: + dictToUse = allChainDicts + else: + log.error("This option is not working right now, need the allChainDicts to be passed for now") + #dictToUse = self.allChainDicts + sys.exit("ERROR when calling getConfFromChainName, didn't pass dictionary") + + + for cDict in dictToUse: + if chainName == cDict["chainName"]: + for cPart in cDict["chainParts"]: + cPName = cPart['chainPartName'] + if "1step" in cPName: + import re + cPName=re.sub('1step', '', cPName) + log.warning("Removing string 1step from hypoTool conf - this needs to be removed eventually") + if "HLT_" in cPName: + chainPartNames.append(cPName) + else: + chainPartNames.append('HLT_'+cPName) + + if len(chainPartNames) == 0: + log.error("MenuChains.getConfFromChainName: Wrong chain name given: found %s",name) + sys.exit("ERROR, in getConfFromChainName: Wrong chain configuration") + return [chainName] + else: + print "TriggerConfigHLT.getConfFromChainName: Called chain " + chainName + " and hypoTool conf "+ str(chainPartNames) + return chainPartNames +