From 159d39a5f04b700f58aece1520b76b4fa1b7eb65 Mon Sep 17 00:00:00 2001
From: Fernando Monticelli <fernando.monticelli@cern.ch>
Date: Fri, 20 Dec 2019 22:53:14 +0000
Subject: [PATCH] updating precisionTrackSequenceSetup.py to be in sync with
 recent changes in ElectronDef.py and ElectronSequenceSetup.py

---
 .../TrigEgammaPrecisionElectronHypoTool.py    | 95 +++++++++++++++++++
 .../share/q221_RDOtoRDOTrig_mt1_build.ref     | 16 ++++
 .../TrigUpgradeTest/share/full_menu_build.ref | 16 ++++
 .../HLTMenuConfig/Egamma/ElectronDef.py       | 94 ++++++++++++------
 .../Egamma/ElectronSequenceSetup.py           |  1 -
 .../python/HLTMenuConfig/Egamma/PhotonDef.py  |  6 +-
 .../Egamma/PrecisionElectronSequenceSetup.py  | 52 ++++++++++
 .../PrecisionElectronRecoSequences.py         | 17 ++--
 .../python/HLTMenuConfig/Menu/LS2_v1.py       | 13 +++
 .../HLTMenuConfig/Menu/SignatureDicts.py      |  2 +-
 10 files changed, 273 insertions(+), 39 deletions(-)
 create mode 100644 Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaPrecisionElectronHypoTool.py
 create mode 100644 Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PrecisionElectronSequenceSetup.py

diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaPrecisionElectronHypoTool.py b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaPrecisionElectronHypoTool.py
new file mode 100644
index 000000000000..4e4d4dc0783d
--- /dev/null
+++ b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaPrecisionElectronHypoTool.py
@@ -0,0 +1,95 @@
+#
+# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+#
+
+from AthenaCommon.Logging import logging
+logging.getLogger().info("Importing %s",__name__)
+log = logging.getLogger("TrigEgammaHypo.TrigEgammaPrecisionElectronHypoTool") 
+from AthenaCommon.SystemOfUnits import GeV
+
+def _IncTool(name, threshold, sel):
+
+    log.debug('TrigEgammaPrecisionElectronHypoTool _IncTool("'+name+'", threshold = '+str(threshold) + ', sel = '+str(sel))
+
+
+    from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaPrecisionElectronHypoToolInc    
+
+    tool = TrigEgammaPrecisionElectronHypoToolInc( name ) 
+
+    from AthenaMonitoring.GenericMonitoringTool import GenericMonitoringTool, defineHistogram
+    monTool = GenericMonitoringTool("MonTool_"+name)
+    monTool.Histograms = [ defineHistogram('dEta', type='TH1F', path='EXPERT', title="PrecisionElectron Hypo #Delta#eta_{EF L1}; #Delta#eta_{EF L1}", xbins=80, xmin=-0.01, xmax=0.01),
+                           defineHistogram('dPhi', type='TH1F', path='EXPERT', title="PrecisionElectron Hypo #Delta#phi_{EF L1}; #Delta#phi_{EF L1}", xbins=80, xmin=-0.01, xmax=0.01),
+                           defineHistogram('Et_em', type='TH1F', path='EXPERT', title="PrecisionElectron Hypo cluster E_{T}^{EM};E_{T}^{EM} [MeV]", xbins=50, xmin=-2000, xmax=100000),
+                           defineHistogram('Eta', type='TH1F', path='EXPERT', title="PrecisionElectron Hypo entries per Eta;Eta", xbins=100, xmin=-2.5, xmax=2.5),
+                           defineHistogram('Phi', type='TH1F', path='EXPERT', title="PrecisionElectron Hypo entries per Phi;Phi", xbins=128, xmin=-3.2, xmax=3.2),
+                           defineHistogram('EtaBin', type='TH1I', path='EXPERT', title="PrecisionElectron Hypo entries per Eta bin;Eta bin no.", xbins=11, xmin=-0.5, xmax=10.5)]
+
+    cuts=['Input','#Delta #eta EF-L1', '#Delta #phi EF-L1','eta','E_{T}^{EM}']
+
+    monTool.Histograms += [ defineHistogram('CutCounter', type='TH1I', path='EXPERT', title="PrecisionElectron Hypo Passed Cuts;Cut",
+                                            xbins=13, xmin=-1.5, xmax=12.5,  opt="kCumulative", labels=cuts) ]
+
+    monTool.HistPath = 'PrecisionElectronHypo/'+tool.name()
+    tool.MonTool = monTool
+
+
+    tool.EtaBins        = [0.0, 0.6, 0.8, 1.15, 1.37, 1.52, 1.81, 2.01, 2.37, 2.47]
+    def same( val ):
+        return [val]*( len( tool.EtaBins ) - 1 )
+
+    tool.ETthr          = same( float(threshold) )
+    tool.dETACLUSTERthr = 0.1
+    tool.dPHICLUSTERthr = 0.1
+    #tool.ET2thr         = same( 90.0*GeV )
+
+    if sel == 'nocut':
+        tool.AcceptAll = True
+        tool.ETthr          = same( float( threshold )*GeV ) 
+        tool.dETACLUSTERthr = 9999.
+        tool.dPHICLUSTERthr = 9999.
+
+    elif sel == "etcut":
+        tool.ETthr          = same( ( float( threshold ) -  3 )*GeV ) 
+        # No other cuts applied
+        tool.dETACLUSTERthr = 9999.
+        tool.dPHICLUSTERthr = 9999.
+    
+    return tool
+
+
+def _MultTool(name):
+    from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaPrecisionElectronHypoToolMult
+    return TrigEgammaPrecisionElectronHypoToolMult( name )
+
+
+
+def TrigEgammaPrecisionElectronHypoToolFromDict( d ):
+    """ Use menu decoded chain dictionary to configure the tool """
+    cparts = [i for i in d['chainParts'] if ((i['signature']=='Electron') or (i['signature']=='Electron'))]
+    
+    def __mult(cpart):
+        return int( cpart['multiplicity'] )
+
+    def __th(cpart):
+        return cpart['threshold']
+    
+    def __sel(cpart):
+        return cpart['addInfo'][0] if cpart['addInfo'] else cpart['IDinfo']
+    
+    name = d['chainName']
+
+    
+    # do we need to configure high multiplicity selection, either NeX or ex_ey_ez etc...?
+    if len(cparts) > 1 or __mult(cparts[0]) > 1:
+        tool = _MultTool(name)
+        for cpart in cparts:
+            for cutNumber in range( __mult( cpart ) ):
+                tool.SubTools += [ _IncTool( cpart['chainPartName']+"_"+str(cutNumber), __th( cpart ), __sel( cpart) ) ]
+
+        return tool
+    else:        
+        return _IncTool( name, __th( cparts[0]),  __sel( cparts[0] ) )
+                   
+    
+
diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/q221_RDOtoRDOTrig_mt1_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/q221_RDOtoRDOTrig_mt1_build.ref
index d4580af68a0e..8d870ea3d03d 100644
--- a/Trigger/TrigValidation/TrigAnalysisTest/share/q221_RDOtoRDOTrig_mt1_build.ref
+++ b/Trigger/TrigValidation/TrigAnalysisTest/share/q221_RDOtoRDOTrig_mt1_build.ref
@@ -1,5 +1,7 @@
 TrigSignatureMoniMT                                INFO HLT_2e17_etcut_L12EM15VH      2         2         2         2         2         0         0         2
 TrigSignatureMoniMT                                INFO HLT_2e17_etcut_L12EM15VH decisions                    6         826       7         0         0
+TrigSignatureMoniMT                                INFO HLT_2e17_lhvloose_L12EM3      20        20        1         1         1         1         0         1
+TrigSignatureMoniMT                                INFO HLT_2e17_lhvloose_L12EM3 decisions                    2         57        3         2         0
 TrigSignatureMoniMT                                INFO HLT_2e3_etcut_L12EM3          20        20        20        20        20        0         0         20
 TrigSignatureMoniMT                                INFO HLT_2e3_etcut_L12EM3 decisions                    172       8889      401       0         0
 TrigSignatureMoniMT                                INFO HLT_2g20_tight_L12EM20VH      2         2         0         0         0         0         0         0
