diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessingTest.py b/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessingTest.py index fce3e553d3932d6f96650980a98e8b2fe32473e4..f9619584eca4bfb51612d94967527a7e80eb95e0 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessingTest.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessingTest.py @@ -31,7 +31,7 @@ from TriggerMenuMT.HLTMenuConfig.Menu.HLTMenuJSON import generateJSON # inputMakers: one per each first RecoAlg in a step (so one per step), one input per chain that needs that step log = logging.getLogger('EmuStepProcessingTest.py') - +log.info('Setup options:') defaultOptions = [a for a in dir(opt) if not a.startswith('__')] for option in defaultOptions: if option in globals(): diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/emu_step_menu_processing.ref b/Trigger/TrigValidation/TrigUpgradeTest/share/emu_step_menu_processing.ref index 2042cd0163a73b87c138fa9a5d4313031592b3de..1f92fac7f8d3341b799da6ac8520b8510bbe7591 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/emu_step_menu_processing.ref +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/emu_step_menu_processing.ref @@ -1,5 +1,3 @@ -Py:Configurable ERROR attempt to add a duplicate (merged_Step3_Step3_1mu31_leg1_EmptySeqStep3.IMmerged_Step3_Step3_1mu31_leg1_EmptySeqStep3) ... dupe ignored -Py:Configurable ERROR attempt to add a duplicate (merged_Step4_Step4_1mu11_leg1_EmptySeqStep4.IMmerged_Step4_Step4_1mu11_leg1_EmptySeqStep4) ... dupe ignored TriggerSummaryStep1 1 0 DEBUG In summary 4 chains passed: TriggerSummaryStep1 1 0 DEBUG +++ HLT_TestChain8_ev1_L1EM5 ID#1677577445 TriggerSummaryStep1 1 0 DEBUG +++ HLT_TestChain5_ev1_L1EM3 ID#1756953305 @@ -92,8 +90,8 @@ TriggerSummaryStep4 3 0 DEBUG In summary 2 chains pas TriggerSummaryStep4 3 0 DEBUG +++ HLT_TestChain20_muv1_L1MU10 ID#356594709 TriggerSummaryStep4 3 0 DEBUG +++ HLT_TestChain8_muv1_L1MU10 ID#2288364952 TrigSignatureMoniMT INFO HLT_2TestChain4_muv1dr_L12MU6 #3176095517 -TrigSignatureMoniMT INFO -- #3176095517 Events 0 0 0 0 - - 0 -TrigSignatureMoniMT INFO -- #3176095517 Features 0 0 - - +TrigSignatureMoniMT INFO -- #3176095517 Events 0 0 0 0 0 0 0 +TrigSignatureMoniMT INFO -- #3176095517 Features 0 0 0 0 TrigSignatureMoniMT INFO HLT_2TestChain6_muEmpty1_L12MU6 #2176116418 TrigSignatureMoniMT INFO -- #2176116418 Events 1 1 0 1 - - 1 TrigSignatureMoniMT INFO -- #2176116418 Features 0 6 - - @@ -133,9 +131,9 @@ TrigSignatureMoniMT INFO -- #64374772 Features TrigSignatureMoniMT INFO HLT_TestChain6_muv1_TestChain10_muv1_L12MU6 #3196402061 TrigSignatureMoniMT INFO -- #3196402061 Events 2 2 1 0 0 0 0 TrigSignatureMoniMT INFO -- #3196402061 Features 3 0 0 0 -TrigSignatureMoniMT INFO HLT_TestChain6_muv1_TestChain5_ev1dr_L12MU6 #3205587050 -TrigSignatureMoniMT INFO -- #3205587050 Events 0 0 0 0 0 0 0 -TrigSignatureMoniMT INFO -- #3205587050 Features 0 0 0 0 +TrigSignatureMoniMT INFO HLT_TestChain6_muv1_TestChain5_ev1dr_L1MU6_EM5 #1237112870 +TrigSignatureMoniMT INFO -- #1237112870 Events 0 0 0 0 0 0 0 +TrigSignatureMoniMT INFO -- #1237112870 Features 0 0 0 0 TrigSignatureMoniMT INFO HLT_TestChain6_muv2_TestChain8_ev2_L1MU6_EM5 #3476793373 TrigSignatureMoniMT INFO -- #3476793373 Events 2 2 2 2 2 - 2 TrigSignatureMoniMT INFO -- #3476793373 Features 4 4 4 - diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py index 25d772009bc674abd0af8937702d401601232e25..a28aa1835ba0370c68602a620a49d1ffc4649a9a 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py @@ -112,7 +112,7 @@ def collectHypoDecisionObjects(hypos, inputs = True, outputs = True): for step, stepHypos in six.iteritems (hypos): for hypoAlg in stepHypos: __log.debug( "Hypo %s with input %s and output %s ", - hypoAlg.name, hypoAlg.HypoInputDecisions, hypoAlg.HypoOutputDecisions ) + hypoAlg.getName(), hypoAlg.HypoInputDecisions, hypoAlg.HypoOutputDecisions ) if isinstance( hypoAlg.HypoInputDecisions, list): if inputs: [ decisionObjects.add( d ) for d in hypoAlg.HypoInputDecisions ] diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py index 0147b4b9eebab0d15014911c3c9f298d8569d5dd..cf91f5c6ff61d10e44636f1a817c94cb64472ee8 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainMerging.py @@ -4,7 +4,7 @@ from AthenaCommon.Logging import logging log = logging.getLogger( __name__ ) -from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import Chain, ChainStep, EmptyMenuSequence +from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import Chain, ChainStep, EmptyMenuSequence, RecoFragmentsPool from copy import deepcopy @@ -58,24 +58,27 @@ def mergeParallel(chainDefList, offset): log.debug("len(myOrderedSteps): %d", len(myOrderedSteps)) for step_index, steps in enumerate(myOrderedSteps): mySteps = list(steps) - log.debug("step_index %d", step_index) - log.debug(mySteps) - combStep = makeChainSteps(mySteps, step_index+1, chainDefList) + log.debug("Merging step counter %d", step_index+1) + combStep = makeCombinedStep(mySteps, step_index+1, chainDefList) combChainSteps.append(combStep) combinedChainDef = Chain(chainName, ChainSteps=combChainSteps, L1Thresholds=l1Thresholds) log.info("Parallel merged chain %s with these steps:", chainName) for step in combinedChainDef.steps: - log.info(' %s', step) + log.info('\n %s', step) return combinedChainDef def getEmptySeqName(stepName, chain_index, step_number): seqName = stepName + '_leg' + str(chain_index) + '_EmptySeqStep' + str(step_number) - #seqName = 'EmptySeq' + str(step_number) return seqName + +def getEmptyMenuSequence(flags, name): + return EmptyMenuSequence(name) + + def serial_zip(allSteps, chainName): n_chains = len(allSteps) newsteps = [] @@ -93,7 +96,7 @@ def serial_zip(allSteps, chainName): for step_index2, emptyStep in enumerate(stepList): if emptyStep is None: seqName = getEmptySeqName(step.name, chain_index, step_index+1) - emptySeq = EmptyMenuSequence(seqName) + emptySeq = RecoFragmentsPool.retrieve(getEmptyMenuSequence, flags=None, name=seqName) stepList[step_index2] = ChainStep( seqName, Sequences=[emptySeq], chainDicts=step.chainDicts) newsteps.append(stepList) @@ -126,7 +129,7 @@ def mergeSerial(chainDefList): combChainSteps =[] for step_index, steps in enumerate(mySerialSteps): mySteps = list(steps) - combStep = makeChainSteps(mySteps, step_index+1, chainDefList) + combStep = makeCombinedStep(mySteps, step_index+1, chainDefList) combChainSteps.append(combStep) # check if all chain parts have the same number of steps @@ -145,7 +148,7 @@ def mergeSerial(chainDefList): return combinedChainDef -def makeChainSteps(steps, stepNumber, chainDefList): +def makeCombinedStep(steps, stepNumber, chainDefList): from copy import deepcopy from TrigCompositeUtils.TrigCompositeUtils import legName stepName = 'merged_Step' + str(stepNumber) @@ -157,14 +160,15 @@ def makeChainSteps(steps, stepNumber, chainDefList): comboHypo = None # this function only makes sense if we are merging steps corresponding to the chains in the chainDefList - assert len(chainDefList)==len(steps), "makeChainSteps: Length of chain defs %d does not match length of steps to merge %d" % (len(chainDefList), len(steps)) + assert len(chainDefList)==len(steps), "makeCombinedStep: Length of chain defs %d does not match length of steps to merge %d" % (len(chainDefList), len(steps)) for chain_index, step in enumerate(steps): if step is None: # this happens for merging chains with different numbers of steps, we need to "pad" out with empty sequences to propogate the decisions - seqName = getEmptySeqName(stepName, chain_index, stepNumber) - log.info(" creating empty sequence %s", seqName) - emptySeq = EmptyMenuSequence(seqName) + currentStep = "Step" + str(stepNumber) + "_Empty" + str(chain_index) + seqName = getEmptySeqName(currentStep, chain_index, stepNumber) + log.info(" step %s, empty sequence %s", currentStep, seqName) + emptySeq = RecoFragmentsPool.retrieve(getEmptyMenuSequence, flags=None, name=seqName) stepSeq.append(emptySeq) stepMult.append(1) # we need a chain dict here, use the one corresponding to this leg of the chain @@ -178,13 +182,9 @@ def makeChainSteps(steps, stepNumber, chainDefList): # this function only works if the input chains are single-object chains (one menu seuqnce) if len(step.sequences) > 1: log.error("More than one menu sequence found in combined chain!!") - - comboHypo = step.comboHypoCfg currentStep = step.name - # the step naming for combined chains needs to be revisted!! - stepName += '_' + currentStep if len(step.sequences): seq = step.sequences[0] stepSeq.append(seq) @@ -193,6 +193,10 @@ def makeChainSteps(steps, stepNumber, chainDefList): comboHypoTools.extend(step.comboToolConfs) # update the chain dict list for the combined step with the chain dict from this step stepDicts += deepcopy(step.chainDicts) + + # the step naming for combined chains needs to be revisted!! + stepName += '_' + currentStep + # for merged steps, we need to update the name to add the leg name stepDicts[-1]['chainName'] = legName(stepDicts[-1]['chainName'], chain_index) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_emu_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_emu_v1.py index 4e4e30eeae9a48a1f76e638c105f34bebc915298..ef8e0e1988fc62522ac2aa73e93414ccaeaac2ef 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_emu_v1.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_emu_v1.py @@ -50,7 +50,7 @@ def setupMenu(): ChainProp(name='HLT_2TestChain6_muv1_L12MU6', stream=['Main'], groups=['RATE:Test','BW:Other'] ), ChainProp(name='HLT_TestChain6_muv1_TestChain10_muv1_L12MU6', stream=['Main'], groups=['RATE:Test','BW:Other'] ), ChainProp(name='HLT_2TestChain6_muEmpty1_L12MU6', stream=['Main'], groups=['RATE:Test','BW:Other']), #may differ from manual - ChainProp(name='HLT_TestChain6_muv1_TestChain5_ev1dr_L12MU6', stream=['Main'], groups=['RATE:Test','BW:Other'] ), + ChainProp(name='HLT_TestChain6_muv1_TestChain5_ev1dr_L1MU6_EM5', stream=['Main'], groups=['RATE:Test','BW:Other'] ), ChainProp(name='HLT_2TestChain4_muv1dr_L12MU6', stream=['Main'], groups=['RATE:Test','BW:Other'] ), # FSNOSEED not implemented in emulation diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py index b30c7d10536480bedf9fc035f583182095bf5fd7..40bd6f7126ee751957a0b9ce0d80ffc6cb659572 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py @@ -73,7 +73,7 @@ class AlgNode(Node): def addOutput(self, name): outputs = self.readOutputList() if name in outputs: - log.debug("Output DH not added in %s: %s already set!", self.name, name) + log.debug("Output DH not added in %s: %s already set!", self.Alg.getName(), name) else: if self.outputProp != '': self.setPar(self.outputProp,name) @@ -96,7 +96,7 @@ class AlgNode(Node): def addInput(self, name): inputs = self.readInputList() if name in inputs: - log.debug("Input DH not added in %s: %s already set!", self.name, name) + log.debug("Input DH not added in %s: %s already set!", self.Alg.getName(), name) else: if self.inputProp != '': self.setPar(self.inputProp,name) @@ -324,7 +324,7 @@ class EmptyMenuSequence(object): self._maker = InputMakerNode( Alg = Maker ) self._seed='' self._sequence = Node( Alg = seqAND(name, [Maker])) - log.debug("Making EmptySequence %s",name) + log.debug("Made EmptySequence %s",name) @property def sequence(self): @@ -338,16 +338,12 @@ class EmptyMenuSequence(object): def name(self): return self._name - @property - def __maker(self): - return self._maker - def getOutputList(self): - return self.__maker.readOutputList() # Only one since it's merged + return self._maker.readOutputList() # Only one since it's merged def connectToFilter(self, outfilter): """ Connect filter to the InputMaker""" - self.__maker.addInput(outfilter) + self._maker.addInput(outfilter) def createHypoTools(self, chainDict): log.debug("This sequence is empty. No Hypo to conficure") diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/GenerateTestChainDefs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/GenerateTestChainDefs.py index d5abe5ffdf7fe22f42cd82f2f8cc6df24295f4a5..1a89d2894ee75a0bf2a735e607ca3059c3956843 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/GenerateTestChainDefs.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/GenerateTestChainDefs.py @@ -4,7 +4,6 @@ from TriggerMenuMT.HLTMenuConfig.Menu.ChainDictTools import splitChainDict from TriggerMenuMT.HLTMenuConfig.Test.TestDef import TestChainConfiguration as TestChainConfiguration from TriggerMenuMT.HLTMenuConfig.Menu.ChainMerging import mergeChainDefs -import pprint from AthenaCommon.Logging import logging log = logging.getLogger( 'TriggerMenuMT.HLTMenuConfig.Test.generateChainConfigs' ) log.info("Importing %s",__name__) @@ -12,8 +11,6 @@ log.info("Importing %s",__name__) def generateChainConfigs( chainDict ): - log.debug('dictionary is: %s\n', pprint.pformat(chainDict)) - listOfChainDicts = splitChainDict(chainDict) listOfChainDefs = [] diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/TestDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/TestDef.py index 8222c2b8ceaf6159afb724191dba549ae281ec67..3d645f7317c1d6dc0e65d539b40080db3ea1fb15 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/TestDef.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Test/TestDef.py @@ -78,9 +78,28 @@ class TestChainConfiguration(ChainConfigurationBase): # ---------------------- def assembleChain(self): chainSteps = [] - log.debug("Assembling chain for " + self.chainName) - # -------------------- - # define here the names of the steps and obtain the chainStep configuration + stepDictionary = self.getStepDictionary() + key = self.chainPart['extra'] + + log.debug('testChain key = ' + key) + if key in stepDictionary: + steps=stepDictionary[key] + else: + raise RuntimeError("Chain configuration unknown for electron chain with key: " + key ) + + for step in steps: + chainstep = getattr(self, step)() + chainSteps+=[chainstep] + + + myChain = self.buildChain(chainSteps) + return myChain + + + + def getStepDictionary(self): + # -------------------- + # define names of the steps and obtain the chainStep configuration # -------------------- stepDictionary = { @@ -91,34 +110,18 @@ class TestChainConfiguration(ChainConfigurationBase): 'muEmpty1': ['Step_empty1', 'Step_mu21'], #'muEmpty1': ['Step_empty1', 'Step_mu11'], # try to break 'Step_mu21'], 'muEmpty2': ['Step_mu11' ,'Step_empty2' ,'Step_mu32', 'Step_mu41'], - 'muv1dr' : ['Step_mu11Dr', 'Step_mu21'], + 'muv1dr' : ['Step_mu11Dr', 'Step_mu21', 'Step_mu31', 'Step_mu41'], #egamma 'ev1': ['Step_em11', 'Step_em21', 'Step_em31'], 'ev2': ['Step_em11', 'Step_em22'], 'ev3': ['Step_em11', 'Step_em23'], 'gv1': ['Step_gam11'], - 'ev1dr' : ['Step_em11Dr', 'Step_em21Dr'] + 'ev1dr' : ['Step_em11Dr', 'Step_em21Dr', 'Step_em31'] } + return stepDictionary - log.debug('test chain part = ' + str(self.chainPart)) - key = self.chainPart['extra'] - - log.debug('testChain key = ' + key) - if key in stepDictionary: - steps=stepDictionary[key] - else: - raise RuntimeError("Chain configuration unknown for electron chain with key: " + key ) - - for step in steps: - log.debug('Adding TestSlice trigger step ' + str(step)) - chainstep = getattr(self, step)() - chainSteps+=[chainstep] - - myChain = self.buildChain(chainSteps) - return myChain - - + ## Muons