diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/generateElectronChainDefs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/generateElectronChainDefs.py index 19d20153e81a999e4a9edd948df004140215f4fd..e58b5f4b36a900036e31acb04ea260f1c705e27a 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/generateElectronChainDefs.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/generateElectronChainDefs.py @@ -2,7 +2,7 @@ from TriggerMenuMT.HLTMenuConfig.Egamma.ElectronDef import generateChain as generateElectronChain from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import Chain -from TriggerMenuMT.HLTMenuConfig.Menu.MenuUtils import splitChainDict +from TriggerMenuMT.HLTMenuConfig.Menu.ChainDictTools import splitChainDict #from TriggerMenuMT.HLTMenuConfig.Egamma.ElectronDef import Chain_electron as Chain_electron diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainDef.py deleted file mode 100644 index e56c187459b07553060a1a59928ad3fd5932795b..0000000000000000000000000000000000000000 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainDef.py +++ /dev/null @@ -1,119 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -"""ChainDef is a simple object with state but no behaviour. -It serves to vehical information from trigger slice menu software, -which is often maintained by a slice domain expertto the central -trigger menu code.""" - -import pprint -pp = pprint.PrettyPrinter(indent=4, depth=8) - -class ChainDef: - - def __init__(self, chain_name, level, lower_chain_name, chain_counter=-1): - """chain_name: string. Identifies the chain within the signature - - lower_chain_name: string. the name of the chain that will be run - immediately prior to the curent chain. Can be the empty string. - - signature list: a list of 2-entry dicionaries. Each dictionary - gives a signature counter which is used by the central trigger - for optimization. The 'normal' values an integer index which - is incremented each time a signature is added. The second - entry is the name of an output trigger element at which the - chain is tested for success or failure. If the chain fails, its - actions are aborted. - - sequence list. a 3-element dictionary containing the names of the - input and output trigger elements of the sequence, and a list - of Algorithms (AthenaConfigurables) which are to be run. A chain - may have more than one sequence. - - """ - self.chain_name = chain_name - self.level = level - self.lower_chain_name = lower_chain_name - self.chain_counter = chain_counter - self.signatureList = [] - self.sequenceList = [] - - def addSignature(self, signature_counter, listOfTriggerElements): - """add signature data to the chain""" - - self.signatureList.append( - {'signature_counter': signature_counter, - 'listOfTriggerElements': listOfTriggerElements}) - - - def insertSignature(self, signature_counter, listOfTriggerElements): - """insert signature data to the chain""" - - #safety: if asked to insert with sig_counter -1, use addSignature - if signature_counter == -1: - addSignature(signature_counter,listOfTriggerElements) - else: - pos_newSeq = -1 - - for pos, sig in enumerate(self.signatureList): - if sig['signature_counter'] == signature_counter: - pos_newSeq = pos - - self.signatureList.insert(pos_newSeq, - {'signature_counter': signature_counter, - 'listOfTriggerElements': listOfTriggerElements}) - - for pos, sig in enumerate(self.signatureList): - if pos <= pos_newSeq: continue - sig['signature_counter'] = sig['signature_counter']+1 - - - def appendSignature(self, listOfTriggerElements): - """add new signature to the end of the signature list and increment chain counter automatically""" - - self.signatureList.append( - {'signature_counter': self.signatureList[-1]["signature_counter"]+1, - 'listOfTriggerElements': listOfTriggerElements}) - - - def addSequence(self, listOfAlgorithmInstances, te_in, te_out, topo_start_from=None): - """add sequence data to the chain""" - - self.sequenceList.append( - {'algorithm': listOfAlgorithmInstances, - 'input': te_in, - 'output': te_out, - 'topo_start_from': topo_start_from}) - - - def __str__(self): - """Provide a string representation of the chain""" - - s = ['chain_name: %s ' % self.chain_name, - 'lower chain name: %s ' % self.lower_chain_name, - 'no signatures %d ' % len(self.signatureList), - 'no sequences %d ' % len(self.sequenceList), - '\n', - 'sequences:'] - - s.extend([pp.pformat(ss) for ss in self.sequenceList]) - s.extend(['\n', - 'signatures:']) - s.extend([pp.pformat(ss) for ss in self.signatureList]) - - return '\n'.join(s) - - -class ErrorChainDef(object): - """Error object. Created when ChainDef creation fails.""" - - def __init__(self, err_msg, chain_name='unknown'): - self.chain_name = chain_name - self.err_msg = err_msg - - def __str__(self): - return '\n'.join(['ErrorChainDef:', - 'chain name: ' + self.chain_name, - 'err msg: ' + self.err_msg]) - - def str_no_cr(self): - return str(self).replace('\n', '; ') diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuUtils.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainDictTools.py similarity index 97% rename from Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuUtils.py rename to Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainDictTools.py index 12112c2bd9d139f4b75f06ce5122fa01e629f1e1..f3abbd87114cef5567586356f03bccb2a14ddf59 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuUtils.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainDictTools.py @@ -1,9 +1,9 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration from collections import Counter from copy import deepcopy from AthenaCommon.Logging import logging -log = logging.getLogger( 'TriggerMenu.menu.MenuUtils' ) +log = logging.getLogger( 'TriggerMenu.menu.ChainDictTools' ) def splitInterSignatureChainDict(chainDict): diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py index 83225cf19d58673aa28d2ffc6f9240e320d646ca..3bab299532cc42896e98b7d247005cbddf22e136 100755 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration """ diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py index a12de7eff48b818264fc8054bfe3118117dbd4ab..1205f0a54f9fcacd00c6b289a51f27db0a75252d 100755 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py @@ -18,8 +18,8 @@ from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import TriggerConfigHLT from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig import * from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import * from TriggerMenuMT.HLTMenuConfig.Menu import DictFromChainName -from TriggerMenuMT.HLTMenuConfig.Menu.MenuUtils import splitInterSignatureChainDict -from TriggerMenuMT.HLTMenuConfig.Menu.Lumi import lumi +from TriggerMenuMT.HLTMenuConfig.Menu.ChainDictTools import splitInterSignatureChainDict +from TriggerMenuMT.HLTMenuConfig.Menu.MenuPrescaleConfig import MenuPrescaleConfig from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig import makeHLTTree @@ -189,9 +189,9 @@ class GenerateMenuMT: def setupMenu(self): # go over the slices and put together big list of signatures requested - #(L1Prescales, HLTPrescales, streamConfig) = lumi(self.triggerPythonConfig) + #(L1Prescales, HLTPrescales, streamConfig) = MenuPrescaleConfig(self.triggerPythonConfig) # that does not seem to work - #(self.L1Prescales, self.HLTPrescales) = lumi(self.triggerConfigHLT) + #(self.L1Prescales, self.HLTPrescales) = MenuPrescaleConfig(self.triggerConfigHLT) #return (self.HLTPrescales) pass diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GroupInfo.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GroupInfo.py index 001e8df9ba371b6af5c39f0cc21b719c6c3b4a0b..10672b10ef70cb084647e804d55d075080c4b6c1 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GroupInfo.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GroupInfo.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration from AthenaCommon.Logging import logging log = logging.getLogger( 'TriggerMenu.menu.GroupInfo' ) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTConfig.py deleted file mode 100755 index 21646b4fcea2061d3a4797d0faefa2acf2960454..0000000000000000000000000000000000000000 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTConfig.py +++ /dev/null @@ -1,104 +0,0 @@ -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration - -#----------------------------------------------------- -# Hlt configuration base classes -#----------------------------------------------------- - -#from AthenaCommon.Configurable import * -from TriggerJobOpts.TriggerFlags import * -from TriggerMenu.menu.ChainDef import ChainDef - -log = logging.getLogger( 'TriggerMenu.menu.HltConfig.py' ) - -class HltSeq: - def __init__(self, inputTEs, algos, outputTE, topo_start_from=None): - self.inputTEs = inputTEs - if type(inputTEs)==type(''): self.inputTEs = [inputTEs] - self.algos = algos - self.outputTE = outputTE - self.topo_start_from = topo_start_from - -class HltChainDef: - """signatures: dictionary from step - """ - def __init__(self, sig_id, - chain_name, chain_counter, - prescale, - pass_through, - rerun, - ): - - self.sig_id = "HLT_"+sig_id - self.chain_name = chain_name - self.chain_counter = chain_counter - self.prescale = prescale - self.pass_through = pass_through - self.rerun = rerun - - self.signatures = [] - self.sequences = [] - self.sequencesPerSignature = {} - self.combined_chains = [] # optional - self.defineSequences() - self.defineSignatures() - self.defineCombinedChain() - if len(self.combined_chains)>0: self.mergeCombinedChains() - - def getClassName(self): - return self.__class__.__name__ - - def defineSequences(self): - self.sequences = [] - - def defineSignatures(self): - self.signatures = [] - - def defineCombinedChain(self): - self.combined_chains = [] - pass - - def addSequence(self, inputTEs, algos, outputTE, topo_start_from=None): - self.sequences.append(HltSeq(inputTEs, algos, outputTE, topo_start_from)) - - def addSignature(self, TElist=[]): - self.signatures.append(TElist) - - def mergeCombinedChains(self): - for (i, c) in enumerate(self.combined_chains): - for seq in c.sequences: - seq.inputTEs = map(lambda x: c.renameTE(x), seq.inputTEs) - seq.outputTE = c.renameTE(seq.outputTE) - self.sequences.extend(c.sequences) - n = max(map(lambda x: len(x.signatures), self.combined_chains)) - for i in range(1, n+1): - tes = [] - for c in self.combined_chains: - if len(c.signatures)>=i: - for te in c.signatures[i-1]: - tes.append(c.renameTE(te)) - self.addSignature(tes) - pass - - - def generateChainDef(self): - chainDef = ChainDef(chain_name=self.chain_name, lower_chain_name=self.lower_chain_name, level=self.level) - - log.debug("HltConfig: all sequences %s" % self.sequencesPerSignature) - log.debug("HltConfig: all signatures %s" % self.signatures) - log.debug("HltConfig: self.sequecnes %s" % self.sequences) - for sequence in self.sequences: - chainDef.addSequence(filter(lambda x: x!=None, sequence.algos), map(lambda x: self.renameTE(x), sequence.inputTEs), self.renameTE(sequence.outputTE)) - - for (isig, sig) in enumerate(self.signatures): - tes = [] - for te in sig: - #print "HltConfig te",te - out = self.renameTE(te) - tes.append(out) - if len(tes)>0: - chainDef.addSignature(isig+1+self.signatureCounterOffset,tes) #addHLTSignature(tes, isig+1) - #print "HltConfig : DONE ===================" - return chainDef - - - diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTObjects.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTObjects.py deleted file mode 100755 index 803955f85c3901f20c294d23f8a23b319700dd36..0000000000000000000000000000000000000000 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTObjects.py +++ /dev/null @@ -1,404 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -import os -import time -import re -import string -from sys import settrace -import xml.etree.cElementTree as etree - -from AthenaCommon.Logging import logging # loads logger - -def logger(): - return logging.getLogger( "TriggerMenu.menu.HLTObjects" ) - -######################################################################################### -# HLT Chain classes -# -class HLTChain: - """ the HLT Chain definition class """ - class HLTSignature: - """ HLT Signature, internal class of HLT Chain """ - def __init__(self, telist, sigcounter, logic='1'): - self.sigcounter = sigcounter - if type(telist) != type([]): - self.tes = [ telist ] - else: - self.tes = telist - self.logic = logic - - - def __eq__(self, other): - if self.tes == other.tes: - return True - return False - - def multiplicity(self): - return len(self.tes) - - def uniqueTEs(self): - return len(self.tes) - - def xml(self, xlist): - if len(self.tes) != 0: - xSignature = etree.SubElement(xlist,'SIGNATURE', - logic='1', signature_counter=str(self.sigcounter)) - for te in self.tes: - if type(te) != type(''): # check if this is a string - raise Exception("The trigger element: " + str(te) + " in the signature: " + self.sigcounter + "is not a plain string" ) - xTriggerElement = etree.SubElement(xSignature, 'TRIGGERELEMENT', te_name=str(te)) - - # construction - def __init__(self, chain_name, chain_counter, - lower_chain_name, level, prescale='1', pass_through='0', rerun_prescale='-1',stream_tag=None, groups=None, EBstep="-1"): - self.chain_name = chain_name - self.chain_counter = chain_counter - self.level = level - self.siglist = [] - self.prescale = prescale - self.rerun_prescale = rerun_prescale - self.pass_through = pass_through - self.lower_chain_name = lower_chain_name - self.stream_tag = [] - if stream_tag is not None: self.stream_tag += stream_tag - self.trigger_type_bits = [] - self.groups = [] - if groups is not None: self.addGroup(groups) - self.chainBindings = [] - self.chains_to_merge = [] - self.sigs_n_before_merge = 0 - self.EBstep = EBstep - - - - - def addHLTSignature(self, telist, sigcounter=None, logic='1'): - if sigcounter is None: # figure out sigcounter if not specified - if len(self.siglist) == 0: - sigcounter = 1 - else: - sigcounter = self.siglist[-1].sigcounter+1 - else: - if len(self.siglist) != 0: - if sigcounter >= self.siglist[-1].sigcounter: - sigcounter = self.siglist[-1].sigcounter+1 - - self.siglist.append( HLTChain.HLTSignature(telist, sigcounter, logic) ) - return self - - def getHLTSignatureOfStep(self, step): - """ Returns signature at given step - - If no signature at given step is present then method recursively searches back. - If step 0 is reached and no signature is found then empty one is returned. - """ - for sig in self.siglist: - if sig.sigcounter == step: - return sig - if step == 0: - return HLTChain.HLTSignature([], step) - else: - return self.getHLTSignatureOfStep(step -1) - - def mergeAndAppendChains_Order(self, chains_list): - """ Helps definig complex chains made out of other chains. - - All chains from the chains_list are scanned and thier signatures are merged and appended to the list of existing signatures. - Note, this is appending one chain to another, e.g. runs first all xe and then egamma, not in parallel - """ - self.chains_to_merge = chains_list - self.sigs_n_before_merge = len(self.siglist) - self.doChainsMerging_Order() - - def doChainsMerging_Order(self): - if type(self.chains_to_merge) != type([]): - logger().error( "Not a chains list given to mergeAndAppendChains for chain: "+ self.chain_name+ " it is: "+ str(type(self.chains_to_merge)) ) - raise Exception("Incorrect usage of: mergeAndAppendChains_Order") - - logger().debug("merging chains seq:"+str([ c.chain_name for c in self.chains_to_merge])) - - copysigs = self.siglist - self.siglist = copysigs[0:self.sigs_n_before_merge] - - # find out counter of last signature - last_counter = 1 - if len(self.siglist) != 0: - last_counter = self.siglist[-1].sigcounter - logger().debug( "The chain: " + self.chain_name + " contains already signatures. Will align sinatures to it." ) - - - total_counter = 0 - for chain in self.chains_to_merge: - if len(chain.siglist) != 0: - total_counter += chain.siglist[-1].sigcounter - logger().debug("Total counter in merged chains "+str(total_counter)) - else: - logger().debug("Chain: "+ chain.chain_name + " is having empty signature list wil lbe ignored in merging") - del self.chains_to_merge[self.chains_to_merge.index(chain)] - - current_counter = 0 - for chain in self.chains_to_merge: - if len(chain.siglist) != 0: - for te in [chain.getHLTSignatureOfStep(step).tes for step in range(1,chain.siglist[-1].sigcounter+1)]: - current_counter += 1 - self.addHLTSignature(te, sigcounter=current_counter) - - # now append all signatures which were added after merging - for sig in copysigs[self.sigs_n_before_merge:]: - current_counter = current_counter+1 - self.addHLTSignature(sig.tes, sigcounter=current_counter) - - def mergeAndAppendChains(self, chains_list): - """ Helps definig complex chains made out of other chains. - - All chains from the chains_list are scanned and thier signatures are merged and appended to the list of existing signatures. - """ - self.chains_to_merge = chains_list - self.sigs_n_before_merge = len(self.siglist) - self.doChainsMerging() # TB this needs to be cut short as we do noeed alignements anymore (TODO remove alignChain(s) etc.) - - def doChainsMerging(self): - if type(self.chains_to_merge) != type([]): - logger().error( "Not a chains list given to mergeAndAppendChains for chain: "+ self.chain_name+ " it is: "+ str(type(self.chains_to_merge)) ) - raise Exception("Incorrect usage of: mergeAndAppendChains") - - logger().debug("merging chains:"+str([ c.chain_name for c in self.chains_to_merge])) - - copysigs = self.siglist - self.siglist = copysigs[0:self.sigs_n_before_merge] - - # find out counter of last signature - last_counter = 1 - if len(self.siglist) != 0: - last_counter = self.siglist[-1].sigcounter - logger().debug( "The chain: " + self.chain_name + " contains already signatures. Will align sinatures to it." ) - - - max_counter = 0; - for chain in self.chains_to_merge: - if len(chain.siglist) != 0: - max_counter = max(chain.siglist[-1].sigcounter, max_counter) - logger().debug("Max counter in merged chains "+str(max_counter)) - else: - logger().debug("Chain: "+ chain.chain_name + " is having empty signature list wil lbe ignored in merging") - del self.chains_to_merge[self.chains_to_merge.index(chain)] - - - # make dictionary with TE sigantures - for i in range(1, max_counter+1): - telist = [] - [ telist.extend(x) for x in [chain.getHLTSignatureOfStep(i).tes for chain in self.chains_to_merge]] # repack TEs from other chain signatures - self.addHLTSignature(telist, sigcounter=i) - - # now append all signatures which were added after merging - for sig in copysigs[self.sigs_n_before_merge:]: - max_counter = max_counter+1 - self.addHLTSignature(sig.tes, sigcounter=max_counter) - - def continueOn(self, chain): - self.siglist = chain.siglist - return self - - def evaluateSignatureAfter(self, mySig, otherChain, otherChainSig): - """ Adds chain binding. Note that at this point action is only scheduled. Real work is done be alignChain method """ - if type(otherChain) == type(''): - self.chainBindings.append( (mySig, otherChain, otherChainSig) ) - else: - self.chainBindings.append( (mySig, otherChain.chain_name, otherChainSig) ) -# self.alignChain(mySig, otherChain, otherChainSig) - - def alignChain(self, mySig, otherChain, otherChainSigName ): - """ Changes internals of this chains and makes sure that selected signatures of other chain are evaluated first """ - # check if any binding is required - if len(self.chainBindings) == 0: - return False - - # find this chain signature - thisChainSig = filter(lambda x: x.tes == HLTChain.HLTSignature(mySig, 0).tes, self.siglist) - if len(thisChainSig) == 0: - logger().debug( "Chains binding ineffective (1), can't find signature: " + mySig + " in chain " + self.chain_name ) - return False - thisChainSig = thisChainSig[0] # unpack it from list - - # find sigcounter of the otherChainSig - otherChainSig = filter(lambda x: x.tes == HLTChain.HLTSignature(otherChainSigName, 0).tes, otherChain.siglist) - if len(otherChainSig) == 0: - logger().debug( "Chains binding ineffective (2), can't find signature: " + str(otherChainSigName) + " in chain " + otherChain.chain_name ) - return False - - otherChainSig = otherChainSig[0] - - # fianlly we have both, check if we need to do anything - if thisChainSig.sigcounter > otherChainSig.sigcounter: - logger().debug( "Chains binding ineffective (3), signatures steps already ordered" ) - return False - - # and real work to be done here - counterShift = otherChainSig.sigcounter - thisChainSig.sigcounter + 1 - for i in range (self.siglist.index(thisChainSig), len(self.siglist)): - self.siglist[i].sigcounter = self.siglist[i].sigcounter + counterShift - logger().debug( "Chains binding effective: signature: " + str(self.siglist[i].tes) + " will be shifted to step: "+ str(self.siglist[i].sigcounter) ) - # true means that there was something to do - return True - - def getOutputTEs(self): - tes = [] - for sig in self.siglist: - tes.extend(sig.tes) - return tes - - def isL2(self): - if self.level == "L2": - return True - else: - return False - - def isEF(self): - if self.level == "EF": - return True - else: - return False - - def isHLT(self): - if self.level == "HLT": - return True - else: - return False - - def addTriggerTypeBit(self, bit): - self.trigger_type_bits.append(bit) - - def addStreamTag(self, stream, type="physics", obeyLB="yes", prescale='1'): - self.stream_tag.append( (stream, type, obeyLB, prescale) ) - - def addGroup(self, name ): - if type(name) == type(''): - self.groups += [name] - if type(name) == type([]): - self.groups += name - - def xml(self, xChainList): - """ Returns XML representation of this chain """ - xChain = etree.SubElement(xChainList, 'CHAIN', - chain_name = self.chain_name, - chain_counter = str(self.chain_counter), - lower_chain_name = self.lower_chain_name, - level = str(self.level), - prescale = str(self.prescale), - pass_through = str(self.pass_through), - rerun_prescale = str(self.rerun_prescale), - EBstep = str(self.EBstep)) - - - xTriggerTypeList = etree.SubElement(xChain, 'TRIGGERTYPE_LIST') - for bit in self.trigger_type_bits: - xTriggerType = etree.SubElement(xTriggerTypeList, 'TRIGGERTYPE', bit = str(bit)) - - xStreamTagList = etree.SubElement(xChain, 'STREAMTAG_LIST') - for stream in self.stream_tag: - xStreamTag = etree.SubElement(xStreamTagList, 'STREAMTAG', - stream = stream[0], - type = stream[1], - obeyLB = stream[2], - prescale = str(stream[3])) - -# ## remove the CPS group from the EF chain -# if self.chain_name.startwith("EF_"): -# for g in self.groups: -# if "CPS" in g: -# self.groups.remove(g) - - xGroupList = etree.SubElement(xChain, 'GROUP_LIST') - for g in self.groups: - xGroup = etree.SubElement(xGroupList, 'GROUP', name = g) - - xSignatureList = etree.SubElement(xChain, 'SIGNATURE_LIST') - for sig in self.siglist: - sig.xml(xSignatureList) - - -# -# EF Chain classes -######################################################################################### - - -######################################################################################### -# HLT Sequence -# -class HLTSequence: - def __init__(self, inputTEs, algos, outputTE, topo_start_from=None): - """HLT Steering Sequence class constructor - inputTEs argument is a one or list of names TEs for the sequence, - if empty string is passed then sequence is considered as UNSEEDED - algos is one or list of algo instances - """ - - if type(inputTEs) == type(""): - self.input = [ inputTEs ] - else: - self.input = inputTEs - - # make algos always to be alist of ... something ... - if type(algos) != type([]): - algos = [ algos ] - from AthenaCommon.Configurable import ConfigurableAlgorithm - self.algs = [] - self.algInstances = [] # needed such that configurables don't go out of scope - for alg in algos: - if type(alg) == type(""): # plain string - self.algs.append( alg ); - logger().warning("Algorithm named %s has no instance. It will not appear in the list of configurables and thus can not be run." % (alg)) - elif issubclass(type(alg), ConfigurableAlgorithm): # configurable given to us - self.algs.append(alg.getFullName()) - self.algInstances.append(alg) - - self.output = outputTE - self.topo_start_from = topo_start_from - - self.__used = None - - def used(self): - return self.__used - - def use(self, level): - if level == 'L2' or level == 'EF' or level == 'HLT': - self.__used = level - else: - raise Exception('setting for the sequence level to incorrect value: '+str(level)) - - def __str__(self): - return str(self.input)+" -> "+ str(self.algs)+" -> "+self.output - - def xml(self, xlist): - """Generates piece of XML used to configure HLT Steering""" - if not self.used(): - return - - xSequence = etree.SubElement(xlist, 'SEQUENCE', - input = reduce(lambda x,y: x+' '+y, self.input), - output = self.output, - algorithm = reduce(lambda x,y: x+' '+y, self.algs)) - - if self.topo_start_from!= None: - xSequence.set('topo_start_from', self.topo_start_from) - - def dot(self, algs=True): - if not self.used(): - return '' - #example EM10_1 -> em10t2calo_1 [label="T2Calo,\n T2Hypo10"] - line = '' - for i in self.input: - if i == '': - line += '"UNSEEDED" [style=filled, fillcolor=blue]\n' - line += 'UNSEEDED' - else: - line += '"'+i+'"' - line += ' -> ' + '"' + self.output + '"' - if algs: - line += ' [label="' + reduce(lambda x,y: x+'\\n '+y, self.algs) + '"]' - line += '\n' - return line - -# -# EOF Sequences -######################################################################################### diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py index d66aaff44fcb48e652fcf88adb65c53320dec5d9..eebff07b51d8c67c455f0845dc3cf857c8c16608 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py @@ -1,6 +1,6 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -#----------phy--------------------------------------------------------------# +#------------------------------------------------------------------------# #------------------------------------------------------------------------# def setupMenu(): diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/Lumi.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuPrescaleConfig.py similarity index 96% rename from Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/Lumi.py rename to Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuPrescaleConfig.py index b9619579f19c96b0228e9fb93c69f89b2483dfed..8b8f1a28d9e53f5b35f92fa6cb5abd696a132962 100755 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/Lumi.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuPrescaleConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration from TriggerJobOpts.TriggerFlags import TriggerFlags #from TriggerMenu.menu.MenuUtil import applyHLTPrescale, resetAllPrescales @@ -6,7 +6,7 @@ from TriggerJobOpts.TriggerFlags import TriggerFlags from AthenaCommon.Logging import logging log = logging.getLogger( 'TriggerMenu.menu.Lumi' ) -def lumi(triggerConfigHLT): +def MenuPrescaleConfig(triggerConfigHLT): L1Prescales = {} HLTPrescales = {} diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuUtil.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuUtil.py index f63afb226bc379ae32182455bffbcfb62515ee33..c469180047dd54f3d68f59fcde8174ecf8f30373 100755 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuUtil.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuUtil.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration from TriggerJobOpts.TriggerFlags import TriggerFlags from AthenaCommon.Logging import logging diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py index 1b40a67b3f13225ed6842fc9cc9623850bdb7972..79689a9fa86bec9ef74fa85c72fa1b2de3559b95 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration from AthenaCommon.Logging import logging logging.getLogger().info("Importing %s",__name__) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/StreamInfo.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/StreamInfo.py index 038168dc73b586482f69b0e5ebcc16484e5ec035..6d211d87502fa1d74c6068998b683870a60f0cec 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/StreamInfo.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/StreamInfo.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration from AthenaCommon.Logging import logging log = logging.getLogger( 'TriggerMenu.menu.StreamInfo' ) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuonChainDefs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuonChainDefs.py index dfd569e250de0b61d20e12be4878b49ea2876c69..7a0a4d7636159526704117d7d20805884ffcd63a 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuonChainDefs.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuonChainDefs.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration ########################################################################### # SliceDef file for Muon chains @@ -9,7 +9,7 @@ __doc__="Definition of muon chains for AthenaMT" from AthenaCommon.Logging import logging logging.getLogger().info("Importing %s",__name__) -from TriggerMenuMT.HLTMenuConfig.Menu.MenuUtils import * +from TriggerMenuMT.HLTMenuConfig.Menu.ChainDictTools import * from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestRecoAlg from TrigUpgradeTest.TrigUpgradeTestConf import HLTTest__TestHypoAlg