@@ -38,14 +40,28 @@ TrigSignatureMoniMT                                INFO HLT_4mu4_L14MU4
 TrigSignatureMoniMT                                INFO HLT_4mu4_L14MU4 decisions                         0         0         0         0         0
 TrigSignatureMoniMT                                INFO HLT_5j70_0eta240_L14J20       7         7         1         0         0         0         0         1
 TrigSignatureMoniMT                                INFO HLT_5j70_0eta240_L14J20 decisions                    5         0         0         0         0
+TrigSignatureMoniMT                                INFO HLT_e140_lhloose_L1EM24VHI    6         6         0         0         0         0         0         0
+TrigSignatureMoniMT                                INFO HLT_e140_lhloose_L1EM24VHI decisions                    0         0         0         0         0
 TrigSignatureMoniMT                                INFO HLT_e26_etcut_L1EM22VHI       6         6         6         6         6         0         0         6
 TrigSignatureMoniMT                                INFO HLT_e26_etcut_L1EM22VHI decisions                    7         645       7         0         0
+TrigSignatureMoniMT                                INFO HLT_e26_lhtight_L1EM24VHI     6         6         5         5         5         5         0         5
+TrigSignatureMoniMT                                INFO HLT_e26_lhtight_L1EM24VHI decisions                    5         241       7         5         0
+TrigSignatureMoniMT                                INFO HLT_e300_etcut_L1EM24VHI      6         6         0         0         0         0         0         0
+TrigSignatureMoniMT                                INFO HLT_e300_etcut_L1EM24VHI decisions                    0         0         0         0         0
 TrigSignatureMoniMT                                INFO HLT_e3_etcut1step_mu6fast_L1EM8I_MU105         5         5         0         0         0         0         5
 TrigSignatureMoniMT                                INFO HLT_e3_etcut1step_mu6fast_L1EM8I_MU10 decisions                    5         0         0         0         0
 TrigSignatureMoniMT                                INFO HLT_e3_etcut_L1EM3            20        20        20        20        20        0         0         20
 TrigSignatureMoniMT                                INFO HLT_e3_etcut_L1EM3 decisions                      172       8889      401       0         0
 TrigSignatureMoniMT                                INFO HLT_e5_etcut_L1EM3            20        20        20        20        20        0         0         20
 TrigSignatureMoniMT                                INFO HLT_e5_etcut_L1EM3 decisions                      140       7892      190       0         0
+TrigSignatureMoniMT                                INFO HLT_e5_lhloose_L1EM3          20        20        17        17        17        17        0         17
+TrigSignatureMoniMT                                INFO HLT_e5_lhloose_L1EM3 decisions                    57        3087      117       56        0
+TrigSignatureMoniMT                                INFO HLT_e5_lhmedium_L1EM3         20        20        16        16        16        15        0         15
+TrigSignatureMoniMT                                INFO HLT_e5_lhmedium_L1EM3 decisions                    48        2444      92        48        0
+TrigSignatureMoniMT                                INFO HLT_e5_lhtight_L1EM3          20        20        16        16        16        14        0         14
+TrigSignatureMoniMT                                INFO HLT_e5_lhtight_L1EM3 decisions                    45        2368      84        44        0
+TrigSignatureMoniMT                                INFO HLT_e60_lhmedium_L1EM24VHI    6         6         2         2         2         2         0         2
+TrigSignatureMoniMT                                INFO HLT_e60_lhmedium_L1EM24VHI decisions                    2         92        3         2         0
 TrigSignatureMoniMT                                INFO HLT_e7_etcut_L1EM3            20        20        20        20        20        0         0         20
 TrigSignatureMoniMT                                INFO HLT_e7_etcut_L1EM3 decisions                      89        5506      113       0         0
 TrigSignatureMoniMT                                INFO HLT_g140_etcut_L1EM24VHI      6         6         0         0         0         0         0         0
diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_build.ref b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_build.ref
index 1c21fe66b8c3..480de7e27004 100644
--- a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_build.ref
+++ b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_build.ref
@@ -1,5 +1,7 @@
 TrigSignatureMoniMT                                 INFO HLT_2e17_etcut_L12EM15VH      20        20        0         0         0         0         0         0         
 TrigSignatureMoniMT                                 INFO HLT_2e17_etcut_L12EM15VH decisions                    0         0         0         0         0         
+TrigSignatureMoniMT                                 INFO HLT_2e17_lhvloose_L12EM3      20        20        0         0         0         0         0         0         
+TrigSignatureMoniMT                                 INFO HLT_2e17_lhvloose_L12EM3 decisions                    0         0         0         0         0         
 TrigSignatureMoniMT                                 INFO HLT_2e3_etcut_L12EM3          20        20        13        13        13        0         0         13        
 TrigSignatureMoniMT                                 INFO HLT_2e3_etcut_L12EM3 decisions                    46        233       85        0         0         
 TrigSignatureMoniMT                                 INFO HLT_2g20_tight_L12EM20VH      20        20        0         0         0         0         0         0         
@@ -42,14 +44,28 @@ TrigSignatureMoniMT                                 INFO HLT_beamspot_allTE_trkf
 TrigSignatureMoniMT                                 INFO HLT_beamspot_allTE_trkfast_BeamSpotPEB_L1J15 decisions                    20        20        0         0         0         
 TrigSignatureMoniMT                                 INFO HLT_costmonitor_CostMonDS_L1All20        20        20        20        0         0         0         20        
 TrigSignatureMoniMT                                 INFO HLT_costmonitor_CostMonDS_L1All decisions                    20        20        0         0         0         
+TrigSignatureMoniMT                                 INFO HLT_e140_lhloose_L1EM24VHI    20        20        0         0         0         0         0         0         
+TrigSignatureMoniMT                                 INFO HLT_e140_lhloose_L1EM24VHI decisions                    0         0         0         0         0         
 TrigSignatureMoniMT                                 INFO HLT_e26_etcut_L1EM22VHI       20        20        1         1         0         0         0         0         
 TrigSignatureMoniMT                                 INFO HLT_e26_etcut_L1EM22VHI decisions                    1         6         0         0         0         
+TrigSignatureMoniMT                                 INFO HLT_e26_lhtight_L1EM24VHI     20        20        0         0         0         0         0         0         
+TrigSignatureMoniMT                                 INFO HLT_e26_lhtight_L1EM24VHI decisions                    0         0         0         0         0         
+TrigSignatureMoniMT                                 INFO HLT_e300_etcut_L1EM24VHI      20        20        0         0         0         0         0         0         
+TrigSignatureMoniMT                                 INFO HLT_e300_etcut_L1EM24VHI decisions                    0         0         0         0         0         
 TrigSignatureMoniMT                                 INFO HLT_e3_etcut1step_mu6fast_L1EM8I_MU1020        20        0         0         0         0         0         0         
 TrigSignatureMoniMT                                 INFO HLT_e3_etcut1step_mu6fast_L1EM8I_MU10 decisions                    0         0         0         0         0         
 TrigSignatureMoniMT                                 INFO HLT_e3_etcut_L1EM3            20        20        15        13        13        0         0         13        
 TrigSignatureMoniMT                                 INFO HLT_e3_etcut_L1EM3 decisions                      48        233       85        0         0         
 TrigSignatureMoniMT                                 INFO HLT_e5_etcut_L1EM3            20        20        13        12        12        0         0         12        
 TrigSignatureMoniMT                                 INFO HLT_e5_etcut_L1EM3 decisions                      41        217       47        0         0         
