From 9b1df39aa2a28b314b1722d15b6eaedd3ee75b03 Mon Sep 17 00:00:00 2001 From: Francesca Pastore <francesca.pastore@cern.ch> Date: Wed, 4 Nov 2020 15:17:15 +0100 Subject: [PATCH] first step in emu done --- .../python/EmuStepProcessingConfig.py | 4 +- .../share/emu_step_processing.ref | 53 ++++-- .../DecisionHandling/src/RoRSeqFilter.cxx | 17 +- .../DecisionHandling/src/RoRSeqFilter.h | 12 +- .../python/HLTMenuConfig/Menu/HLTCFConfig.py | 157 ++++-------------- .../HLTMenuConfig/Menu/MenuComponents.py | 43 ++++- 6 files changed, 139 insertions(+), 147 deletions(-) diff --git a/Trigger/TrigSteer/DecisionHandling/python/EmuStepProcessingConfig.py b/Trigger/TrigSteer/DecisionHandling/python/EmuStepProcessingConfig.py index 0d80f0e9ddb..83402868c1f 100644 --- a/Trigger/TrigSteer/DecisionHandling/python/EmuStepProcessingConfig.py +++ b/Trigger/TrigSteer/DecisionHandling/python/EmuStepProcessingConfig.py @@ -325,8 +325,8 @@ def generateChainsManually(): # FSNOSEED not implemented in emulation # L1Thresholds=["MU6", "MU6"], makeChain(name='HLT_TestChain10_muEmpty1_TestChain6_muEmpty1_L12MU6', L1Thresholds=["MU6", "MU6"], ChainSteps=[ - makeChainStep("Step1_2muAs_empty", multiplicity=[]), - makeChainStep("Step2_2muAs", [mu21, mu21], multiplicity=[1,1]) ]) + makeChainStep("Step1_2muAs_empty", multiplicity=[]), + makeChainStep("Step2_2muAs", [mu21, mu21], multiplicity=[1,1]) ]) ] diff --git a/Trigger/TrigSteer/DecisionHandling/share/emu_step_processing.ref b/Trigger/TrigSteer/DecisionHandling/share/emu_step_processing.ref index 143c5713c64..c9e9f5ff4b6 100644 --- a/Trigger/TrigSteer/DecisionHandling/share/emu_step_processing.ref +++ b/Trigger/TrigSteer/DecisionHandling/share/emu_step_processing.ref @@ -1,7 +1,26 @@ -TriggerSummaryStep1 1 0 DEBUG In summary 4 chains passed: +Py:TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents ERROR no InputProp set +Py:TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents ERROR no OutputProp set +Py:TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents ERROR no InputProp set +Py:TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents ERROR no OutputProp set +Py:TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents ERROR no InputProp set +Py:TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents ERROR no OutputProp set +Py:TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents ERROR no InputProp set +Py:TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents ERROR no OutputProp set +Py:TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents ERROR no InputProp set +Py:TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents ERROR no OutputProp set +Py:TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents ERROR no InputProp set +Py:TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents ERROR no OutputProp set +TriggerSummaryStep1 0 0 DEBUG In summary 0 chains passed: +TriggerSummaryStep2 0 0 DEBUG In summary 0 chains passed: +TriggerSummaryStep3 0 0 DEBUG In summary 0 chains passed: +TriggerSummaryStep1 1 0 DEBUG In summary 8 chains passed: +TriggerSummaryStep1 1 0 DEBUG +++ HLT_2TestChain6_muv1_L12MU6 ID#1408409992 TriggerSummaryStep1 1 0 DEBUG +++ HLT_TestChain8_ev1_L1EM5 ID#1677577445 TriggerSummaryStep1 1 0 DEBUG +++ HLT_TestChain5_ev1_L1EM3 ID#1756953305 +TriggerSummaryStep1 1 0 DEBUG +++ leg000_HLT_TestChain6_muv1_TestChain10_muv1_L12MU6 ID#1790520567 TriggerSummaryStep1 1 0 DEBUG +++ HLT_TestChain5_ev3_L1EM7 ID#2336588294 +TriggerSummaryStep1 1 0 DEBUG +++ HLT_TestChain6_muv1_TestChain10_muv1_L12MU6 ID#3196402061 +TriggerSummaryStep1 1 0 DEBUG +++ leg001_HLT_TestChain6_muv1_TestChain10_muv1_L12MU6 ID#3844733695 TriggerSummaryStep1 1 0 DEBUG +++ HLT_TestChain5_gv1_L1EM7 ID#3893303900 TriggerSummaryStep2 1 0 DEBUG In summary 3 chains passed: TriggerSummaryStep2 1 0 DEBUG +++ HLT_TestChain8_ev1_L1EM5 ID#1677577445 @@ -10,7 +29,7 @@ TriggerSummaryStep2 1 0 DEBUG +++ HLT_TestChain5_ev3 TriggerSummaryStep3 1 0 DEBUG In summary 2 chains passed: TriggerSummaryStep3 1 0 DEBUG +++ HLT_TestChain8_ev1_L1EM5 ID#1677577445 TriggerSummaryStep3 1 0 DEBUG +++ HLT_TestChain5_ev1_L1EM3 ID#1756953305 -TriggerSummaryStep1 2 0 DEBUG In summary 23 chains passed: +TriggerSummaryStep1 2 0 DEBUG In summary 24 chains passed: TriggerSummaryStep1 2 0 DEBUG +++ leg002_HLT_TestChain5_ev1_TestChain8_ev1_2TestChain6_muv1_L1EM3_L1EM5_L12MU6 ID#56278684 TriggerSummaryStep1 2 0 DEBUG +++ HLT_TestChain6_muv1_TestChain10_ev1_L1MU6_EM5 ID#64374772 TriggerSummaryStep1 2 0 DEBUG +++ leg001_HLT_TestChain6_muv1_TestChain10_ev1_L1MU6_EM5 ID#122300819 @@ -26,6 +45,7 @@ TriggerSummaryStep1 2 0 DEBUG +++ HLT_2TestChain6_mu TriggerSummaryStep1 2 0 DEBUG +++ HLT_TestChain8_muv1_L1MU10 ID#2288364952 TriggerSummaryStep1 2 0 DEBUG +++ HLT_TestChain6_muEmpty2_L1MU6 ID#2511524900 TriggerSummaryStep1 2 0 DEBUG +++ leg001_HLT_TestChain10_muEmpty1_TestChain6_muEmpty1_L12MU6 ID#2599553377 +TriggerSummaryStep1 2 0 DEBUG +++ HLT_TestChain10_muEmpty1_TestChain6_muEmpty1_L12MU6 ID#2764921170 TriggerSummaryStep1 2 0 DEBUG +++ leg000_HLT_TestChain5_ev1_TestChain8_ev1_2TestChain6_muv1_L1EM3_L1EM5_L12MU6 ID#3037831603 TriggerSummaryStep1 2 0 DEBUG +++ HLT_TestChain6_muv1_TestChain10_muv1_L12MU6 ID#3196402061 TriggerSummaryStep1 2 0 DEBUG +++ HLT_TestChain6_muv2_TestChain8_ev2_L1MU6_EM5 ID#3476793373 @@ -34,7 +54,7 @@ TriggerSummaryStep1 2 0 DEBUG +++ HLT_TestChain8_muv TriggerSummaryStep1 2 0 DEBUG +++ leg001_HLT_TestChain6_muv1_TestChain10_muv1_L12MU6 ID#3844733695 TriggerSummaryStep1 2 0 DEBUG +++ leg000_HLT_TestChain10_muEmpty1_TestChain6_muEmpty1_L12MU6 ID#4097287954 TriggerSummaryStep1 2 0 DEBUG +++ leg000_HLT_TestChain6_muv2_TestChain8_ev2_L1MU6_EM5 ID#4283304400 -TriggerSummaryStep2 2 0 DEBUG In summary 19 chains passed: +TriggerSummaryStep2 2 0 DEBUG In summary 23 chains passed: TriggerSummaryStep2 2 0 DEBUG +++ leg002_HLT_TestChain5_ev1_TestChain8_ev1_2TestChain6_muv1_L1EM3_L1EM5_L12MU6 ID#56278684 TriggerSummaryStep2 2 0 DEBUG +++ HLT_TestChain6_muv1_TestChain10_ev1_L1MU6_EM5 ID#64374772 TriggerSummaryStep2 2 0 DEBUG +++ leg001_HLT_TestChain6_muv1_TestChain10_ev1_L1MU6_EM5 ID#122300819 @@ -47,14 +67,19 @@ TriggerSummaryStep2 2 0 DEBUG +++ leg000_HLT_TestCha TriggerSummaryStep2 2 0 DEBUG +++ HLT_TestChain5_ev1_TestChain8_ev1_2TestChain6_muv1_L1EM3_L1EM5_L12MU6 ID#1820214917 TriggerSummaryStep2 2 0 DEBUG +++ leg000_HLT_TestChain6_muv1_TestChain10_ev1_L1MU6_EM5 ID#1827802456 TriggerSummaryStep2 2 0 DEBUG +++ HLT_2TestChain6_muEmpty1_L12MU6 ID#2176116418 +TriggerSummaryStep2 2 0 DEBUG +++ HLT_TestChain8_muv1_L1MU10 ID#2288364952 TriggerSummaryStep2 2 0 DEBUG +++ HLT_TestChain6_muEmpty2_L1MU6 ID#2511524900 TriggerSummaryStep2 2 0 DEBUG +++ leg001_HLT_TestChain10_muEmpty1_TestChain6_muEmpty1_L12MU6 ID#2599553377 TriggerSummaryStep2 2 0 DEBUG +++ HLT_TestChain10_muEmpty1_TestChain6_muEmpty1_L12MU6 ID#2764921170 TriggerSummaryStep2 2 0 DEBUG +++ leg000_HLT_TestChain5_ev1_TestChain8_ev1_2TestChain6_muv1_L1EM3_L1EM5_L12MU6 ID#3037831603 TriggerSummaryStep2 2 0 DEBUG +++ HLT_TestChain6_muv2_TestChain8_ev2_L1MU6_EM5 ID#3476793373 +TriggerSummaryStep2 2 0 DEBUG +++ HLT_TestChain10_muv2_L1MU10 ID#3482819675 +TriggerSummaryStep2 2 0 DEBUG +++ HLT_TestChain8_muv1step_L1MU6 ID#3588359947 +TriggerSummaryStep2 2 0 DEBUG +++ leg001_HLT_TestChain6_muv1_TestChain10_muv1_L12MU6 ID#3844733695 TriggerSummaryStep2 2 0 DEBUG +++ leg000_HLT_TestChain10_muEmpty1_TestChain6_muEmpty1_L12MU6 ID#4097287954 TriggerSummaryStep2 2 0 DEBUG +++ leg000_HLT_TestChain6_muv2_TestChain8_ev2_L1MU6_EM5 ID#4283304400 -TriggerSummaryStep3 2 0 DEBUG In summary 5 chains passed: +TriggerSummaryStep3 2 0 DEBUG In summary 6 chains passed: +TriggerSummaryStep3 2 0 DEBUG +++ HLT_TestChain6_muv1_TestChain10_ev1_L1MU6_EM5 ID#64374772 TriggerSummaryStep3 2 0 DEBUG +++ leg001_HLT_TestChain6_muv1_TestChain10_ev1_L1MU6_EM5 ID#122300819 TriggerSummaryStep3 2 0 DEBUG +++ HLT_TestChain8_ev1_L1EM5 ID#1677577445 TriggerSummaryStep3 2 0 DEBUG +++ HLT_TestChain5_ev1_L1EM3 ID#1756953305 @@ -76,12 +101,14 @@ TriggerSummaryStep1 3 0 DEBUG +++ HLT_TestChain8_muv TriggerSummaryStep1 3 0 DEBUG +++ HLT_TestChain6_muv2_TestChain8_ev2_L1MU6_EM5 ID#3476793373 TriggerSummaryStep1 3 0 DEBUG +++ HLT_TestChain8_muv1step_L1MU6 ID#3588359947 TriggerSummaryStep1 3 0 DEBUG +++ leg000_HLT_TestChain6_muv2_TestChain8_ev2_L1MU6_EM5 ID#4283304400 -TriggerSummaryStep2 3 0 DEBUG In summary 6 chains passed: +TriggerSummaryStep2 3 0 DEBUG In summary 8 chains passed: TriggerSummaryStep2 3 0 DEBUG +++ HLT_TestChain20_muv1_L1MU10 ID#356594709 TriggerSummaryStep2 3 0 DEBUG +++ leg001_HLT_TestChain6_muv2_TestChain8_ev2_L1MU6_EM5 ID#1546253468 TriggerSummaryStep2 3 0 DEBUG +++ HLT_TestChain8_ev1_L1EM5 ID#1677577445 +TriggerSummaryStep2 3 0 DEBUG +++ leg000_HLT_TestChain6_muv1_TestChain10_ev1_L1MU6_EM5 ID#1827802456 TriggerSummaryStep2 3 0 DEBUG +++ HLT_TestChain8_muv1_L1MU10 ID#2288364952 TriggerSummaryStep2 3 0 DEBUG +++ HLT_TestChain6_muv2_TestChain8_ev2_L1MU6_EM5 ID#3476793373 +TriggerSummaryStep2 3 0 DEBUG +++ HLT_TestChain8_muv1step_L1MU6 ID#3588359947 TriggerSummaryStep2 3 0 DEBUG +++ leg000_HLT_TestChain6_muv2_TestChain8_ev2_L1MU6_EM5 ID#4283304400 TriggerSummaryStep3 3 0 DEBUG In summary 3 chains passed: TriggerSummaryStep3 3 0 DEBUG +++ HLT_TestChain20_muv1_L1MU10 ID#356594709 @@ -94,8 +121,8 @@ TrigSignatureMoniMT INFO HLT_2TestChain4_muv1dr_ TrigSignatureMoniMT INFO -- #3176095517 Events 0 0 0 0 - - 0 TrigSignatureMoniMT INFO -- #3176095517 Features 0 0 - - TrigSignatureMoniMT INFO HLT_2TestChain6_muEmpty1_L12MU6 #2176116418 -TrigSignatureMoniMT INFO -- #2176116418 Events 1 1 0 1 - - 1 -TrigSignatureMoniMT INFO -- #2176116418 Features 0 6 - - +TrigSignatureMoniMT INFO -- #2176116418 Events 1 1 - 1 - - 1 +TrigSignatureMoniMT INFO -- #2176116418 Features - 6 - - TrigSignatureMoniMT INFO HLT_2TestChain6_muv1_L12MU6 #1408409992 TrigSignatureMoniMT INFO -- #1408409992 Events 2 2 1 1 - - 1 TrigSignatureMoniMT INFO -- #1408409992 Features 6 6 - - @@ -103,8 +130,8 @@ TrigSignatureMoniMT INFO HLT_3TestChain6_muv1_L1 TrigSignatureMoniMT INFO -- #2217088100 Events 0 0 0 0 - - 0 TrigSignatureMoniMT INFO -- #2217088100 Features 0 0 - - TrigSignatureMoniMT INFO HLT_TestChain10_muEmpty1_TestChain6_muEmpty1_L12MU6 #2764921170 -TrigSignatureMoniMT INFO -- #2764921170 Events 1 1 0 1 - - 1 -TrigSignatureMoniMT INFO -- #2764921170 Features 0 3 - - +TrigSignatureMoniMT INFO -- #2764921170 Events 1 1 - 1 - - 1 +TrigSignatureMoniMT INFO -- #2764921170 Features - 3 - - TrigSignatureMoniMT INFO HLT_TestChain10_muv2_L1MU10 #3482819675 TrigSignatureMoniMT INFO -- #3482819675 Events 2 2 1 0 0 - 0 TrigSignatureMoniMT INFO -- #3482819675 Features 1 0 0 - @@ -130,11 +157,11 @@ TrigSignatureMoniMT INFO HLT_TestChain5_gv1_L1EM TrigSignatureMoniMT INFO -- #3893303900 Events 1 1 1 - - - 1 TrigSignatureMoniMT INFO -- #3893303900 Features 2 - - - TrigSignatureMoniMT INFO HLT_TestChain6_muEmpty2_L1MU6 #2511524900 -TrigSignatureMoniMT INFO -- #2511524900 Events 1 1 1 0 1 1 1 -TrigSignatureMoniMT INFO -- #2511524900 Features 3 0 3 3 +TrigSignatureMoniMT INFO -- #2511524900 Events 1 1 1 - 1 1 1 +TrigSignatureMoniMT INFO -- #2511524900 Features 3 - 3 3 TrigSignatureMoniMT INFO HLT_TestChain6_muv1_TestChain10_ev1_L1MU6_EM5 #64374772 -TrigSignatureMoniMT INFO -- #64374772 Events 2 2 2 1 0 1 1 -TrigSignatureMoniMT INFO -- #64374772 Features 4 3 0 3 +TrigSignatureMoniMT INFO -- #64374772 Events 2 2 2 1 - 1 1 +TrigSignatureMoniMT INFO -- #64374772 Features 4 3 - 3 TrigSignatureMoniMT INFO HLT_TestChain6_muv1_TestChain10_muv1_L12MU6 #3196402061 TrigSignatureMoniMT INFO -- #3196402061 Events 2 2 1 0 - - 0 TrigSignatureMoniMT INFO -- #3196402061 Features 3 0 - - diff --git a/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.cxx b/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.cxx index 2e95d1959e3..ff0a0b5f3f5 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.cxx +++ b/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.cxx @@ -27,7 +27,6 @@ StatusCode RoRSeqFilter::initialize() CHECK( not m_inputKeys.empty() ); CHECK( not m_outputKeys.empty() ); - CHECK( m_inputKeys.initialize() ); CHECK( m_outputKeys.initialize() ); @@ -88,6 +87,13 @@ StatusCode RoRSeqFilter::initialize() for ( const std::string& el: m_chainsProperty ) m_chains.insert( HLT::Identifier( el ).numeric() ); + + // m_chainsPerInput.clear(); + // for ( const auto& m : m_chainsPerInputProperty ) { + // for ( const std::string& el: m.second ) + // m_chainsPerInput[m.first].insert( HLT::Identifier( el ).numeric() ); + // } + m_chainsPerInput.resize( m_chainsPerInputProperty.size() ); for ( size_t i = 0; i < m_chainsPerInputProperty.size(); ++i ) { for ( const std::string& el: m_chainsPerInputProperty[i] ) @@ -98,6 +104,14 @@ StatusCode RoRSeqFilter::initialize() ATH_MSG_DEBUG( "Configured to require these chains: "); for ( const HLT::Identifier& id: m_chains ) ATH_MSG_DEBUG( " - " << id ); + + // ATH_MSG_DEBUG( "Configured to require these chains per input: "); + // for ( const auto& m : m_chainsPerInput ){ + // ATH_MSG_DEBUG( " - " << m.first <<": "); + // for (const HLT::Identifier& id: m.second ) + // ATH_MSG_DEBUG( " - " << id ); + + // } } if ( not m_monTool.name().empty() ) { @@ -159,6 +173,7 @@ StatusCode RoRSeqFilter::execute( const EventContext& ctx ) const { for ( auto inputIndex : m_ioMapping[outputIndex] ) { if ( inputHandles[inputIndex].isValid() and not inputHandles[inputIndex]->empty() ) { ATH_MSG_DEBUG( "Checking inputHandle: "<< inputHandles[inputIndex].key() <<" has " << inputHandles[inputIndex]->size() <<" elements"); + std::string input_key = std::string(inputHandles[inputIndex].key()); if ( not m_chainsPerInput.empty() ) { passCounter += copyPassing( *inputHandles[inputIndex], *output, m_chainsPerInput[inputIndex], ctx ); } else { diff --git a/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.h b/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.h index ea084626900..ce5d1d5a03d 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.h +++ b/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.h @@ -61,6 +61,9 @@ class RoRSeqFilter **/ virtual StatusCode execute(const EventContext& ctx) const override; + //typedef std::map<std::string, std::vector<std::string>> InputToChainMap; + //const InputToChainMap& getInputToChainMap() const { return m_chainsPerInputProperty.value(); } + private: RoRSeqFilter(); SG::ReadHandleKeyArray<TrigCompositeUtils::DecisionContainer> m_inputKeys{ this, "Input", {}, "Inputs to the filter" }; @@ -69,9 +72,14 @@ class RoRSeqFilter Gaudi::Property<std::vector<std::string> > m_chainsProperty{ this, "Chains", {}, "Chains of which this filter is concerned" }; std::set<HLT::Identifier> m_chains; - Gaudi::Property<std::vector <std::vector<std::string>> > m_chainsPerInputProperty{ this, "ChainsPerInput", {}, "Chains of which this filter is concerned" }; - std::vector<std::set<HLT::Identifier>> m_chainsPerInput; + // Gaudi::Property< InputToChainMap > m_chainsPerInputProperty{ this, "ChainsPerInput", {}, "Chains of which this filter is concerned" }; + // std::map<std::string, std::set<HLT::Identifier>> m_chainsPerInput; + + + std::vector<std::set<HLT::Identifier>> m_chainsPerInput; + Gaudi::Property<std::vector <std::vector<std::string>> > m_chainsPerInputProperty{ this, "ChainsPerInput", {}, "Chains of which this filter is concerned" }; + /** * It can be used to define a custom routing from input to output collections * Example: [[0,1,3], [2]] means that inputs 0, 1, and 3 are directed to output 0, and input under the index 2 to aoutput 1 diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py index ec70259e6dd..5d402b82b04 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py @@ -35,6 +35,7 @@ from AthenaCommon.CFElements import parOR, seqAND from AthenaCommon.AlgSequence import dumpSequence from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFDot import stepCF_DataFlow_to_dot, stepCF_ControlFlow_to_dot, all_DataFlow_to_dot, create_dot from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponentsNaming import CFNaming +from AthenaConfiguration.ComponentFactory import CompFactory from AthenaCommon.Configurable import Configurable from AthenaCommon.CFElements import getSequenceChildren, isSequence, compName @@ -379,12 +380,11 @@ def createDataFlow(chains, allDicts): lastCFseq = None lastDecisions = [] for nstep, chainStep in enumerate( chain.steps ): - log.debug("\n************* Start connecting step %d %s for chain %s", nstep+1, chainStep.name, chain.name) + log.debug("\n************* Start connecting step %d %s for chain %s", nstep+1, chainStep.name, chain.name) filterInput = chain.L1decisions if nstep == 0 else lastDecisions log.debug("Seeds added; having in the filter now: %s", filterInput) - if len(filterInput) == 0 : log.error("ERROR: Filter for step %s has %d inputs! At least one is expected", chainStep.name, len(filterInput)) @@ -392,15 +392,19 @@ def createDataFlow(chains, allDicts): # make one filter per step: sequenceFilter= None filterName = CFNaming.filterName(chainStep.name) - filterOutput =[ CFNaming.filterOutName(filterName, inputName) for inputName in filterInput ] + if chainStep.isEmpty: + filterOutput= filterInput + else: + filterOutput =[ CFNaming.filterOutName(filterName, inputName) for inputName in filterInput ] # log.debug("Filter outputps: %s", filterOutput) -# note: can use + (foundFilter, foundCFSeq) = findCFSequences(filterName, CFseqList[nstep]) - log.debug("Found %d CF sequences with filter name %s", foundFilter, filterName) + log.debug("Found %d CF sequences with filter name %s", foundFilter, filterName) # add error if more than one if not foundFilter: - sequenceFilter = buildFilter(filterName, filterInput) + sequenceFilter = buildFilter(filterName, filterInput, chainStep.isEmpty) + #filter_input_indexes = [i for i in range(0,len(filterInput)) ] CFseq = CFSequence( ChainStep=chainStep, FilterAlg=sequenceFilter) CFseq.connect(filterOutput) CFseqList[nstep].append(CFseq) @@ -411,7 +415,6 @@ def createDataFlow(chains, allDicts): log.error("Found more than one seuqences containig this filter %s", filterName) lastCFseq=foundCFSeq[0] sequenceFilter=lastCFseq.filter - #lastCFseq.connect(filterOutput) [ sequenceFilter.addInput(inputName) for inputName in filterInput ] [ sequenceFilter.addOutput(outputName) for outputName in filterOutput ] lastCFseq.connect(filterOutput) @@ -422,10 +425,13 @@ def createDataFlow(chains, allDicts): # add chains to the filter: chainLegs = chainStep.getChainLegs() - for leg in chainLegs: - sequenceFilter.addChain(leg) - log.debug("Adding chain %s to %s", leg, sequenceFilter.Alg.name()) -# log.debug("Now Filter has chains: %s", sequenceFilter.getChains()) + if len(chainLegs) != len(filterInput): + log.error("chainlegs = %i differ from inputs=%i", len(chainLegs), len(filterInput)) + for finput, leg in zip(filterInput, chainLegs): + sequenceFilter.addChain(leg, finput) + log.debug("Adding chain %s to input %s of %s", leg, finput,sequenceFilter.Alg.name()) + log.debug("Now Filter has chains: %s", sequenceFilter.getChains()) + log.debug("Now Filter has chains/input: %s", sequenceFilter.getChainsPerInput()) if chainStep.isCombo: if chainStep.combo is not None: @@ -487,112 +493,6 @@ def createControlFlow(HLTNode, CFseqList): -""" -Not used, kept for reference and testing purposes -To be removed in future -""" -def generateDecisionTreeOld(HLTNode, chains, allChainDicts): - log.debug("Run generateDecisionTreeOld on %s", HLTNode.name()) - from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator - acc = ComponentAccumulator() - from collections import defaultdict - from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import CFSequence - - chainStepsMatrix = defaultdict(lambda: defaultdict(lambda: list())) - - ## Fill chain steps matrix - for chain in chains: - chain.createHypoTools()#allChainDicts) - for stepNumber, chainStep in enumerate(chain.steps): - chainName = chainStep.name.split('_')[0] - chainStepsMatrix[stepNumber][chainName].append(chain) - - allSequences = [] - - ## Matrix with steps lists generated. Creating filters for each cell - for nstep in chainStepsMatrix: - CFsequences = [] - stepDecisions = [] - stepAccs = [] - stepHypos = [] - - for chainName in chainStepsMatrix[nstep]: - chainsInCell = chainStepsMatrix[nstep][chainName] - - if not chainsInCell: - continue - - - stepCategoryAcc = ComponentAccumulator() - - stepHypo = None - - for chain in chainsInCell: - for seq in chain.steps[nstep].sequences: - if seq.ca: - stepCategoryAcc.merge( seq.ca ) - - alg = seq.hypo.Alg - if stepHypo is None: - stepHypo = alg - stepHypos.append( alg ) - stepCategoryAcc.addEventAlgo( alg ) - - stepAccs.append( stepCategoryAcc ) - - stepCategoryAcc.printConfig( True, True ) - firstChain = chainsInCell[0] - - if nstep == 0: - filter_input = firstChain.L1decisions - else: - filter_input = [] - for sequence in firstChain.steps[nstep - 1].sequences: - filter_input += sequence.outputs - - # One aggregated filter per chain (one per column in matrix) - filterName = 'Filter_{}'.format( firstChain.steps[nstep].name ) - filter_output =[] - for i in filter_input: - filter_output.append( CFNaming.filterOutName(filterName, i)) - sfilter = buildFilter(filterName, filter_input) - - chainStep = firstChain.steps[nstep] - - CFseq = CFSequence( ChainStep=chainStep, FilterAlg=sfilter, connections=filter_output ) - CFsequences.append( CFseq ) - - - for sequence in chainStep.sequences: - stepDecisions += sequence.outputs - - for chain in chainsInCell: - sfilter.addChain(chain.name) - - allSequences.append(CFsequences) - - stepName = 'Step{}'.format(nstep) - stepFilter = createStepFilterNode(stepName, CFsequences, dump=False) - stepCF = createStepRecoNode('{}_{}'.format(HLTNode.name(), stepName), CFsequences, dump=False) - - from AthenaCommon.CFElements import findOwningSequence - for oneAcc, cfseq, hypo in zip( stepAccs, CFsequences, stepHypos): - owning = findOwningSequence( stepCF, hypo.getName() ) - acc.addSequence( owning ) - acc.merge( oneAcc, sequenceName = owning.getName() ) - summary = makeSummary('TriggerSummary{}'.format(stepName), stepDecisions) - - HLTNode += stepFilter - HLTNode += stepCF - HLTNode += summary - if create_dot(): - stepCF_DataFlow_to_dot('{}_{}'.format(HLTNode.name(), stepName), CFsequences) - stepCF_ControlFlow_to_dot(stepCF) - all_DataFlow_to_dot(HLTNode.name(), allSequences) - - matrixDisplay( allSequences ) - return acc - def findCFSequences(filter_name, cfseqList): @@ -600,6 +500,7 @@ def findCFSequences(filter_name, cfseqList): searches for a filter, with given name, in the CF sequence list of this step """ log.debug( "findCFSequences: filter base name %s", filter_name ) + foundFilters = [cfseq for cfseq in cfseqList if filter_name == cfseq.filter.Alg.name()] log.debug("found %d filters with base name %s", len( foundFilters ), filter_name) @@ -609,22 +510,30 @@ def findCFSequences(filter_name, cfseqList): return (found, None) -def buildFilter(filter_name, filter_input): +def buildFilter(filter_name, filter_input, empty): """ Build the FILTER one filter per previous sequence at the start of the sequence: always create a new one if the previous hypo has more than one output, try to get all of them one filter per previous sequence: 1 input/previous seq, 1 output/next seq """ - from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import RoRSequenceFilterNode - sfilter = RoRSequenceFilterNode(name=filter_name) - for i in filter_input: - sfilter.addInput(i) - for i in filter_input: - sfilter.addOutput(CFNaming.filterOutName(filter_name, i)) + from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import RoRSequenceFilterNode, PassFilterNode + if empty: + sfilter = PassFilterNode(name=filter_name) + for i in filter_input: + sfilter.addInput(i) + sfilter.addOutput(i) + else: + sfilter = RoRSequenceFilterNode(name=filter_name) + + for i in filter_input: + sfilter.addInput(i) + for i in filter_input: + sfilter.addOutput(CFNaming.filterOutName(filter_name, i)) log.debug("Added inputs to filter: %s", sfilter.getInputList()) log.debug("Added outputs to filter: %s", sfilter.getOutputList()) + log.debug("Filter Done: %s", sfilter.Alg.name()) return (sfilter) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py index f21f1263664..55511d7787e 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py @@ -8,6 +8,7 @@ from AthenaCommon.CFElements import parOR, seqAND, compName, getProp from DecisionHandling.DecisionHandlingConfig import ComboHypoCfg from AthenaConfiguration.ComponentFactory import CompFactory RoRSeqFilter=CompFactory.RoRSeqFilter +PassFilter = CompFactory.PassFilter class Node(object): """base class representing one Alg + inputs + outputs, to be used to Draw dot diagrams and connect objects""" @@ -101,8 +102,9 @@ class AlgNode(Node): if self.inputProp != '': self.setPar(self.inputProp,name) else: - log.error("no InputProp set") + log.debug("no InputProp set for input of %s", self.Alg.getName()) Node.addInput(self, name) + return len(self.readInputList()) def readInputList(self): @@ -210,11 +212,14 @@ class SequenceFilterNode(AlgNode): def __init__(self, Alg, inputProp, outputProp): AlgNode.__init__(self, Alg, inputProp, outputProp) - def addChain(self, name): - return self.setPar("Chains", name) + def addChain(self, name, input_index): + return def getChains(self): - return self.getPar("Chains") + return [] + + def getChainsPerInput(self): + return [[]] def __repr__(self): return "SequenceFilter::%s [%s] -> [%s], chains=%s"%(compName(self.Alg),' '.join(map(str, self.getInputList())),' '.join(map(str, self.getOutputList())), self.getChains()) @@ -225,6 +230,34 @@ class RoRSequenceFilterNode(SequenceFilterNode): Alg= RoRSeqFilter(name) SequenceFilterNode.__init__(self, Alg, 'Input', 'Output') + def addChain(self, name, input_name): + input_index = self.readInputList().index(input_name) + chains_in_input = self.getPar("ChainsPerInput") + print ("CACCA " + str(len(chains_in_input))+ " " + str(input_index)) + print (chains_in_input) + if len(chains_in_input) == input_index: + new_input = [name] + chains_in_input.append(new_input) + elif len(chains_in_input) > input_index: + chains_in_input[input_index].append(name) + else: + log.error("Error: why requiring input %i when size is %i ?" , input_index , len(chains_in_input)) + raise RuntimeError("Error: why requiring input %i when size is %i " , input_index , len(chains_in_input)) + + self.Alg.ChainsPerInput= chains_in_input + return self.setPar("Chains", name) # still neded? + + + def getChains(self): + return self.getPar("Chains") + + def getChainsPerInput(self): + return self.getPar("ChainsPerInput") + +class PassFilterNode(SequenceFilterNode): + def __init__(self, name): + Alg= PassFilter(name) + SequenceFilterNode.__init__(self, Alg, '', '') class InputMakerNode(AlgNode): @@ -676,7 +709,7 @@ class CFSequence(object): """ Set the output decision of this CFSequence as the hypo outputdecision; In case of combo, takes the Combo outputs""" self.decisions=[] # empty steps: - if not len(self.step.sequences): + if self.step.isEmpty: self.decisions.extend(self.filter.getOutputList()) else: if self.step.isCombo: -- GitLab