diff --git a/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt b/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt index 0a707cc9188f2813db0f12c6d7933119736b17ec..adbdb1df64c019e56c193d2f8f34851e8d4b7415 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt +++ b/Trigger/TrigValidation/TrigUpgradeTest/CMakeLists.txt @@ -159,6 +159,14 @@ atlas_add_test( EmuStepProcessing PROPERTIES WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/unitTestRun_emu_step_processing ) +file( MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/unitTestRun_emu_newjo ) +atlas_add_test( EmuNewJO + SCRIPT test_emu_newjo.sh + EXTRA_PATTERNS "-s TrigSignatureMo.*INFO HLT_.*" + PROPERTIES TIMEOUT 1000 + PROPERTIES WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/unitTestRun_emu_newjo + ) + file( MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/unitTestRun_NewJO ) atlas_add_test( NewJO SCRIPT test/test_newJO_build.sh diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..9c8fda770ba2f9cd87baeedef8f047e5f1e649f0 --- /dev/null +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py @@ -0,0 +1,191 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +# Configure the scheduler +from AthenaCommon.AlgScheduler import AlgScheduler +from AthenaCommon.Constants import DEBUG, VERBOSE +from AthenaCommon.CFElements import parOR +from AthenaCommon.Logging import logging +from L1Decoder.L1DecoderConf import CTPUnpackingEmulationTool, RoIsUnpackingEmulationTool, L1Decoder + +log = logging.getLogger('EmuStepProcessingConfig') +log.setLevel(VERBOSE) + + +def generateL1DecoderAndChains(): + AlgScheduler.ShowControlFlow( True ) + AlgScheduler.ShowDataFlow( True ) + + # add chain names in Menu/MenuChains.py + + # 4 events + + data = {'noreco': [';', ';', ';',';']} # in the lists there are the events + + data['emclusters'] = [ ';', + 'eta:1,phi:1,et:180000; eta:1,phi:-1.2,et:35000;', + 'eta:0.5,phi:0,et:120000; eta:1,phi:-1.2,et:65000;', + 'eta:-0.6,phi:1.7,et:9000;'] + + data['msmu'] = [';', + ';', + 'eta:-1.2,phi:0.7,pt:6500,pt2:8500; eta:-1.1,phi:0.6,pt:8500,pt2:8500;', + 'eta:-1.7,phi:-0.2,pt:9500,pt2:8500;'] + + #data['ctp'] = [ 'HLT_e20 HLT_e5_e8 HLT_e5 HLT_e8 HLT_e5v22 HLT_g5', + data['ctp'] = [ 'HLT_e20 HLT_e5_e8 HLT_e5 HLT_e8 HLT_g5', + 'HLT_e20 HLT_e5_e8 HLT_e5 HLT_e8 HLT_g5 HLT_e5_v3', + 'HLT_mu8 HLT_mu8_1step HLT_e20 HLT_e8 HLT_mu8_e8 HLT_e3_e5', + 'HLT_mu20 HLT_mu8 HLT_mu8_1step HLT_2mu8 HLT_e8' ] + + + data['l1emroi'] = [ ';', + '1,1,0,EM3,EM7,EM15,EM20,EM50,EM100,2EM3; 1,-1.2,0,EM3,EM7,2EM3', + '-0.6,0.2,0,EM3,EM7,EM15,EM20,EM50,EM100; 1,-1.1,0,EM3,EM7,EM15,EM20,EM50', + '-0.6,1.5,0,EM3,EM7,EM7'] + + data['l1muroi'] = [';', + '0,0,0,MU0;', + '-1,0.5,0,MU6,MU8; -1,0.5,0,MU6,MU8,MU10', + '-1.5,-0.1,0,MU6,MU8'] + + data['tracks'] = ['eta:1,phi:1,pt:120000; eta:1,phi:-1.2,et:32000;', + 'eta:1,phi:1,pt:120000; eta:1,phi:-1.2,et:32000;', + 'eta:0.5,phi:0,pt:130000; eta:1,phi:-1.2,pt:60000;eta:-1.2,phi:0.7,pt:6700; eta:-1.1,phi:0.6,pt:8600;', + 'eta:-0.6,phi:1.7,et:9000;'] # no MU track for MS candidate 'eta:-1.7,phi:-0.2,pt:9500;' + + data['mucomb'] = [';', + ';', + 'eta:-1.2,phi:0.7,pt:6600; eta:-1.1,phi:0.6,pt:8600;', + ';'] + + data['electrons'] = [';', + 'eta:1,phi:1,pt:120000; eta:1,phi:-1.2,et:32000;', + ';', + ';'] + data['photons'] = [';', + 'eta:1,phi:1,pt:130000;', + ';', + ';'] + + + + from TrigUpgradeTest.TestUtils import writeEmulationFiles + writeEmulationFiles(data) + + from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence, Chain, ChainStep + + + doMuon=True + doElectron=True + doCombo=True + + HLTChains = [] + EnabledElChains = [] + EnabledMuChains = [] + EnabledMuComboChains = [] + EnabledElComboChains = [] + + + # muon chains + if doMuon: + from TrigUpgradeTest.HLTSignatureConfig import muStep1MenuSequence, muStep2MenuSequence + muStep1 = muStep1MenuSequence("v1") + muStep2 = muStep2MenuSequence("v1") + + + MuChains = [ + Chain(name='HLT_mu20', Seed="L1_MU10", ChainSteps=[ChainStep("Step1_mu", [muStep1]) , ChainStep("Step2_mu", [muStep2] )]) , + Chain(name='HLT_mu8_1step', Seed="L1_MU6", ChainSteps=[ChainStep("Step1_mu", [muStep1]) ]) , + Chain(name='HLT_mu8', Seed="L1_MU6", ChainSteps=[ChainStep("Step1_mu", [muStep1]) , ChainStep("Step2_mu", [muStep2] ) ] ) + ] + + HLTChains += MuChains + EnabledMuChains= [c.seed.strip().split("_")[1] +" : "+ c.name for c in MuChains] + + + + + ## #electron chains + if doElectron: + from TrigUpgradeTest.HLTSignatureConfig import elStep1MenuSequence, elStep2MenuSequence, gammStep1MenuSequence + # electron + elStep1 = elStep1MenuSequence("v1") + elStep2 = elStep2MenuSequence("v1","v1") + elStep2v2 = elStep2MenuSequence("v2","v2") + elStep2v3 = elStep2MenuSequence("v2","v3") + # gamma + gammStep1 = gammStep1MenuSequence("v1") + + ElChains = [ + Chain(name='HLT_e5' , Seed="L1_EM7", ChainSteps=[ ChainStep("Step1_em", [elStep1]), ChainStep("Step2_em", [elStep2]) ] ), + Chain(name='HLT_e5_v2', Seed="L1_EM7", ChainSteps=[ ChainStep("Step1_em", [elStep1]), ChainStep("Step2v2_em", [elStep2v2]) ] ), + Chain(name='HLT_e5_v3', Seed="L1_EM7", ChainSteps=[ ChainStep("Step1_em", [elStep1]), ChainStep("Step2v3_em", [elStep2v3]) ] ), + Chain(name='HLT_e8' , Seed="L1_EM7", ChainSteps=[ ChainStep("Step1_em", [elStep1]), ChainStep("Step2_em", [elStep2]) ] ), + Chain(name='HLT_g5' , Seed="L1_EM7", ChainSteps=[ ChainStep("Step1_gam", [gammStep1]) ] ) + ] + + HLTChains += ElChains + EnabledElChains= [c.seed.strip().split("_")[1] +" : "+ c.name for c in ElChains] + + + # combined chain + if doCombo: + from TrigUpgradeTest.HLTSignatureConfig import elStep1MenuSequence, muStep1MenuSequence, elStep2MenuSequence, muStep2MenuSequence + elStep1 = elStep1MenuSequence("v1") + muStep1 = muStep1MenuSequence("v1") + elStep2 = elStep2MenuSequence("v1","v1") + muStep2 = muStep2MenuSequence("v1") + + + CombChains =[ + Chain(name='HLT_mu8_e8', Seed="L1_MU6_EM7", ChainSteps=[ ChainStep("Step1_mu_em", [muStep1, elStep1]), ChainStep("Step2_mu_em", [muStep2, elStep2])] ), + Chain(name='HLT_e5_e8', Seed="L1_2EM3", ChainSteps=[ ChainStep("Step1_2em",[elStep1, elStep1]) ]) + ] + + HLTChains += CombChains + for c in CombChains: + seeds=c.seed.split("_") + seeds.pop(0) #remove first L1 string + for s in seeds: + if "MU" in s: EnabledMuComboChains.append(s +" : "+ c.name) + if "EM" in s: EnabledElComboChains.append(s +" : "+ c.name) + + log.debug("enabled Combo chains: %s, %s", EnabledMuComboChains, EnabledElComboChains) + + + # this is a temporary hack to include new test chains + EnabledChainNamesToCTP = dict([ (c.name, c.seed) for c in HLTChains]) + + ########################## L1 ################################################# + + L1UnpackingSeq = parOR("L1UnpackingSeq") + + l1Decoder = L1Decoder( OutputLevel=DEBUG, RoIBResult="" ) + l1Decoder.prescaler.EventInfo="" + l1Decoder.ChainToCTPMapping = EnabledChainNamesToCTP + l1Decoder.L1DecoderSummaryKey = "L1DecoderSummary" + + ctpUnpacker = CTPUnpackingEmulationTool( OutputLevel = DEBUG, ForceEnableAllChains=False , InputFilename="ctp.dat" ) + l1Decoder.ctpUnpacker = ctpUnpacker + + emUnpacker = RoIsUnpackingEmulationTool("EMRoIsUnpackingTool", OutputLevel=DEBUG, InputFilename="l1emroi.dat", OutputTrigRoIs="L1EMRoIs", Decisions="L1EM" ) + emUnpacker.ThresholdToChainMapping = EnabledElChains + EnabledElComboChains + emUnpacker.Decisions="L1EM" + log.debug("EMRoIsUnpackingTool enables chians:") + log.debug(emUnpacker.ThresholdToChainMapping) + + muUnpacker = RoIsUnpackingEmulationTool("MURoIsUnpackingTool", OutputLevel=DEBUG, InputFilename="l1muroi.dat", OutputTrigRoIs="L1MURoIs", Decisions="L1MU" ) + muUnpacker.ThresholdToChainMapping = EnabledMuChains + EnabledMuComboChains + muUnpacker.Decisions="L1MU" + log.debug("MURoIsUnpackingTool enables chians:") + log.debug(muUnpacker.ThresholdToChainMapping) + + l1Decoder.roiUnpackers = [emUnpacker, muUnpacker] + + #print l1Decoder + L1UnpackingSeq += l1Decoder + log.debug(L1UnpackingSeq) + + ########################## L1 ################################################# + + return l1Decoder, HLTChains diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/EmuNewJO.ref b/Trigger/TrigValidation/TrigUpgradeTest/share/EmuNewJO.ref new file mode 100644 index 0000000000000000000000000000000000000000..4b9adbc6363b95194800f2eae3317791a922600e --- /dev/null +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/EmuNewJO.ref @@ -0,0 +1,20 @@ +TrigSignatureMo... INFO HLT_e5 2 2 1 1 1 +TrigSignatureMo... INFO HLT_e5 decisions 2 2 +TrigSignatureMo... INFO HLT_e5_e8 2 2 1 0 1 +TrigSignatureMo... INFO HLT_e5_e8 decisions 6 0 +TrigSignatureMo... INFO HLT_e5_v2 0 0 0 0 0 +TrigSignatureMo... INFO HLT_e5_v2 decisions 0 0 +TrigSignatureMo... INFO HLT_e5_v3 1 1 1 1 1 +TrigSignatureMo... INFO HLT_e5_v3 decisions 2 2 +TrigSignatureMo... INFO HLT_e8 4 4 3 3 3 +TrigSignatureMo... INFO HLT_e8 decisions 5 5 +TrigSignatureMo... INFO HLT_g5 2 2 1 0 1 +TrigSignatureMo... INFO HLT_g5 decisions 2 0 +TrigSignatureMo... INFO HLT_mu20 1 1 0 0 0 +TrigSignatureMo... INFO HLT_mu20 decisions 0 0 +TrigSignatureMo... INFO HLT_mu8 2 2 2 2 2 +TrigSignatureMo... INFO HLT_mu8 decisions 2 2 +TrigSignatureMo... INFO HLT_mu8_1step 2 2 2 0 2 +TrigSignatureMo... INFO HLT_mu8_1step decisions 2 0 +TrigSignatureMo... INFO HLT_mu8_e8 1 1 1 1 1 +TrigSignatureMo... INFO HLT_mu8_e8 decisions 4 4 diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/EmuNewJOTest.py b/Trigger/TrigValidation/TrigUpgradeTest/share/EmuNewJOTest.py new file mode 100644 index 0000000000000000000000000000000000000000..c63ee0bf86c63c993d472480acdfe7a9d1b7b44f --- /dev/null +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/EmuNewJOTest.py @@ -0,0 +1,101 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +from AthenaCommon.Configurable import Configurable +Configurable.configurableRun3Behavior=1 + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.AllConfigFlags import ConfigFlags as flags +from AthenaCommon.Constants import INFO, DEBUG, VERBOSE +from AthenaCommon.Logging import logging +from ByteStreamCnvSvc.ByteStreamConfig import TrigBSReadCfg +from TrigUpgradeTest.TriggerHistSvcConfig import TriggerHistSvcConfig +from MuonConfig.MuonCablingConfig import RPCCablingConfigCfg, TGCCablingConfigCfg +from TrigConfigSvc.TrigConfigSvcConfig import TrigConfigSvcCfg +from TriggerJobOpts.TriggerConfig import triggerSummaryCfg, triggerMonitoringCfg, \ + setupL1DecoderFromMenu, collectHypos, collectFilters +from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig_newJO import generateDecisionTree +from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence +from AthenaCommon.CFElements import seqOR +from RegionSelector.RegSelConfig import regSelCfg +from TrigUpgradeTest.InDetConfig import TrigInDetCondConfig +from TrigUpgradeTest.EmuStepProcessingConfig import generateL1DecoderAndChains + +log = logging.getLogger('EmuNewJOTest') +log.setLevel(VERBOSE) + +flags.needFlagsCategory("Trigger") +flags.Input.isMC = False +flags.Input.Files= ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1"] + +flags.Trigger.L1Decoder.forceEnableAllChains = True + +flags.lock() + +acc = ComponentAccumulator() +acc.merge(TrigBSReadCfg(flags)) +acc.merge(TriggerHistSvcConfig(flags)) + +l1DecoderAlg, HLTChains = generateL1DecoderAndChains() +setupL1DecoderFromMenu( flags, l1DecoderAlg ) + +l1DecoderAcc = ComponentAccumulator() +l1DecoderAcc.mergeAll( TGCCablingConfigCfg( flags ) ) +l1DecoderAcc.mergeAll( RPCCablingConfigCfg( flags ) ) +l1DecoderAcc.merge( TrigConfigSvcCfg( flags ) ) +acc.merge(l1DecoderAcc) + + +from TriggerMenuMT.HLTMenuConfig.Menu.DictFromChainName import DictFromChainName +toChainDictTranslator = DictFromChainName() +chainDicts = [toChainDictTranslator.getChainDict(chain.name) for chain in HLTChains] + +## Set ca in all sequences to none +for index, chain in enumerate(HLTChains): + for step in chain.steps: + for seqIndex, seq in enumerate(step.sequences): + hypoAlg = seq.hypo.Alg.__class__(seq.hypo.Alg.name(), **seq.hypo.Alg.getValuedProperties()) + hypoTool = seq.hypoToolConf.hypoToolGen(chainDicts[index]) + hypoAlg.HypoTools = [hypoTool] + + sequenceAcc = ComponentAccumulator() + sequenceAcc.addSequence(seq.sequence.Alg) + seq.ca = sequenceAcc + sequenceAcc.wasMerged() + + ms = MenuSequence( Sequence = seq.sequence.Alg, + Maker = seq.maker.Alg, + Hypo = hypoAlg, + HypoToolGen = None, + CA = sequenceAcc) + + step.sequences[seqIndex] = ms + +menuAcc = generateDecisionTree(HLTChains) + +HLTSteps = menuAcc.getSequence("HLTAllSteps") +hypos = collectHypos(HLTSteps) +filters = collectFilters(HLTSteps) + +summaryAcc, summaryAlg = triggerSummaryCfg(flags, hypos) +acc.merge(summaryAcc) + +monitoringAcc, monitoringAlg = triggerMonitoringCfg( flags, hypos, l1DecoderAlg ) +acc.merge( monitoringAcc ) + +topSequenceName = "HLTTop" +HLTTopSequence = seqOR(topSequenceName, [l1DecoderAlg, HLTSteps, summaryAlg, monitoringAlg]) +acc.addSequence(HLTTopSequence) + +acc.merge(menuAcc) +acc.merge(regSelCfg(flags)) +acc.merge(TrigInDetCondConfig(flags)) + +acc.getEventAlgo( "TrigSignatureMoniMT").OutputLevel=DEBUG + +acc.printConfig() + +fname = "EmuNewJOTest.pkl" +log.debug("Storing config in the config %s", fname) +with file(fname, "w") as p: + acc.store( p, nEvents=4, useBootStrapFile=False, threaded=True ) + p.close() diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessingTest.py b/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessingTest.py index ce526f1aef90968621d6a77864ef849a6574ecfb..193765b26d904b015067b9a0202d1f002a96050a 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessingTest.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/EmuStepProcessingTest.py @@ -10,192 +10,11 @@ # ATLAS default Application Configuration options #-------------------------------------------------------------- -# Configure the scheduler -from AthenaCommon.AlgScheduler import AlgScheduler -AlgScheduler.ShowControlFlow( True ) -AlgScheduler.ShowDataFlow( True ) - -# add chain names in Menu/MenuChains.py - -# 4 events - -data = {'noreco': [';', ';', ';',';']} # in the lists there are the events - -data['emclusters'] = [ ';', - 'eta:1,phi:1,et:180000; eta:1,phi:-1.2,et:35000;', - 'eta:0.5,phi:0,et:120000; eta:1,phi:-1.2,et:65000;', - 'eta:-0.6,phi:1.7,et:9000;'] - -data['msmu'] = [';', - ';', - 'eta:-1.2,phi:0.7,pt:6500,pt2:8500; eta:-1.1,phi:0.6,pt:8500,pt2:8500;', - 'eta:-1.7,phi:-0.2,pt:9500,pt2:8500;'] - -#data['ctp'] = [ 'HLT_e20 HLT_e5_e8 HLT_e5 HLT_e8 HLT_e5v22 HLT_g5', -data['ctp'] = [ 'HLT_e20 HLT_e5_e8 HLT_e5 HLT_e8 HLT_g5', - 'HLT_e20 HLT_e5_e8 HLT_e5 HLT_e8 HLT_g5 HLT_e5_v3', - 'HLT_mu8 HLT_mu8_1step HLT_e20 HLT_e8 HLT_mu8_e8 HLT_e3_e5', - 'HLT_mu20 HLT_mu8 HLT_mu8_1step HLT_2mu8 HLT_e8' ] - - -data['l1emroi'] = [ ';', - '1,1,0,EM3,EM7,EM15,EM20,EM50,EM100,2EM3; 1,-1.2,0,EM3,EM7,2EM3', - '-0.6,0.2,0,EM3,EM7,EM15,EM20,EM50,EM100; 1,-1.1,0,EM3,EM7,EM15,EM20,EM50', - '-0.6,1.5,0,EM3,EM7,EM7'] - -data['l1muroi'] = [';', - '0,0,0,MU0;', - '-1,0.5,0,MU6,MU8; -1,0.5,0,MU6,MU8,MU10', - '-1.5,-0.1,0,MU6,MU8'] - -data['tracks'] = ['eta:1,phi:1,pt:120000; eta:1,phi:-1.2,et:32000;', - 'eta:1,phi:1,pt:120000; eta:1,phi:-1.2,et:32000;', - 'eta:0.5,phi:0,pt:130000; eta:1,phi:-1.2,pt:60000;eta:-1.2,phi:0.7,pt:6700; eta:-1.1,phi:0.6,pt:8600;', - 'eta:-0.6,phi:1.7,et:9000;'] # no MU track for MS candidate 'eta:-1.7,phi:-0.2,pt:9500;' - -data['mucomb'] = [';', - ';', - 'eta:-1.2,phi:0.7,pt:6600; eta:-1.1,phi:0.6,pt:8600;', - ';'] - -data['electrons'] = [';', - 'eta:1,phi:1,pt:120000; eta:1,phi:-1.2,et:32000;', - ';', - ';'] -data['photons'] = [';', - 'eta:1,phi:1,pt:130000;', - ';', - ';'] - - - -from TrigUpgradeTest.TestUtils import writeEmulationFiles -writeEmulationFiles(data) - - -from AthenaCommon.CFElements import parOR, seqAND, stepSeq - +from TrigUpgradeTest.EmuStepProcessingConfig import generateL1DecoderAndChains # signatures from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig import makeHLTTree -from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence, Chain, ChainStep - - -doMuon=True -doElectron=True -doCombo=True - -HLTChains = [] -EnabledElChains = [] -EnabledMuChains = [] -EnabledMuComboChains = [] -EnabledElComboChains = [] - - -# muon chains -if doMuon: - from TrigUpgradeTest.HLTSignatureConfig import muStep1MenuSequence, muStep2MenuSequence - muStep1 = muStep1MenuSequence("v1") - muStep2 = muStep2MenuSequence("v1") - - - MuChains = [ - Chain(name='HLT_mu20', Seed="L1_MU10", ChainSteps=[ChainStep("Step1_mu", [muStep1]) , ChainStep("Step2_mu", [muStep2] )]) , - Chain(name='HLT_mu8_1step', Seed="L1_MU6", ChainSteps=[ChainStep("Step1_mu", [muStep1]) ]) , - Chain(name='HLT_mu8', Seed="L1_MU6", ChainSteps=[ChainStep("Step1_mu", [muStep1]) , ChainStep("Step2_mu", [muStep2] ) ] ) - ] - HLTChains += MuChains - EnabledMuChains= [c.seed.strip().split("_")[1] +" : "+ c.name for c in MuChains] - - - - -## #electron chains -if doElectron: - from TrigUpgradeTest.HLTSignatureConfig import elStep1MenuSequence, elStep2MenuSequence, gammStep1MenuSequence - # electron - elStep1 = elStep1MenuSequence("v1") - elStep2 = elStep2MenuSequence("v1","v1") - elStep2v2 = elStep2MenuSequence("v2","v2") - elStep2v3 = elStep2MenuSequence("v2","v3") - # gamma - gammStep1 = gammStep1MenuSequence("v1") - - ElChains = [ - Chain(name='HLT_e5' , Seed="L1_EM7", ChainSteps=[ ChainStep("Step1_em", [elStep1]), ChainStep("Step2_em", [elStep2]) ] ), - Chain(name='HLT_e5_v2', Seed="L1_EM7", ChainSteps=[ ChainStep("Step1_em", [elStep1]), ChainStep("Step2v2_em", [elStep2v2]) ] ), - Chain(name='HLT_e5_v3', Seed="L1_EM7", ChainSteps=[ ChainStep("Step1_em", [elStep1]), ChainStep("Step2v3_em", [elStep2v3]) ] ), - Chain(name='HLT_e8' , Seed="L1_EM7", ChainSteps=[ ChainStep("Step1_em", [elStep1]), ChainStep("Step2_em", [elStep2]) ] ), - Chain(name='HLT_g5' , Seed="L1_EM7", ChainSteps=[ ChainStep("Step1_gam", [gammStep1]) ] ) - ] - - HLTChains += ElChains - EnabledElChains= [c.seed.strip().split("_")[1] +" : "+ c.name for c in ElChains] - - -# combined chain -if doCombo: - from TrigUpgradeTest.HLTSignatureConfig import elStep1MenuSequence, muStep1MenuSequence, elStep2MenuSequence, muStep2MenuSequence - elStep1 = elStep1MenuSequence("v1") - muStep1 = muStep1MenuSequence("v1") - elStep2 = elStep2MenuSequence("v1","v1") - muStep2 = muStep2MenuSequence("v1") - - - CombChains =[ - Chain(name='HLT_mu8_e8', Seed="L1_MU6_EM7", ChainSteps=[ ChainStep("Step1_mu_em", [muStep1, elStep1]), ChainStep("Step2_mu_em", [muStep2, elStep2])] ), - Chain(name='HLT_e5_e8', Seed="L1_2EM3", ChainSteps=[ ChainStep("Step1_2em",[elStep1, elStep1]) ]) - ] - - HLTChains += CombChains - for c in CombChains: - seeds=c.seed.split("_") - seeds.pop(0) #remove first L1 string - for s in seeds: - if "MU" in s: EnabledMuComboChains.append(s +" : "+ c.name) - if "EM" in s: EnabledElComboChains.append(s +" : "+ c.name) - - print "enabled Combo chains: ", EnabledMuComboChains,EnabledElComboChains - - -# this is a temporary hack to include new test chains -EnabledChainNamesToCTP = dict([ (c.name, c.seed) for c in HLTChains]) - - - - -########################## L1 ################################################# - -L1UnpackingSeq = parOR("L1UnpackingSeq") -from L1Decoder.L1DecoderConf import CTPUnpackingEmulationTool, RoIsUnpackingEmulationTool, L1Decoder -l1Decoder = L1Decoder( OutputLevel=DEBUG, RoIBResult="" ) -l1Decoder.prescaler.EventInfo="" -l1Decoder.ChainToCTPMapping = EnabledChainNamesToCTP -l1Decoder.L1DecoderSummaryKey = "L1DecoderSummary" - -ctpUnpacker = CTPUnpackingEmulationTool( OutputLevel = DEBUG, ForceEnableAllChains=False , InputFilename="ctp.dat" ) -l1Decoder.ctpUnpacker = ctpUnpacker - -emUnpacker = RoIsUnpackingEmulationTool("EMRoIsUnpackingTool", OutputLevel=DEBUG, InputFilename="l1emroi.dat", OutputTrigRoIs="L1EMRoIs", Decisions="L1EM" ) -emUnpacker.ThresholdToChainMapping = EnabledElChains + EnabledElComboChains -emUnpacker.Decisions="L1EM" -print "EMRoIsUnpackingTool enables chians:" -print emUnpacker.ThresholdToChainMapping - -muUnpacker = RoIsUnpackingEmulationTool("MURoIsUnpackingTool", OutputLevel=DEBUG, InputFilename="l1muroi.dat", OutputTrigRoIs="L1MURoIs", Decisions="L1MU" ) -muUnpacker.ThresholdToChainMapping = EnabledMuChains + EnabledMuComboChains -muUnpacker.Decisions="L1MU" -print "MURoIsUnpackingTool enables chians:" -print muUnpacker.ThresholdToChainMapping - -l1Decoder.roiUnpackers = [emUnpacker, muUnpacker] - -#print l1Decoder -L1UnpackingSeq += l1Decoder -print L1UnpackingSeq - -########################## L1 ################################################# # steps: sequential AND of 1=Filter 2=Processing # chainstep=single chain step @@ -203,10 +22,9 @@ print L1UnpackingSeq # filters: one SeqFilter per step, per chain # inputMakers: one per each first RecoAlg in a step (so one per step), one input per chain that needs that step - from AthenaCommon.AlgSequence import AlgSequence, AthSequencer, dumpSequence topSequence = AlgSequence() -#topSequence += L1UnpackingSeq +l1Decoder, HLTChains = generateL1DecoderAndChains() topSequence += l1Decoder ##### Make all HLT ####### makeHLTTree(HLTChains) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_emu_newjo.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/test_emu_newjo.sh new file mode 100755 index 0000000000000000000000000000000000000000..ea2e1c7a3069b61d822f3cbb1d63fe36d447a910 --- /dev/null +++ b/Trigger/TrigValidation/TrigUpgradeTest/test/test_emu_newjo.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# art-type: build +# art-include: master/Athena + +rm -rf EmuNewJOTest.py bootstrap.pkl bootstrap.py + +# this is a hack to pre-confgure scheduler and other MT services, +#will be taken away once NEW system has better means to influence the bootstrap content +cat <<EOF >> bootstrap.py +from AthenaCommon.AppMgr import theApp, ServiceMgr as svcMgr +svcMgr.AvalancheSchedulerSvc.ShowControlFlow=True +svcMgr.AvalancheSchedulerSvc.ShowDataDependencies=True +EOF + +athena --threads=1 --config-only=bootstrap.pkl bootstrap.py + + +get_files -jo TrigUpgradeTest/EmuNewJOTest.py +python EmuNewJOTest.py # generate pickle +status=$? +if [ ${status} -ne 0 ] +then + echo "ERROR in configuration generation stage, stopping" + exit -1 +else + echo + echo "JOs reading stage finished, launching Athena from pickle file" + echo + athena EmuNewJOTest.pkl +fi diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py index ad79a5b31416599b0e154ba37e7e9829adc1070c..7aba19dee893bc2a4c8daadc34db2f680390cc46 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT_newJO.py @@ -84,7 +84,7 @@ def generateMenu( flags ): useReworked = True if useReworked: - menuAcc = generateDecisionTree(menuChains, allChainDicts) + menuAcc = generateDecisionTree(menuChains) else: menuAcc = ComponentAccumulator() mainSequenceName = 'HLTAllSteps' diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py index a074748583d68226d94c0a1504fe7484caa11342..1e88b553b2d6be061aa4326e52b7a00c9182db4b 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig_newJO.py @@ -1,7 +1,12 @@ # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +from collections import defaultdict +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponentsNaming import CFNaming from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig import buildFilter, makeSummary +from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFDot import stepCF_DataFlow_to_dot, \ + stepCF_ControlFlow_to_dot, all_DataFlow_to_dot +from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import CFSequence from AthenaCommon.CFElements import parOR, seqAND from AthenaCommon.Logging import logging from AthenaCommon.Constants import VERBOSE @@ -10,27 +15,17 @@ log = logging.getLogger('HLTCFConfig_newJO') log.setLevel( VERBOSE ) -def connectStepToFilter(chainStep, filterNode): - filter_output = filterNode.getOutputList() - if len(filter_output) == 0: - raise ValueError('ERROR: no filter outputs are set') +def printStepsMatrix(matrix): + print('----- Steps matrix ------') + for nstep in matrix: + print('step {}:'.format(nstep)) + for chainName in matrix[nstep]: + namesInCell = map(lambda el: el.name, matrix[nstep][chainName]) + print('---- {}: {}'.format(chainName, namesInCell)) + print('-------------------------') - if len(filter_output) != len(chainStep.sequences): - msg = 'ERROR: found {} filter outputs and {} MenuSequences in step {}'.format(len(filter_output), - len(chainStep.sequences), chainStep.name) - raise ValueError(msg) - - for nseq, sequence in enumerate(chainStep.sequences): - output = filter_output[nseq] - log.debug("Found input %s to sequence::%s from Filter::%s (from seed %s)", output, - sequence.name, filterNode.Alg.name(), sequence.seed) - sequence.connectToFilter(output) - - -def generateDecisionTree(chains, allChainDicts): - from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator - from collections import defaultdict +def generateDecisionTree(chains): acc = ComponentAccumulator() mainSequenceName = 'HLTAllSteps' acc.addSequence( seqAND(mainSequenceName) ) @@ -40,24 +35,30 @@ def generateDecisionTree(chains, allChainDicts): chainStepsMatrix = defaultdict(lambda: defaultdict(list)) ## Fill chain steps matrix - for chain in chains: + for index, chain in enumerate(chains): for stepNumber, chainStep in enumerate(chain.steps): - chainName = chainStep.name.split('_')[0] - chainStepsMatrix[stepNumber][chainName].append(chain) + chainStepsMatrix[stepNumber][chainStep.name].append(chain) + + printStepsMatrix(chainStepsMatrix) + + allCFSequences = [] ## Matrix with steps lists generated. Creating filters for each cell - for nstep in chainStepsMatrix: + for nstep in sorted(chainStepsMatrix.keys()): stepDecisions = [] - stepName = 'Step{}'.format(nstep) + stepName = CFNaming.stepName(nstep) stepFilterNodeName = '{}{}'.format(stepName, CFNaming.FILTER_POSTFIX) filterAcc = ComponentAccumulator() filterAcc.addSequence( parOR(stepFilterNodeName) ) - stepRecoNodeName = '{}_{}'.format(mainSequenceName, stepName) + stepRecoNodeName = CFNaming.stepRecoNodeName(mainSequenceName, stepName) + stepRecoNode = parOR(stepRecoNodeName) recoAcc = ComponentAccumulator() - recoAcc.addSequence( parOR(stepRecoNodeName) ) + recoAcc.addSequence(stepRecoNode) + + CFSequences = [] for chainName in chainStepsMatrix[nstep]: chainsInCell = chainStepsMatrix[nstep][chainName] @@ -72,12 +73,13 @@ def generateDecisionTree(chains, allChainDicts): else: filter_input = [output for sequence in firstChain.steps[nstep - 1].sequences for output in sequence.outputs] + chainStep = firstChain.steps[nstep] + # One aggregated filter per chain (one per column in matrix) - filterName = 'Filter_{}'.format( firstChain.steps[nstep].name ) + filterName = CFNaming.filterName(chainStep.name) sfilter = buildFilter(filterName, filter_input) filterAcc.addEventAlgo(sfilter.Alg, sequenceName = stepFilterNodeName) - chainStep = firstChain.steps[nstep] stepReco = parOR('{}{}'.format(chainStep.name, CFNaming.RECO_POSTFIX)) stepView = seqAND('{}{}'.format(chainStep.name, CFNaming.VIEW_POSTFIX), [stepReco]) viewWithFilter = seqAND(chainStep.name, [sfilter.Alg, stepView]) @@ -85,18 +87,25 @@ def generateDecisionTree(chains, allChainDicts): stepsAcc = ComponentAccumulator() + CFSequenceAdded = False + for chain in chainsInCell: - for seq in chain.steps[nstep].sequences: + step = chain.steps[nstep] + CFSeq = CFSequence(step, sfilter) + if not CFSequenceAdded: + CFSequences.append(CFSeq) + CFSequenceAdded = True + for seq in step.sequences: if seq.ca is None: raise ValueError('ComponentAccumulator missing in sequence {} in chain {}'.format(seq.name, chain.name)) stepsAcc.merge( seq.ca ) - recoAcc.addEventAlgo( seq.hypo.Alg, sequenceName = stepView.getName() ) + recoAcc.addEventAlgo(seq.hypo.Alg, sequenceName = stepView.getName()) + if step.isCombo: + recoAcc.addEventAlgo(step.combo.Alg, sequenceName = stepView.getName()) sfilter.setChains(chain.name) recoAcc.merge(stepsAcc, sequenceName = stepReco.getName()) - connectStepToFilter(chainStep, sfilter) - for sequence in chainStep.sequences: stepDecisions += sequence.outputs @@ -106,4 +115,13 @@ def generateDecisionTree(chains, allChainDicts): summary = makeSummary('TriggerSummary{}'.format(stepName), stepDecisions) acc.addSequence(summary, parentName = mainSequenceName) + allCFSequences.append(CFSequences) + + stepCF_DataFlow_to_dot(stepRecoNodeName, CFSequences) + stepCF_ControlFlow_to_dot(stepRecoNode) + + acc.printConfig() + + all_DataFlow_to_dot(mainSequenceName, allCFSequences) + return acc