+TrigSignatureMoniMT                                 INFO HLT_e5_lhloose_L1EM3          20        20        10        9         9         7         0         7         
+TrigSignatureMoniMT                                 INFO HLT_e5_lhloose_L1EM3 decisions                    15        71        28        9         0         
+TrigSignatureMoniMT                                 INFO HLT_e5_lhmedium_L1EM3         20        20        9         8         8         6         0         6         
+TrigSignatureMoniMT                                 INFO HLT_e5_lhmedium_L1EM3 decisions                    13        68        27        7         0         
+TrigSignatureMoniMT                                 INFO HLT_e5_lhtight_L1EM3          20        20        9         8         8         6         0         6         
+TrigSignatureMoniMT                                 INFO HLT_e5_lhtight_L1EM3 decisions                    13        68        27        7         0         
+TrigSignatureMoniMT                                 INFO HLT_e60_lhmedium_L1EM24VHI    20        20        0         0         0         0         0         0         
+TrigSignatureMoniMT                                 INFO HLT_e60_lhmedium_L1EM24VHI decisions                    0         0         0         0         0         
 TrigSignatureMoniMT                                 INFO HLT_e7_etcut_L1EM3            20        20        13        12        11        0         0         11        
 TrigSignatureMoniMT                                 INFO HLT_e7_etcut_L1EM3 decisions                      26        153       21        0         0         
 TrigSignatureMoniMT                                 INFO HLT_g140_etcut_L1EM24VHI      20        20        0         0         0         0         0         0         
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py
index 674d0b8afc00..8831abe08223 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronDef.py
@@ -12,6 +12,7 @@ from TriggerMenuMT.HLTMenuConfig.CommonSequences.CaloSequenceSetup import fastCa
 
 from TriggerMenuMT.HLTMenuConfig.Egamma.ElectronSequenceSetup import fastElectronMenuSequence
 from TriggerMenuMT.HLTMenuConfig.Egamma.PrecisionCaloSequenceSetup import precisionCaloMenuSequence
+from TriggerMenuMT.HLTMenuConfig.Egamma.PrecisionElectronSequenceSetup import precisionElectronMenuSequence
 
 #----------------------------------------------------------------
 # fragments generating configuration will be functions in New JO,
@@ -27,6 +28,9 @@ def fastElectronSequenceCfg( flags ):
 def precisionCaloSequenceCfg( flags ):
     return precisionCaloMenuSequence('Electron')
 
+def precisionElectronSequenceCfg( flags ):
+    return precisionElectronMenuSequence()
+
 #----------------------------------------------------------------
 # Class to configure chain
 #----------------------------------------------------------------
@@ -39,46 +43,76 @@ class ElectronChainConfiguration(ChainConfigurationBase):
     # Assemble the chain depending on information from chainName
     # ----------------------
     def assembleChain(self):
-        myStepNames = []
         chainSteps = []
         log.debug("Assembling chain for " + self.chainName)
         # --------------------
         # define here the names of the steps and obtain the chainStep configuration
         # --------------------
-        if 'etcut1step' in self.chainPart['addInfo']:
-            myStepNames += ["Step1_electron"]
-            for step in myStepNames:
-                chainSteps += [self.getElectronStep(step)]
-        elif 'etcut' in self.chainPart['addInfo']:
-            myStepNames += ["Step1_electron"]
-            myStepNames += ["Step2_electron"]
-            myStepNames += ["Step3_electron"]
-            for step in myStepNames:
-                chainSteps += [self.getElectronStep(step)]
+        etcut1step          = [ self.getFastCalo() ]
+        etcut_sequence      = [ self.getFastCalo(), self.getFastElectron(), self.getPrecisionCaloElectron()]
+        electron_sequence   = [ self.getFastCalo(), self.getFastElectron(), self.getPrecisionCaloElectron(), self.getPrecisionElectron()]
+
+        stepDictionary = {
+                'etcut1step': etcut1step,
+                'etcut'     : etcut_sequence,
+                'lhloose'   : electron_sequence,
+                'lhvloose'   : electron_sequence,
+                'lhmedium'  : electron_sequence,
+                'lhtight'   : electron_sequence,
+                }
+
+
+        log.debug('electron chain part = ' + str(self.chainPart))
+        key = self.chainPart['extra'] + self.chainPart['IDinfo'] + self.chainPart['isoInfo']
+        for addInfo in self.chainPart['addInfo']:
+            key+=addInfo
+            
+        log.debug('electron key = ' + key)
+        if key in stepDictionary:
+            steps=stepDictionary[key]
         else:
-            raise RuntimeError("Chain configuration unknown for chain: " + self.chainName )
+            raise RuntimeError("Chain configuration unknown for electron chain with key: " + key )
+
+        chainSteps = []
+
+        for step in steps:
+            log.debug('Adding electron trigger step ' + str(step))
+            chainSteps+=[step]
+    
+        myChain = self.buildChain(chainSteps)
+        return myChain
+
+
 
         myChain = self.buildChain(chainSteps)
         return myChain
 
     # --------------------
-    # Configuration of electron chain
+    # Configuration of electron steps
     # --------------------
-    def getElectronStep(self, stepName):
-        if stepName == "Step1_electron":
-          log.debug("Configuring step " + stepName)
-          fastCalo = RecoFragmentsPool.retrieve( electronFastCaloCfg, None ) # the None will be used for flags in future
-          chainStep =ChainStep(stepName, [fastCalo], [self.mult])
-        elif stepName == "Step2_electron":
-          log.debug("Configuring step " + stepName)
-          electronReco = RecoFragmentsPool.retrieve( fastElectronSequenceCfg, None )
-          chainStep=ChainStep(stepName, [electronReco], [self.mult])
-        elif stepName == "Step3_electron":
-          log.debug("Configuring step " + stepName)
-          precisionReco = RecoFragmentsPool.retrieve( precisionCaloSequenceCfg, None )
-          chainStep=ChainStep(stepName, [precisionReco], [self.mult])
-        else:
-          raise RuntimeError("chainStepName unknown: " + stepName )
 
-        log.debug("Returning chainStep from getEtCutStep function: " + stepName)
-        return chainStep
+    def getFastCalo(self):
+        stepName = "Step1_FastCalo_electron"
+        log.debug("Configuring step " + stepName)
+        fastCalo = RecoFragmentsPool.retrieve( electronFastCaloCfg, None ) # the None will be used for flags in future
+        return ChainStep(stepName, [fastCalo], [self.mult])
+
+    def getFastElectron(self):
+        stepName = "Step2_fast_electron"
+        log.debug("Configuring step " + stepName)
+        electronReco = RecoFragmentsPool.retrieve( fastElectronSequenceCfg, None )
+        return ChainStep(stepName, [electronReco], [self.mult])
+
+
+    def getPrecisionCaloElectron(self):
+        stepName = "Step3_precisionCalo_electron"
+        log.debug("Configuring step " + stepName)
+        precisionReco = RecoFragmentsPool.retrieve( precisionCaloSequenceCfg, None )
+        return ChainStep(stepName, [precisionReco], [self.mult]) 
+
+
+    def getPrecisionElectron(self):
+        stepName = "Step4_precision_electron"
+        log.debug("Configuring step " + stepName)
+        precisionElectron = RecoFragmentsPool.retrieve( precisionElectronSequenceCfg, None )
+        return ChainStep(stepName, [precisionElectron], [self.mult])
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py
index c2d63201de3c..b4cd900b24da 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py
@@ -22,7 +22,6 @@ def fastElectronSequence(ConfigFlags):
     RoIs = "EMIDRoIs" # contract with the fastCalo
     viewAlgs = makeInDetAlgs(whichSignature = "Electron", separateTrackParticleCreator="_Electron", rois = RoIs)
 
-
     # A simple algorithm to confirm that data has been inherited from parent view
     # Required to satisfy data dependencies
     from TriggerMenuMT.HLTMenuConfig.CommonSequences.CaloSequenceSetup import CaloMenuDefs  
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonDef.py
index cec13a6103a4..00db59002167 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonDef.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonDef.py
@@ -65,9 +65,13 @@ class PhotonChainConfiguration(ChainConfigurationBase):
             key+=addInfo
             
         log.debug('photon key = ' + key)
-        steps=stepDictionary[key]
+        if key in stepDictionary:
+            steps=stepDictionary[key]
+        else:
+            raise RuntimeError("Chain configuration unknown for photon chain with key: " + key )
 
         chainSteps = []
+
         for step in steps:
             log.debug('Adding photon trigger step ' + str(step))
             chainSteps+=[step]
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PrecisionElectronSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PrecisionElectronSequenceSetup.py
new file mode 100644
index 000000000000..a4cd9177ae0f
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PrecisionElectronSequenceSetup.py
@@ -0,0 +1,52 @@
+#
+#  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+#
+
+from AthenaConfiguration.AllConfigFlags import ConfigFlags
+
+# menu components   
+from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence, RecoFragmentsPool
+from AthenaCommon.CFElements import parOR, seqAND
+from ViewAlgs.ViewAlgsConf import EventViewCreatorAlgorithm
+
+
+def precisionElectronSequence(ConfigFlags):
+    """ fourth step:  precision tracking....."""    
+    InViewRoIs = "precisionElectron"
+    # EVCreator:
+    precisionTrackViewsMaker = EventViewCreatorAlgorithm("IMprecisionTrack")
+    precisionTrackViewsMaker.RoIsLink = "initialRoI" # -||-
+    precisionTrackViewsMaker.InViewRoIs = InViewRoIs # contract with the precisionCalo
+    precisionTrackViewsMaker.Views = "precisionElectronViews" #precisionTrackViews
+    precisionTrackViewsMaker.ViewFallThrough = True
+    precisionTrackViewsMaker.RequireParentView = True
+
+    # Configure the reconstruction algorithm sequence
+    from TriggerMenuMT.HLTMenuConfig.Electron.PrecisionElectronRecoSequences import precisionElectronRecoSequence
+    (electronPrecisionRec, electronPrecisionTrack, sequenceOut) = precisionElectronRecoSequence(InViewRoIs)
+
+    electronPrecisionInViewAlgs = parOR("electronPrecisionInViewAlgs", [electronPrecisionTrack, electronPrecisionRec])
+    precisionTrackViewsMaker.ViewNodeName = "electronPrecisionInViewAlgs"
+
+    electronPrecisionAthSequence = seqAND("electronPrecisionAthSequence", [precisionTrackViewsMaker, electronPrecisionInViewAlgs ] )
+    return (electronPrecisionAthSequence, precisionTrackViewsMaker, sequenceOut)
+
+
+def precisionElectronMenuSequence():
+    # retrieve the reco seuqence+EVC
+    (electronPrecisionAthSequence, precisionTrackViewsMaker, sequenceOut) = RecoFragmentsPool.retrieve(precisionElectronSequence, ConfigFlags)
+
+    # make the Hypo
+    from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaPrecisionElectronHypoAlgMT
+    thePrecisionElectronHypo = TrigEgammaPrecisionElectronHypoAlgMT("TrigEgammaPrecisionElectronHypoAlgMT")
+    thePrecisionElectronHypo.Electrons = sequenceOut
+    thePrecisionElectronHypo.RunInView = True
+
+    # from TrigEgammaHypo.TrigL2ElectronHypoTool import TrigL2ElectronHypoToolFromDict
+    from TrigEgammaHypo.TrigEgammaPrecisionElectronHypoTool import TrigEgammaPrecisionElectronHypoToolFromDict
+
+    return  MenuSequence( Maker       = precisionTrackViewsMaker,                                        
+                          Sequence    = electronPrecisionAthSequence,
+                          Hypo        = thePrecisionElectronHypo,
+                          HypoToolGen = TrigEgammaPrecisionElectronHypoToolFromDict )
+
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/PrecisionElectronRecoSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/PrecisionElectronRecoSequences.py
index 5c1d71db30ff..6aa56b3e9849 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/PrecisionElectronRecoSequences.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/PrecisionElectronRecoSequences.py
@@ -3,6 +3,7 @@
 #
 
 from AthenaCommon.CFElements import parOR, seqAND
+from AthenaCommon.GlobalFlags import globalflags
 
 #logging
 from AthenaCommon.Logging import logging
@@ -32,14 +33,18 @@ def precisionElectronRecoSequence(RoIs):
     ## Taking Fast Track information computed in 2nd step ##
     TrackCollection="TrigFastTrackFinder_Tracks_Electron"
     ViewVerifyTrk = CfgMgr.AthViews__ViewDataVerifier("FastTrackViewDataVerifier")
-
+    
+    
     ViewVerifyTrk.DataObjects = [('TrackCollection','StoreGateSvc+'+TrackCollection),
-                                 ('InDetBSErrContainer' , 'StoreGateSvc+SCT_ByteStreamErrs'),
-                                 ( 'InDetBSErrContainer' , 'StoreGateSvc+PixelByteStreamErrs' ),
-                                 ('xAOD::CaloClusterContainer' , 'StoreGateSvc+HLT_CaloClusters'),
-                                 ('SCT_FlaggedCondData','StoreGateSvc+SCT_FlaggedCondData_TRIG'),
-				 ( 'IDCInDetBSErrContainer' , 'StoreGateSvc+SCT_ByteStreamErrs' )]
+                                 ('xAOD::CaloClusterContainer' , precisionCaloMenuDefs.precisionCaloClusters),
+                                 ('SCT_FlaggedCondData','StoreGateSvc+SCT_FlaggedCondData_TRIG')]
     
+    if globalflags.InputFormat.is_bytestream():
+       ViewVerifyTrk.DataObjects += [( 'InDetBSErrContainer' , 'StoreGateSvc+SCT_ByteStreamErrs' ) ,
+                                    ( 'InDetBSErrContainer' , 'StoreGateSvc+PixelByteStreamErrs' ),
+                                    ( 'IDCInDetBSErrContainer' , 'StoreGateSvc+SCT_ByteStreamErrs' ) ]
+
+    # AlgSequence.SGInputLoader.Load.append([ ('InDetBSErrContainer','StoreGateSvc+PixelByteStreamErrs') ])
     """ Precision Track Related Setup.... """
     PTAlgs = []
     PTTracks = []
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
index 2bfdab606346..d30da9a35bc6 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py
@@ -61,6 +61,19 @@ def setupMenu():
 
         ChainProp(name='HLT_2e3_etcut_L12EM3', stream=[PhysicsStream], groups=MultiElectronGroup),
 
+        # low et threshold for debugging
+        ChainProp(name='HLT_e5_lhloose_L1EM3', groups=SingleElectronGroup),
+        ChainProp(name='HLT_e5_lhmedium_L1EM3', groups=SingleElectronGroup),
+        ChainProp(name='HLT_e5_lhtight_L1EM3', groups=SingleElectronGroup),
+
+        # Primary
+        ChainProp(name='HLT_e26_lhtight_L1EM24VHI', groups=SingleElectronGroup),
+        ChainProp(name='HLT_e60_lhmedium_L1EM24VHI', groups=SingleElectronGroup),
+        ChainProp(name='HLT_e140_lhloose_L1EM24VHI', groups=SingleElectronGroup),
+        ChainProp(name='HLT_e300_etcut_L1EM24VHI', groups=SingleElectronGroup),
+
+        ChainProp(name='HLT_2e17_lhvloose_L12EM3', stream=[PhysicsStream], groups=MultiElectronGroup),
+
         # PhotonChains------------
         # these are to debug photon working points should be removed in production
         ChainProp(name='HLT_g5_etcut_L1EM3', groups=SinglePhotonGroup),
diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py
index cfda5726d232..85503a0a63af 100644
--- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py
+++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py
@@ -336,7 +336,7 @@ ElectronChainParts = {
     'trigType'       : ['e'],
     'threshold'      : '',
     'etaRange'       : [],
-    'IDinfo'         : ['lhtight'],
+    'IDinfo'         : ['lhvloose','lhloose','lhmedium','lhtight'],
     'isoInfo'        : [],
     'trkInfo'        : ['idperf'],
     'caloInfo'       : [],
-- 
GitLab