Commit 731d5edb authored by Catrin Bernius's avatar Catrin Bernius Committed by Graeme Stewart
Browse files

modified ds config and chains in LS1 (ATR-8190) (TriggerMenu-00-03-63)

parent aecd0280
Information on how to run/test changes of TriggerMenu can be found here:
https://twiki.cern.ch/twiki/bin/view/Atlas/TriggerMenuPackageInstructions
\ No newline at end of file
package TriggerMenu
author Moritz Backes <Moritz.Backes@cern.ch> Catrin Bernius <Catrin.Bernius@cern.ch>
use AtlasPolicy AtlasPolicy-*
apply_pattern declare_joboptions files="*.py"
pattern declare_python_submodule \
apply_pattern generic_declare_for_link kind=python_modules files='-s=../python/<submodule>/<subsubmodule> <files>' prefix=python/<package>/<submodule>/<subsubmodule> name=<submodule><subsubmodule> ; \
private ; \
macro_append <package>_python_init_dependencies " install_<submodule><subsubmodule>python_modules " ; \
end_private
apply_pattern declare_python_modules files="*.py"
apply_pattern declare_python_submodule files="*.py" submodule=menu
apply_pattern declare_python_submodule files="*.py" submodule=l1
apply_pattern declare_python_submodule files="*.py" submodule=l1menu
apply_pattern declare_python_submodule files="*.py" submodule=l1topo
apply_pattern declare_python_submodule files="*.py" submodule=l1topomenu
apply_pattern declare_python_submodule files="*.py" submodule=egamma
apply_pattern declare_python_submodule files="*.py" submodule=muon
apply_pattern declare_python_submodule files="*.py" submodule=jet
apply_pattern declare_python_submodule files="*.py" submodule=bjet
apply_pattern declare_python_submodule files="*.py" submodule=met
apply_pattern declare_python_submodule files="*.py" submodule=tau
apply_pattern declare_python_submodule files="*.py" submodule=minbias
apply_pattern declare_python_submodule files="*.py" submodule=bphysics
apply_pattern declare_python_submodule files="*.py" submodule=calibcosmicmon
apply_pattern declare_python_submodule files="*.py" submodule=combined
#apply_pattern declare_python_modules files="*.py ../scripts/cnvXml_express.py"
apply_pattern declare_xmls
apply_pattern declare_scripts files="-s=../scripts generate*Menu.py"
## at the moment these scripts conflict with those in the old TMP and are not useful anyway with the new TM (JS)
#apply_pattern declare_scripts \
# files="-s=../scripts dumpMenu.py createMenuXMLFiles.sh \
# generateChainDef.py \
# trigconf_dumphltchain.py trigconf_find_related.py \
# printL1CableMap.py \
# addPS.py"
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE exceptions [
<!ELEMENT exceptions (test)*>
<!ELEMENT test (ex)*>
<!ATTLIST test name (ThrSeqMismatch|PhysChainsCounterRange|SeedingEF) #REQUIRED>
<!ELEMENT ex EMPTY>
<!ATTLIST ex
name CDATA #REQUIRED
>
]>
<exceptions>
<test name="ThrSeqMismatch">
<ex name="L2_tau27Ti_loose2_tau18Ti_loose2_deta.*->HA15I"/>
<ex name="L2_tau27T_loose2_tau18T_loose2_vbf.*->HA11I"/>
<ex name="L2_j30_c4ccem_L1TAU_LOF_HV_.*->HA40"/>
<ex name="L2_b30_.*_j30.*_vbf_2L1FJ15->J15"/>
<ex name="L2_j30_c4ccem_2L1MU.*->J15"/>
<ex name="L2_e24vh_loose0_.*_a4TTem->J15"/>
<ex name="L2_mu.*_tight_e.*_medium.*->EM3"/>
<ex name="L2_mu.*_tight_g.*->EM3"/>
<ex name="L2_e24vh_medium1_e7.*->EM3"/>
<ex name="L2_2mu10_MSonly_g10_loose_.*->EM6"/>
<ex name="L2_2g15vh_medium_g10_medium->EM6"/>
<ex name="L2_j25_c4ccem_Trackless_HV_.*->MU10"/>
<ex name="L2_3mu6_MSonly_EMPTY->MU6"/>
<ex name="L2_e24vhi_loose1_mu8->MU6"/>
<ex name="L2_mu8_4j15_a4TTem->MU6"/>
<ex name="L2_mu4T_j60_c4cchad->J20"/>
<ex name="L2_j10000_.*_L1RD0->J10"/>
<ex name="L2_g40_loose_g.*_loose->EM30"/>
<ex name="L2_.*_noMu.*->MU4"/>
<ex name="L2_.*_xe.*->MU4"/>
<ex name="L2_.*_EFxe.*->MU4"/>
<ex name="L2_xs.*->MU4"/>
<ex name="L2_xe.*->MU4"/>
<ex name="L2_.*_L2xe.*->MU4"/>
<ex name="L2_e.*_xs.*->MU4"/>
<ex name="L2_mu4T_j.*->MU4"/>
<ex name="L2_*->MU4"/>
<ex name="L2_te\d*->MU4"/>
<ex name="L2_2MUL1_l2j30_HV.*->J15"/>
<ex name="L2_j30_L1TAU_HVtrk.*->J15"/>
<ex name="L2_j30_Trackless_HV.*->MU6"/>
<ex name="L2_2mu10_empty->MU10"/>
<ex name="L2_2mu10_MSonly.*->MU10"/>
<ex name="L2_2mu13_Zmumu_IDTrkNoCut->MU10"/>
<ex name="L2_2mu4T_2e5_medium->EM3"/>
<ex name="L2_2mu4T_DiMu_e5_medium->EM3"/>
<ex name="L2_b10_medium_j70_2j50_4j25->J30|J50"/>
<ex name="L2_e12Tvh_medium1_mu10->MU10"/>
<ex name="L2_e20_tight_e15_NoCut_Zee->EM10VH"/>
<ex name="L2_e25_loose2_xe20_noL2->MU4"/>
<ex name="L2_e22vh_loose_3L1J10"/>
<ex name="L2_e22vh_loose_4L1J10"/>
<ex name="L2_g40_tight_b10_medium->J10"/>
<ex name="L2_j30_Trackless_HV_L1MU10->J15"/>
<ex name="L2_mu4_L1J20_matched->J20"/>
<ex name="L2_2mu4T_2e5_medium"/>
<ex name="L2_2mu4T_DiMu_e5_medium"/>
<ex name="L2_mu4T_g20Tvh_loose_TauMass"/>
<ex name="L2_mu20_tight_g5_loose_TauMass"/>
<ex name="L2_mu4T_g20Tvh_loose"/>
<ex name="L2_mu20_tight_g5_loose"/>
<ex name="L2_mu18_g20h_loose->EM12|MU10"/>
<ex name="L2_mu18_g.*->MU10"/>
<ex name="L2_mu18_2g.*->MU10"/>
<ex name="L2_mu24_g.*->MU10"/>
<ex name="L2_e22vh_medium1_e5_medium"/>
<ex name="L2_2b15_medium_4j40_4L1J15"/>
<ex name="L2_b15_medium_4j40_4L1J15"/>
<ex name="L2_b15_medium_j70_j35_xe35_noMu"/>
<ex name="L2_e24vh_tight1_e15_NoCut_Zee"/>
</test>
<test name="SeedingL2">
<ex name="L1_CALREQ."/>
</test>
<test name="SeedingEF">
<ex name="L2_.*_IDCalib"/>
<ex name="L2_.*_larcalib"/>
<ex name="L2_vtxbeamspot_.*"/>
<ex name="L2_VdM_.*"/>
<ex name="L2_TRTMon_.*"/>
<ex name="L2_mu.*_l2cal.*"/>
<ex name="L2_.*_Monitoring"/>
<ex name="L2_(Pixel|SCT)Noise"/>
<ex name="L2_PixelBeam"/>
<ex name="L2_ALFA_Calib"/>
<ex name="L2_cost_monitor"/>
</test>
<test name="PhysChainsCounterRange" menu="MC_.*">
<ex name=".*"/>
</test>
<test name="PhysChainsCounterRange" menu=".*_HI_.*">
<ex name="(L2|EF)_L1ItemStreamer_L1_.*"/>
<ex name="(L2|EF)_SeededStreamer.*"/>
<ex name="(L2|EF)_mbRd._eff.*"/>
</test>
<test name="PhysChainsCounterRange">
<!-- MinBias -->
<ex name="(L2|EF)_InDetMon_FS"/>
<ex name="L2.*_Monitoring"/>
<!-- L1 NoAlg -->
<ex name="(L2|EF)_L1Calo_NoAlg"/>
<ex name="(L2|EF)_L1Muon_NoAlg"/>
<ex name="(L2|EF)_L1MinBias_NoAlg"/>
<!-- Other -->
<ex name="(L2|EF)_e11T_medium"/>
<ex name="(L2|EF)_e6T_medium"/>
<ex name="(L2|EF)_2mu13_Zmumu_IDTrkNoCut"/>
<ex name="(L2|EF)_SeededStreamerL1CaloXS"/>
<ex name="(L2|EF)_L1MU10_firstempty_NoAlg"/>
<ex name="(L2|EF)_mu10_muCombTag_NoEF"/>
<ex name="(L2|EF)_mu13_muCombTag_NoEF"/>
<ex name="(L2|EF)_mu20_muCombTag_NoEF"/>
<ex name="(L2|EF)_Background"/>
<ex name="(L2|EF)_TileMon"/>
<ex name="(L2|EF)_Standby"/>
<ex name="(L2|EF)_ALFA_Phys"/>
<ex name="(L2|EF)_ALFA_Phys_Any"/>
<ex name="(L2|EF)_PreS_L1J10_firstempty"/>
<ex name="(L2|EF)_PreS_L1J30_firstempty"/>
<ex name="L2_TRTMon_.*"/>
<ex name="L2_j25_l2cleanph"/>
<ex name="L2_j95_l2cleanph"/>
<ex name="L2_fj25_l2cleanph"/>
<ex name="L2_j70_xe35_noMu_l2cleancons"/>
<ex name="L2_j50_xe35_medium_noMu_l2cleancons"/>
<ex name="EF_fj30_a4tc_EFFS_l2cleanph"/>
<ex name="EF_j240_a4tc_EFFS_l2cleanph"/>
<ex name="EF_j75_a4tc_EFFS_xe55_noMu_l2cleancons"/>
<ex name="EF_j30_a4tc_EFFS_l2cleanph"/>
<ex name="EF_j55_a4tc_EFFS_xe55_medium_noMu_dphi2j30xe10_l2cleancons"/>
<ex name="(L2|EF)_mu10_muCombTag_NoEF_(tight|tight1)"/>
<ex name="(L2|EF)_mu15_muCombTag_NoEF_(tight|tight1)"/>
<ex name="(L2|EF)_mu20_muCombTag_NoEF_(tight|tight1)"/>
<ex name="L2_mu6T_2b50_medium_2j50_a4tchad_L1J20_matched"/>
<ex name="EF_mu6T_2b55_medium_2j55_a4tchad_L1J20_matched"/>
<ex name="(L2|EF)_2mu4T_Bmumux_test"/>
<ex name="(L2|EF)_2mu6_Bmumux_test"/>
<ex name="(L2|EF)_mu4Tmu6_Bmumux_test"/>
<ex name="(L2|EF)_mu4T_j(110|145|180|220)_a4tchad_(|L2FS_)matched_jetcalibdelayed"/>
<ex name="L2_xe_NoCut_allL1"/>
<ex name="EF_xe_NoCut_tclcw_allL1"/>
<ex name="EF_g(20|40|60)_loose_jetcalibdelayed"/>
<ex name="EF_j(15|25|35|55|80|110)_a4tchad_jetcalibdelayed"/>
<ex name="EF_xe_NoCut_FEB_allL1"/>
<ex name="EF_j(55|360)_a4tchad_testCleaning"/>
<ex name="EF_fj45_a4tchad_L2FS_testCleaning"/>
<ex name="EF_j45_a4tchad_L2FS_L1J15_testCleaning"/>
<ex name="EF_mu4T_j(15|80)_a4tchad_matched_jetcalibdelayed"/>
<ex name="EF_mu4T_j80_a4tchad_L2FS_matched_jetcalibdelayed"/>
<ex name="EF_mu4T_j15_a4tchad_matchedZ_jetcalibdelayed"/>
<ex name="EF_2mu4T_Bmumux_v2"/>
<ex name="EF_2mu6_Bmumux_v2"/>
<ex name="EF_mu4Tmu6_Bmumux_v2"/>
<ex name="EF_2mu4T_DiMu_muFast"/>
<ex name="EF_mu4T_muFast"/>
<ex name="EF_2mu13_muFast"/>
<ex name="EF_mu24i_tight_muFast"/>
<ex name="EF_mu6i"/>
<ex name="L2_j(50|165)_c4cchad_testCleaning"/>
<ex name="L2_2mu4T_Bmumux_v2"/>
<ex name="L2_2mu6_Bmumux_v2"/>
<ex name="L2_mu4Tmu6_Bmumux_v2"/>
<ex name="L2_g(40|60)_loose"/>
<ex name="L2_2mu4T_DiMu_muFast"/>
<ex name="L2_2mu13_muFast"/>
<ex name="L2_mu24_tight_muFast"/>
<ex name="L2_mu4T_muFast"/>
<ex name="L2_j15_a4TTem_j40_c4cchad_testCleaning"/>
<ex name="L2_fj10_a4TTem_fj40_c4cchad_testCleaning"/>
<ex name="L2_mu6T_2b50_medium_2j50_c4cchad_L1J20"/>
<ex name="L2_mu4T_j30_a4TTem"/>
<ex name="L2_j105_c4cchad_xe45"/>
<!-- Streams -->
<ex name="str:EnhancedBias"/>
<ex name="str:CosmicCalo"/>
<ex name="str:CosmicMuons"/>
<ex name="str:IDCosmic"/>
<ex name="str:PixelNoise"/>
<ex name="str:SCTNoise"/>
<ex name="str:LArCells"/>
<ex name="str:LArCellsEmpty"/>
<ex name="str:DISCARD"/>
<ex name="str:type:calibration"/>
</test>
<test name="BWGroupPresent" menu=".*_HI_.*">
<ex name="(L2|EF)_L1ItemStreamer_L1_.*"/>
<ex name="(L2|EF)_SeededStreamer.*"/>
<ex name="(L2|EF)_mbRd._eff.*"/>
</test>
</exceptions>
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
@mainpage
@section TrigerMenuPythonIntro Introduction
This package contains only python code which is used to dynamically
generate XML configuration of trigger which are used by HLT::TrigSteer to schedule HLT selection.
There are 3 types of files here:<br/>
1) flags - which are diffing possible in generation process switches i.e. python::EgammaSliceFlags.py<br/>
This flags contain set of common switches defined in python::CommonSliceFlags.py and set of functions
to operate on them defined in CommonSliceHelper.py<br/>
2) generation classes - which is python code specialized for generation of HLT chains and sequences definition<br/>
The helper objects for it are defined in TrigConfigSvc in python::TriggerPythonConfig.py module.
There are 2 types of generation: simple chains i.e. python::Electron.py and chains composition i.e.
python::MultiElectron.py<br/>
3) generic script for generation - python::GenerateManu.py which drives all the generation. <br/>
It is used by Trigger Getter modules defined in TriggerJobOpts package.
@htmlinclude used_packages.html
@include requirements
*/
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
from sys import settrace
from l1topo.TopoAlgos import TopoAlgo
from l1topo.L1TopoMenu import L1TopoMenu
from l1topo.L1TopoFlags import L1TopoFlags
from AthenaCommon.Logging import logging
log = logging.getLogger("TriggerConfigL1Topo")
class TriggerConfigL1Topo:
current = None
def __init__(self, outputFile = None , inputFile = None , menuName = None ):
current = self
from TriggerJobOpts.TriggerFlags import TriggerFlags
if menuName:
TriggerFlags.triggerMenuSetup = menuName
self.menuName = TriggerFlags.triggerMenuSetup()
self.inputFile = inputFile
self.outputFile = outputFile
# all registered algos
self.registeredAlgos = {}
# menu
self.menu = L1TopoMenu(self.menuName)
if self.inputFile != None:
"""Read menu from XML"""
print "Menu input is not implemented!!"
else:
"""Build menu from menu name"""
# defines the menu (algo only for now)
self.defineMenu(self.menuName)
# registers all items ever defined
self.registerMenu()
def registerAlgo(self, algo):
""" Add a L1Topo algo to the set of algos which are registered for further use"""
name = algo.name
if name in self.registeredAlgos:
raise RuntimeError('L1Topo algo %s is already registered' % name)
self.registeredAlgos[name] = algo
log.debug("Added %s in the algo list: " % name)
return algo
def getRegisteredAlgo(self, name):
if name in self.registeredAlgos:
return self.registeredAlgos[name]
return None
def findRegisteredSortingAlgoByOutput(self, requiredOutput):
"""returns a list of all sorting algorithms that are needed to
produce the required output. Even one missing will raise a runtime exception"""
sortingAlgs = []
missingOutput = []
for output in requiredOutput:
foundOutput = False
for name, alg in self.registeredAlgos.items():
if output in alg.outputs:
sortingAlgs += [alg]
foundOutput = True
break
if not foundOutput:
missingOutput += [output]
if missingOutput:
raise RuntimeError("Not for all required sorted lists a sorting algorithm could be found: missing lists are %r" % missingOutput)
return sortingAlgs
def writeXML(self):
""" Writes L1Topo XML file"""
if self.outputFile is None:
log.warning("Can't write xml file since no name was provided")
return
FH = open( self.outputFile, mode="wt" )
FH.write( self.menu.xml() )
FH.close()
log.info("Wrote %s " % self.outputFile)
@staticmethod
def defineMenu(menuName = None ):
"""
Defines the list if algo names that will be in the menu
Calls defineMenu() of the correct module 'Menu_<menuname>.py'
Menu.defineMenu() defines the menu via L1TopoFlags
"""
from TriggerJobOpts.TriggerFlags import TriggerFlags
menumodule = __import__('l1topomenu.Menu_%s' % menuName, globals(), locals(), ['defineMenu'], -1)
menumodule.defineMenu()
log.info("%s menu contains %i algos." % ( menuName, len(L1TopoFlags.algos()) ))
def registerMenu(self):
"""
Calls registerTopoAlgos() of the correct module 'TopoalgoDef.py'
Has to run AFTER defineMenu
"""
algodefmodule = __import__('l1topomenu.TopoAlgoDef', globals(), locals(), ['TopoAlgoDef'], -1)
algodefmodule.TopoAlgoDef.registerTopoAlgos(self)
log.info("Registered %i algos." % ( len(self.registeredAlgos) ) )
def generateMenu(self):
"""
Generates the menu structure from the list of algo names in the L1TopoFlags
Always to be called after defineMenu()
"""
from AthenaCommon.Logging import logging
log = logging.getLogger('L1Topo.generateMenu')
# add the algos to the menu
undefined_alg = False
for topooutput in L1TopoFlags.algos():
topooutput.algo = self.getRegisteredAlgo(topooutput.algoname)
if topooutput.algo is None:
raise RuntimeError("L1Topo algo of name '%s' is not defined in L1Topo algo definition file TopoAlgoDef.py." % topooutput.algoname )
topooutput.sortingAlgos = self.findRegisteredSortingAlgoByOutput(topooutput.algo.inputs)
self.menu += topooutput
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
from sys import settrace
from .TriggerConfigL1Topo import TriggerConfigL1Topo
from l1.Lvl1Menu import Lvl1Menu
from l1.Lvl1Flags import Lvl1Flags
from AthenaCommon.Logging import logging
log = logging.getLogger("TriggerConfigLVL1")
class TriggerConfigLVL1:
current = None
def __init__(self, outputFile = None , inputFile = None , menuName = None , topoMenu = "MATCH" ):
"""
topoMenu: MATCH means that the L1Topo menu matches the L1 menu
"""
TriggerConfigLVL1.current = self
from TriggerJobOpts.TriggerFlags import TriggerFlags
if menuName:
TriggerFlags.triggerMenuSetup = menuName
self.menuName = TriggerFlags.triggerMenuSetup()
self.inputFile = inputFile
self.outputFile = outputFile
self.l1menuFromXML = None # flag if l1menu is read from XML file
self.menuName = menuName
# all registered items
self.registeredItems = {}
# all registered thresholds
self.registeredThresholds = {}
# get L1Topo trigger line connections
if topoMenu=="MATCH": topoMenu = self.menuName # topo menu name should match CTP menu for correct connection
self.topotriggers = self.getL1TopoTriggerLines(topoMenu)
self.registerAllTopoTriggersAsThresholds()
# menu
self.menu = Lvl1Menu(self.menuName)
if self.inputFile != None:
"""Read menu from XML"""
self.l1menuFromXML = True
self.menu.readMenuFromXML(self.inputFile)
else:
"""Build menu from menu name"""
# defines the menu (item and threshold names)
TriggerConfigLVL1.defineMenu(self.menuName)
# registers all items ever defined
self.registerMenu()
## L1 Topo connection
def getL1TopoTriggerLines(self, menu):
if menu == None:
return None
if menu.endswith(".xml"):
raise RuntimeError("Can't read the topo trigger lines from xml yet")
else:
triggerLines = None
try:
tpcl1 = TriggerConfigL1Topo( menuName = menu )
tpcl1.generateMenu()
triggerLines = tpcl1.menu.getTriggerLines()
except Exception, ex:
print "Topo menu generation inside L1 menu failed, but will be ignored for the time being",ex
# restore the triggerMenuSetup for the LVL1 generation
from TriggerJobOpts.TriggerFlags import TriggerFlags
TriggerFlags.triggerMenuSetup = self.menuName
return triggerLines
## Thresholds
def registerThr(self, name, type, mapping=-1, active=1,
seed='', seed_ttype='', seed_multi=0, bcdelay=0 ):
"""
Add LVL1 thresholds with the given type and mapping and store
it in the list of available thresholds.
The cable input information will be calculated from type and
mapping.
Seed, seed_ttype, seed_multi and bcdelay are for the zero bias
trigger only.
"""
if name in self.registeredThresholds:
log.error("LVL1 threshold of name '%s' already registered, will ignore this new registration request" % name)
return self.registeredThresholds[name]
from l1.Lvl1Thresholds import LVL1Threshold
thr = LVL1Threshold( name, type,
mapping = mapping, active = active,
seed_type = seed_ttype, seed = seed, seed_multi = seed_multi, bcdelay = bcdelay
)
thr.setCableInput()
self.registeredThresholds[name] = thr
return thr
def registerAllTopoTriggersAsThresholds(self):
"""
Add all L1Topo triggers as allowed input to the menu
"""
if not self.topotriggers:
return
from l1.Lvl1Thresholds import LVL1Threshold
for topotrigger in self.topotriggers:
thr = LVL1Threshold( topotrigger.trigger, 'TOPO', mapping = topotrigger.ordinal)
thr.setCableInput()
self.registeredThresholds[topotrigger.trigger] = thr
def getRegisteredThreshold(self, name):
if name in self.registeredThresholds:
return self.registeredThresholds[name]
return None
## Items
def registerItem(self, name, item):
""" Adds a LVL1 item to the set of items which are registered for further use"""
if name in self.registeredItems:
log.error('LVL1 item %s is already registered with ctpid=%d' % \
(name, int(self.registeredItems[name].ctpid)))
else:
self.registeredItems[name] = item
def getRegisteredItem(self, name):
if name in self.registeredItems:
return self.registeredItems[name]
return None
def CTPInfo(self):
return self.menu.CTPInfo
def Lvl1CaloInfo(self):
return self.menu.CaloInfo
def writeXML(self):
""" Writes L1 XML file"""
log = logging.getLogger("TriggerConfigLVL1")
if self.outputFile is None:
log.warning("Can't write xml file since no name was provided")
return
from l1.Lvl1MenuUtil import idgen
idgen.reset()
FH = open( self.outputFile, mode="wt" )
FH.write( self.menu.xml() )
FH.close()
from l1.Lvl1MenuUtil import oldStyle
log.info("Wrote %s in %s" % (self.outputFile, "run 1 style" if oldStyle() else "run 2 style"))