From cbeffd08fe2c1ac0c3740e95adadf65e80d140e7 Mon Sep 17 00:00:00 2001
From: Tomasz Bold <tomasz.bold@gmail.com>
Date: Tue, 3 Sep 2019 18:48:24 +0000
Subject: [PATCH] adds hooks necessary to generate JSON for CF only & emulation
 tests

---
 .../TrigUpgradeTest/python/TestUtils.py       |  26 +++
 .../TrigUpgradeTest/share/full_menu_cf.py     | 103 ++++++-----
 .../share/full_menu_cf_build.ref              |  10 +-
 .../HLTMenuConfig/Menu/DictFromChainName.py   |  16 +-
 .../HLTMenuConfig/Menu/GenerateMenuMT.py      |   2 +-
 .../python/HLTMenuConfig/Menu/HLTCFConfig.py  | 167 +++++++++---------
 .../python/HLTMenuConfig/Menu/HLTMenuJSON.py  |   2 +
 .../HLTMenuConfig/Menu/TriggerConfigHLT.py    |   8 +-
 8 files changed, 186 insertions(+), 148 deletions(-)

diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/TestUtils.py b/Trigger/TrigValidation/TrigUpgradeTest/python/TestUtils.py
index 0cf2029109e..9fb177fbb5a 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/python/TestUtils.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/python/TestUtils.py
@@ -99,6 +99,32 @@ class L1EmulationTest(L1Decoder):
 
         self.L1DecoderSummaryKey = "L1DecoderSummary"
 
+from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import TriggerConfigHLT
+chainsConfig = TriggerConfigHLT( )
+
+chainsCounter = 0
+
+def makeChain( name, L1Thresholds, ChainSteps, Streams="physics:Main", Groups=[] ):
+    """
+    In addition to making the chain object fills the flags that are used to generate MnuCOnfig JSON file
+    """
+
+    from TriggerMenuMT.HLTMenuConfig.Menu.ChainDefInMenu import ChainProp
+    prop = ChainProp( name=name,  l1SeedThresholds=L1Thresholds, groups=Groups )
+
+    from TriggerMenuMT.HLTMenuConfig.Menu.DictFromChainName import DictFromChainName
+    decoder = DictFromChainName()
+    chainDict = decoder.getChainDict( prop )
+    global chainsCounter
+    chainDict["chainCounter"] = chainsCounter
+    chainsCounter += 1
+    TriggerConfigHLT.currentTriggerConfig().allChainDicts.append( chainDict )
+
+    from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import Chain
+    chainConfig = Chain( name=name, L1Thresholds=L1Thresholds, ChainSteps=ChainSteps )
+    TriggerConfigHLT.currentTriggerConfig().allChainConfigs.append( chainConfig )
+    return chainConfig
+
 if __name__ == "__main__":
     from AthenaCommon.Constants import DEBUG
     real = L1EmulationTest(OutputLevel=DEBUG)
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_cf.py b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_cf.py
index b891a158a7f..17d0c3aebb4 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_cf.py
+++ b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_cf.py
@@ -23,8 +23,7 @@ include("TrigUpgradeTest/testHLT_MT.py")
 from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import Chain, ChainStep, RecoFragmentsPool
 
 testChains = []
-
-
+from TrigUpgradeTest.TestUtils import makeChain
 
 ##################################################################
 # egamma chains
@@ -40,10 +39,10 @@ if opt.doElectronSlice == True:
     PrecisionCaloStep = ChainStep("ElectronPrecisionCaloStep", [precisionCaloSeq])
 
     egammaChains  = [
-        Chain(name='HLT_e3_etcut1step_L1EM3',  L1Thresholds=["EM3"],  ChainSteps=[FastCaloStep]  ),
-        Chain(name='HLT_e3_etcut_L1EM3',       L1Thresholds=["EM3"],  ChainSteps=[FastCaloStep, FastElectronStep, PrecisionCaloStep]  ),
-        Chain(name='HLT_e5_etcut_L1EM3',       L1Thresholds=["EM3"],  ChainSteps=[FastCaloStep, FastElectronStep, PrecisionCaloStep]  ),
-        Chain(name='HLT_e7_etcut_L1EM3',       L1Thresholds=["EM3"],  ChainSteps=[FastCaloStep, FastElectronStep, PrecisionCaloStep]  )
+        makeChain(name='HLT_e3_etcut1step_L1EM3',  L1Thresholds=["EM3"],  ChainSteps=[FastCaloStep]  ),
+        makeChain(name='HLT_e3_etcut_L1EM3',       L1Thresholds=["EM3"],  ChainSteps=[FastCaloStep, FastElectronStep, PrecisionCaloStep]  ),
+        makeChain(name='HLT_e5_etcut_L1EM3',       L1Thresholds=["EM3"],  ChainSteps=[FastCaloStep, FastElectronStep, PrecisionCaloStep]  ),
+        makeChain(name='HLT_e7_etcut_L1EM3',       L1Thresholds=["EM3"],  ChainSteps=[FastCaloStep, FastElectronStep, PrecisionCaloStep]  )
         ]
 
 #    DiEleStep1=ChainStep("DiEleStep1",[fastCaloSeq, fastCaloSeq], multiplicity=2) #same step
@@ -68,7 +67,7 @@ if opt.doPhotonSlice == True:
     precisionCaloPhotonStep = ChainStep("precisionCaloPhotonStep", [precisionCaloPhotonSeq])
 
     photonChains = [
-        Chain(name='HLT_g5_etcut_L1EM3',    L1Thresholds=["EM3"],  ChainSteps=[ FastCaloStep,  fastPhotonStep, precisionCaloPhotonStep]  )
+        makeChain(name='HLT_g5_etcut_L1EM3',    L1Thresholds=["EM3"],  ChainSteps=[ FastCaloStep,  fastPhotonStep, precisionCaloPhotonStep]  )
         ]
 
     testChains += photonChains
@@ -95,11 +94,11 @@ if opt.doMuonSlice == True:
     emptyStep=ChainStep("Step2_empty")
 
     ## single muon trigger  
