Commit edbd445b authored by Moritz Backes's avatar Moritz Backes Committed by Graeme Stewart
Browse files

New jet trigger updates & razor input TE fixes (ATR-9481, ATR-9521) (TriggerMenu-00-06-17)

	* New jet trigger updates & razor input TE fixes (ATR-9481,
	ATR-9521)
	* Needs TrigHLTJetRec-00-00-34
	* TriggerMenu-00-06-17

2015-01-16 Mario Campanelli
	* additional changes to rate groups
	* TriggerMenu-00-06-16

2015-01-16 Mario Campanelli
	* rate group changed
	* TriggerMenu-00-06-14

2015-01-16 Lidia Dell'Asta
	* fixed mu0_perf (ATR-9564)
	* TriggerMenu-00-06-13

2015-01-16 Catrin Bernius
	* Changed input TE to mu/jet matching sequence (ATR-9668)
	* TriggerMenu-00-06-12
...
(Long ChangeLog diff - truncated)
parent 02550249
......@@ -29,6 +29,7 @@ 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=test
apply_pattern declare_python_submodule files="*.py" submodule=combined
......
......@@ -10,183 +10,24 @@
]>
<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.*"/>
<ex name="HLT_.*xe.*->MU6"/>
<ex name="HLT_e5_etcut_L110MINDPHI-AJj15s2-XE0->EM3"/>
<ex name="HLT_e5_etcut_L120MINDPHI-AJjs6-XE0->EM3"/>
<ex name="HLT_e5_etcut_L120MINDPHI-AJj15s2-XE0->EM3"/>
<ex name="HLT_e5_etcut_L105RATIO-XE0-HT0-AJj15all.ETA49->EM3"/>
<ex name="HLT_e5_etcut_L108RATIO-XE0-HT0-AJj0all.ETA49->EM3"/>
<ex name="HLT_e5_etcut_L140RATIO-XE0-HT0-AJj15all.ETA49->EM3"/>
<ex name="HLT_e5_etcut_L190RATIO-XE0-HT0-AJj0all.ETA49->EM3"/>
<ex name="HLT_e5_etcut_L1HT20-AJj0all.ETA49->EM3"/>
<ex name="HLT_e5_etcut_L1NOT-02MATCH-EM9s1-AJj15all.ETA49->EM3"/>
<ex name="HLT_e5_etcut_L1NOT-02MATCH-EM9s1-AJj15all.ETA49_05RATIO-XE0-SUM0-EM9s1-HT0-AJj15all.ETA49->EM3"/>
<ex name="HLT_e12_loose_2mu10->EM8VH"/>
<ex name="HLT_e12_medium_2mu10->EM8VH"/>
<ex name="HLT_e12_lhloose_2mu10->EM8VH"/>
<ex name="HLT_e12_lhmedium_2mu10->EM8VH"/>
<ex name="HLT_g15_loose_2mu10_msonly->EM8VH"/>
<ex name="HLT_g25_medium_mu24->EM15VH"/>
<ex name="HLT_2g10_loose_mu20->EM7"/>
<ex name="HLT_2g10_medium_mu20->EM7"/>
</test>
</exceptions>
......@@ -20,6 +20,8 @@ class TriggerConfigL1Topo:
TriggerFlags.triggerMenuSetup = menuName
self.menuName = TriggerFlags.triggerMenuSetup()
print self.menuName
self.inputFile = inputFile
self.outputFile = outputFile
......@@ -37,7 +39,7 @@ class TriggerConfigL1Topo:
# defines the menu (algo only for now)
self.defineMenu(self.menuName)
# registers all items ever defined
self.registerMenu()
......@@ -45,39 +47,43 @@ class TriggerConfigL1Topo:
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)
if algo.name in self.registeredAlgos:
raise RuntimeError('L1Topo algo %s is already registered' % algo.name)
self.registeredAlgos[name] = algo
log.debug("Added %s in the algo list: " % name)
self.registeredAlgos[algo.name] = algo
log.debug("Added %s in the algo list: " % algo.name)
return algo
def getRegisteredAlgo(self, name):
def getRegisteredAlgo(self, name):
if name in self.registeredAlgos:
return self.registeredAlgos[name]
return None
def findRegisteredSortingAlgoByOutput(self, requiredOutput):
def findRegisteredSortingAlgoByOutput(self, algo):
"""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:
for requiredInput in algo.inputs:
foundOutput = False
for name, alg in self.registeredAlgos.items():
if output in alg.outputs:
if type(alg.outputs)==list:
foundOutput = (requiredInput in alg.outputs)
else:
foundOutput = (requiredInput == alg.outputs)
if foundOutput:
sortingAlgs += [alg]
foundOutput = True
break
if not foundOutput:
missingOutput += [output]
missingOutput += [(algo.name, requiredInput)]
if missingOutput:
raise RuntimeError("Not for all required sorted lists a sorting algorithm could be found: missing lists are %r" % missingOutput)
raise RuntimeError("For some algorithms not all inputs could be found. Missing are: %r" % ["%s <- %s" % (algname, inputname) for (algname, inputname) in missingOutput] )
return sortingAlgs
def writeXML(self):
""" Writes L1Topo XML file"""
if self.outputFile is None:
......@@ -88,6 +94,7 @@ class TriggerConfigL1Topo:
FH.close()
log.info("Wrote %s " % self.outputFile)
@staticmethod
def defineMenu(menuName = None ):
"""
......@@ -97,11 +104,17 @@ class TriggerConfigL1Topo:
Menu.defineMenu() defines the menu via L1TopoFlags
"""
#from TriggerConfigLVL1 import TriggerConfigLVL1
#tcl1 = TriggerConfigLVL1()
#menuName = tcl1.getMenuBaseName(menuName)
from TriggerJobOpts.TriggerFlags import TriggerFlags
menumodule = __import__('l1topomenu.Menu_%s' % menuName, globals(), locals(), ['defineMenu'], -1)
menumodule = __import__('l1topomenu.Menu_%s' % menuName.replace('_tight_mc_prescale','').replace('_loose_mc_prescale','').replace('_special_mc_prescale','').replace('_no_prescale',''), globals(), locals(), ['defineMenu'], -1)
#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'
......@@ -109,7 +122,6 @@ class TriggerConfigL1Topo:
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) ) )
......@@ -131,6 +143,14 @@ class TriggerConfigL1Topo:
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)
topooutput.sortingAlgos = self.findRegisteredSortingAlgoByOutput(topooutput.algo)
#print "For decision alg %s with inputs %r found the following sorting algs %r" % (topooutput.algo.name, topooutput.algo.inputs, [x.name for x in topooutput.sortingAlgos])
self.menu += topooutput
if not self.menu.check():
raise RuntimeError("Menu check failed")
......@@ -42,7 +42,6 @@ class TriggerConfigLVL1:
# menu
self.menu = Lvl1Menu(self.menuName)
if self.inputFile != None:
"""Read menu from XML"""
......@@ -58,6 +57,19 @@ class TriggerConfigLVL1:
# registers all items ever defined
self.registerMenu()
# remove prescale suffixes
def getMenuBaseName(self, menuName):
#import re
#pattern = re.compile('_v\d+|DC14')
#patternPos = pattern.search(menuName)
#if m:
# menuName=menuName[:patternPos.end()]
#else:
# log.info('Can\'t find pattern to shorten menu name, either non-existent in name or not implemented.')
#return menuName
return menuName.replace("_tight_mc_prescale","").replace("_loose_mc_prescale","").replace("_special_mc_prescale","").replace("_no_prescale","")
## L1 Topo connection
def getL1TopoTriggerLines(self, menu):
......@@ -70,9 +82,11 @@ class TriggerConfigLVL1:
else:
triggerLines = None
try:
tpcl1 = TriggerConfigL1Topo( menuName = menu )
tpcl1 = TriggerConfigL1Topo( menuName = self.getMenuBaseName(menu) )
tpcl1.generateMenu()
triggerLines = tpcl1.menu.getTriggerLines()
#for tr in triggerLines:
# print " ",tr
except Exception, ex:
print "Topo menu generation inside L1 menu failed, but will be ignored for the time being",ex
......@@ -105,8 +119,7 @@ class TriggerConfigLVL1:
mapping = mapping, active = active,
seed_type = seed_ttype, seed = seed, seed_multi = seed_multi, bcdelay = bcdelay
)
thr.setCableInput()
self.registeredThresholds[name] = thr
return thr
......@@ -117,13 +130,12 @@ class TriggerConfigLVL1:
"""
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
from l1.Lvl1Thresholds import LVL1Threshold, LVL1TopoInput
for triggerline in self.topotriggers:
thr = LVL1TopoInput( triggerline )
thr.setCableInput()
self.registeredThresholds[thr.name] = thr
def getRegisteredThreshold(self, name):
if name in self.registeredThresholds:
return self.registeredThresholds[name]
......@@ -182,11 +194,13 @@ class TriggerConfigLVL1:
Menu.defineMenu() defines the menu via Lvl1Flags
"""
from TriggerJobOpts.TriggerFlags import TriggerFlags
if not menuName:
menuName = TriggerFlags.triggerMenuSetup()
from TriggerJobOpts.TriggerFlags import TriggerFlags
menumodule = __import__('l1menu.Menu_%s' % menuName.replace("_tight_mc_prescale","").replace("_loose_mc_prescale",""), globals(), locals(), ['defineMenu'], -1)
#menuName=self.getMenuBaseName(menuName)
#menumodule = __import__('l1menu.Menu_%s' % menuName, globals(), locals(), ['defineMenu'], -1)
menumodule = __import__('l1menu.Menu_%s' % menuName.replace("_tight_mc_prescale","").replace("_loose_mc_prescale","").replace("_special_mc_prescale","").replace("_no_prescale",""), globals(), locals(), ['defineMenu'], -1)
menumodule.defineMenu()
log = logging.getLogger('TriggerConfigLVL1.defineMenu')
log.info("menu %s contains %i items and %i thresholds" % ( menuName, len(Lvl1Flags.items()), len(Lvl1Flags.thresholds()) ) )
......@@ -252,17 +266,16 @@ class TriggerConfigLVL1:
available_ctpids = sorted( list( set(range(Limits.MaxTrigItems)) - set(assigned_ctpids) ) )
available_ctpids.reverse()
# add the items to the menu
from TriggerMenu.l1.TriggerTypeDef import TT
for item in itemsForMenu:
# set the physics bit
if not item.name.startswith('L1_CALREQ') and not item.name=='L1_MU0_LOW':
if not item.name.startswith('L1_CALREQ'):
item.setTriggerType( item.trigger_type | TT.phys )
# assign ctp IDs to items that don't have one
if item.ctpid == -1:
item.setCtpid( available_ctpids.pop() )
# add the items into the menu
self.menu.addItem( item )
......@@ -270,7 +283,6 @@ class TriggerConfigLVL1:
if item.verbose:
log.info(str(item))
# add the thresholds to the menu
undefined_thr = False
for thresholdName in Lvl1Flags.thresholds():
......@@ -285,9 +297,11 @@ class TriggerConfigLVL1:
if undefined_thr:
raise RuntimeError("Found undefined threshold in menu %s, must be fixed" % self.menu.menuName )
# threshold mapping
self.remapThresholds()
self.mapThresholds()
# add the counters to the menu
self.menu.addCounters()
# update the prescales that are not 1
self.updateItemPrescales()
......@@ -301,7 +315,7 @@ class TriggerConfigLVL1:
def remapThresholds(self):
def mapThresholds(self):
"""
Set the correct mapping of thresholds according to the
order it was given in Lvl1Flags.thresholds list. That list
......@@ -309,20 +323,26 @@ class TriggerConfigLVL1:
NIM and CALREQ types are not remapped !!
"""
from TriggerMenu.l1.Lvl1Flags import Lvl1Flags
if not Lvl1Flags.RemapThresholdsAsListed():
return
from collections import defaultdict
mappingCounter = defaultdict(int)
existingMappings = {}
for thr in self.menu.thresholds():
if thr.ttype=='NIM' or thr.ttype=='CALREQ' or thr.ttype=='TOPO':
continue
log.debug('Setting mapping of threshold %s as %i' % (thr, mappingCounter[thr.ttype]))
thr.mapping = mappingCounter[thr.ttype]
mappingCounter[thr.ttype] += 1
if not thr.ttype in existingMappings:
existingMappings[thr.ttype] = set()
if thr.mapping<0: continue
existingMappings[thr.ttype].add(thr.mapping)
nextFreeMapping = {}
for k in existingMappings:
nextFreeMapping[k] = 0
for thr in self.menu.thresholds():
if thr.mapping < 0:
while nextFreeMapping[thr.ttype] in existingMappings[thr.ttype]:
nextFreeMapping[thr.ttype] += 1
log.debug('Setting mapping of threshold %s as %i' % (thr, nextFreeMapping[thr.ttype]) )
thr.mapping = nextFreeMapping[thr.ttype]
nextFreeMapping[thr.ttype] += 1
#print thr, thr.ttype, thr.mapping
thr.setCableInput()
......
......@@ -9,6 +9,8 @@ logging.getLogger().info("Importing %s",__name__)
logBjetDef = logging.getLogger("TriggerMenu.bjet.generateBjetChainDefs.py")
from TriggerMenu.menu.MenuUtils import *
from TriggerMenu.menu.DictFromChainName import DictFromChainName
theDictFromChainName = DictFromChainName()
import pprint
pp = pprint.PrettyPrinter(indent=4, depth=8)
......@@ -21,6 +23,7 @@ def generateChainDefs(chainDict):
chainDict_orig = deepcopy(chainDict)
logBjetDef.debug("Initial b-jet chainDict: \n %s" % (pp.pformat(chainDict)))
#----------------------------------------------------------------------------
# --- preparing the dictionary for jet chain generation ---
n_chainParts = len(chainDict['chainParts'])
......@@ -31,23 +34,44 @@ def generateChainDefs(chainDict):
jetchainDict = chainDict
else:
raise RuntimeError('No chain parts found for chain %s' % (chainDict['chainName']))
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
# --- obtain jet chain def used as inputTE for first btag sequence ---
thejThrChainDef = get_j35_ChainDef()
if ('j0_bperf' in chainDict['chainName']):
thejThrChainDef['L1item'] = 'L1_J10'
thejThrChainDef['chainName'] = 'j0'
for part in thejThrChainDef['chainParts']:
part['chainPartName'] = 'j0'
part['threshold'] = '0'
if ('L1MU10' in chainDict['chainName']):
thejThrChainDef['L1item'] = 'L1_MU10'
if ('L1RD0_EMPTY' in chainDict['chainName']):
thejThrChainDef['L1item'] = 'L1_RD0_EMPTY'
# --- build the jet chain, then pass JetChainDef and bjetchainDictionaries to build bjet chains ---
from TriggerMenu.jet.generateJetChainDefs import generateChainDefs as genJetChainDefs
theBJChainDef = genJetChainDefs(thejThrChainDef)
logBjetDef.debug("ChainDef for b-jet chain: \n %s" % (str(theBJChainDef)))
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
# --- build the jet chain, then pass JetChainDef and bjetchainDictionaries to build bjet chains ---
theAllJetChainDef = genJetChainDefs(jetchainDict)
logBjetDef.debug("Jet ChainDef for b-jet chain: \n %s" % (str(theAllJetChainDef)))
#----------------------------------------------------------------------------
# --- obtain j35 chain def used as inputTE for first btag sequence ---
thej35ChainDef = get_j35_ChainDef()
logBjetDef.debug("j35 ChainDef for b-jet chain: \n %s" % (str(thej35ChainDef)))
# --- now merge chain defs so that last TE is from j35 serving as input to bjet seq ---
#----------------------------------------------------------------------------
# --- now merge chain defs so that last TE is from jet serving as input to bjet seq ---
# DO NOT CHANGE THE MERGING ORDER PLEASE, OTHERWISE WRONG INPUTTE IS SELECTED
theJetChainDef = mergeChainDefs([theAllJetChainDef, thej35ChainDef], 'serial', -1, False)
theJetChainDef = mergeChainDefs([theAllJetChainDef, theBJChainDef], 'serial', -1, False)
logBjetDef.debug("Merged chainDef for b-jet chain: \n %s" % (str(theJetChainDef)))
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
# --- filtering b-tagged jets chainParts ---
listofChainDicts = splitChainDict(chainDict_orig)
logBjetDef.debug("Split b-jet chainDict: \n %s" % (pp.pformat(listofChainDicts)))
......@@ -88,15 +112,22 @@ def generateChainDefs(chainDict):
###########################################################################
def buildBjetChains(jchaindef,bjetdict,doAtL2AndEF=True,numberOfSubChainDicts=1):
inputTEsEF = jchaindef.signatureList[-1]['listOfTriggerElements'][0]
print 'MEOW inputTEsEF', inputTEsEF
print 'MEOW all inpTEs', jchaindef