Skip to content
Snippets Groups Projects
Commit 21d99f06 authored by Catrin Bernius's avatar Catrin Bernius Committed by Edward Moyse
Browse files

Change of extracting needed signatures to import relevant files to make use of ChainDict

parent f4bcff84
No related branches found
No related tags found
5 merge requests!69091Fix correlated smearing bug in JER in JetUncertainties in 22.0,!58791DataQualityConfigurations: Modify L1Calo config for web display,!51674Fixing hotSpotInHIST for Run3 HIST,!50012RecExConfig: Adjust log message levels from GetRunNumber and GetLBNumber,!49559Change of extracting needed signatures to import relevant files to make use of ChainDict
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
from .ChainDefInMenu import ChainProp
from .SignatureDicts import ChainStore
......
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
#------------------------------------------------------------------------#
# Dev_pp_run3_v1.py menu for the long shutdown development
......
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
from TriggerMenuMT.HLT.Menu.ChainDefInMenu import ChainProp
def setupMenu():
......
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
"""
Class to obtain the chain configuration dictionary from the short or long name
......@@ -429,7 +429,7 @@ def analyseChainName(chainName, L1thresholds, L1item):
if overlaps:
#log.error("[analyseChainName] The following string(s) is/are already defined as defaults, please remove: %s", overlaps)
#raise RuntimeError("[analyseChainname] Default config appearing in chain name, please remove: %s", overlaps)
log.warning("[analyseChainName] The following string(s) is/are already defined as defaults, please remove: %s", overlaps)
log.warning("[analyseChainName] The following chainpart %s contains the string(s) %s which is/are already defined as defaults, please remove!", chainparts, overlaps)
# ---- check remaining parts for complete matches in allowedPropertiesAndValues Dict ----
# ---- unmatched = list of tokens that are not found in the allowed values as a whole ----
......@@ -586,6 +586,13 @@ def dictFromChainName(chainInfo):
log.debug('ChainProperties: %s', chainDict)
for chainPart in chainDict['chainParts']:
# fill the sigFolder and subSigs folder
for sf in chainPart['sigFolder']:
chainDict['sigDicts'].update({sf:chainPart['subSigs']})
if sf == 'Bjet':
chainDict['sigDicts'].update({'Jet':['Jet']})
thisSignature = chainPart['signature']
thisAlignGroup = chainPart['alignmentGroup']
thisExtra = chainPart['extra']
......
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
import importlib
import string
......@@ -70,6 +70,8 @@ class GenerateMenuMT(object, metaclass=Singleton):
self.availableSignatures = []
self.signaturesToGenerate = []
self.sigDicts = {}
self.chainDefModule = {} # Generate[SIG]ChainDefs module for each SIGnature
def setChainFilter(self, f):
......@@ -93,7 +95,7 @@ class GenerateMenuMT(object, metaclass=Singleton):
"""Check if chain is assigned to the correct signature"""
reqd = GenerateMenuMT.getRequiredSignatures(currentSig)
isValid = chainSig.issubset( reqd )
log.info("Chain signatures: %s, required signatures: %s",chainSig,reqd)
log.debug("Chain signatures: %s, required signatures: %s",chainSig,reqd)
if not isValid:
log.error("Chain signatures %s not a subset of required signatures %s",set(chainSig),reqd)
return isValid
......@@ -102,12 +104,21 @@ class GenerateMenuMT(object, metaclass=Singleton):
invalid = False
for sig, chains in self.chainsInMenu.items():
for chain in chains:
log.debug("Now processing chain: %s ", chain)
log.debug("Now processing chain: %s from signature %s", chain, sig)
chainCounter += 1
chainDict = dictFromChainName(chain)
chainDict['chainCounter'] = chainCounter
chainDict['prescale'] = 1 # set default chain prescale
# Pick out the folder and subsignature directories to import
for sigfo, subsig in chainDict['sigDicts'].items():
if sigfo not in self.sigDicts:
self.sigDicts[sigfo] = subsig
else:
for ss in subsig:
if ss not in self.sigDicts[sigfo]:
self.sigDicts[sigfo].append(ss)
self.chainDicts.append(chainDict)
if not validSignature(sig, set(chainDict['signatures'])):
......@@ -120,49 +131,10 @@ class GenerateMenuMT(object, metaclass=Singleton):
def importSignaturesToGenerate(self):
"""check if all the signature files can be imported and then import them"""
# List of all non-empty signatures
self.signaturesToGenerate = [s for s,chains in self.chainsInMenu.items()
if len(chains)>0]
log.info("Enabled signature(s): %s", self.signaturesToGenerate)
# Extend the list to satisfy certain requirements
extendedSignatureToGenerate = set(self.signaturesToGenerate + GenerateMenuMT.defaultSigs)
# Combined chains themselves are created by merging
# If we activate combined chains, we need all of the (legal) sub-signatures
if "Combined" in extendedSignatureToGenerate:
log.info("Combined chains requested -- activate other necessary signatures")
extendedSignatureToGenerate.remove("Combined")
extendedSignatureToGenerate.update(GenerateMenuMT.combinedSigs)
# Electron and Photon chains both have Egamma as the top-level folder
# but have separate chain configuration modules
if "Egamma" in extendedSignatureToGenerate:
log.info("Egamma chains requested -- activate other necessary signatures")
extendedSignatureToGenerate.remove("Egamma")
extendedSignatureToGenerate.update(["Electron","Photon"])
for sig in extendedSignatureToGenerate:
log.debug("[getSignaturesInMenu] sig: %s", sig)
if sig not in self.availableSignatures:
self.availableSignatures.append(sig)
for sig, subSigs in self.sigDicts.items():
try:
if sig in ['Electron', 'Photon']:
sigFolder = 'Egamma'
subSigs = [sig]
elif sig in GenerateMenuMT.calibCosmicMonSigs:
sigFolder = 'CalibCosmicMon'
#only import the CalibCosmicMon signatures that we need, not all of them!
subSigs = [sig]
else:
sigFolder = sig
subSigs = [sig]
for ss in subSigs:
# import the relevant signature module
import_module = 'TriggerMenuMT.HLT.' + sigFolder +'.Generate' + ss + 'ChainDefs'
import_module = 'TriggerMenuMT.HLT.' + sig +'.Generate' + ss + 'ChainDefs'
self.chainDefModule[ss] = importlib.import_module(import_module)
if ss not in self.availableSignatures:
......@@ -174,6 +146,7 @@ class GenerateMenuMT(object, metaclass=Singleton):
traceback.print_exc()
log.debug('Available signature(s) for chain generation: %s', self.availableSignatures)
return
def generateChains(self):
......
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
from AthenaCommon.Logging import logging
log = logging.getLogger( __name__ )
log.info("Importing %s",__name__)
......@@ -63,7 +63,8 @@ ChainDictTemplate = {
'EBstep' : '',
'chainParts' : [],
'topoStartFrom' : False,
'sigFolder' : '',
'sigDicts' : {},
'sigFolder' : [],
'subSigs' : [],
'extraComboHypos' : []
}
......@@ -82,7 +83,7 @@ TestChainParts = {
'trigType' : ['TestChain'],
'threshold' : '',
'addInfo' : [''],
'sigFolder' : 'Test',
'sigFolder' : ['Test'],
'subSigs' : ['Test'],
'chainPartIndex': list(range(0,10))
}
......@@ -96,7 +97,7 @@ TestChainParts_Default = {
'trigType' : '',
'threshold' : '',
'addInfo' : [],
'sigFolder' : 'Test',
'sigFolder' : ['Test'],
'subSigs' : ['Test'],
'chainPartIndex': 0
}
......@@ -118,7 +119,7 @@ JetChainParts = {
'topo' : AllowedTopos_jet,
'extra' : [],
'addInfo' : ['perf'],
'sigFolder' : 'Jet',
'sigFolder' : ['Jet'],
'subSigs' : ['Jet'],
'chainPartIndex': list(range(0,10)),
# Information unique to the jet slice
......@@ -289,7 +290,7 @@ JetChainParts_Default = {
'topo' : [],
'extra' : '',
'addInfo' : [],
'sigFolder' : 'Jet',
'sigFolder' : ['Jet'],
'subSigs' : ['Jet'],
'chainPartIndex': 0,
#
......@@ -322,6 +323,9 @@ JetChainParts_Default = {
# ---- bJet Dictionary of default Values that are different to the ones for normal jet chains ----
bJetChainParts_Default = {
'etaRange' : '0eta290',
'sigFolder' : ['Bjet'],
'subSigs' : ['Bjet'],
}
#==========================================================
......@@ -353,7 +357,7 @@ MuonChainParts = {
'addInfo' : ['idperf','LRT','3layersEC','cosmic',"muonqual","nscan"],
'topo' : AllowedTopos_mu,
'flavour' : [],
'sigFolder' : 'Muon',
'sigFolder' : ['Muon'],
'subSigs' : ['Muon'],
'chainPartIndex': list(range(0,10))
}
......@@ -377,7 +381,7 @@ MuonChainParts_Default = {
'msonlyInfo' : [],
'topo' : [],
'flavour' : '',
'sigFolder' : 'Muon',
'sigFolder' : ['Muon'],
'subSigs' : ['Muon'],
'chainPartIndex': 0
}
......@@ -404,14 +408,14 @@ AllAllowedTopos_Bphysics = AllowedTopos_Bphysics_topoVariant+AllowedTopos_Bphysi
# ---- Bphysics Dictionary of all allowed Values ----
BphysicsChainParts = deepcopy(MuonChainParts)
BphysicsChainParts['signature'] = ['Bphysics']
BphysicsChainParts['subFolder'] = 'Bphysics'
BphysicsChainParts['sigFolder'] = ['Bphysics']
BphysicsChainParts['subSigs'] = ['Bphysics']
BphysicsChainParts['topo'] = AllowedTopos_Bphysics
# ---- Bphysics Dictionary of default Values ----
BphysicsChainParts_Default = deepcopy(MuonChainParts_Default)
BphysicsChainParts_Default['signature'] = ['Bphysics']
BphysicsChainParts_Default['subFolder'] = 'Bphysics'
BphysicsChainParts_Default['sigFolder'] = ['Bphysics']
BphysicsChainParts_Default['subSigs'] = ['Bphysics']
BphysicsChainParts_Default['topo'] = []
......@@ -440,7 +444,7 @@ TauChainParts = {
'calib' : '',
'addInfo' : ['IdTest'],
'topo' : AllowedTopos_tau,
'sigFolder' : 'Tau',
'sigFolder' : ['Tau'],
'subSigs' : ['Tau'],
'chainPartIndex': list(range(0,10))
}
......@@ -461,7 +465,7 @@ TauChainParts_Default = {
'calib' : '',
'addInfo' : '',
'topo' : [],
'sigFolder' : 'Tau',
'sigFolder' : ['Tau'],
'subSigs' : ['Tau'],
'chainPartIndex': 0
}
......@@ -489,7 +493,7 @@ METChainParts = {
'L2muonCorr' : [],
'EFmuonCorr' : [],
'addInfo' : ['FStracks'],
'sigFolder' : 'MET',
'sigFolder' : ['MET'],
'subSigs' : ['MET'],
'constitmod' : ['cssk', 'vssk'],
'chainPartIndex': list(range(0,10))
......@@ -511,7 +515,7 @@ METChainParts_Default = {
'addInfo' : '',
'constitType' : 'tc',
'constitmod' : '',
'sigFolder' : 'MET',
'sigFolder' : ['MET'],
'subSigs' : ['MET'],
'chainPartIndex': 0
}
......@@ -567,8 +571,8 @@ ElectronChainParts = {
'lhInfo' : ['nod0', 'nopix'],
'L2IDAlg' : ['noringer'],
'addInfo' : [ 'etcut', 'etcut1step',"fwd"],
'sigFolder' : 'Egamma',
'subSigs' : ['Electron','Photon'],
'sigFolder' : ['Egamma'],
'subSigs' : ['Electron'],
'topo' : AllowedTopos_e,
'chainPartIndex': list(range(0,10))
}
......@@ -598,8 +602,8 @@ ElectronChainParts_Default = {
'recoAlg' : '',
'FSinfo' : '',
'addInfo' : [],
'sigFolder' : 'Egamma',
'subSigs' : ['Electron','Photon'],
'sigFolder' : ['Egamma'],
'subSigs' : ['Electron'],
'topo' : [],
'chainPartIndex': 0
}
......@@ -627,8 +631,8 @@ PhotonChainParts = {
'recoAlg' : [],
'FSinfo' : [],
'addInfo' : ['etcut',],
'sigFolder' : 'Egamma',
'subSigs' : ['Electron','Photon'],
'sigFolder' : ['Egamma'],
'subSigs' : ['Photon'],
'topo' : AllowedTopos_g,
'chainPartIndex': list(range(0,10)),
}
......@@ -651,8 +655,8 @@ PhotonChainParts_Default = {
'recoAlg' : '',
'FSinfo' : '',
'addInfo' : [],
'sigFolder' : 'Egamma',
'subSigs' : ['Electron','Photon'],
'sigFolder' : ['Egamma'],
'subSigs' : ['Photon'],
'topo' : [],
'chainPartIndex': 0
}
......@@ -686,7 +690,7 @@ MinBiasChainParts = {
'hypoSumEtInfo' : ['sumet40', 'sumet50', 'sumet60', 'sumet70', 'sumet80', 'sumet90', 'sumet110', 'sumet150',],
'recoAlg' : ['mbts', 'sptrk', 'sp', 'noalg', 'perf', 'hmt', 'hmtperf', 'idperf', 'zdcperf', 'alfaperf', 'afprec', 'afptof', 'excl'],
'addInfo' : ['peb'],
'sigFolder' : 'MinBias',
'sigFolder' : ['MinBias'],
'subSigs' : ['MinBias'],
'chainPartIndex': list(range(0,10))
}
......@@ -710,7 +714,7 @@ MinBiasChainParts_Default = {
'hypoSumEtInfo': '',
'recoAlg' : [],
'addInfo' : [],
'sigFolder' : 'MinBias',
'sigFolder' : ['MinBias'],
'subSigs' : ['MinBias'],
'chainPartIndex': 0
}
......@@ -739,7 +743,7 @@ HeavyIonChainParts = {
'recoAlg' : [],
'addInfo' : [],
'gap' : [],
'sigFolder' : 'HeavyIon',
'sigFolder' : ['HeavyIon'],
'subSigs' : ['HeavyIon'],
'chainPartIndex': list(range(0,10))
}
......@@ -765,7 +769,7 @@ HeavyIonChainParts_Default = {
'recoAlg' : [],
'addInfo' : [],
'gap' : '',
'sigFolder' : 'HeavyIon',
'sigFolder' : ['HeavyIon'],
'subSigs' : ['HeavyIon'],
'chainPartIndex': 0
}
......@@ -790,7 +794,7 @@ CosmicChainParts = {
'multiplicity' : '',
'trigType' : 'cosmic',
'extra' : '',
'sigFolder' : 'CalibCosmicMon',
'sigFolder' : ['CalibCosmicMon'],
'subSigs' : ['Cosmic'],
'chainPartIndex': list(range(0,10))
}
......@@ -809,7 +813,7 @@ CosmicChainParts_Default = {
'multiplicity' : '',
'trigType' : '',
'extra' : '',
'sigFolder' : 'CalibCosmicMon',
'sigFolder' : ['CalibCosmicMon'],
'subSigs' : ['Cosmic'],
'chainPartIndex': 0
}
......@@ -836,7 +840,7 @@ StreamingChainParts = {
'extra' : '',
'streamType' : AllowedStreamingChainIdentifiers,
'algo' : ['NoAlg'],
'sigFolder' : 'CalibCosmicMon',
'sigFolder' : ['CalibCosmicMon'],
'subSigs' : ['Streaming'],
'chainPartIndex': list(range(0,10))
}
......@@ -854,7 +858,7 @@ StreamingChainParts_Default = {
'extra' : '',
'streamType' : '',
'algo' : [],
'sigFolder' : 'CalibCosmicMon',
'sigFolder' : ['CalibCosmicMon'],
'subSigs' : ['Streaming'],
'chainPartIndex': 0
}
......@@ -887,7 +891,7 @@ CalibChainParts = {
'multiplicity' : '',
'trigType' : ['trk'],
'extra' : ['bs',''],
'sigFolder' : 'CalibCosmicMon',
'sigFolder' : ['CalibCosmicMon'],
'subSigs' : ['Calib'],
'chainPartIndex': list(range(0,10))
}
......@@ -909,7 +913,7 @@ CalibChainParts_Default = {
'location' : '',
'trigType' : '',
'extra' : '',
'sigFolder' : 'CalibCosmicMon',
'sigFolder' : ['CalibCosmicMon'],
'subSigs' : ['Calib'],
'chainPartIndex': 0
}
......@@ -937,7 +941,7 @@ MonitorChainParts = {
'isLegacyL1' : ['legacy'],
'trigType' : 'mon',
'extra' : '',
'sigFolder' : 'CalibCosmicMon',
'sigFolder' : ['CalibCosmicMon'],
'subSigs' : ['Monitor'],
'chainPartIndex': list(range(0,10))
}
......@@ -955,7 +959,7 @@ MonitorChainParts_Default = {
'isLegacyL1' : [],
'trigType' : '',
'extra' : '',
'sigFolder' : 'CalibCosmicMon',
'sigFolder' : ['CalibCosmicMon'],
'subSigs' : ['Monitor'],
'chainPartIndex': 0
}
......@@ -976,7 +980,7 @@ EnhancedBiasChainParts = {
'multiplicity' : '',
'trigType' : '',
'extra' : '',
'sigFolder' : 'CalibCosmicMon',
'sigFolder' : ['CalibCosmicMon'],
'subSigs' : ['EnhancedBias'],
'chainPartIndex': list(range(0,10))
}
......@@ -992,7 +996,7 @@ EnhancedBiasChainParts_Default = {
'multiplicity' : '',
'trigType' : '',
'extra' : '',
'sigFolder' : 'CalibCosmicMon',
'sigFolder' : ['CalibCosmicMon'],
'subSigs' : ['EnhancedBias'],
'chainPartIndex': 0
}
......@@ -1015,7 +1019,7 @@ BeamspotChainParts = {
'multiplicity' : '',
'trigType' : 'beamspot',
'extra' : '',
'sigFolder' : 'CalibCosmicMon',
'sigFolder' : ['CalibCosmicMon'],
'subSigs' : ['Beamspot'],
'chainPartIndex': list(range(0,10))
}
......@@ -1035,7 +1039,7 @@ BeamspotChainParts_Default = {
'location' : 'vtx',
'trigType' : 'beamspot',
'extra' : '',
'sigFolder' : 'CalibCosmicMon',
'sigFolder' : ['CalibCosmicMon'],
'subSigs' : ['Beamspot'],
'chainPartIndex': 0
}
......@@ -1056,7 +1060,7 @@ UnconventionalTrackingChainParts = {
'isoInfo' : ['iaggrmedium','iaggrloose','imedium','iloose'],
'extra' : ["isohpttrack", "fslrt", "dedx", "hitdv", "distrk"],
'addInfo' : [],
'sigFolder' : 'UnconventionalTracking',
'sigFolder' : ['UnconventionalTracking'],
'subSigs' : ['UnconventionalTracking'],
'chainPartIndex': list(range(0,10))
}
......@@ -1073,7 +1077,7 @@ UnconventionalTrackingChainParts_Default = {
'threshold' : '',
'extra' : '',
'addInfo' : [],
'sigFolder' : 'UnconventionalTracking',
'sigFolder' : ['UnconventionalTracking'],
'subSigs' : ['UnconventionalTracking'],
'chainPartIndex': 0
}
......
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