-    MuonChains += [Chain(name='HLT_mu6fast_L1MU6',     L1Thresholds=["MU6"], ChainSteps=[ step1mufast ])]
-    MuonChains += [Chain(name='HLT_mu6Comb_L1MU6',     L1Thresholds=["MU6"], ChainSteps=[ step1mufast, step2muComb ])]
-    MuonChains += [Chain(name='HLT_mu6_L1MU6',         L1Thresholds=["MU6"], ChainSteps=[ step1mufast, step2muComb, step3muEFSA, step4muEFCB ])]
-    MuonChains += [Chain(name='HLT_mu6msonly_L1MU6',   L1Thresholds=["MU6"], ChainSteps=[ step1mufast, emptyStep,   step3muEFSA ])] # removed due to muEFSA isuue(?)
-    MuonChains += [Chain(name='HLT_mu20_ivar_L1MU6',   L1Thresholds=["MU6"], ChainSteps=[ step1mufast, step2muComb, step3muIso ])]
+    MuonChains += [ makeChain(name='HLT_mu6fast_L1MU6',     L1Thresholds=["MU6"], ChainSteps=[ step1mufast ])]
+    MuonChains += [ makeChain(name='HLT_mu6Comb_L1MU6',     L1Thresholds=["MU6"], ChainSteps=[ step1mufast, step2muComb ])]
+    MuonChains += [ makeChain(name='HLT_mu6_L1MU6',         L1Thresholds=["MU6"], ChainSteps=[ step1mufast, step2muComb, step3muEFSA, step4muEFCB ])]
+    MuonChains += [ makeChain(name='HLT_mu6msonly_L1MU6',   L1Thresholds=["MU6"], ChainSteps=[ step1mufast, emptyStep,   step3muEFSA ])] # removed due to muEFSA isuue(?)
+    MuonChains += [ makeChain(name='HLT_mu20_ivar_L1MU6',   L1Thresholds=["MU6"], ChainSteps=[ step1mufast, step2muComb, step3muIso ])]
 
     # multi muon trigger
     # 2muons symmetric
@@ -109,7 +108,7 @@ if opt.doMuonSlice == True:
     step3_2muEFSA_sym= ChainStep("Step3_2muEFSA_sym", [ muEFSASequence()], multiplicity=2)
     step4_2muEFCB_sym= ChainStep("Step4_2muEFCB_sym", [ muEFCBSequence()], multiplicity=2)
  
-    MuonChains += [Chain(name='HLT_2mu6Comb_L12MU6',  L1Thresholds=["MU6"], ChainSteps=[ step1_2mufast_sym, step2_2muComb_sym ])]
+    MuonChains += [ makeChain(name='HLT_2mu6Comb_L12MU6',  L1Thresholds=["MU6"], ChainSteps=[ step1_2mufast_sym, step2_2muComb_sym ])]
 
     # 2muons asymmetric (this will change): 2 sequences, 2 seeds
     step1_2mufast_asym= ChainStep("Step1_2muFast_asym", [ muFastSequence(), muFastSequence()], multiplicity=2)
@@ -118,20 +117,17 @@ if opt.doMuonSlice == True:
     step3_2muEFSA_asym= ChainStep("Step3_2muEFSA_asym", [ muEFSASequence(), muEFSASequence()], multiplicity=2)
     step4_2muEFCB_asym= ChainStep("Step4_2muEFCB_asym", [ muEFCBSequence(), muEFCBSequence()], multiplicity=2)
     
-    MuonChains += [Chain(name='HLT_mu6_mu4_L12MU4',
-                             L1Thresholds=["MU4", "MU4"],
-                             ChainSteps=[ step1_2mufast_asym, step2_2muComb_asym ])]
-            
-    # MuonChains += [Chain(name='HLT_mu6_mu4_L1MU4_MU6',
-    #                          L1Thresholds=["MU4", "MU6"],
-    #                          ChainSteps=[ step1_2mufast_asym, step2_2muComb_asym ])]        
-
+    
+    MuonChains += [ makeChain(name='HLT_mu6_mu4_L12MU4',
+                              L1Thresholds=["MU4", "MU6"],
+                              ChainSteps=[ step1_2mufast_asym, step2_2muComb_asym ])]        
+    
     
     #FS Muon trigger
     # Full scan MS tracking step
     stepFSmuEFSA=ChainStep("Step_FSmuEFSA", [muEFSAFSSequence()])
     stepFSmuEFCB=ChainStep("Step_FSmuEFCB", [muEFCBFSSequence()])
-    MuonChains += [Chain(name='HLT_mu6nol1_L1MU6', L1Thresholds=["MU6"],  ChainSteps=[stepFSmuEFSA, stepFSmuEFCB])] 
+    MuonChains += [ makeChain(name='HLT_mu6nol1_L1MU6', L1Thresholds=["MU6"],  ChainSteps=[stepFSmuEFSA, stepFSmuEFCB])] 
 
     testChains += MuonChains
 
@@ -163,16 +159,16 @@ if opt.doJetSlice == True:
     step_a10r=ChainStep("Step_jet_a10r", [jetSeq_a10r])
     
     jetChains  = [
-        Chain(name='HLT_j45_L1J20',  L1Thresholds=["J20"],   ChainSteps=[step_a4_tc_em]  ),
-        Chain(name='HLT_j85_L1J20',  L1Thresholds=["J20"],ChainSteps=[step_a4_tc_em]  ),
-        Chain(name='HLT_j420_L1J20', L1Thresholds=["J20"], ChainSteps=[step_a4_tc_em]  ),
-        Chain(name='HLT_j260_320eta490_L1J20',  L1Thresholds=["J20"], ChainSteps=[step_a4_tc_em]  ),
-      #  Chain(name='HLT_j225_gsc420_boffperf_split',   ChainSteps=[step_a4_tc_em]  ),
-        Chain(name='HLT_j0_vbenfSEP30etSEP34mass35SEP50fbet_L1J20',  L1Thresholds=["J20"], ChainSteps=[step_a4_tc_em]  ),
-        Chain(name='HLT_j460_a10_lcw_subjes_L1J20', L1Thresholds=["J20"], ChainSteps=[step_a10_tc_lcw_subjes]  ),
-        Chain(name='HLT_j460_a10r_L1J20', L1Thresholds=["J20"], ChainSteps=[step_a10r]  ),
-        Chain(name='HLT_3j200_L1J20', L1Thresholds=["J20"], ChainSteps=[step_a4_tc_em]  ),
-        Chain(name='HLT_5j70_0eta240_L1J20', L1Thresholds=["J20"], ChainSteps=[step_a4_tc_em]  ), # 5j70_0eta240_L14J15 (J20 until multi-object L1 seeds supported)
+        makeChain(name='HLT_j45_L1J20',  L1Thresholds=["J20"],   ChainSteps=[step_a4_tc_em]  ),
+        makeChain(name='HLT_j85_L1J20',  L1Thresholds=["J20"],ChainSteps=[step_a4_tc_em]  ),
+        makeChain(name='HLT_j420_L1J20', L1Thresholds=["J20"], ChainSteps=[step_a4_tc_em]  ),
+        makeChain(name='HLT_j260_320eta490_L1J20',  L1Thresholds=["J20"], ChainSteps=[step_a4_tc_em]  ),
+      # makeChain(name='HLT_j225_gsc420_boffperf_split',   ChainSteps=[step_a4_tc_em]  ),
+        makeChain(name='HLT_j0_vbenfSEP30etSEP34mass35SEP50fbet_L1J20',  L1Thresholds=["J20"], ChainSteps=[step_a4_tc_em]  ),
+        makeChain(name='HLT_j460_a10_lcw_subjes_L1J20', L1Thresholds=["J20"], ChainSteps=[step_a10_tc_lcw_subjes]  ),
+        makeChain(name='HLT_j460_a10r_L1J20', L1Thresholds=["J20"], ChainSteps=[step_a10r]  ),
+        makeChain(name='HLT_3j200_L1J20', L1Thresholds=["J20"], ChainSteps=[step_a4_tc_em]  ),
+        makeChain(name='HLT_5j70_0eta240_L1J20', L1Thresholds=["J20"], ChainSteps=[step_a4_tc_em]  ), # 5j70_0eta240_L14J15 (J20 until multi-object L1 seeds supported)
         ]
 
     testChains += jetChains
@@ -188,9 +184,9 @@ if opt.doBjetSlice == True:
     step2 = ChainStep("Step2_bjet", [getBJetSequence('gsc')])
 
     bjetChains  = [                                                                                                                                                                         
-          Chain(name='HLT_j35_gsc45_boffperf_split_L1J20' , L1Thresholds=["J20"], ChainSteps=[step1,step2] ),
-          Chain(name='HLT_j35_gsc45_bmv2c1070_split_L1J20', L1Thresholds=["J20"], ChainSteps=[step1,step2] ),
-          Chain(name='HLT_j35_gsc45_bmv2c1070_L1J20'      , L1Thresholds=["J20"], ChainSteps=[step1,step2] )
+          makeChain(name='HLT_j35_gsc45_boffperf_split_L1J20' , L1Thresholds=["J20"], ChainSteps=[step1,step2] ),
+          makeChain(name='HLT_j35_gsc45_bmv2c1070_split_L1J20', L1Thresholds=["J20"], ChainSteps=[step1,step2] ),
+          makeChain(name='HLT_j35_gsc45_bmv2c1070_L1J20'      , L1Thresholds=["J20"], ChainSteps=[step1,step2] )
         ]
     testChains += bjetChains
     
@@ -208,9 +204,9 @@ if opt.doTauSlice == True:
   
   
   tauChains  = [
-      Chain(name='HLT_tau0_perf_ptonly_L1TAU12',              L1Thresholds=["TAU12"], ChainSteps=[step1, step2] ),
-      Chain(name='HLT_tau25_medium1_tracktwo_L1TAU12IM',      L1Thresholds=["TAU12IM"],  ChainSteps=[step1, step2TP] ),
-      Chain(name='HLT_tau35_mediumRNN_tracktwoMVA_L1TAU12IM', L1Thresholds=["TAU20IM"], ChainSteps=[step1MVA, step2PT]),
+      makeChain(name='HLT_tau0_perf_ptonly_L1TAU12',              L1Thresholds=["TAU12"], ChainSteps=[step1, step2] ),
+      makeChain(name='HLT_tau25_medium1_tracktwo_L1TAU12IM',      L1Thresholds=["TAU12IM"],  ChainSteps=[step1, step2TP] ),
+      makeChain(name='HLT_tau35_mediumRNN_tracktwoMVA_L1TAU12IM', L1Thresholds=["TAU20IM"], ChainSteps=[step1MVA, step2PT]),
       ]
   testChains += tauChains
 
@@ -228,10 +224,10 @@ if opt.doMETSlice == True:
     comboStep_cell_clusterpufit  = ChainStep("Step1_combo_cell_clusterpufit", [metCellSeq, metClusterPufitSeq], multiplicity=2)
 
     metChains = [
-        Chain(name="HLT_xe65_L1XE50",         L1Thresholds=["XE50"], ChainSteps=[metCellStep]),
-        Chain(name="HLT_xe30_L1XE10",         L1Thresholds=["XE10"], ChainSteps=[metCellStep]),
-        Chain(name="HLT_xe30_tcpufit_L1XE10", L1Thresholds=["XE10"], ChainSteps=[metClusterPufitStep]),
-        #Chain(name='HLT_xe30_cell_xe30_tcpufit_L1XE10',  L1Thresholds=["XE10","XE10"], ChainSteps=[comboStep_cell_clusterpufit ]) 
+        makeChain(name="HLT_xe65_L1XE50",         L1Thresholds=["XE50"], ChainSteps=[metCellStep]),
+        makeChain(name="HLT_xe30_L1XE10",         L1Thresholds=["XE10"], ChainSteps=[metCellStep]),
+        makeChain(name="HLT_xe30_tcpufit_L1XE10", L1Thresholds=["XE10"], ChainSteps=[metClusterPufitStep]),
+        makeChain(name='HLT_xe30_cell_xe30_tcpufit_L1XE10',  L1Thresholds=["XE10","XE10"], ChainSteps=[comboStep_cell_clusterpufit ]) 
         ]
 
 
@@ -254,11 +250,11 @@ if opt.doBphysicsSlice == True:
     step4muEFCB=ChainStep("Step4_muEFCB",   [ muEFCBSequence() ])
     step5EFDimu=ChainStep("Step5_EFDimu",   [ dimuEFSequence() ])
 
-    BphysChains += [Chain(name='HLT_2mu4_bDimu_L12MU4',     L1Thresholds=["MU4"], ChainSteps=[ step1mufast, step2L2Dimu, step3muEFSA, step4muEFCB, step5EFDimu])]
-    BphysChains += [Chain(name='HLT_2mu6_bJpsimumu_L12MU6', L1Thresholds=["MU6"], ChainSteps=[ step1mufast, step2L2Dimu])]
-    BphysChains += [Chain(name='HLT_2mu4_bBmumu_L12MU4',    L1Thresholds=["MU4"], ChainSteps=[ step1mufast, step2L2Dimu])]
-    BphysChains += [Chain(name='HLT_2mu4_bUpsimumu_L12MU4', L1Thresholds=["MU4"], ChainSteps=[ step1mufast, step2L2Dimu])]
-    BphysChains += [Chain(name='HLT_2mu4_bJpsimumu_L12MU4', L1Thresholds=["MU4"], ChainSteps=[ step1mufast, step2L2Dimu])]
+    BphysChains += [ makeChain(name='HLT_2mu4_bDimu_L12MU4',     L1Thresholds=["MU4"], ChainSteps=[ step1mufast, step2L2Dimu, step3muEFSA, step4muEFCB, step5EFDimu])]
+    BphysChains += [ makeChain(name='HLT_2mu6_bJpsimumu_L12MU6', L1Thresholds=["MU6"], ChainSteps=[ step1mufast, step2L2Dimu])]
+    BphysChains += [ makeChain(name='HLT_2mu4_bBmumu_L12MU4',    L1Thresholds=["MU4"], ChainSteps=[ step1mufast, step2L2Dimu])]
+    BphysChains += [ makeChain(name='HLT_2mu4_bUpsimumu_L12MU4', L1Thresholds=["MU4"], ChainSteps=[ step1mufast, step2L2Dimu])]
+    BphysChains += [ makeChain(name='HLT_2mu4_bJpsimumu_L12MU4', L1Thresholds=["MU4"], ChainSteps=[ step1mufast, step2L2Dimu])]
 
     #BphysChains += [Chain(name='HLT_mu6_mu4_bJpsimumu_L1MU6_2MU4',  ChainSteps=[ step1mufast, step2L2Dimu])]
                                         #to come: step3muEFSA, step4muEFCB, step5EFJpsi])]
@@ -282,7 +278,7 @@ if opt.doCombinedSlice == True:
     comboStep_mufast_etcut1_step1 = ChainStep("Step1_mufast_etcut1", [muFastSequence(), fastCaloSeq], multiplicity=2)
 
 
-    comboChains =  [Chain(name='HLT_e3_etcut_mu6_L1EM8I_MU10', L1Thresholds=["EM8I", "MU10"],  ChainSteps=[comboStep_et_mufast ])]
+    comboChains =  [ makeChain(name='HLT_e3_etcut_mu6_L1EM8I_MU10', L1Thresholds=["EM8I", "MU10"],  ChainSteps=[comboStep_et_mufast ])]
  #   comboChains += [Chain(name='HLT_mu8fast_e8_etcut1step',   ChainSteps=[ comboStep_mufast_etcut1_step1 ])]
     testChains += comboChains
 
@@ -294,7 +290,8 @@ if opt.doCombinedSlice == True:
 
 ##### Make all HLT #######
 from TriggerMenuMT.HLTMenuConfig.Menu.HLTCFConfig import makeHLTTree
-makeHLTTree(testChains)
+from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import TriggerConfigHLT
+makeHLTTree( None, triggerConfigHLT=TriggerConfigHLT.currentTriggerConfig() )
 
 
 ##########################################
@@ -319,6 +316,10 @@ filters = collectFilters(findSubSequence(topSequence, "HLTAllSteps"))
 
 # try to find L1Decoder
 l1decoder = findAlgorithm(topSequence,'L1Decoder')
+l1decoder.OutputLevel=DEBUG
+
+
+
 if not l1decoder:
     l1decoder = findAlgorithm(topSequence,'L1EmulationTest')
 
@@ -348,3 +349,7 @@ StreamESD.ItemList = ItemList
 
 
 HLTTop = findSubSequence(topSequence, "HLTTop")
+from TriggerMenuMT.HLTMenuConfig.Menu.HLTMenuJSON import generateJSON
+generateJSON()
+
+
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_cf_build.ref b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_cf_build.ref
index 5022c5d1161..bb2f583e527 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_cf_build.ref
+++ b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_cf_build.ref
@@ -8,6 +8,7 @@ TriggerSummaryStep1                     0   0     DEBUG  +++ HLT_xe30_tcpufit_L1
 TriggerSummaryStep1                     0   0     DEBUG  +++ HLT_e7_etcut_L1EM3 ID#1959043579
 TriggerSummaryStep1                     0   0     DEBUG  +++ HLT_j35_gsc45_boffperf_split_L1J20 ID#2603162203
 TriggerSummaryStep1                     0   0     DEBUG  +++ HLT_j35_gsc45_bmv2c1070_L1J20 ID#3007674636
+TriggerSummaryStep1                     0   0     DEBUG  +++ HLT_xe30_cell_xe30_tcpufit_L1XE10 ID#3768353779
 TriggerSummaryStep1                     0   0     DEBUG  +++ HLT_j35_gsc45_bmv2c1070_split_L1J20 ID#3815360851
 TriggerSummaryStep2                     0   0     DEBUG  +++ HLT_e5_etcut_L1EM3 ID#324908483
 TriggerSummaryStep2                     0   0     DEBUG  +++ HLT_g5_etcut_L1EM3 ID#471243435
@@ -30,6 +31,7 @@ TriggerSummaryStep1                     1   0     DEBUG  +++ HLT_xe30_tcpufit_L1
 TriggerSummaryStep1                     1   0     DEBUG  +++ HLT_e7_etcut_L1EM3 ID#1959043579
 TriggerSummaryStep1                     1   0     DEBUG  +++ HLT_j35_gsc45_boffperf_split_L1J20 ID#2603162203
 TriggerSummaryStep1                     1   0     DEBUG  +++ HLT_j35_gsc45_bmv2c1070_L1J20 ID#3007674636
+TriggerSummaryStep1                     1   0     DEBUG  +++ HLT_xe30_cell_xe30_tcpufit_L1XE10 ID#3768353779
 TriggerSummaryStep1                     1   0     DEBUG  +++ HLT_j35_gsc45_bmv2c1070_split_L1J20 ID#3815360851
 TriggerSummaryStep2                     1   0     DEBUG  +++ HLT_e5_etcut_L1EM3 ID#324908483
 TriggerSummaryStep2                     1   0     DEBUG  +++ HLT_g5_etcut_L1EM3 ID#471243435
@@ -65,6 +67,7 @@ TriggerSummaryStep1                     3   0     DEBUG  +++ HLT_xe30_tcpufit_L1
 TriggerSummaryStep1                     3   0     DEBUG  +++ HLT_e7_etcut_L1EM3 ID#1959043579
 TriggerSummaryStep1                     3   0     DEBUG  +++ HLT_j35_gsc45_boffperf_split_L1J20 ID#2603162203
 TriggerSummaryStep1                     3   0     DEBUG  +++ HLT_j35_gsc45_bmv2c1070_L1J20 ID#3007674636
+TriggerSummaryStep1                     3   0     DEBUG  +++ HLT_xe30_cell_xe30_tcpufit_L1XE10 ID#3768353779
 TriggerSummaryStep1                     3   0     DEBUG  +++ HLT_j35_gsc45_bmv2c1070_split_L1J20 ID#3815360851
 TriggerSummaryStep2                     3   0     DEBUG  +++ HLT_e5_etcut_L1EM3 ID#324908483
 TriggerSummaryStep2                     3   0     DEBUG  +++ HLT_g5_etcut_L1EM3 ID#471243435
@@ -79,6 +82,7 @@ TriggerSummaryStep3                     3   0     DEBUG  +++ HLT_e3_etcut_L1EM3
 TriggerSummaryStep3                     3   0     DEBUG  +++ HLT_e7_etcut_L1EM3 ID#1959043579
 TriggerSummaryStep1                     4   0     DEBUG  +++ HLT_e5_etcut_L1EM3 ID#324908483
 TriggerSummaryStep1                     4   0     DEBUG  +++ HLT_g5_etcut_L1EM3 ID#471243435
+TriggerSummaryStep1                     4   0     DEBUG  +++ HLT_mu6nol1_L1MU6 ID#501380442
 TriggerSummaryStep1                     4   0     DEBUG  +++ HLT_e3_etcut_L1EM3 ID#683953566
 TriggerSummaryStep1                     4   0     DEBUG  +++ HLT_e3_etcut1step_L1EM3 ID#999988353
 TriggerSummaryStep1                     4   0     DEBUG  +++ HLT_e7_etcut_L1EM3 ID#1959043579
@@ -359,10 +363,12 @@ TrigSignatureMoniMT                                INFO HLT_mu6fast_L1MU6
 TrigSignatureMoniMT                                INFO HLT_mu6fast_L1MU6 decisions                       3         0         0         0         0         
 TrigSignatureMoniMT                                INFO HLT_mu6msonly_L1MU6           20        20        3         0         2         0         0         2         
 TrigSignatureMoniMT                                INFO HLT_mu6msonly_L1MU6 decisions                     3         0         2         0         0         
-TrigSignatureMoniMT                                INFO HLT_mu6nol1_L1MU6             20        20        2         1         0         0         0         1         
-TrigSignatureMoniMT                                INFO HLT_mu6nol1_L1MU6 decisions                       2         1         0         0         0         
+TrigSignatureMoniMT                                INFO HLT_mu6nol1_L1MU6             20        20        3         1         0         0         0         1         
+TrigSignatureMoniMT                                INFO HLT_mu6nol1_L1MU6 decisions                       3         1         0         0         0         
 TrigSignatureMoniMT                                INFO HLT_xe30_L1XE10               20        20        12        0         0         0         0         12        
 TrigSignatureMoniMT                                INFO HLT_xe30_L1XE10 decisions                         12        0         0         0         0         
+TrigSignatureMoniMT                                INFO HLT_xe30_cell_xe30_tcpufit_L1XE1020        20        12        0         0         0         0         3         
+TrigSignatureMoniMT                                INFO HLT_xe30_cell_xe30_tcpufit_L1XE10 decisions                    18        0         0         0         0         
 TrigSignatureMoniMT                                INFO HLT_xe30_tcpufit_L1XE10       20        20        3         0         0         0         0         3         
 TrigSignatureMoniMT                                INFO HLT_xe30_tcpufit_L1XE10 decisions                    3         0         0         0         0         
 TrigSignatureMoniMT                                INFO HLT_xe65_L1XE50               20        20        3         0         0         0         0         3         
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py
index 10661518c5f..1c9ef5107a9 100755
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/DictFromChainName.py
@@ -72,21 +72,21 @@ def getUniqueThresholdsFromItem(item):
 
 class DictFromChainName(object):
 
-    def getChainDict(self,chainInfo):
+    def getChainDict(self, chainInfo):
         logDict.debug("chainInfo %s", chainInfo)
 
         # ---- Loop over all chains (keys) in dictionary ----
         # ---- Then complete the dict with other info    ----
         # Default input format will be namedtuple:
-        # ChainProp: ['name', 'L1chainParts'=[], 'stream', 'groups',
+        # ChainProp: ['name', 'L1Thresholds'=[], 'stream', 'groups',
         # 'merging'=[], 'topoStartFrom'=False],
 
         # these if/elif/else statements are due to temporary development
         from TrigConfHLTData.HLTUtils import string2hash
         if type(chainInfo) == str:
             chainName       = chainInfo
+            l1Thresholds    = []
             chainNameHash   = string2hash(chainInfo)
-            L1chainParts    = []
             stream          = ''
             groups          = []
             mergingStrategy = 'parallel'
@@ -96,8 +96,8 @@ class DictFromChainName(object):
 
         elif 'ChainProp' in str(type(chainInfo)):
             chainName       = chainInfo.name
+            l1Thresholds    = chainInfo.l1SeedThresholds
             chainNameHash   = string2hash(chainInfo.name)
-            L1chainParts    = chainInfo.l1SeedThresholds
             stream          = chainInfo.stream
             groups          = chainInfo.groups
             mergingStrategy = chainInfo.mergingStrategy
@@ -110,8 +110,9 @@ class DictFromChainName(object):
 
         L1item = getL1item(chainName)
 
+
         logDict.debug("Analysing chain with name: %s", chainName)
-        chainDict = self.analyseShortName(chainName,  L1chainParts, L1item)
+        chainDict = self.analyseShortName(chainName,  l1Thresholds, L1item)
         logDict.debug('ChainProperties: %s', chainDict)
 
         # setting the L1 item
@@ -374,11 +375,12 @@ class DictFromChainName(object):
         for chainindex, chainparts in enumerate(multichainparts):
 
             chainProperties = {} #will contain properties for one part of chain if multiple parts
-
             if len(L1thresholds) != 0:
                 chainProperties['L1threshold'] = L1thresholds[chainindex]
             else:
-                chainProperties['L1threshold'] = getAllThresholdsFromItem ( L1item )[chainindex]  #replced getUniqueThresholdsFromItem
+                __th = getAllThresholdsFromItem ( L1item )
+                assert chainindex < len(__th), "In defintion of the chain {} there is not enough thresholds to be used, index: {} >= number of thresholds, thresholds are: {}".format(chainName, chainindex, __th )
+                chainProperties['L1threshold'] = __th[chainindex]  #replced getUniqueThresholdsFromItem
 
 
             chainpartsNoL1 = chainparts
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py
index 7dfe06a0a35..6f41ce77035 100755
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/GenerateMenuMT.py
@@ -335,7 +335,7 @@ class GenerateMenuMT(object):
             for step in cc.steps:
                 log.debug(step)
 
-        makeHLTTree(HLTChains=finalListOfChainConfigs, newJO=False, triggerConfigHLT = self.triggerConfigHLT)
+        makeHLTTree(None, newJO=False, triggerConfigHLT = self.triggerConfigHLT)
         # the return values used for debugging, might be removed later
 
         from TriggerMenuMT.HLTMenuConfig.Menu.HLTMenuJSON import generateJSON
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
index d40b50a2774..0d7165bcf19 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py
@@ -16,7 +16,7 @@
      -- This is needed for two reasons:
            -- the HypoAlg is designed to have only one input TC (that is already for the single object)
            -- otherwise the HypoAlg would be equipped with differnt HypoTools with the same name (see for example e3_e8)
-     -- If the combined chain is symmetric (with multiplicity >1), the Hypo is duplicated only once, 
+     -- If the combined chain is symmetric (with multiplicity >1), the Hypo is duplicated only once,
         equipped with a HypoTool configured as single object and followed by one ComboHypoAlg
 
 
@@ -52,11 +52,11 @@ def createStepRecoNode(name, seq_list, dump=False):
 
     log.debug("Create reco step %s with %d sequences", name, len(seq_list))
     stepCF = parOR(name + CFNaming.RECO_POSTFIX)
-    for seq in seq_list:        
+    for seq in seq_list:
         stepCF += createCFTree(seq)
-    
-    if dump: 
-        dumpSequence (stepCF, indent=0)        
+
+    if dump:
+        dumpSequence (stepCF, indent=0)
     return stepCF
 
 
@@ -73,8 +73,8 @@ def createStepFilterNode(name, seq_list, dump=False):
 
     stepCF = parOR(name + CFNaming.FILTER_POSTFIX, subs=set(filter_list))
 
-    if dump: 
-        dumpSequence (stepCF, indent=0)        
+    if dump:
+        dumpSequence (stepCF, indent=0)
     return stepCF
 
 
@@ -88,7 +88,7 @@ def createCFTree(CFseq):
     if len(CFseq.step.sequences)==0:
         seqAndWithFilter = seqAND(CFseq.step.name, [filterAlg])
         return seqAndWithFilter
-        
+
     stepReco = parOR(CFseq.step.name + CFNaming.RECO_POSTFIX)  # all reco algoritms from al lthe sequences in a parallel sequence
     seqAndView = seqAND(CFseq.step.name + CFNaming.VIEW_POSTFIX, [stepReco])  # include in seq:And to run in views: add here the Hypo
     seqAndWithFilter = seqAND(CFseq.step.name, [filterAlg, seqAndView])  # add to the main step+filter
@@ -123,24 +123,27 @@ def makeHLTTree(HLTChains, newJO=False, triggerConfigHLT = None):
     """ creates the full HLT tree"""
 
     # Check if triggerConfigHLT exits, if yes, derive information from this
-    # this will be in use once TrigUpgrade test has migrated to TriggerMenuMT completely 
-    allChainDicts = []  
-    allChainConfigs = []
+    # this will be in use once TrigUpgrade test has migrated to TriggerMenuMT completely
+
     if triggerConfigHLT:
-        log.info("Obtaining chain dictionaries and configuration from triggerConfigHLT")
+        assert len(triggerConfigHLT.allChainConfigs) != 0, "Chain configurations passed, but list of configurations it is empty"
+        assert len(triggerConfigHLT.allChainDicts) != 0, "Chain configurations passed, but list of chain dicts it is empty"
+        assert HLTChains is None, "Both triggerConfigHLT and HLTChains list passed to CF building, either one or the other shoudl be used"
         allChainConfigs = triggerConfigHLT.allChainConfigs
         allChainDicts = triggerConfigHLT.allChainDicts
     else:
-        log.info("No triggerConfigHLT was passed, only relying on HLTChains now")
+        log.info("No triggerConfigHLT was passed, only relying on HLTChains now, in this mode complex chains can not be handled")
         log.info("Creating necessary chainDict info now")
+
         allChainConfigs = HLTChains
-        # call dictfrom chain name maybe here once to obtain list of dictionaries for all chains
-        # loop over HLT Chains
+        allChainDicts = []
         from TriggerMenuMT.HLTMenuConfig.Menu import DictFromChainName
         decodeChainName = DictFromChainName.DictFromChainName()
         for chain in allChainConfigs:
             chainDict = decodeChainName.getChainDict(chain.name)
             allChainDicts.append(chainDict)
+            from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import TriggerConfigHLT
+        TriggerConfigHLT.currentTriggerConfig().allChainDicts = allChainDicts # need to fill it because HypoTool creation needs it
 
     # lock flags
     from AthenaConfiguration.AllConfigFlags import ConfigFlags
@@ -170,16 +173,16 @@ def makeHLTTree(HLTChains, newJO=False, triggerConfigHLT = None):
 
     # put L1Decoder here
     hltTop += l1decoder
- 
+
     # add the HLT steps Node
     steps = seqAND("HLTAllSteps")
     hltTop +=  steps
-    
+
     # make DF and CF tree from chains
     finalDecisions = decisionTree_From_Chains(steps, allChainConfigs, allChainDicts, newJO)
-        
+
     flatDecisions=[]
-    for step in finalDecisions: 
+    for step in finalDecisions:
         flatDecisions.extend (step)
 
     summary= makeSummary("TriggerSummaryFinal", flatDecisions)
@@ -198,18 +201,18 @@ def makeHLTTree(HLTChains, newJO=False, triggerConfigHLT = None):
     decObj = collectDecisionObjects( hypos, filters, l1decoder[0] )
     summaryAcc, summaryAlg = triggerSummaryCfg( ConfigFlags, hypos )
     hltTop += summaryAlg
-    summaryAcc.appendToGlobals()    
-    
+    summaryAcc.appendToGlobals()
+
     monAcc, monAlg = triggerMonitoringCfg( ConfigFlags, hypos, filters, l1decoder[0] )
     monAcc.appendToGlobals()
     hltTop += monAlg
-    
+
     # this is a shotcut for now, we always assume we may be writing ESD & AOD outputs, so all gaps will be filled
     edmAlg = triggerMergeViewsAndAddMissingEDMCfg(['AOD', 'ESD'], hypos, viewMakers, decObj )
     hltTop += edmAlg
 
     Configurable.configurableRun3Behavior=0
-        
+
     topSequence += hltTop
 
     # Test the configuration
@@ -224,9 +227,9 @@ def matrixDisplay( allCFSeq ):
     for stepNumber,step in enumerate(allCFSeq, 1):
         for seq in step:
             mx[stepNumber][seq.step.name] = seq # what if ther eare more sequences in one step?
-            
+
             longestName = max(longestName, len(seq.step.name) )
-            
+
     longestName = longestName + 1
     def __getHyposOfStep( s ):
         if len(s.step.sequences):
@@ -235,29 +238,29 @@ def matrixDisplay( allCFSeq ):
            else:
               return s.step.sequences[0].hypo.tools
         return []
-    
 
-    
+
+
     def __nextSteps( index, stepName ):
         nextStepName = "Step%s_"%index + "_".join(stepName.split("_")[1:])
         for sname, seq in mx[index].iteritems():
             if sname == nextStepName:
                 return sname.ljust( longestName ) + __nextSteps( index + 1, nextStepName )
         return ""
-            
+
     log.debug("" )
     log.debug("chains^ vs steps ->")
-    log.debug( "="*90 )    
+    log.debug( "="*90 )
     for sname, seq in mx[1].iteritems():
         guessChainName = '_'.join( sname.split( "_" )[1:] )
         log.debug( " Reco chain: %s: %s", guessChainName.rjust(longestName),  __nextSteps( 1, sname ) )
         log.debug( " %s", " ".join( __getHyposOfStep( seq ) ) )
         log.debug( "" )
-        
+
     log.debug( "%s", "="*90 )
     log.debug( "" )
 
-        
+
 
 def decisionTree_From_Chains(HLTNode, chains, allDicts, newJO):
     """ creates the decision tree, given the starting node and the chains containing the sequences  """
@@ -266,11 +269,11 @@ def decisionTree_From_Chains(HLTNode, chains, allDicts, newJO):
     HLTNodeName= HLTNode.name()
     if len(chains) == 0:
         log.info("Configuring empty decisionTree")
-        return []    
-    
+        return []
+
     # add chains to multiplicity map (new step here, as this was originally in the __init__ of Chain class
 
-    (finalDecisions, CFseq_list) = createDataFlow(chains, allDicts) 
+    (finalDecisions, CFseq_list) = createDataFlow(chains, allDicts)
     if not newJO:
         createControlFlow(HLTNode, CFseq_list)
     else:
@@ -288,7 +291,7 @@ def decisionTree_From_Chains(HLTNode, chains, allDicts, newJO):
 
 def createDataFlow(chains, allDicts):
     """ Creates the filters and connect them to the menu sequences"""
-    
+
     # find tot nsteps
     chainWithMaxSteps = max(chains, key=lambda chain: len(chain.steps))
     NSTEPS = len(chainWithMaxSteps.steps)
@@ -297,7 +300,7 @@ def createDataFlow(chains, allDicts):
 
     from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import CFSequence
     # initialize arrays for monitor
-    finalDecisions = [] 
+    finalDecisions = []
     CFseq_list = []
     for nstep in range(0, NSTEPS):
         finalDecisions.append([]) # list of final deciisons per step
@@ -306,9 +309,9 @@ def createDataFlow(chains, allDicts):
 
     # loop over chains
     for chain in chains:
-        log.info("\n Configuring chain %s with %d steps: \n   - %s ", chain.name,len(chain.steps),'\n   - '.join(map(str, [{step.name:step.multiplicity} for step in chain.steps])))   
+        log.info("\n Configuring chain %s with %d steps: \n   - %s ", chain.name,len(chain.steps),'\n   - '.join(map(str, [{step.name:step.multiplicity} for step in chain.steps])))
 
-        lastCFseq = None        
+        lastCFseq = None
         for nstep in range(0,len(chain.steps)):
 #            stepCF_name =  CFNaming.stepName(nstep)
             chain_step=chain.steps[nstep]
@@ -325,57 +328,57 @@ def createDataFlow(chains, allDicts):
                     filter_input.append(out)
                     log.debug("Connect to previous sequence through these filter inputs: %s", filter_input)
 
-                
+
             if len(filter_input) == 0 or (len(filter_input) != 1 and not chain_step.isCombo):
                 log.error("ERROR: Filter for step %s has %d inputs! One is expected", chain_step.name, len(filter_input))
-                    
+
 
             # make one filter per step:
             sfilter= None
             filter_name = CFNaming.filterName(chain_step.name)
             filter_output =[]
-            for i in filter_input: 
+            for i in filter_input:
                 filter_output.append( CFNaming.filterOutName(filter_name, i))
-            
+
             (foundFilter, foundCFSeq) = findCFSequences(filter_name, CFseq_list[nstep])
             log.debug("Found %d CF sequences with base filter name %s", foundFilter, filter_name)
             if not foundFilter:
                 sfilter = buildFilter(filter_name, filter_input)
                 CF_seq = CFSequence( ChainStep=chain_step, FilterAlg=sfilter, connections=filter_output)
                 CFseq_list[nstep].append(CF_seq)
-                lastCFseq=CF_seq                
+                lastCFseq=CF_seq
             else:
-                count_fil=0                              
+                count_fil=0
                 # find correspoding CFsequence
-                for cfseq in foundCFSeq: # all the CFseq using the same filter                    
+                for cfseq in foundCFSeq: # all the CFseq using the same filter
                     sfilter=cfseq.filter
                     #exactly same filter with the same inputs (same gropu of chains);
                     already_connected = [x for x in filter_output if x in cfseq.connections]
-                    if len(already_connected):                        
+                    if len(already_connected):
                         chain.steps[nstep] = cfseq.step # reuse the same step
                         chain_step=chain.steps[nstep]
                         lastCFseq=cfseq #reuse the CFseq
                         count_fil =0
                         break
-                    else:                   
+                    else:
                         count_fil+=1
-                        
+
                 # if we have the same filter, with differnt inputs:
                 # add inputs/output to filter
                 # deepcopy all the seqeunces
                 # duplicate the Hypo with differnt name
                 # create new ChainStep and replace in the list
                 # create a new CFsequence with different name
-                if (count_fil):                 
+                if (count_fil):
                     log.debug("Adding more inputs/outputs to filter %s", filter_name)
-                    for i in filter_input: 
-                        sfilter.addInput(i)                        
-                    for i in filter_output:                            
+                    for i in filter_input:
+                        sfilter.addInput(i)
+                    for i in filter_output:
                         sfilter.addOutput(i)
-                                            
-                    log.debug("Duplicating the Step %s", chain_step.name) 
-                    new_sequences = []                    
-                    for sequence in chain_step.sequences:             
+
+                    log.debug("Duplicating the Step %s", chain_step.name)
+                    new_sequences = []
+                    for sequence in chain_step.sequences:
                         new_sequence=copy.deepcopy(sequence)
                         new_sequence.resetConnections()
                         new_sequence.name = "%s_%d"%(sequence.name, count_fil)
@@ -394,16 +397,16 @@ def createDataFlow(chains, allDicts):
                            new_sequence.replaceHypoForDuplication(new_hypoAlg)
                            new_sequences.append(new_sequence)
 
-                    new_chain_step_name="%s_%d"%(chain_step.name, count_fil)                    
+                    new_chain_step_name="%s_%d"%(chain_step.name, count_fil)
                     # making new ChainStep
                     new_chain_step = ChainStep(new_chain_step_name, Sequences=new_sequences,  multiplicity=chain_step.multiplicity)
                     chain.steps[nstep] = new_chain_step # replace chain step
                     chain_step = chain.steps[nstep]
-                   
-                    new_CF_seq = CFSequence( ChainStep=new_chain_step, FilterAlg=sfilter, connections=filter_output)                
+
+                    new_CF_seq = CFSequence( ChainStep=new_chain_step, FilterAlg=sfilter, connections=filter_output)
                     CFseq_list[nstep].append(new_CF_seq)
                     lastCFseq=new_CF_seq
-          
+
 
             sfilter.setChains(chain.name)
             log.debug("Adding chain %s to %s", chain.name,sfilter.Alg.name())
@@ -415,15 +418,15 @@ def createDataFlow(chains, allDicts):
                     log.debug("Added chains to ComboHypo: %s",chain_step.combo.getChains())
 
 
-            if len(chain.steps) == nstep+1:  
+            if len(chain.steps) == nstep+1:
                 log.debug("Adding finalDecisions for chain %s at step %d:", chain.name, nstep+1)
                 for seq in chain_step.sequences:
                     finalDecisions[nstep].extend(seq.outputs)
                     log.debug(seq.outputs)
 
-           
+
         #end of loop over steps
-        log.info("\n Built CF for chain %s with %d steps: \n   - %s ", chain.name,len(chain.steps),'\n   - '.join(map(str, [{step.name:step.multiplicity} for step in chain.steps])))   
+        log.info("\n Built CF for chain %s with %d steps: \n   - %s ", chain.name,len(chain.steps),'\n   - '.join(map(str, [{step.name:step.multiplicity} for step in chain.steps])))
     #end of loop over chains
 
     # decode and attach HypoTools:
@@ -437,15 +440,15 @@ def createDataFlow(chains, allDicts):
 
 def createControlFlow(HLTNode, CFseq_list):
     """ Creates Control Flow Tree starting from the CFSequences"""
-    
+
     HLTNodeName= HLTNode.name()
     log.debug("createControlFlow on node %s",HLTNodeName)
-        
+
     for nstep in range(0, len(CFseq_list)):
         step_decisions = []
         for CFseq in CFseq_list[nstep]:
             step_decisions.extend(CFseq.decisions)
-            
+
         stepCF_name =  CFNaming.stepName(nstep)
         log.debug("\n******** Create CF Tree %s with AthSequencers", stepCF_name)
 
@@ -510,7 +513,7 @@ def generateDecisionTreeOld(HLTNode, chains, allChainDicts):
                 continue
 
 
-            stepCategoryAcc = ComponentAccumulator()            
+            stepCategoryAcc = ComponentAccumulator()
 
             stepHypo = None
 
@@ -526,7 +529,7 @@ def generateDecisionTreeOld(HLTNode, chains, allChainDicts):
                     stepCategoryAcc.addEventAlgo( alg )
 
             stepAccs.append( stepCategoryAcc )
-                
+
             stepCategoryAcc.printConfig( True, True )
             firstChain = chainsInCell[0]
 
@@ -536,11 +539,11 @@ def generateDecisionTreeOld(HLTNode, chains, allChainDicts):
                 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: 
+            for i in filter_input:
                 filter_output.append( CFNaming.filterOutName(filterName, i))
             sfilter = buildFilter(filterName,  filter_input)
 
@@ -552,7 +555,7 @@ def generateDecisionTreeOld(HLTNode, chains, allChainDicts):
 
             for sequence in chainStep.sequences:
                 stepDecisions += sequence.outputs
-        
+
             for chain in chainsInCell:
                 sfilter.setChains(chain.name)
 
@@ -593,8 +596,8 @@ def findFilter(filter_name, cfseqList):
           log.error("found %d filters  with name %s", len( foundFilters ), filter_name)
 
       found = bool(foundFilters)
-      if found:          
-          log.debug("Filter %s already exists", filter_name)        
+      if found:
+          log.debug("Filter %s already exists", filter_name)
           return (found, foundFilters[0])
       return (found, None)
 
@@ -609,7 +612,7 @@ def findCFSequences(filter_name, cfseqList):
       log.debug("found %d filters with base name %s", len( foundFilters ), filter_name)
 
       found=len(foundFilters)
-      if found:          
+      if found:
           return (found, foundFilters)
       return (found, None)
 
@@ -617,15 +620,15 @@ def findCFSequences(filter_name, cfseqList):
 def buildFilter(filter_name,  filter_input):
     """
      Build the FILTER
-     one filter per previous sequence at the start of the sequence: always create a new one    
+     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 
+     one filter per previous sequence: 1 input/previous seq, 1 output/next seq
     """
-    from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import  RoRSequenceFilterNode       
+    from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import  RoRSequenceFilterNode
     sfilter = RoRSequenceFilterNode(name=filter_name)
-    for i in filter_input: 
+    for i in filter_input:
         sfilter.addInput(i)
-    for i in filter_input: 
+    for i in filter_input:
         sfilter.addOutput(CFNaming.filterOutName(filter_name, i))
 
     log.debug("Added inputs to filter: %s", sfilter.getInputList())
@@ -633,9 +636,3 @@ def buildFilter(filter_name,  filter_input):
     log.debug("Filter Done: %s", sfilter.Alg.name())
 
     return (sfilter)
-
-
-
-
-
-    
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTMenuJSON.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTMenuJSON.py
index fff7f76a12f..2fc2084b16b 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTMenuJSON.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTMenuJSON.py
@@ -52,6 +52,8 @@ def __generateJSON( chainDicts, chainConfigs, menuName ):
                       "streams": streamDicts,
                       # "sequences": sequences 
                     }
+
+
         menuDict["chains"].append( chainDict )
 
     from AthenaCommon.AppMgr import release_metadata
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerConfigHLT.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerConfigHLT.py
index 56dc93bbf2e..5012ee6d802 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerConfigHLT.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/TriggerConfigHLT.py
@@ -59,11 +59,11 @@ class TriggerConfigHLT(object):
 
         log.info("Writing of config files needs to be implemented")
 
-__chainsDict = {}
+#__chainsDict = {}
 def getChainDictFromChainName(chainName, allChainDicts = None):
-    if __chainsDict == {}:
-        __chainsDict.update( [ (c['chainName'], c) for c in allChainDicts ] )
-    return __chainsDict[chainName]
+    found = [ c for c in TriggerConfigHLT.currentTriggerConfig().allChainDicts if c['chainName'] == chainName ]
+    assert len(found) == 1, "Problem finding a unique dict for the chain {}, found that many: {} ".format(chainName, len(found))
+    return found[0]
 
 ##############################
 # this function was supposed to be part of the class but doesn't work for now
-- 
GitLab