From 241a1b532b2223ebe44e846891650a98f1c48ffa Mon Sep 17 00:00:00 2001 From: Francesca Pastore <francesca.pastore@cern.ch> Date: Thu, 6 Jun 2019 09:24:23 +0000 Subject: [PATCH] Fix combined chains in full menu test and some cleanup --- .../TrigUpgradeTest/share/full_menu.py | 77 +++++++++++-------- .../HLTMenuConfig/Egamma/ElectronDef.py | 4 +- .../python/HLTMenuConfig/Egamma/PhotonDef.py | 6 +- .../python/HLTMenuConfig/Menu/HLTCFConfig.py | 9 +-- .../python/HLTMenuConfig/Menu/HLTCFDot.py | 4 +- .../HLTMenuConfig/Menu/MenuComponents.py | 26 +++---- 6 files changed, 63 insertions(+), 63 deletions(-) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu.py b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu.py index 42304d54d0c..3e85d57fe07 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu.py @@ -33,37 +33,44 @@ inDetSetup() # egamma chains ################################################################## if opt.doElectronSlice == True: - from TriggerMenuMT.HLTMenuConfig.CommonSequences.CaloSequenceSetup import fastCaloMenuSequence - from TriggerMenuMT.HLTMenuConfig.Egamma.ElectronSequenceSetup import electronMenuSequence - from TriggerMenuMT.HLTMenuConfig.Egamma.ElectronDef import fastCaloSequenceCfg, electronSequenceCfg, precisionCaloSequenceCfg - fastCaloStep = RecoFragmentsPool.retrieve( fastCaloSequenceCfg, None ) - electronStep = RecoFragmentsPool.retrieve( electronSequenceCfg, None ) - precisionCaloStep = RecoFragmentsPool.retrieve( precisionCaloSequenceCfg, None ) + from TriggerMenuMT.HLTMenuConfig.Egamma.ElectronDef import electronFastCaloCfg, electronSequenceCfg, precisionCaloSequenceCfg + fastCaloSeq = RecoFragmentsPool.retrieve( electronFastCaloCfg, None ) + electronSeq = RecoFragmentsPool.retrieve( electronSequenceCfg, None ) + precisionCaloSeq = RecoFragmentsPool.retrieve( precisionCaloSequenceCfg, None ) - step1=ChainStep("ElectronFastCalo", [fastCaloStep]) - step2=ChainStep("ElectronFastTrack", [electronStep]) - step3=ChainStep("ElectronPrecisionCalo", [precisionCaloStep]) + FastCaloStep = ChainStep("ElectronFastCaloStep", [fastCaloSeq]) + step2 = ChainStep("ElectronFastTrackStep", [electronSeq]) + step3 = ChainStep("ElectronPrecisionCaloStep", [precisionCaloSeq]) egammaChains = [ - Chain(name='HLT_e3_etcut1step', Seed="L1_EM3", ChainSteps=[step1] ), - Chain(name='HLT_e3_etcut', Seed="L1_EM3", ChainSteps=[step1, step2, step3] ), - Chain(name='HLT_e5_etcut', Seed="L1_EM3", ChainSteps=[step1, step2, step3] ), - Chain(name='HLT_e7_etcut', Seed="L1_EM3", ChainSteps=[step1, step2, step3] ) + Chain(name='HLT_e3_etcut1step', Seed="L1_EM3", ChainSteps=[FastCaloStep] ), + Chain(name='HLT_e3_etcut', Seed="L1_EM3", ChainSteps=[FastCaloStep, step2, step3] ), + Chain(name='HLT_e5_etcut', Seed="L1_EM3", ChainSteps=[FastCaloStep, step2, step3] ), + Chain(name='HLT_e7_etcut', Seed="L1_EM3", ChainSteps=[FastCaloStep, step2, step3] ) ] + +# DiEleStep1=ChainStep("DiEleStep1",[fastCaloSeq, fastCaloSeq], multiplicity=2) #same step +# DiEleStep2=ChainStep("DiEleStep2",[electronSeq, electronSeq], multiplicity=2) #need to be: one leg with only one step, one with 3 steps! + +# egammaChains += [Chain(name='HLT_e5_etcut1step_e8_etcut', Seed="L1_EM3_EM3", ChainSteps=[DiEleStep1, DiEleStep2 ] )] testChains += egammaChains ################################################################## # photon chains ################################################################## if opt.doPhotonSlice == True: - from TriggerMenuMT.HLTMenuConfig.CommonSequences.CaloSequenceSetup import fastCaloMenuSequence - from TriggerMenuMT.HLTMenuConfig.Egamma.PhotonSequenceSetup import photonMenuSequence - fastCaloStep = fastCaloMenuSequence("Gamma") - photonstep = photonMenuSequence() + from TriggerMenuMT.HLTMenuConfig.Egamma.PhotonDef import gammaFastCaloCfg + from TriggerMenuMT.HLTMenuConfig.Egamma.PhotonDef import photonSequenceCfg + + fastCaloSeq = RecoFragmentsPool.retrieve( gammaFastCaloCfg, None ) + PhotonSeq = RecoFragmentsPool.retrieve( photonSequenceCfg, None ) + + FastCaloStep = ChainStep("PhotonFastCaloStep", [fastCaloSeq]) + photon_step2 = ChainStep("PhotonStep2", [PhotonSeq]) photonChains = [ - Chain(name='HLT_g5_etcut', Seed="L1_EM3", ChainSteps=[ ChainStep("Step1_g5_etcut", [fastCaloStep]), ChainStep("Step2_g5_etcut", [photonstep])] ) + Chain(name='HLT_g5_etcut', Seed="L1_EM3", ChainSteps=[ FastCaloStep, photon_step2] ) ] testChains += photonChains @@ -90,14 +97,6 @@ if opt.doMuonSlice == True: stepFSmuEFSA=ChainStep("Step_FSmuEFSA", [muEFSAFSSequence()]) stepFSmuEFCB=ChainStep("Step_FSmuEFCB", [muEFCBFSSequence()]) - - # 2muons - step1_2mufast= ChainStep("Step1_2muFast", [ muFastSequence(), muFastSequence()], multiplicity=2) - step2_2muComb= ChainStep("Step1_2muComb", [ muCombSequence(), muCombSequence()], multiplicity=2) - step3_2muEFSA= ChainStep("Step3_2muEFSA", [ muEFSASequence(), muEFSASequence()], multiplicity=2) - step4_2muEFCB= ChainStep("Step4_2muEFCB", [ muEFCBSequence(), muEFCBSequence()], multiplicity=2) - - emptyStep=ChainStep("Step2_empty") ## single muon trigger @@ -107,12 +106,17 @@ if opt.doMuonSlice == True: MuonChains += [Chain(name='HLT_mu6msonly', Seed="L1_MU6", ChainSteps=[ step1mufast, emptyStep, step3muEFSA ])] # removed due to muEFSA isuue(?) MuonChains += [Chain(name='HLT_mu20_ivar', Seed="L1_MU6", ChainSteps=[ step1mufast, step2muComb, step3muIso ])] - # multi muon trigger - MuonChains += [Chain(name='HLT_2mu6Comb', Seed="L1_MU6", ChainSteps=[ step1mufast, step2muComb ])] - MuonChains += [Chain(name='HLT_2mu6', Seed="L1_MU6", ChainSteps=[ step1mufast, step2muComb, step3muEFSA, step4muEFCB ])] + # multi muon trigger + # 2muons + step1_2mufast_sym= ChainStep("Step1_2muFast_sym", [ muFastSequence()], multiplicity=2) + step2_2muComb_sym= ChainStep("Step1_2muComb_sym", [ muCombSequence()], multiplicity=2) + + step3_2muEFSA_sym= ChainStep("Step3_2muEFSA_sym", [ muEFSASequence()], multiplicity=2) + step4_2muEFCB_sym= ChainStep("Step4_2muEFCB_sym", [ muEFCBSequence()], multiplicity=2) + + MuonChains += [Chain(name='HLT_2mu6Comb', Seed="L1_MU6", ChainSteps=[ step1_2mufast_sym, step2_2muComb_sym ])] + MuonChains += [Chain(name='HLT_2mu6', Seed="L1_MU6", ChainSteps=[ step1_2mufast_sym, step2_2muComb_sym, step3_2muEFSA_sym, step4_2muEFCB_sym ])] - ## MuonChains += [Chain(name='HLT_2mu6Comb', Seed="L1_2MU6", ChainSteps=[ step1_2mufast, step2_2muComb ])] - ## MuonChains += [Chain(name='HLT_2mu6', Seed="L1_2MU6", ChainSteps=[ step1_2mufast, step2_2muComb, step3_2muEFSA, step4_2muEFCB ])] #FS Muon trigger MuonChains += [Chain(name='HLT_mu6nol1', Seed="L1_MU6", ChainSteps=[stepFSmuEFSA, stepFSmuEFCB])] @@ -240,9 +244,16 @@ if opt.doBphysicsSlice == True: ################################################################## if opt.doComboSlice == True: # combo chains - comboStep=ChainStep("Step1_mufast_et", [fastCaloStep,muFastSequence()], multiplicity=2) + from TriggerMenuMT.HLTMenuConfig.Egamma.ElectronDef import electronFastCaloCfg + + fastCaloSeq = RecoFragmentsPool.retrieve( electronFastCaloCfg, None ) + + comboStep_et_mufast = ChainStep("Step1_et_mufast", [fastCaloSeq, muFastSequence()], multiplicity=2) + comboStep_mufast_etcut1_step1 = ChainStep("Step1_mufast_etcut1", [muFastSequence(), fastCaloSeq], multiplicity=2) + - comboChains = [Chain(name='HLT_e3_etcut_mu6', Seed="L1_EM8I_MU10", ChainSteps=[comboStep ])] + comboChains = [Chain(name='HLT_e3_etcut_mu6', Seed="L1_EM8I_MU10", ChainSteps=[comboStep_et_mufast ])] + # comboChains += [Chain(name='HLT_mu8fast_e8_etcut1step', Seed="L1_MU6_EM7", ChainSteps=[ comboStep_mufast_etcut1_step1 ])] testChains += comboChains diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py index 1f751f384ed..5915722720e 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py @@ -19,7 +19,7 @@ from TriggerMenuMT.HLTMenuConfig.Egamma.PrecisionCaloSequenceSetup import precis # so let's make them functions already now #---------------------------------------------------------------- -def fastCaloSequenceCfg( flags ): +def electronFastCaloCfg( flags ): return fastCaloMenuSequence("ElectronFastCalo") def electronSequenceCfg( flags ): @@ -69,7 +69,7 @@ class ElectronChainConfiguration(ChainConfigurationBase): def getEtCutStep(self, stepName): if stepName == "Step1_etcut": log.debug("Configuring step " + stepName) - fastCalo = RecoFragmentsPool.retrieve( fastCaloSequenceCfg, None ) # the None will be used for flags in future + fastCalo = RecoFragmentsPool.retrieve( electronFastCaloCfg, None ) # the None will be used for flags in future chainStep =ChainStep(stepName, [fastCalo], self.mult) elif stepName == "Step2_etcut": log.debug("Configuring step " + stepName) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonDef.py index 73916015340..b6c8e28638a 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonDef.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonDef.py @@ -15,8 +15,8 @@ from TriggerMenuMT.HLTMenuConfig.Egamma.PhotonSequenceSetup import photonMenuSeq # fragments generating configuration will be functions in New JO, # so let's make them functions already now #---------------------------------------------------------------- -def fastCaloSequenceCfg( flags ): - return fastCaloMenuSequence("Gamma") +def gammaFastCaloCfg( flags ): + return fastCaloMenuSequence("GammaFastCalo") def photonSequenceCfg( flags ): return photonMenuSequence() @@ -60,7 +60,7 @@ class PhotonChainConfiguration(ChainConfigurationBase): def getFastCalo(self): stepName = "Step1_g5_etcut" log.debug("Configuring step " + stepName) - fastCalo = RecoFragmentsPool.retrieve( fastCaloSequenceCfg, None ) # the None will be used for flags in future + fastCalo = RecoFragmentsPool.retrieve( gammaFastCaloCfg, None ) # the None will be used for flags in future return ChainStep(stepName, [fastCalo]) def getPhoton(self): diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py index 6c28b0789fd..b611de9da67 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py @@ -9,7 +9,7 @@ ++ Seeds -++ Combined chains +++ Combined chain strategy - The combined chains use duplicates of the single-object-HypoAlg, called HypoAlgName_for_stepName. These duplicates are connected to a dedicated ComboHypoAlg (added by the framework), able to count object multiplicity @@ -25,9 +25,6 @@ """ - - - # Classes to configure the CF graph, via Nodes from AthenaCommon.CFElements import parOR, seqAND, seqOR, isSequence from AthenaCommon.Logging import logging @@ -35,7 +32,7 @@ from AthenaCommon.AlgSequence import dumpSequence from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFDot import stepCF_DataFlow_to_dot, stepCF_ControlFlow_to_dot, all_DataFlow_to_dot from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponentsNaming import CFNaming -import sys, copy +import copy log = logging.getLogger('HLTCFConfig') @@ -359,7 +356,6 @@ def createDataFlow(chains, allDicts): if len(filter_input) == 0 or (len(filter_input) != 1 and not chain_step.isCombo): log.error("ERROR: Filter for step %s has %d inputs! One is expected", chain_step.name, len(filter_input)) - sys.exit("ERROR, in configuration of step "+chain_step.name) # get the filter: @@ -594,7 +590,6 @@ def findFilter(filter_name, cfseqList): #foundFilters = [cfseq.filter for cfseq in cfseqList if filter_name in cfseq.filter.Alg.name()] if len(foundFilters) > 1: log.error("found %d filters with name %s", len( foundFilters ), filter_name) - sys.exit("ERROR, in filter configuration") found = bool(foundFilters) if found: diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFDot.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFDot.py index 8c35f9213f0..8add498930e 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFDot.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFDot.py @@ -248,10 +248,10 @@ def getValuesProperties(node): for k, cval in alg.getValuedProperties().items(): if type(cval) is list: for val in cval: - if val is '': # CAT type(val) is None ?? + if val == '': # CAT type(val) is None ?? if val not in Excluded: values.append(val) - elif cval is '': # CAT type(val) is None ?? + elif cval == '': # CAT type(val) is None ?? if cval not in Excluded: values.append(cval) else: diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py index d543db0b5e6..5baceed10a7 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py @@ -1,6 +1,6 @@ # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -import sys, re, copy +import re, copy from AthenaCommon.Logging import logging log = logging.getLogger('MenuComponents') @@ -42,7 +42,7 @@ class AlgNode(Node): self.inputProp=inputProp def addDefaultOutput(self): - if self.outputProp is not '': + if self.outputProp != '': self.addOutput(("%s_%s"%(self.Alg.name(),self.outputProp))) def setPar(self, prop, name): @@ -78,10 +78,10 @@ class AlgNode(Node): if name in outputs: log.debug("Warning, %s already set in %s, DH not added",name, self.name) else: - if self.outputProp is not '': + if self.outputProp != '': self.setPar(self.outputProp,name) else: - sys.exit("no OutputProp set") + log.error("no OutputProp set") Node.addOutput(self, name) @@ -101,10 +101,10 @@ class AlgNode(Node): if name in inputs: log.debug("Warning, %s already set in %s, DH not added",name, self.name) else: - if self.inputProp is not '': + if self.inputProp != '': self.setPar(self.inputProp,name) else: - sys.exit("no InputProp set") + log.error("no InputProp set") Node.addInput(self, name) @@ -230,15 +230,14 @@ class ComboMaker(AlgNode): cval = self.Alg.getProperties()[self.prop] # check necessary to see if chain was added already? if type(cval) is dict: if chain in cval.keys(): - log.error("ERROR in cofiguration: ComboAlg %s has already been configured for chain %s", self.name, chain) - sys.exit("ERROR, in chain configuration") + log.error("ERROR in cofiguration: ComboAlg %s has already been configured for chain %s", self.Alg.name(), chain) else: - cval[chain]=[allMultis] + cval[chain]=allMultis else: cval=newdict setattr(self.Alg, self.prop, cval) - log.debug("Added chain %s to ComboAlg %s", self.getPar(self.prop), self.name) + log.debug("ComboAlg %s has now these chains chain %s", self.Alg.name(), self.getPar(self.prop)) @@ -325,7 +324,6 @@ class MenuSequence(object): hypo_output = CFNaming.hypoAlgOutName(self.hypo.Alg.name(), input_maker_output) if len(self.hypo.getOutputList()): log.error("Hypo " + self.hypo.name() +" has already an output configured: you may want to duplicate the Hypo!") - sys.exit("ERROR, in chain configuration") self.hypo.addOutput(hypo_output) # needed for drawing @@ -363,7 +361,6 @@ def DoMapSeedToL1Decoder(seed): stripSeed = filter(lambda x: x.isalpha(), seed) if stripSeed not in mapSeedToL1Decoder: log.error("Seed "+ seed + " not mapped to any Decision objects! Available are: " + str(mapSeedToL1Decoder.values())) - sys.exit("ERROR, in chain configuration") return (mapSeedToL1Decoder[stripSeed]) ################################################# @@ -422,7 +419,6 @@ class Chain(object): else: 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, allChainDicts): """ This is extrapolating the hypotool configuration from the (combined) chain name""" @@ -436,7 +432,6 @@ class Chain(object): if len(chainDict['chainParts']) != len(step.sequences): log.error("Error in step %s: found %d chain parts and %d sequences", step.name, len(chainDict['chainParts']), len(step.sequences)) - sys.exit("ERROR, in chain configuration") for seq, chainDictPart in zip(step.sequences, chainDict['chainParts']): if seq.ca is not None: # The CA merging took care of everything @@ -481,14 +476,13 @@ class CFSequence(object): filter_output = self.filter.getOutputList() if len(filter_output) == 0: log.error("ERROR, no filter outputs are set!") - sys.exit("ERROR, no filter outputs are set!") + if len(self.step.sequences): # check whether the number of filter outputs are the same as the number of sequences in the step if len(filter_output) != len(self.step.sequences): log.error("Found %d filter outputs and %d MenuSequences in Step %s", len(self.filter.getOutputList()), len(self.step.sequences), self.step.name) - sys.exit("ERROR: Found %d filter outputs differnt from %d MenuSequences in Step %s", len(self.filter.getOutputList()), len(self.step.sequences), self.step.name) nseq=0 for seq in self.step.sequences: filter_out = filter_output[nseq] -- GitLab