diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/python/TrigBjetEtHypoTool.py b/Trigger/TrigHypothesis/TrigBjetHypo/python/TrigBjetEtHypoTool.py index fb9689679cae1c158c052358bc6bae2c1bde743f..3f849855c65d286a471e1f99c21169e9b38795cc 100644 --- a/Trigger/TrigHypothesis/TrigBjetHypo/python/TrigBjetEtHypoTool.py +++ b/Trigger/TrigHypothesis/TrigBjetHypo/python/TrigBjetEtHypoTool.py @@ -9,26 +9,29 @@ from AthenaCommon.Constants import VERBOSE,DEBUG #################################################################################################### -def TrigBjetEtHypoToolFromName_j( name, conf ): +def TrigBjetEtHypoToolFromDict_j( chainDict ): + from AthenaCommon.Constants import DEBUG """ set the name of the EtHypoTool (name=chain) and figure out the threshold and selection from conf """ + name = chainDict['chainName'] + chainPart = chainDict['chainParts'][0] - default_conf = { 'threshold' : '0', - 'multiplicity' : '1', - 'gscThreshold' : '0', - 'bTag' : 'offperf', - 'bConfig' : 'EF', - 'minEta' : '0', - 'maxEta' : '320', - 'L1' : None } + conf_dict = { 'threshold' : chainPart['threshold'], + 'multiplicity' : '1', + 'gscThreshold' : '0', + 'bTag' : 'offperf', + 'bConfig' : 'EF', + 'minEta' : chainPart['etaRange'].split('eta')[0], + 'maxEta' : chainPart['etaRange'].split('eta')[1], + 'L1' : None } - chain = conf - match = re_Bjet.match( chain ) - conf_dict = match.groupdict() + # chain = conf + # match = re_Bjet.match( chain ) + # conf_dict = match.groupdict() - for k, v in default_conf.items(): - if k not in conf_dict: conf_dict[k] = v - if conf_dict[k] == None: conf_dict[k] = v + # for k, v in default_conf.items(): + # if k not in conf_dict: conf_dict[k] = v + # if conf_dict[k] == None: conf_dict[k] = v from TrigBjetHypo.TrigBjetHypoConf import TrigBjetEtHypoTool tool = TrigBjetEtHypoTool( name ) @@ -41,26 +44,40 @@ def TrigBjetEtHypoToolFromName_j( name, conf ): print "TrigBjetEtHypoToolFromName_j: name = %s, cut_j = %s "%(name,tool.EtThreshold) return tool -def TrigBjetEtHypoToolFromName_gsc( name, conf ): +def TrigBjetEtHypoToolFromName_j( name, conf ): + from TriggerMenuMT.HLTMenuConfig.Menu.DictFromChainName import DictFromChainName + + decoder = DictFromChainName() + decodedDict = decoder.analyseShortName(conf, [], "") # no L1 info + decodedDict['chainName'] = name # override + + return TrigBjetEtHypoToolFromDict_j( decodedDict ) + + +def TrigBjetEtHypoToolFromDict_gsc( chainDict ): from AthenaCommon.Constants import DEBUG """ set the name of the EtHypoTool (name=chain) and figure out the threshold and selection from conf """ + + name = chainDict['chainName'] + chainPart = chainDict['chainParts'][0] + - default_conf = { 'threshold' : '0', - 'multiplicity' : '1', - 'gscThreshold' : '0', - 'bTag' : 'offperf', - 'bConfig' : 'EF', - 'minEta' : '0', - 'maxEta' : '320', - 'L1' : None } + conf_dict = { 'threshold' : '0', + 'multiplicity' : '1', + 'gscThreshold' : '0' if 'gscThreshold' not in chainPart else chainPart['gscThreshold'].replace('gsc',''), + 'bTag' : 'offperf', + 'bConfig' : 'EF', + 'minEta' : chainPart['etaRange'].split('eta')[0], + 'maxEta' : chainPart['etaRange'].split('eta')[1], + 'L1' : None } - chain = conf - match = re_Bjet.match( chain ) - conf_dict = match.groupdict() + # chain = conf + # match = re_Bjet.match( chain ) + # conf_dict = match.groupdict() - for k, v in default_conf.items(): - if k not in conf_dict: conf_dict[k] = v - if conf_dict[k] == None: conf_dict[k] = v + # for k, v in default_conf.items(): + # if k not in conf_dict: conf_dict[k] = v + # if conf_dict[k] == None: conf_dict[k] = v from TrigBjetHypo.TrigBjetHypoConf import TrigBjetEtHypoTool tool = TrigBjetEtHypoTool( name ) @@ -72,6 +89,16 @@ def TrigBjetEtHypoToolFromName_gsc( name, conf ): print "TrigBjetEtHypoToolFromName_gsc: name = %s, cut_j = %s "%(name,tool.EtThreshold) return tool + +def TrigBjetEtHypoToolFromName_gsc( name, conf ): + from TriggerMenuMT.HLTMenuConfig.Menu.DictFromChainName import DictFromChainName + + decoder = DictFromChainName() + decodedDict = decoder.analyseShortName(conf, [], "") # no L1 info + decodedDict['chainName'] = name # override + + return TrigBjetEtHypoToolFromDict_gsc( decodedDict ) + #################################################################################################### diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2CaloHypoTool.py b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2CaloHypoTool.py index 9f9bf2d3898e05009f4d13952f87b0b56638d291..188fa526cce207224a3b580c9c01f176751d13f1 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2CaloHypoTool.py +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2CaloHypoTool.py @@ -78,7 +78,7 @@ def _IncTool(name, threshold, sel): tool.CARCOREthr = same( -9999. ) tool.CAERATIOthr = same( -9999. ) - elif sel == "etcut": + elif "etcut" in sel: # stcut is part of the name, it can as well be etcut1step (test chains) tool.ETthr = same( ( float( threshold ) - 3 )*GeV ) # No other cuts applied tool.dETACLUSTERthr = 9999. @@ -155,20 +155,23 @@ def TrigL2CaloHypoToolFromName( name, conf ): if __name__ == "__main__": from TriggerJobOpts.TriggerFlags import TriggerFlags TriggerFlags.enableMonitoring=['Validation'] - t = TrigL2CaloHypoToolFromName( "HLT_e10_nocut", "HLT_e10_nocut" ) - assert t, "cant configure NoCut" + # t = TrigL2CaloHypoToolFromName( "HLT_e10_nocut", "HLT_e10_nocut" ) + # assert t, "cant configure NoCut" + # not possible after recent trimming in SignatureDict, will be restored #print t t = TrigL2CaloHypoToolFromName( "HLT_e10_etcut","HLT_e10_etcut" ) assert t, "cant configure EtCut" print t - t = TrigL2CaloHypoToolFromName( "HLT_e10_tight", "HLT_e10_tight" ) - assert t, "cant configure rel selection - tight" + # t = TrigL2CaloHypoToolFromName( "HLT_e10_tight", "HLT_e10_tight" ) + # assert t, "cant configure rel selection - tight" + # not possible after recent trimming in SignatureDict, will be restored #print t - t = TrigL2CaloHypoToolFromName( "HLT_e10_perf", "HLT_e10_perf" ) - assert t, "cant configure rel selection - perf" + # t = TrigL2CaloHypoToolFromName( "HLT_e10_perf", "HLT_e10_perf" ) + # assert t, "cant configure rel selection - perf" + # not possible after recent trimming in SignatureDict, will be restored #print t t = TrigL2CaloHypoToolFromName( "HLT_2e5_etcut", "HLT_2e5_etcut" ) diff --git a/Trigger/TrigHypothesis/TrigTauHypo/python/TrigL2TauHypoTool.py b/Trigger/TrigHypothesis/TrigTauHypo/python/TrigL2TauHypoTool.py index fff2b2041718f4e111969ebdc88b655b9bddcf96..94cdc988aeaba1a661baca411ab5b8dc628cbe0d 100644 --- a/Trigger/TrigHypothesis/TrigTauHypo/python/TrigL2TauHypoTool.py +++ b/Trigger/TrigHypothesis/TrigTauHypo/python/TrigL2TauHypoTool.py @@ -1,14 +1,18 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -def TrigTauHypoProvider( name, conf ): - part='calo' - threshold='25' - criteria='medium1' - strategy='tracktwo' +def TrigL2TauHypoToolFromDict( chainDict ): + + name = chainDict['chainName'] + chainPart = chainDict['chainParts'][0] + part='calo' + threshold='25' # chainPart['threshold'] else not quite testing anything, leaving to experts + criteria= 'medium1' # likely chainPart['selection'] + strategy='tracktwo' # do not know which chain property maps here, experts need to look print "TrigL2TauHypoTool: name = ", name # Simple implementation of 2015 pre-selection - currentHypoKey = 'l2'+part+'_tau'+threshold+'_'+criteria+'_'+strategy + #currentHypoKey = 'l2'+part+'_tau'+threshold+'_'+criteria+'_'+strategy # Re-define the calo part using the generic hypo if part == 'calo': @@ -31,3 +35,16 @@ def TrigTauHypoProvider( name, conf ): currentHypo.Formulas = theFormulas return currentHypo + + +def TrigTauHypoProvider( name, conf ): + from AthenaCommon.Constants import DEBUG + """ Configure a b-jet hypo tool from chain name. """ + + from TriggerMenuMT.HLTMenuConfig.Menu.DictFromChainName import DictFromChainName + + decoder = DictFromChainName() + decodedDict = decoder.analyseShortName(conf, [], "") # no L1 info + decodedDict['chainName'] = name # override + + return TrigL2TauHypoToolFromDict( decodedDict ) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/CaloMenuDefs.py b/Trigger/TrigValidation/TrigUpgradeTest/python/CaloMenuDefs.py index a53c608660cb28e5f3c923e1ceb6573042cfa141..fc01a394e83bd1637afdd3acd5054dea448c5f28 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/CaloMenuDefs.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/CaloMenuDefs.py @@ -38,8 +38,8 @@ def fastCaloMenuSequence(name): CaloMenuDefs.L2CaloClusters = sequenceOut - from TrigEgammaHypo.TrigL2CaloHypoTool import TrigL2CaloHypoToolFromName + from TrigEgammaHypo.TrigL2CaloHypoTool import TrigL2CaloHypoToolFromDict return MenuSequence( Sequence = sequence, Maker = fastCaloViewsMaker, Hypo = theFastCaloHypo, - HypoToolGen = TrigL2CaloHypoToolFromName ) + HypoToolGen = TrigL2CaloHypoToolFromDict ) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/ElectronMenuConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/ElectronMenuConfig.py index 0158dfcdb4958240eb4dd13ca46e926cc47f8a97..417d1fbf9f05b0bf62ad307edd62e567665649ef 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/ElectronMenuConfig.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/ElectronMenuConfig.py @@ -182,7 +182,7 @@ def generateElectronsCfg( flags ): acc = ComponentAccumulator() from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence, ChainStep, Chain, RecoFragmentsPool - from TrigEgammaHypo.TrigL2CaloHypoTool import TrigL2CaloHypoToolFromName + from TrigEgammaHypo.TrigL2CaloHypoTool import TrigL2CaloHypoToolFromDict from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2CaloHypoAlgMT l2CaloHypo = TrigL2CaloHypoAlgMT( 'L2ElectronCaloHypo' ) l2CaloHypo.CaloClusters = 'L2CaloEMClusters' @@ -193,7 +193,7 @@ def generateElectronsCfg( flags ): fastCaloSequence = MenuSequence( Sequence = l2CaloReco.sequence(), Maker = l2CaloReco.inputMaker(), Hypo = l2CaloHypo, - HypoToolGen = TrigL2CaloHypoToolFromName ) + HypoToolGen = TrigL2CaloHypoToolFromDict ) fastCaloStep = ChainStep("Electron_step1", [fastCaloSequence]) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureHypoTools.py b/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureHypoTools.py index b6163673e65def6ea31280c819a87f737dc26c45..2ae01830e96dca9d0b0a16bb386c02379fb66203 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureHypoTools.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureHypoTools.py @@ -10,22 +10,26 @@ def TestHypoTool(name, prop, threshold_value): h = HLTTest__TestHypoTool(name, OutputLevel=DEBUG, Threshold=value, Property=prop, LinkName=UseThisLinkName) return h -def MuTestHypoTool(name, conf): +def MuTestHypoTool(chainDict): #threshold = conf.replace("HLT_mu","") + conf = name = chainDict['chainName'] threshold = getThreshold(conf, 'mu') return TestHypoTool(name,prop="pt", threshold_value=threshold) -def ElTestHypoTool(name,conf): +def ElTestHypoTool(chainDict): #threshold = conf.replace("HLT_e","") + conf = name = chainDict['chainName'] threshold = getThreshold(conf, 'e') return TestHypoTool(name,prop="et", threshold_value=threshold) -def GammTestHypoTool(name,conf): +def GammTestHypoTool(chainDict): + conf = name = chainDict['chainName'] threshold = getThreshold(conf, 'g') return TestHypoTool(name,prop="et", threshold_value=threshold) -def MuTest2HypoTool(name, conf): +def MuTest2HypoTool(chainDict): + conf = name = chainDict['chainName'] threshold = getThreshold(conf, 'mu') return TestHypoTool(name,prop="pt2", threshold_value=threshold) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/PhotonMenuConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/PhotonMenuConfig.py index 2007bddf05faf7e99d3b3209fa19ad7002b06e3b..28fab911b736a334626462bbf98fd4ab7eca3fd0 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/PhotonMenuConfig.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/PhotonMenuConfig.py @@ -53,7 +53,7 @@ def generatePhotonsCfg( flags ): acc = ComponentAccumulator() from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence, ChainStep, Chain, RecoFragmentsPool - from TrigEgammaHypo.TrigL2CaloHypoTool import TrigL2CaloHypoToolFromName + from TrigEgammaHypo.TrigL2CaloHypoTool import TrigL2CaloHypoToolFromDict from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2CaloHypoAlgMT l2CaloHypo = TrigL2CaloHypoAlgMT("L2PhotonCaloHypo") l2CaloHypo.CaloClusters = 'L2CaloEMClusters' @@ -68,7 +68,7 @@ def generatePhotonsCfg( flags ): fastCaloSequence = MenuSequence( Sequence = l2CaloReco.sequence(), Maker = l2CaloReco.inputMaker(), Hypo = l2CaloHypo, - HypoToolGen = TrigL2CaloHypoToolFromName ) + HypoToolGen = TrigL2CaloHypoToolFromDict ) fastCaloStep = ChainStep( "Photon_step1", [fastCaloSequence] ) @@ -83,12 +83,12 @@ def generatePhotonsCfg( flags ): l2PhotonHypo.RunInView=True l2PhotonHypo.OutputLevel = VERBOSE - from TrigEgammaHypo.TrigL2PhotonHypoTool import TrigL2PhotonHypoToolFromName + from TrigEgammaHypo.TrigL2PhotonHypoTool import TrigL2PhotonHypoToolFromDict l2PhotonSequence = MenuSequence( Sequence = l2PhotonReco.sequence(), Maker = l2PhotonReco.inputMaker(), Hypo = l2PhotonHypo, - HypoToolGen = TrigL2PhotonHypoToolFromName ) + HypoToolGen = TrigL2PhotonHypoToolFromDict ) l2PhotonStep = ChainStep( "Photon_step2", [ l2PhotonSequence] ) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/bjetMenuDefs.py b/Trigger/TrigValidation/TrigUpgradeTest/python/bjetMenuDefs.py index 0d5284f70b7e4078d4d6b3d7caf2fb4697842ae2..a7d50ce3b0dbaae144e1ce80a58439bc4c115575 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/bjetMenuDefs.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/bjetMenuDefs.py @@ -105,7 +105,7 @@ def bJetStep1Sequence(): # hypo from TrigBjetHypo.TrigBjetHypoConf import TrigBjetEtHypoAlgMT - from TrigBjetHypo.TrigBjetEtHypoTool import TrigBjetEtHypoToolFromName_j + from TrigBjetHypo.TrigBjetEtHypoTool import TrigBjetEtHypoToolFromDict_j hypo = TrigBjetEtHypoAlgMT("TrigBjetEtHypoAlgMT_step1") hypo.OutputLevel = DEBUG hypo.Jets = jetSplitter.OutputJets @@ -119,7 +119,7 @@ def bJetStep1Sequence(): return MenuSequence( Sequence = BjetAthSequence, Maker = InputMakerAlg, Hypo = hypo, - HypoToolGen = TrigBjetEtHypoToolFromName_j ) + HypoToolGen = TrigBjetEtHypoToolFromDict_j ) def bJetStep1SequenceALLTE(): # menu components @@ -178,7 +178,7 @@ def bJetStep1SequenceALLTE(): # hypo from TrigBjetHypo.TrigBjetHypoConf import TrigBjetEtHypoAlgMT - from TrigBjetHypo.TrigBjetEtHypoTool import TrigBjetEtHypoToolFromName_j + from TrigBjetHypo.TrigBjetEtHypoTool import TrigBjetEtHypoToolFromDict_j hypo = TrigBjetEtHypoAlgMT("TrigBjetEtHypoAlgMT_step1_ALLTE") hypo.OutputLevel = DEBUG hypo.Jets = jetSplitter.OutputJets @@ -192,7 +192,7 @@ def bJetStep1SequenceALLTE(): return MenuSequence( Sequence = BjetAthSequence, Maker = InputMakerAlg, Hypo = hypo, - HypoToolGen = TrigBjetEtHypoToolFromName_j ) + HypoToolGen = TrigBjetEtHypoToolFromDict_j ) @@ -235,7 +235,7 @@ def bJetStep2Sequence(): # hypo from TrigBjetHypo.TrigBjetHypoConf import TrigBjetEtHypoAlgMT - from TrigBjetHypo.TrigBjetEtHypoTool import TrigBjetEtHypoToolFromName_gsc + from TrigBjetHypo.TrigBjetEtHypoTool import TrigBjetEtHypoToolFromDict_gsc hypo = TrigBjetEtHypoAlgMT("TrigBjetEtHypoAlg_step2") hypo.OutputLevel = DEBUG hypo.RoIs = "step1RoI" @@ -250,7 +250,7 @@ def bJetStep2Sequence(): return MenuSequence( Sequence = BjetAthSequence, Maker = InputMakerAlg, Hypo = hypo, - HypoToolGen = TrigBjetEtHypoToolFromName_gsc ) + HypoToolGen = TrigBjetEtHypoToolFromDict_gsc ) def bJetStep2SequenceALLTE(): @@ -274,7 +274,7 @@ def bJetStep2SequenceALLTE(): # hypo from TrigBjetHypo.TrigBjetHypoConf import TrigBjetEtHypoAlgMT - from TrigBjetHypo.TrigBjetEtHypoTool import TrigBjetEtHypoToolFromName_gsc + from TrigBjetHypo.TrigBjetEtHypoTool import TrigBjetEtHypoToolFromDict_gsc hypo = TrigBjetEtHypoAlgMT("TrigBjetEtHypoAlg_step2ALLTE") hypo.OutputLevel = DEBUG hypo.Jets = theGSC.JetOutputKey @@ -288,7 +288,7 @@ def bJetStep2SequenceALLTE(): return MenuSequence( Sequence = BjetAthSequence, Maker = InputMakerAlg, Hypo = hypo, - HypoToolGen = TrigBjetEtHypoToolFromName_gsc ) + HypoToolGen = TrigBjetEtHypoToolFromDict_gsc ) # ==================================================================================================== # step 3: secondary vertex and b-tagging diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/electronMenuDefs.py b/Trigger/TrigValidation/TrigUpgradeTest/python/electronMenuDefs.py index 8c1ddd83339740063c3fb413fb6c585d1a845d90..e4693823ef4e17534013654dfd1daaf552e0e0f0 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/electronMenuDefs.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/electronMenuDefs.py @@ -100,10 +100,10 @@ def electronMenuSequence(): theElectronHypo.RunInView=True theElectronHypo.OutputLevel = VERBOSE - from TrigEgammaHypo.TrigL2ElectronHypoTool import TrigL2ElectronHypoToolFromName + from TrigEgammaHypo.TrigL2ElectronHypoTool import TrigL2ElectronHypoToolFromDict return MenuSequence( Maker = l2ElectronViewsMaker, Sequence = electronAthSequence, Hypo = theElectronHypo, - HypoToolGen = TrigL2ElectronHypoToolFromName ) + HypoToolGen = TrigL2ElectronHypoToolFromDict ) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/jetMenuDefs.py b/Trigger/TrigValidation/TrigUpgradeTest/python/jetMenuDefs.py index 5082582d2db0ad342a688eba32793ef3d7c6db09..eddd243889e45ad5dc5ba835a9db76524dd2e12c 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/jetMenuDefs.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/jetMenuDefs.py @@ -16,7 +16,7 @@ def jetMenuSequence(): #hypo from TrigHLTJetHypo.TrigHLTJetHypoConf import TrigJetHypoAlgMT - from TrigHLTJetHypo.TrigJetHypoToolConfig import trigJetHypoToolFromName + from TrigHLTJetHypo.TrigJetHypoToolConfig import trigJetHypoToolFromDict hypo = TrigJetHypoAlgMT("TrigJetHypoAlgMT") hypo.OutputLevel = DEBUG hypo.Jets = sequenceOut @@ -25,4 +25,4 @@ def jetMenuSequence(): return MenuSequence( Sequence = JetAthSequence, Maker = InputMakerAlg, Hypo = hypo, - HypoToolGen = trigJetHypoToolFromName ) + HypoToolGen = trigJetHypoToolFromDict ) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/metMenuDefs.py b/Trigger/TrigValidation/TrigUpgradeTest/python/metMenuDefs.py index 8d43b41cb4b8f68bbe00b7a4a0a3fb8cbcffff05..0c57a73be3fae3fc354a1420efb7ff79ab7175e6 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/metMenuDefs.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/metMenuDefs.py @@ -13,7 +13,7 @@ def metCellMenuSequence(): (metCellSequence, InputMakerAlg, sequenceOut) = RecoFragmentsPool.retrieve(metCellAthSequence,ConfigFlags) #hypo - from TrigMissingETHypo.TrigMissingETHypoConfigMT import MissingETHypoAlgMT, TrigMETCellHypoToolFromName, MissingETHypoToolMT + from TrigMissingETHypo.TrigMissingETHypoConfigMT import MissingETHypoAlgMT, TrigMETCellHypoToolFromDict, MissingETHypoToolMT metHypoAlg = MissingETHypoAlgMT("METHypoAlg") metHypoAlg.METContainerKey=sequenceOut @@ -22,5 +22,5 @@ def metCellMenuSequence(): return MenuSequence( Sequence = metCellSequence, Maker = InputMakerAlg, Hypo = metHypoAlg, - HypoToolGen = TrigMETCellHypoToolFromName ) + HypoToolGen = TrigMETCellHypoToolFromDict ) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/muMenuDefs.py b/Trigger/TrigValidation/TrigUpgradeTest/python/muMenuDefs.py index addc98ddd19e8462a2eeb1f311a44fa9b0d656f9..fc6a247959614bba6c44741a1b1c1634ed2e5763 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/muMenuDefs.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/muMenuDefs.py @@ -84,12 +84,12 @@ def muFastStep(): l2muFastSequence = seqAND("l2muFastSequence", [ l2MuViewsMaker, muFastRecoSequence ]) - from TrigMuonHypoMT.TrigMuonHypoMTConfig import TrigMufastHypoToolFromName + from TrigMuonHypoMT.TrigMuonHypoMTConfig import TrigMufastHypoToolFromDict return MenuSequence( Sequence = l2muFastSequence, Maker = l2MuViewsMaker, Hypo = trigMufastHypo, - HypoToolGen = TrigMufastHypoToolFromName ) + HypoToolGen = TrigMufastHypoToolFromDict ) ### ************* Step2 ************* ### @@ -118,12 +118,12 @@ def muCombStep(): l2muCombSequence = seqAND("l2muCombSequence", eventAlgs + [l2muCombViewsMaker, muCombRecoSequence] ) - from TrigMuonHypoMT.TrigMuonHypoMTConfig import TrigmuCombHypoToolFromName + from TrigMuonHypoMT.TrigMuonHypoMTConfig import TrigmuCombHypoToolFromDict return MenuSequence( Sequence = l2muCombSequence, Maker = l2muCombViewsMaker, Hypo = trigmuCombHypo, - HypoToolGen = TrigmuCombHypoToolFromName ) + HypoToolGen = TrigmuCombHypoToolFromDict ) ### ************* Step3 ************* ### @@ -151,12 +151,12 @@ def muEFMSStep(): muonEFMSonlySequence = seqAND( "muonEFMSonlySequence", [efmsViewsMaker, muEFMSRecoSequence] ) - from TrigMuonHypoMT.TrigMuonHypoMTConfig import TrigMuonEFMSonlyHypoToolFromName + from TrigMuonHypoMT.TrigMuonHypoMTConfig import TrigMuonEFMSonlyHypoToolFromDict return MenuSequence( Sequence = muonEFMSonlySequence, Maker = efmsViewsMaker, Hypo = trigMuonEFMSHypo, - HypoToolGen = TrigMuonEFMSonlyHypoToolFromName ) + HypoToolGen = TrigMuonEFMSonlyHypoToolFromDict ) ### EFSA step ### def muEFSAStep(): @@ -181,12 +181,12 @@ def muEFSAStep(): muonEFSAonlySequence = seqAND( "muonEFSAonlySequence", [efsaViewsMaker, muEFSARecoSequence ] ) - from TrigMuonHypoMT.TrigMuonHypoMTConfig import TrigMuonEFMSonlyHypoToolFromName + from TrigMuonHypoMT.TrigMuonHypoMTConfig import TrigMuonEFMSonlyHypoToolFromDict return MenuSequence( Sequence = muonEFSAonlySequence, Maker = efsaViewsMaker, Hypo = trigMuonEFSAHypo, - HypoToolGen = TrigMuonEFMSonlyHypoToolFromName ) + HypoToolGen = TrigMuonEFMSonlyHypoToolFromDict ) def muEFCBStep(): @@ -215,12 +215,12 @@ def muEFCBStep(): muonEFCBSequence = seqAND( "muonEFCBSequence", [efcbViewsMaker, efcbViewNode] ) - from TrigMuonHypoMT.TrigMuonHypoMTConfig import TrigMuonEFCombinerHypoToolFromName + from TrigMuonHypoMT.TrigMuonHypoMTConfig import TrigMuonEFCombinerHypoToolFromDict return MenuSequence( Sequence = muonEFCBSequence, Maker = efcbViewsMaker, Hypo = trigMuonEFCBHypo, - HypoToolGen = TrigMuonEFCombinerHypoToolFromName ) + HypoToolGen = TrigMuonEFCombinerHypoToolFromDict ) ### EF SA full scan ### def muEFSAFSStep(): @@ -245,12 +245,12 @@ def muEFSAFSStep(): muonEFSAFSSequence = seqAND( "muonEFSAFSSequence", [efsafsInputMaker, muEFSAFSRecoSequence ] ) - from TrigMuonHypoMT.TrigMuonHypoMTConfig import TrigMuonEFMSonlyHypoToolFromName + from TrigMuonHypoMT.TrigMuonHypoMTConfig import TrigMuonEFMSonlyHypoToolFromDict return MenuSequence( Sequence = muonEFSAFSSequence, Maker = efsafsInputMaker, Hypo = trigMuonEFSAFSHypo, - HypoToolGen = TrigMuonEFMSonlyHypoToolFromName ) + HypoToolGen = TrigMuonEFMSonlyHypoToolFromDict ) ### l2Muiso step ### @@ -277,12 +277,12 @@ def muIsoStep(): ### Define a Sequence to run for muIso ### l2muIsoSequence = seqAND("l2muIsoSequence", [ l2muIsoViewsMaker, l2muisoRecoSequence ] ) - from TrigMuonHypoMT.TrigMuonHypoMTConfig import TrigMuisoHypoToolFromName + from TrigMuonHypoMT.TrigMuonHypoMTConfig import TrigMuisoHypoToolFromDict return MenuSequence( Sequence = l2muIsoSequence, Maker = l2muIsoViewsMaker, Hypo = trigmuIsoHypo, - HypoToolGen = TrigMuisoHypoToolFromName ) + HypoToolGen = TrigMuisoHypoToolFromDict ) def TMEF_TrkMaterialProviderTool(name='TMEF_TrkMaterialProviderTool',**kwargs): diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/pebMenuDefs.py b/Trigger/TrigValidation/TrigUpgradeTest/python/pebMenuDefs.py index 8f2c3935ffdd6b82d831647a34f8884a5e5cac7c..875a6ac94ce56bc398462f46fbdddde9b3172281 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/pebMenuDefs.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/pebMenuDefs.py @@ -29,7 +29,8 @@ def addHLTResultToROBList(robList, moduleId=0): hltResultSID = SourceIdentifier(SubDetector.TDAQ_HLT,moduleId) robList.extend([hltResultSID.code()]) -def pebInfoWriterToolFromName(name, conf): +def pebInfoWriterToolFromDict(chainDict): + name = chainDict['chainName'] # pebtestone is a physics-type PEB example, i.e. saves a few detector ROBs and the full HLT result if "pebtestone" in name: tool = StaticPEBInfoWriterTool(name) @@ -50,7 +51,7 @@ def pebInfoWriterToolFromName(name, conf): log.error("Unknown name %s passed to pebInfoWriterToolFromName" % name) sys.exit("Configuration error") -def pebInfoWriterSequence(name,toolGenerator=pebInfoWriterToolFromName): +def pebInfoWriterSequence(name,toolGenerator=pebInfoWriterToolFromDict): """Creates a MenuSequence for PEBInfo writer. The algorithm and tools are given unique names derived from the name parameter. This is required to avoid execution stall from having the same algorithm instance configured in different steps awaiting different inputs.""" @@ -73,7 +74,8 @@ def dataScoutingResultIDFromName(name): log.error("Unknown name %s, cannot assign result ID" % name) sys.exit("Configuration error") -def dataScoutingInfoWriter(name, conf): +def dataScoutingInfoWriter(chainDict): + name = chainDict['chainName'] '''Creates a StaticPEBInfoWriterTool, which adds the data scouting HLT result to the PEBInfo''' tool = StaticPEBInfoWriterTool(name) moduleId = dataScoutingResultIDFromName(name) @@ -83,4 +85,4 @@ def dataScoutingInfoWriter(name, conf): return tool def dataScoutingSequence(name): - return pebInfoWriterSequence(name,dataScoutingInfoWriter) \ No newline at end of file + return pebInfoWriterSequence(name,dataScoutingInfoWriter) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/photonMenuDefs.py b/Trigger/TrigValidation/TrigUpgradeTest/python/photonMenuDefs.py index 2c2629dc1446c29e04231004f16a7fc3d00fdd82..ab324f6ae0223c918be8950628644ceb9621f4b9 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/photonMenuDefs.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/photonMenuDefs.py @@ -55,11 +55,11 @@ def photonMenuSequence(): #electronDecisionsDumper = DumpDecisions("electronDecisionsDumper", OutputLevel=DEBUG, Decisions = theElectronHypo.Output ) photonAthSequence = seqAND("photonAthSequence", [l2PhotonViewsMaker, photonInViewAlgs] ) - from TrigEgammaHypo.TrigL2PhotonHypoTool import TrigL2PhotonHypoToolFromName + from TrigEgammaHypo.TrigL2PhotonHypoTool import TrigL2PhotonHypoToolFromDict return MenuSequence( Maker=l2PhotonViewsMaker, Sequence=photonAthSequence, Hypo=thePhotonHypo, - HypoToolGen=TrigL2PhotonHypoToolFromName) + HypoToolGen=TrigL2PhotonHypoToolFromDict) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/tauMenuDefs.py b/Trigger/TrigValidation/TrigUpgradeTest/python/tauMenuDefs.py index 9e337c0b4e9a3bb2a3087e50439a6d378806da2d..b87be76df1a46b5316ccac566e079dd128672da4 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/tauMenuDefs.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/tauMenuDefs.py @@ -10,10 +10,10 @@ import AthenaCommon.CfgMgr as CfgMgr from InDetRecExample.InDetJobProperties import InDetFlags InDetFlags.doCaloSeededBrem = False -InDetFlags.InDet25nsec = True -InDetFlags.doPrimaryVertex3DFinding = False +InDetFlags.InDet25nsec = True +InDetFlags.doPrimaryVertex3DFinding = False InDetFlags.doPrintConfigurables = False -InDetFlags.doResolveBackTracks = True +InDetFlags.doResolveBackTracks = True InDetFlags.doSiSPSeededTrackFinder = True InDetFlags.doTRTPhaseCalculation = True InDetFlags.doTRTSeededTrackFinder = True @@ -24,7 +24,7 @@ InDetFlags.init() #include("InDetRecExample/InDetRecConditionsAccess.py") from InDetRecExample.InDetKeys import InDetKeys -# menu components +# menu components from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence # =============================================================================================== @@ -38,7 +38,7 @@ cellMaker.OutputLevel=DEBUG from TrigCaloRec.TrigCaloRecConfig import TrigCaloClusterMakerMT_topo clusMaker = TrigCaloClusterMakerMT_topo("CaloClusMakerTopo") clusMaker.OutputLevel=VERBOSE - + from AthenaCommon.CFElements import parOR, seqOR, seqAND, stepSeq from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm @@ -74,10 +74,10 @@ from TrigTauHypo.TrigTauHypoConf import TrigTauCaloHypoAlgMT fastCaloHypo = TrigTauCaloHypoAlgMT("TauGenericHypoMT") fastCaloHypo.OutputLevel = DEBUG -from TrigTauHypo.TrigL2TauHypoTool import TrigTauHypoProvider +from TrigTauHypo.TrigL2TauHypoTool import TrigL2TauHypoToolFromDict def tauCaloSequence(): return MenuSequence( Sequence = fastCaloAthSequence, Maker = fastCaloViewsMaker, Hypo = fastCaloHypo, - HypoToolGen = TrigTauHypoProvider ) + HypoToolGen = TrigL2TauHypoToolFromDict ) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/pebTest.py b/Trigger/TrigValidation/TrigUpgradeTest/share/pebTest.py index 874c41acd26867914eeb6295763ad1d80e2df916..c45457cb1e63bba9315d8c580d82f0c73ab23bfb 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/pebTest.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/pebTest.py @@ -20,6 +20,7 @@ testChains = [] ################################################################## from TrigUpgradeTest.pebMenuDefs import pebInfoWriterSequence + ################################################################## # egamma chains ################################################################## diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py index 278b4c6f4507e196ed8c6d876aacc91743e4a376..b9fc1072f79a45dac54d888eeab3455800246283 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py @@ -18,24 +18,24 @@ class Node(): self.Alg=Alg self.inputs=[] self.outputs=[] - + def addOutput(self, name): self.outputs.append(name) def addInput(self, name): self.inputs.append(name) - def getOutputList(self): + def getOutputList(self): return self.outputs - def getInputList(self): + def getInputList(self): return self.inputs def __str__(self): return "Node::%s [%s] -> [%s]"%(self.Alg.name(), ' '.join(map(str, self.getInputList())), ' '.join(map(str, self.getOutputList()))) - + class AlgNode(Node): """Node class that connects inputs and outputs to basic alg. properties """ def __init__(self, Alg, inputProp, outputProp): @@ -46,7 +46,7 @@ class AlgNode(Node): def addDefaultOutput(self): if self.outputProp is not '': self.addOutput(("%s_%s"%(self.Alg.name(),self.outputProp))) - + def setPar(self, prop, name): cval = self.Alg.getProperties()[prop] try: @@ -75,19 +75,19 @@ class AlgNode(Node): else: sys.exit("no OutputProp set") Node.addOutput(self, name) - + def readOutputList(self): outputs = [] cval = self.getPar(self.outputProp) if cval == '': return outputs - if type(cval) == type(list()): + if type(cval) == type(list()): outputs.extend(cval) else: outputs.append(cval) return outputs - + def addInput(self, name): inputs = self.readInputList() if name in inputs: @@ -105,7 +105,7 @@ class AlgNode(Node): cval = self.getPar(self.inputProp) if cval =='': return inputs - if type(cval) == type(list()): + if type(cval) == type(list()): inputs.extend(cval) else: inputs.append(cval) @@ -113,7 +113,7 @@ class AlgNode(Node): def __str__(self): return "Alg::%s [%s] -> [%s]"%(self.Alg.name(), ' '.join(map(str, self.getInputList())), ' '.join(map(str, self.getOutputList()))) - + class HypoToolConf(): """ Class to group info on hypotools""" @@ -122,17 +122,22 @@ class HypoToolConf(): self.name='' self.conf='' - def setName(self, name): - self.name=name + def setConf( self, chainDict): + if type(chainDict) != type({}): + raise RuntimeError("Configuring hypo with %s, not good anymore, use chainDict" % str(chainDict) ) + self.chainDict = chainDict - def setConf(self, conf): - self.conf=conf + # def setName(self, name): + # self.name=name + + # def setConf(self, conf): + # self.conf=conf def create(self): """creates instance of the hypo tool""" - return self.hypoToolGen( self.name, self.conf ) + return self.hypoToolGen( self.chainDict ) + - class HypoAlgNode(AlgNode): """Node for HypoAlgs""" def __init__(self, Alg): @@ -142,19 +147,19 @@ class HypoAlgNode(AlgNode): self.previous=[] def addHypoTool (self, hypoToolConf): - - if hypoToolConf.name not in self.tools: + print "here", hypoToolConf.chainDict + if hypoToolConf.chainDict['chainName'] not in self.tools: ## HypoTools are private, so need to be created when added to the Alg ## this incantation may seem strange, however it is the only one which works ## trying tool = hypoToolConf.create() and then assignement does not work! will be no problem in run3 config tools = self.Alg.HypoTools self.Alg.HypoTools = tools+[hypoToolConf.create()] - self.tools.append( hypoToolConf.name ) + self.tools.append( self.Alg.HypoTools[-1].getName() ) # should not be needed anymore else: - raise RuntimeError("The hypo tool of name "+ hypoToolConf.name +" already present") - + raise RuntimeError("The hypo tool of name "+ hypoToolConf.chainDict['chainName'] +" already present") + - def setPreviousDecision(self,prev): + def setPreviousDecision(self,prev): self.previous.append(prev) return self.addInput(prev) @@ -170,11 +175,11 @@ class SequenceFilterNode(AlgNode): """Node for any kind of sequence filter""" def __init__(self, Alg, inputProp, outputProp): AlgNode.__init__(self, Alg, inputProp, outputProp) - + def setChains(self, name): log.debug("Adding Chain %s to filter %s"%(name, self.Alg.name())) return self.setPar("Chains", name) - + def getChains(self): return self.getPar("Chains") @@ -206,16 +211,16 @@ 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 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)): + 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 @@ -228,7 +233,7 @@ class ComboMaker(AlgNode): else: cval=newdict setattr(self.Alg, self.prop, cval) - + ######################################################### @@ -256,7 +261,7 @@ class WrappedList: def __setitem__(self, item): return self._lst.append(item) - + #class duplicatedHypos(WrappedList): ## allAlgs={} @@ -274,12 +279,12 @@ class WrappedList: ## allAlgs[name] = instance ## return instance - + ########################################################## # NOW sequences and chains ########################################################## - + class MenuSequence(): """ Class to group reco sequences with the Hypo""" def __init__(self, Sequence, Maker, Hypo, HypoToolGen, CA=None ): @@ -298,34 +303,34 @@ class MenuSequence(): def replaceHypoForCombo(self, HypoAlg): log.debug("set new Hypo %s for combo sequence %s "%(HypoAlg.name(), self.name)) self.hypo= HypoAlgNode( Alg=HypoAlg ) - + def connectToFilter(self, outfilter): """ Sets the input and output of the hypo, and links to the input maker """ #### Connect filter to the InputMaker - self.maker.addInput(outfilter) + self.maker.addInput(outfilter) input_maker_output = CFNaming.inputMakerOutName(self.maker.Alg.name(),outfilter) - self.maker.addOutput(input_maker_output) + self.maker.addOutput(input_maker_output) #### Add input/output Decision to Hypo self.hypo.setPreviousDecision( input_maker_output) 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") + sys.exit("ERROR, in chain configuration") self.hypo.addOutput(hypo_output) # needed for drawing self.inputs.append(outfilter) self.outputs.append(hypo_output) - + log.debug("MenuSequence.connectToFilter: connecting InputMaker and HypoAlg, adding: \n\ InputMaker::%s.output=%s, \n\ HypoAlg::%s.previousDecision=%s, \n\ HypoAlg::%s.output=%s",\ self.maker.Alg.name(), input_maker_output, self.hypo.Alg.name(), input_maker_output, self.hypo.Alg.name(), hypo_output ) - + def __str__(self): return "MenuSequence::%s \n Hypo::%s \n Maker::%s \n Sequence::%s"%(self.name, self.hypo, self.maker, self.sequence) @@ -348,8 +353,8 @@ 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]) + sys.exit("ERROR, in chain configuration") + return (mapSeedToL1Decoder[stripSeed]) ################################################# @@ -357,10 +362,10 @@ class Chain: """Basic class to define the trigger menu """ def __init__(self, name, Seed, ChainSteps=[]): self.name = name - self.steps=ChainSteps + self.steps=ChainSteps self.seed=Seed self.vseeds=[] - vseeds = Seed.strip().split("_") + vseeds = Seed.strip().split("_") vseeds.pop(0) #remove first L1 string # split multi seeds for seed in vseeds: @@ -369,18 +374,18 @@ class Chain: if not mult: mult=1 else: mult=int(mult) # print mult,single - for m in range(0,mult): self.vseeds.append(single) - + for m in range(0,mult): self.vseeds.append(single) + # group_seed is used to se tthe seed type (EM, MU,JET), removing the actual threshold # in practice it is the L1Decoder Decision output self.group_seed = [DoMapSeedToL1Decoder(stri) for stri in self.vseeds] 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 @@ -394,32 +399,37 @@ class Chain: seq.seed ="L1"+filter(lambda x: x.isalpha(), seed) log.debug( "Chain %s adding seed %s to sequence %d in step %s"%(self.name, seq.seed, nseq, step.name)) nseq+=1 - + 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") - + sys.exit("ERROR, in chain configuration") + def decodeHypoToolConfs(self, allChainDicts): """ This is extrapolating the hypotool configuration from the (combined) chain name""" - from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import getConfFromChainName - signatures = getConfFromChainName(self.name, allChainDicts) + #from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import getConfFromChainName + from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import getChainDictFromChainName + chainDict = getChainDictFromChainName(self.name, allChainDicts) + + print "got here", chainDict 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))) + 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") - nseq=0 - for seq in step.sequences: + + for seq, chainDictPart in zip(step.sequences, chainDict['chainParts']): if seq.ca != None: # The CA merging took care of everything continue - seq.hypoToolConf.setConf(signatures[nseq]) - seq.hypoToolConf.setName(self.name) + import copy + onePartChainDict = copy.deepcopy( chainDict ) + onePartChainDict['chainParts'] = [ chainDictPart ] + + seq.hypoToolConf.setConf( onePartChainDict ) seq.hypo.addHypoTool(seq.hypoToolConf) - nseq +=1 - + class CFSequence(): """Class to describe the ChainStep + filter - + """ def __init__(self, ChainStep, FilterAlg): self.filter = FilterAlg @@ -428,7 +438,7 @@ class CFSequence(): def connect(self): """Connect filter to ChainStep (all its sequences) - if a ChainStep contains the same sequence multiple times (for multi-object chains), + if a ChainStep contains the same sequence multiple times (for multi-object chains), the filter is connected only once (to avoid multiple DH links) """ @@ -442,8 +452,8 @@ class CFSequence(): 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] @@ -451,7 +461,7 @@ class CFSequence(): seq.connectToFilter( filter_out ) #seq.connectToFilter(self.filter, filter_out ) nseq+=1 - + if self.step.isCombo: self.connectCombo() @@ -459,7 +469,7 @@ class CFSequence(): # reset sequence output, they will b ereplaced by new combo outputs for seq in self.step.sequences: seq.outputs=[] - + for seq in self.step.sequences: combo_input=seq.hypo.getOutputList()[0] self.step.combo.addInput(combo_input) @@ -470,12 +480,12 @@ class CFSequence(): self.step.combo.addOutput(combo_output) seq.outputs.append(combo_output) log.debug("Adding outputs %s to combo %s"%(combo_output, self.step.combo.Alg.name())) - - + + def __str__(self): return "--- CFSequence ---\n + Filter: %s \n + %s \n "%(\ self.filter, self.step ) - + class ChainStep: """Class to describe one step of a chain; if more than one menuSequence, then the step is combo""" @@ -484,27 +494,27 @@ class ChainStep: self.sequences=[] self.isCombo=len(Sequences)>1 self.combo=None - if self.isCombo: + if self.isCombo: self.makeCombo(Sequences) else: - self.sequences = Sequences + self.sequences = Sequences - def makeCombo(self, Sequences): + def makeCombo(self, Sequences): # For combo sequences, duplicate the sequence, the Hypo with differnt names and create the ComboHypoAlg self.combo = ComboMaker(CFNaming.comboHypoName(self.name)) duplicatedHypos = [] - for sequence in Sequences: + for sequence in Sequences: oldhypo=sequence.hypo.Alg duplicatedHypos.append(oldhypo.name()) ncopy=duplicatedHypos.count(oldhypo.name()) - + new_sequence=copy.deepcopy(sequence) new_sequence.name = CFNaming.comboSequenceCopyName(sequence.name,ncopy, self.name) - + newHypoAlgName = CFNaming.comboHypoCopyName(oldhypo.name(),ncopy, self.name) new_hypoAlg=oldhypo.clone(newHypoAlgName) new_sequence.replaceHypoForCombo(new_hypoAlg) - self.sequences.append(new_sequence) + self.sequences.append(new_sequence) def __str__(self): return "--- ChainStep %s ---\n + isCombo: %d \n + %s \n "%(self.name, self.isCombo, ' '.join(map(str, self.sequences) )) @@ -513,7 +523,7 @@ class ChainStep: # this is fragment for New JO - + from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator class InEventReco( ComponentAccumulator ): """ Class to handle in-event reco """ @@ -531,7 +541,7 @@ class InViewReco( ComponentAccumulator ): from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm if viewMaker: - self.viewMakerAlg = viewMaker + self.viewMakerAlg = viewMaker else: from AthenaCommon.Constants import DEBUG self.viewMakerAlg = EventViewCreatorAlgorithm(name+'ViewsMaker', @@ -543,9 +553,9 @@ class InViewReco( ComponentAccumulator ): OutputLevel=DEBUG) self.addEventAlgo( self.viewMakerAlg, self.mainSeq.name() ) - self.viewsSeq = parOR( self.viewMakerAlg.ViewNodeName ) + self.viewsSeq = parOR( self.viewMakerAlg.ViewNodeName ) self.addSequence( self.viewsSeq, self.mainSeq.name() ) - + def addInputFromFilter(self, filterAlg ): assert len(filterAlg.Output) == 1, "Can only oprate on filter algs with one configured output, use addInput to setup specific inputs" self.addInput( filterAlg.Output[0], "Reco_"+( filterAlg.Output[0].replace("Filtered_", "") ) ) @@ -571,7 +581,7 @@ class InViewReco( ComponentAccumulator ): return self.mainSeq def inputMaker( self ): - return self.viewMakerAlg + return self.viewMakerAlg class RecoFragmentsPool: @@ -581,7 +591,7 @@ class RecoFragmentsPool: def retrieve( cls, creator, flags, **kwargs ): """ create, or return created earlier reco fragment - Reco fragment is uniquelly identified by the function and set og **kwargs. + Reco fragment is uniquelly identified by the function and set og **kwargs. The flags are not part of unique identifier as creation of new reco fragments should not be caused by difference in the unrelated flags. TODO, if that code survives migration to New JO we need to handle the case when the creator is an inner function """ @@ -596,7 +606,7 @@ class RecoFragmentsPool: log.debug( "reconstruction fragment that would be created from %s is taken from the cache" % creator.func_name ) return cls.fragments[requestHash] - + class NJMenuSequence( ComponentAccumulator ): def __init__( self, name ): super( NJMenuSequence, self ).__init__() @@ -656,13 +666,13 @@ class HLTMenuAccumulator( ComponentAccumulator ): def __getOrMakeStepSequence(self, step, isFilter = False ): """ Constructs sequence for the step, the filtering step or, reco step will be created depending on isFilter flags - + The function assures that all previous steps are aready in place i.e. HLTStep_1_filter, HLTStep_1 ... until HLTStep_N-1 are in place. Therefore the steps can be added in any order (not yet sure if that will but better assure robustness now) """ from AthenaCommon.CFElements import parOR name = "HLTStep_%d%s" % (step, "_filters" if isFilter else "" ) - + s = self.getSequence( name ) if s: return s @@ -678,9 +688,9 @@ class HLTMenuAccumulator( ComponentAccumulator ): return s - def setupSteps( self, steps ): + def setupSteps( self, steps ): """ The main menu function, it is responsible for crateion of step sequences and placing slice specific sequencers there. - + It would rely on the MenuSeq object API in two aspects, to obtain filter alg and to obtain the reco sequence The MenuSeq should already contain all the chains that are needed for the menu setup (chains info can be accessed via flags passed when steps were created) """ @@ -688,10 +698,10 @@ class HLTMenuAccumulator( ComponentAccumulator ): filterStep = self.__getOrMakeStepSequence( stepNo, isFilter = True ) filterStep += fhSeq.filter() # FilterHypoSequence API - recoStep = self.__getOrMakeStepSequence( stepNo, isFilter = False ) + recoStep = self.__getOrMakeStepSequence( stepNo, isFilter = False ) self.addSequence( fhSeq.sequence(), recoStep.name() ) - + def steps( self ): """ returns step seqeuncers """ return self.getSequence("HLTSteps") diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerConfigHLT.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerConfigHLT.py index 76141fa52238d5aa4eb0f2f5850536a1a935807c..a05458ebd87796ed02b7fc787fa1bf1c3e17a279 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerConfigHLT.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerConfigHLT.py @@ -55,7 +55,11 @@ class TriggerConfigHLT: log.info("Writing of config files needs to be implemented") - +__chainsDict = {} +def getChainDictFromChainName(chainName, allChainDicts = None): + if __chainsDict == {}: + __chainsDict.update( [ (c['chainName'], c) for c in allChainDicts ] ) + return __chainsDict[chainName] ############################## # this function was supposed to be part of the class but doesn't work for now @@ -79,10 +83,6 @@ def getConfFromChainName(chainName, allChainDicts = None): 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: