Skip to content
Snippets Groups Projects
Commit 673d22d1 authored by Tomasz Bold's avatar Tomasz Bold
Browse files

Fixes after review

parent 19eb19b6
No related branches found
No related tags found
No related merge requests found
......@@ -55,7 +55,7 @@ StatusCode ComboHypo::initialize() {
}
ATH_CHECK( m_multiplicitiesReqMap.size() != 0 );
bool errorOccured = false;
if (m_checkMultiplicityMap) {
for ( const auto& m : m_multiplicitiesReqMap ) {
......@@ -177,8 +177,8 @@ StatusCode ComboHypo::execute(const EventContext& context ) const {
for ( size_t legIndex = 0; legIndex < multiplicityPerLeg.size(); ++legIndex ) {
const size_t requiredMultiplicity = multiplicityPerLeg.at( legIndex );
nRequiredUnique += requiredMultiplicity;
HLT::Identifier legId = TrigCompositeUtils::createLegName(chainId, legIndex);
HLT::Identifier legId = TrigCompositeUtils::createLegName(chainId, legIndex);
// If there is only one leg, then we just use the chain's name.
if (multiplicityPerLeg.size() == 1) {
ATH_MSG_DEBUG(chainId << " has multiplicityPerLeg.size() == 1, so we don't use legXXX_HLT_YYY, we just use HLT_YYY");
......@@ -187,7 +187,7 @@ StatusCode ComboHypo::execute(const EventContext& context ) const {
const DecisionID requiredDecisionIDLeg = legId.numeric();
ATH_MSG_DEBUG("Container " << legIndex << ", looking at leg : " << legId );
LegDecisionsMap::const_iterator it = dmap.find(requiredDecisionIDLeg);
if ( it == dmap.end() ) {
overallDecision = false;
......
......@@ -23,7 +23,6 @@ StatusCode RoIsUnpackingToolBase::initialize()
return StatusCode::SUCCESS;
}
StatusCode RoIsUnpackingToolBase::decodeMapping( std::function< bool(const std::string&)> filter ) {
SG::ReadHandle<TrigConf::HLTMenu> hltMenuHandle = SG::makeHandle( m_HLTMenuKey );
......@@ -37,9 +36,9 @@ StatusCode RoIsUnpackingToolBase::decodeMapping( std::function< bool(const std::
if ( filter(th) ) {
const HLT::Identifier thresholIdentifier(th);
m_thresholdToChainMapping[ thresholIdentifier ].push_back( chainIdentifier );
ATH_MSG_DEBUG( "Associating " << chainIdentifier << " with threshold " << th );
ATH_MSG_DEBUG( "Associating " << chainIdentifier << " with threshold " << th );
if ( thresholds.size() > 1 ) {
HLT::Identifier legIdentifier = TrigCompositeUtils::createLegName( chainIdentifier, counter );
HLT::Identifier legIdentifier = TrigCompositeUtils::createLegName(chainIdentifier, counter);
m_thresholdToChainMapping[ thresholIdentifier ].push_back( legIdentifier );
m_legToChainMapping.insert( std::make_pair( legIdentifier, chainIdentifier ) );
ATH_MSG_INFO( "Associating additional chain leg " << legIdentifier << " with threshold " << thresholIdentifier );
......
......@@ -100,7 +100,7 @@ acc.foreach_component("*/L1Decoder").OutputLevel = DEBUG
acc.foreach_component("*/L1Decoder/*Tool").OutputLevel = DEBUG # tools
acc.foreach_component("*HLTTop/*Hypo*").OutputLevel = DEBUG # hypo algs
acc.foreach_component("*HLTTop/*Hypo*/*Tool*").OutputLevel = INFO # hypo tools
acc.foreach_component("*HLTTop/RoRSeqFilter/*").OutputLevel = DEBUG# filters
acc.foreach_component("*HLTTop/RoRSeqFilter/*").OutputLevel = INFO# filters
acc.foreach_component("*HLTTop/*Input*").OutputLevel = DEBUG # input makers
acc.foreach_component("*HLTTop/*HLTEDMCreator*").OutputLevel = WARNING # messaging from the EDM creators
acc.foreach_component("*HLTTop/*GenericMonitoringTool*").OutputLevel = WARNING # silcence mon tools (addressing by type)
......
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaCommon.CFElements import seqAND
from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig import generateDecisionTreeOld
from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig_newJO import generateDecisionTree
from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import TriggerConfigHLT
from TriggerMenuMT.HLTMenuConfig.Menu.ChainMerging import mergeChainDefs
......@@ -82,7 +81,7 @@ def generateMenu( flags ):
chainDicts = splitInterSignatureChainDict(mainChainDict)
listOfChainConfigs = []
print("aaa", chainDicts)
for chainDict in chainDicts:
signature = chainDict['signature'].lower()
......
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
from PyUtils.Decorators import memoize
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
from functools import lru_cache
from AthenaCommon.CFElements import findAllAlgorithms, parOR, seqAND
from AthenaCommon.Logging import logging
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
......@@ -22,22 +22,13 @@ def printStepsMatrix(matrix):
print('---- {}: {}'.format(chainName, namesInCell)) # noqa: ATL901
print('-------------------------') # noqa: ATL901
# def memoize(f):
# """ caches call of the helper functions, (copied from the internet) remove when we move to python 3.2 or newer and rplace by functools.lru_cache"""
# memo = {}
# def helper(*x):
# tupledx = tuple(x)
# if tupledx not in memo:
# memo[tupledx] = f(*x)
# return memo[tupledx]
# return helper
def generateDecisionTree(chains):
acc = ComponentAccumulator()
mainSequenceName = 'HLTAllSteps'
acc.addSequence( seqAND(mainSequenceName) )
@memoize
@lru_cache(None)
def getFiltersStepSeq( stepNumber ):
"""
Returns sequence containing all filters for a step
......@@ -49,7 +40,7 @@ def generateDecisionTree(chains):
acc.addSequence( seq, parentName = mainSequenceName )
return seq
@memoize
@lru_cache(None)
def getRecosStepSeq( stepNumber ):
"""
"""
......@@ -59,7 +50,7 @@ def generateDecisionTree(chains):
acc.addSequence( seq, parentName = mainSequenceName )
return seq
@memoize
@lru_cache(None)
def getSingleMenuSeq( stepNumber, stepName ):
"""
"""
......@@ -70,7 +61,7 @@ def generateDecisionTree(chains):
acc.addSequence(seq, parentName = allRecoSeqName )
return seq
@memoize
@lru_cache(None)
def getComboSequences( stepNumber, stepName ):
"""
"""
......@@ -83,7 +74,7 @@ def generateDecisionTree(chains):
acc.addSequence( parOR(stepComboRecoName), parentName=stepComboName )
return acc.getSequence(stepComboName), acc.getSequence(stepComboRecoName)
@memoize
@lru_cache(None)
def getFilterAlg( stepNumber, stepName ):
"""
Returns, if need be created, filter for a given step
......@@ -101,7 +92,7 @@ def generateDecisionTree(chains):
log.debug('Creted filter {}'.format(filterName))
return filterAlg
@memoize
@lru_cache(None)
def findInputMaker( stepCounter, stepName ):
seq = getSingleMenuSeq( stepCounter, stepName )
algs = findAllAlgorithms( seq )
......@@ -110,7 +101,7 @@ def generateDecisionTree(chains):
return alg
raise Exception("No input maker in seq "+seq.name)
@memoize
@lru_cache(None)
def findAllInputMakers( stepCounter, stepName ):
seq = getSingleMenuSeq( stepCounter, stepName )
algs = findAllAlgorithms( seq )
......@@ -123,7 +114,7 @@ def generateDecisionTree(chains):
return result
else:
raise Exception("No input maker in seq "+seq.name)
@memoize
@lru_cache(None)
def findComboHypoAlg( stepCounter, stepName ):
seq = getSingleMenuSeq( stepCounter, stepName )
algs = findAllAlgorithms( seq )
......@@ -132,7 +123,7 @@ def generateDecisionTree(chains):
return alg
raise Exception("No combo hypo alg in seq "+seq.name)
@memoize
@lru_cache(None)
def findHypoAlg( stepCounter, stepName ):
seq = getSingleMenuSeq( stepCounter, stepName )
algs = findAllAlgorithms( seq )
......@@ -142,7 +133,7 @@ def generateDecisionTree(chains):
raise Exception("No hypo alg in seq "+seq.name)
@memoize
@lru_cache(None)
def findAllHypoAlgs( stepCounter, stepName ):
seq = getSingleMenuSeq( stepCounter, stepName )
algs = findAllAlgorithms( seq )
......@@ -183,7 +174,7 @@ def generateDecisionTree(chains):
return p.rstrip("_")
p = n
@memoize
@lru_cache(None)
def prevStepOutput( chain, stepCounter ):
"""
Returns list of decision collections that are outputs of previous step as well as the hypo alg name that outpus it
......@@ -194,7 +185,6 @@ def generateDecisionTree(chains):
else:
prevCounter = stepCounter-1
prevName = chain.steps[prevCounter-1].name # counting steps from 1, for indexing need one less
prevStep = chain.steps[prevCounter-1]
prevHypoAlg = findComboHypoAlg( prevCounter, prevName )
out = prevHypoAlg.HypoOutputDecisions
prevHypoAlgName = prevHypoAlg.name
......@@ -206,9 +196,7 @@ def generateDecisionTree(chains):
for chain in chains:
for stepCounter, step in enumerate( chain.steps, 1 ):
getFilterAlg( stepCounter, step.name )
menuSeqName = getSingleMenuSeq( stepCounter, step.name ).name
getSingleMenuSeq( stepCounter, step.name ).name
# add sequences that allows reconstructions to be run in parallel, followed (in sequence) by the combo hypo
comboSeq, comboRecoSeq = getComboSequences( stepCounter, step.name )
for sequence in step.sequences:
......@@ -320,7 +308,7 @@ def generateDecisionTree(chains):
else:
hypoAlg = findHypoAlg( stepCounter, step.name )
log.info(" HypoAlg {} Inputs {} Outputs {} Tools {}".format( hypoAlg.name, hypoAlg.HypoInputDecisions, hypoAlg.HypoOutputDecisions, [t.name for t in hypoAlg.HypoTools] ) )
#kaboom
return acc
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment