diff --git a/Trigger/TriggerCommon/TriggerJobOpts/cmt/requirements b/Trigger/TriggerCommon/TriggerJobOpts/cmt/requirements
new file mode 100644
index 0000000000000000000000000000000000000000..3d2dfc4651a7bffd3e5df52e09ef367d93251483
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/cmt/requirements
@@ -0,0 +1,15 @@
+package TriggerJobOpts
+
+ 
+author  Tomasz Bold <Tomasz.Bold@cern.ch>
+
+use AtlasPolicy 	AtlasPolicy-*
+use TrigEDMConfig 	TrigEDMConfig-* 	Trigger/TriggerCommon	-no_auto_imports
+use TrigTier0 		TrigTier0-* 		Trigger/TriggerCommon	-no_auto_imports
+
+apply_pattern declare_joboptions files="*.py "
+apply_pattern declare_python_modules files="*.py"
+
+
+
+
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/doc/mainpage.h b/Trigger/TriggerCommon/TriggerJobOpts/doc/mainpage.h
new file mode 100644
index 0000000000000000000000000000000000000000..cf12124f81de4c627f263ecdfc3bbfa2809d17b8
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/doc/mainpage.h
@@ -0,0 +1,22 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/**
+
+@mainpage
+
+@section TriggerJobOptsIntroduction Introduction
+This package contains basic configuration scripts for Trigger.
+This are python Getters for HLT and LVL1 for various usecases.
+
+It also contains global TriggerFlags container of job properties.
+
+This package does not contain code and is not meant to be used by developers.
+The usefull information is however set of flags defined in python::TriggerFlags .
+
+@htmlinclude used_packages.html
+
+@include requirements
+
+*/
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/GenerateOnlineMenu.py b/Trigger/TriggerCommon/TriggerJobOpts/python/GenerateOnlineMenu.py
new file mode 100644
index 0000000000000000000000000000000000000000..c4ad6c68966bd0db3c5b64af7ca163fcbd876028
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/GenerateOnlineMenu.py
@@ -0,0 +1,330 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from AthenaCommon.Logging import logging
+
+# flags
+from TriggerJobOpts.TriggerFlags            import TriggerFlags
+from TriggerMenuPython.EgammaSliceFlags     import EgammaSliceFlags
+from TriggerMenuPython.TauSliceFlags        import TauSliceFlags
+from TriggerMenuPython.JetSliceFlags        import JetSliceFlags
+from TriggerMenuPython.METSliceFlags        import METSliceFlags
+from TriggerMenuPython.MuonSliceFlags       import MuonSliceFlags
+from TriggerMenuPython.BphysicsSliceFlags   import BphysicsSliceFlags
+from TriggerMenuPython.BjetSliceFlags       import BjetSliceFlags
+from TriggerMenuPython.CombinedSliceFlags   import CombinedSliceFlags
+from TriggerMenuPython.MinBiasSliceFlags    import MinBiasSliceFlags
+from TriggerMenuPython.CosmicSliceFlags     import CosmicSliceFlags
+from TriggerMenuPython.Lvl1Flags            import Lvl1Flags
+from TriggerMenuPython.CosmicSliceFlags     import CosmicSliceFlags
+from TriggerMenuPython.GenericSliceFlags    import GenericSliceFlags
+from TriggerMenuPython.MonitorSliceFlags    import MonitorSliceFlags
+
+# lvl1
+from TriggerMenuPython.Lvl1                 import Lvl1
+from TriggerMenuPython.Egamma_Lvl1          import Egamma_Lvl1
+from TriggerMenuPython.Bphysics_Lvl1        import Bphysics_Lvl1
+
+# hlt
+from TriggerMenuPython.TriggerPythonConfig  import TriggerPythonConfig
+from TriggerMenuPython.Express              import addExpressStream
+from TriggerMenuPython.Lumi                 import lumi
+
+def reportSliceImportError(flags):
+    log = logging.getLogger( 'GenerateOnlineMenu.py' )
+    if flags.signatures() == None or len(flags.signatures()) == 0:
+        log.warning("Error in configuration of "+flags.__class__.__name__+" but it is not required so we can continue")
+    else:
+        log.error("Error in configuration of "+flags.__class__.__name__)
+        raise
+
+
+class GenerateOnlineMenu:
+    def __init__(self):
+
+        log = logging.getLogger( 'GenerateOnlineMenu.py' )
+        log.info('Including lvl1 configurations')
+        # if TrigT1ConfigVersion:
+
+        #self.egamma_lvl1 = Egamma_Lvl1()
+        #self.bphysics_lvl1 = Bphysics_Lvl1()
+
+        log.info('Including HLT configurations')
+        self.chains = []
+
+        #-----------------------------------------------------------------------------
+        if TriggerFlags.EgammaSlice.signatures():
+            try:
+                current = TriggerFlags.EgammaSlice.signatures.get_Value()
+                hasPhoton =  [ True for x in current if "g" == x[0] or "g" == x[1] ]
+                hasElectron =  [ True for x in current if not ("g" == x[0] or "g" == x[1]) ]
+
+                if hasElectron:
+                    from TriggerMenuPython.EMObject           import EMObjects
+                    from TriggerMenuPython.Electron           import Electrons
+                    from TriggerMenuPython.MultiElectron      import MultiElectrons
+                    self.chains += EMObjects
+                    self.chains += Electrons
+                    self.chains += MultiElectrons
+
+                if hasPhoton:
+                    from TriggerMenuPython.Photon             import Photons
+                    from TriggerMenuPython.MultiPhoton        import MultiPhotons
+                    self.chains += Photons
+                    self.chains += MultiPhotons
+            except:
+                reportSliceImportError(EgammaSliceFlags)
+
+        #-----------------------------------------------------------------------------            
+        if TriggerFlags.MuonSlice.signatures():
+            try:
+                from TriggerMenuPython.Muon               import Muons
+                from TriggerMenuPython.MultiMuon          import MultiMuons            
+                self.chains += Muons
+                self.chains += MultiMuons
+            except:
+                reportSliceImportError(MuonSliceFlags)
+
+        #-----------------------------------------------------------------------------
+        if TriggerFlags.TauSlice.signatures():
+            try:
+                from TriggerMenuPython.Tau                import Taus
+                from TriggerMenuPython.MultiTau           import MultiTaus
+                self.chains += Taus
+                self.chains += MultiTaus
+            except:
+                reportSliceImportError(TauSliceFlags)
+
+        #-----------------------------------------------------------------------------
+        if TriggerFlags.METSlice.signatures():
+            try:
+                from TriggerMenuPython.MissingET          import MissingETs
+
+                self.chains += MissingETs            
+            except:
+                reportSliceImportError(METSliceFlags) 
+
+        #-----------------------------------------------------------------------------
+        if TriggerFlags.JetSlice.signatures():
+            try:
+                from TriggerMenuPython.JetSequence        import JetSequences
+                from TriggerMenuPython.Jet                import Jets
+            
+                self.chains += JetSequences
+                self.chains += Jets
+            except:
+                reportSliceImportError(JetSliceFlags)
+            
+        #-----------------------------------------------------------------------------
+        if TriggerFlags.BjetSlice.signatures():
+            try:
+                from TriggerMenuPython.Bjet               import Bjets
+                from TriggerMenuPython.MultiBjet          import MultiBjets
+            
+                self.chains += Bjets
+                self.chains += MultiBjets
+            except:
+                reportSliceImportError(BjetSliceFlags)
+
+        #-----------------------------------------------------------------------------
+        if TriggerFlags.BphysicsSlice.signatures():
+            try:
+                from TriggerMenuPython.Bphysics           import Bphysics
+                self.chains += Bphysics
+            except:
+                reportSliceImportError(BphysicsSliceFlags)
+            
+        #-----------------------------------------------------------------------------            
+        if TriggerFlags.MinBiasSlice.signatures():
+            try:
+                from TriggerMenuPython.MinBias import MinBias
+                self.chains += MinBias
+            except:
+                reportSliceImportError(MinBiasSliceFlags) 
+
+        #-----------------------------------------------------------------------------            
+        #if TriggerFlags.CosmicSlice.signatures():
+        try:
+            from TriggerMenuPython.Cosmic import Cosmics
+            self.chains += Cosmics
+        except:
+            reportSliceImportError(CosmicSliceFlags) 
+
+        #-----------------------------------------------------------------------------
+        if TriggerFlags.CombinedSlice.signatures():
+            try:
+                from TriggerMenuPython.Combined           import TauElectrons, TauMuons, TauMETs, JetMETs, ElectronMETs
+                from TriggerMenuPython.Combined           import MuonMETs, MuonMETs, ElectronJets, MuonJets, ElectronMuons
+                from TriggerMenuPython.Combined           import PhotonMETs, PhotonElectrons, PhotonMuons, TauJets, TauBjets, TripleSignatures
+                self.chains += TauElectrons
+                self.chains += TauMuons
+                self.chains += TauMETs
+                self.chains += JetMETs
+                self.chains += ElectronMETs
+                self.chains += MuonMETs
+                self.chains += ElectronJets
+                self.chains += MuonJets
+                self.chains += ElectronMuons
+                self.chains += PhotonMETs
+                self.chains += PhotonElectrons
+                self.chains += PhotonMuons
+                self.chains += TauJets
+                self.chains += TauBjets
+                self.chains += TripleSignatures
+            except:
+                reportSliceImportError(CombinedSliceFlags)
+                
+        #-----------------------------------------------------------------------------            
+        if TriggerFlags.GenericSlice.signatures():
+            try:
+                from TriggerMenuPython.GenericDef import Generic
+                self.chains += Generic
+            except:
+                reportSliceImportError(GenericSliceFlags)
+                
+        #-----------------------------------------------------------------------------            
+        if TriggerFlags.MonitorSlice.signatures():
+            try:
+                from TriggerMenuPython.MonitorDef import MonitorChainList
+                self.chains += MonitorChainList
+            except:
+                reportSliceImportError(MonitorSliceFlags)                
+        
+    def generate(self):
+        log = logging.getLogger( 'GenerateOnlineMenu.py' )
+
+        if TriggerFlags.readHLTconfigFromXML() and TriggerFlags.readLVL1configFromXML():
+            log.info('XML files generation not requested')
+            return
+
+        log.info('Doing consistency checks between defined slice signatures flags and accessible HLT configurations')
+        log.info('Creating list of all available slice signatures flags')
+        slice_signatures = []
+        if TriggerFlags.EgammaSlice.signatures():
+       	    slice_signatures.extend(EgammaSliceFlags.signatures.allowedValues())
+        if TriggerFlags.TauSlice.signatures():
+            slice_signatures.extend(TauSliceFlags.signatures.allowedValues())
+        if TriggerFlags.JetSlice.signatures():
+            slice_signatures.extend(JetSliceFlags.signatures.allowedValues())
+        if TriggerFlags.METSlice.signatures():
+            slice_signatures.extend(METSliceFlags.signatures.allowedValues())
+        if TriggerFlags.MuonSlice.signatures():
+            slice_signatures.extend(MuonSliceFlags.signatures.allowedValues())
+        if TriggerFlags.BphysicsSlice.signatures():
+            slice_signatures.extend(BphysicsSliceFlags.signatures.allowedValues())
+        if TriggerFlags.BjetSlice.signatures():
+            slice_signatures.extend(BjetSliceFlags.signatures.allowedValues())
+        if TriggerFlags.CombinedSlice.signatures():
+            slice_signatures.extend(CombinedSliceFlags.signatures.allowedValues())
+        if TriggerFlags.MinBiasSlice.signatures():
+            slice_signatures.extend(MinBiasSliceFlags.signatures.allowedValues())
+        #if TriggerFlags.CosmicSlice.signatures():
+        slice_signatures.extend(CosmicSliceFlags.signatures.allowedValues())
+        log.info('All possible slice signatures flags: '+str(slice_signatures))
+
+        log.debug('Creating list of available configurations')
+        configs = [ x.sig_id for x in self.chains ]
+        log.info('All possible configurations: '+str(configs))
+
+        for i in slice_signatures:
+            if i not in configs:
+                log.warning('Slice signature flag: '+i+' defined but no corresponding configuration exists')
+
+            
+        log.info('generating XML configuration files')
+        log.info('LVL1: '+str(TriggerFlags.inputLVL1configFile()))
+        log.info('HLT : '+str(TriggerFlags.inputHLTconfigFile()))
+
+        triggerPythonConfig = TriggerPythonConfig(TriggerFlags.outputHLTconfigFile(),
+                                                  TriggerFlags.outputLVL1configFile())
+
+        # global triggerPythonConfig
+
+        lvl1_items = []
+        lvl1_items.extend(Lvl1Flags.items())
+        lvl1_thresholds = []
+        lvl1_thresholds.extend(Lvl1Flags.thresholds())
+        Lvl1.registerItems(triggerPythonConfig)
+        log.info('N L1 items     : %s (/256)' % len(lvl1_items) )
+        log.info('N L1 thresholds: %s (/54)' % len(lvl1_thresholds) )
+
+        # pregenerate chains
+        for chaindef in self.chains:
+            log.info("generating: %s" % chaindef.sig_id )
+            chaindef.generateMenu(triggerPythonConfig)
+
+        # go over the slices and put together big list of signatures requested
+        sigs = []
+        log.info('modifying menu according to the luminosity and prescaling setup')
+        lumi(triggerPythonConfig)
+        addExpressStream(triggerPythonConfig)
+        # lumi_old_20071003(triggerPythonConfig)
+
+        # make one big list of enabled signatures
+        if EgammaSliceFlags.signatures():   # this protection for None rather than some list --- it can happen if slice is disabled
+            sigs += EgammaSliceFlags.signatures()
+
+        if MuonSliceFlags.signatures():
+            sigs += MuonSliceFlags.signatures()
+
+        if TauSliceFlags.signatures():
+            sigs += TauSliceFlags.signatures()
+
+        if JetSliceFlags.signatures():
+            sigs += JetSliceFlags.signatures()
+
+        if BjetSliceFlags.signatures():
+            sigs += BjetSliceFlags.signatures()
+
+        if BphysicsSliceFlags.signatures():
+            sigs += BphysicsSliceFlags.signatures()
+
+        if METSliceFlags.signatures():
+            sigs += METSliceFlags.signatures()
+
+        if CombinedSliceFlags.signatures():
+            sigs += CombinedSliceFlags.signatures()
+
+        if MinBiasSliceFlags.signatures():
+            sigs += MinBiasSliceFlags.signatures()
+
+        if CosmicSliceFlags.signatures():
+            sigs += CosmicSliceFlags.signatures()
+
+        log.info( 'Enabled signatures: '+str(sigs) )
+
+
+        # note only this chains enter current config
+        # print triggerPythonConfig.allChains
+
+##         log.info('modifying menu according to the luminosity and prescaling setup')
+##         lumi(triggerPythonConfig)
+        if not TriggerFlags.readLVL1configFromXML:
+            Lvl1.generateMenu(triggerPythonConfig, \
+                              Lvl1Flags.items(), Lvl1Flags.thresholds())
+        for name, chains in triggerPythonConfig.allChains.iteritems():
+            if name in sigs:
+                log.info("placing in the configuration chains for: %s" % name )
+                [triggerPythonConfig.addHLTChain(c) for c in chains]
+
+        # dump configuration files
+        triggerPythonConfig.writeConfigFiles()
+        triggerPythonConfig.dot(algs=True)
+
+        # suggest counters for new chains
+        countersL2 = []
+        countersEF = []
+        for name, chains in triggerPythonConfig.allChains.iteritems():
+            for c in chains:
+
+                if c.isL2():
+                    countersL2.append(int(c.chain_counter))
+                if c.isEF():
+                    countersEF.append(int(c.chain_counter))
+        countersL2.sort()
+        countersEF.sort()
+        maxL2 = max(countersL2)
+        maxEF = max(countersEF)
+
+        log.info("L2 available chain counters:" +str([x for x in range(0, 1023) if x not in countersL2]))
+        log.info("EF available chain counters:" +str([x for x in range(0, 1023) if x not in countersEF]))
+
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/HLTTriggerGetter.py b/Trigger/TriggerCommon/TriggerJobOpts/python/HLTTriggerGetter.py
new file mode 100644
index 0000000000000000000000000000000000000000..510551f4572f52f96b4186349756743f1e98953b
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/HLTTriggerGetter.py
@@ -0,0 +1,281 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+from AthenaCommon.Logging import logging  # loads logger
+from PerfMonComps.PerfMonFlags import jobproperties
+from AthenaCommon.Include import include
+from AthenaCommon.GlobalFlags import GlobalFlags
+from RegionSelector.RegSelSvcDefault import RegSelSvcDefault
+# serializer replacing usuall online (this needs to be moved to TrigNavigation in DEV) ???
+from TrigSerializeResult.TrigSerializeResultConf import TrigTSerializer
+
+from AthenaCommon.AppMgr import ServiceMgr, ToolSvc, theApp
+from AthenaCommon.Include import include
+
+from RecExConfig.Configured import Configured
+
+from AthenaCommon.Constants import VERBOSE, DEBUG, INFO, ERROR
+
+def getHLTOutputLevel():
+    level=DEBUG
+    if globals().has_key('HLTOutputLevel'):
+        level= globals()['HLTOutputLevel']
+    return level
+
+def makeKeysList(inputDict):
+    tmpList={}
+    for typename,v in inputDict.iteritems():
+        if type(v) is type({}):
+            stored = typename
+            if 'collection' in v.keys():
+                stored = v['collection']
+            tmpList[ stored ] = v['sgkeys']
+        else:
+            tmpList[ typename ] = v
+    return tmpList
+
+
+def setTHistSvcOutput(outputList):
+    """Build the Output list of the THistSvc. This is used below and to
+    configure athenaMT/PT when running from the online DB but with the
+    offline THistSvc"""
+    
+    if 1 not in [ o.count('SHIFT') for o in outputList ]:
+        outputList += [ "SHIFT DATAFILE='shift-monitoring.root' OPT='RECREATE'"]
+    if 1 not in [ o.count('EXPERT') for o in outputList ]:
+        outputList += [ "EXPERT DATAFILE='expert-monitoring.root' OPT='RECREATE'"]
+    if 1 not in [ o.count('run_1') for o in outputList ]:
+        outputList += [ "run_1 DATAFILE='lbn-monitoring.root' OPT='RECREATE'"]        
+    if 1 not in [ o.count('RUNSTAT') for o in outputList ]:
+        outputList += [ "RUNSTAT DATAFILE='runstat-monitoring.root' OPT='RECREATE'"]
+    if 1 not in [ o.count('DEBUG') for o in outputList ]:        
+        outputList += [ "DEBUG DATAFILE='debug-monitoring.root' OPT='RECREATE'"]
+
+    return
+        
+    
+def monitoringTools(steering):
+    log = logging.getLogger("monitoringTools" )
+    LBNdepth=4
+    if 'EF' in steering.name():
+        LBNdepth = 6
+    def assign_prop_value(a):
+        try:
+            a.LBNHistoryDepth = LBNdepth
+        except:
+            return False
+        return True
+
+    try:
+        Set = set
+    except NameError:
+        from sets import Set
+    setOfEnabled = Set(TriggerFlags.enableMonitoring()) # this is set of enabled monitoring targets
+
+    log.info("requested targets: "+str(setOfEnabled)+" pruning other tools")
+    # prune subalgorithms
+    for alg in steering.getChildren():
+        tokeep = [ x for x in alg.AthenaMonTools if len(Set(x.target()) & setOfEnabled) != 0 ]
+        log.debug( "will keep "+str( [ x.getFullName() for x in tokeep ]) )
+        toscratch = list(set(alg.AthenaMonTools)-set(tokeep))        
+        log.debug( "will scratch "+str( [ x.getFullName() for x in toscratch ]) )
+        del toscratch        
+        
+        [ assign_prop_value(x) for x in tokeep ]
+        alg.AthenaMonTools = tokeep
+        
+        if "Time" in TriggerFlags.enableMonitoring() or "TimeTree" in TriggerFlags.enableMonitoring():
+            alg.doTiming=True            
+
+        if "Log" in  TriggerFlags.enableMonitoring():
+            alg.OutputLevel=getHLTOutputLevel()
+
+
+    # prune steering monitoring tools
+    steering.pruneSteeringMonTools(TriggerFlags.enableMonitoring())
+    [ assign_prop_value(x) for x in steering.MonTools  ]
+
+    from AthenaCommon.AppMgr import ServiceMgr
+    # Enable performance monitoring
+    if 'PerfMon' in TriggerFlags.enableMonitoring():
+        from PerfMonComps.JobOptCfg import PerfMonSvc
+        jobproperties.PerfMonFlags.doMonitoring = True
+        ServiceMgr += PerfMonSvc()
+
+    log.debug("Setting up offline THistSvc")
+    if not hasattr(ServiceMgr, 'THistSvc'):        
+        from GaudiSvc.GaudiSvcConf import THistSvc
+        ServiceMgr += THistSvc()
+    if hasattr(ServiceMgr.THistSvc, "Output"): # this is offline THistSvc fo which we want to setup files
+        setTHistSvcOutput(ServiceMgr.THistSvc.Output)
+        
+
+def keyToLabel(key):
+    """ The key is usually HLT_blablah, this function returns second part of it or empty string
+    """
+    if '_' not in key:
+        return ''
+    else:
+        return key[key.index('_'):].lstrip('_')
+
+class HLTSimulationGetter(Configured):
+
+    log = logging.getLogger("HLTTriggergetter.py")
+
+    def configure(self):
+        
+        log = logging.getLogger("HLTTriggergetter.py")
+
+        from AthenaCommon.AlgSequence import AlgSequence 
+        topSequence = AlgSequence()
+
+        #scheduling eventinfo
+        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
+        if not hasattr(svcMgr, 'HltEventLoopMgr'):
+            from RecExConfig.ObjKeyStore import objKeyStore
+            if not objKeyStore.isInInput( "xAOD::EventInfo_v1"):
+                from xAODEventInfoCnv.xAODEventInfoCreator import xAODMaker__EventInfoCnvAlg
+                topSequence+=xAODMaker__EventInfoCnvAlg()
+	        
+
+        log.info("Loading RegionSelector")
+        from AthenaCommon.AppMgr import ServiceMgr
+        ServiceMgr += RegSelSvcDefault()
+
+        # Configure the Data Preparation for Calo
+        # This is a hack - configurables and toolhandles can be changed for next release
+        if TriggerFlags.doCalo():  
+            include('TrigT2CaloCommon/TrigDataAccessConfigured.py')
+        
+        if TriggerFlags.doFTK():
+            # FTK algorithm inclusions
+            from TrigFTKSim.TrigFTKSimConf import FTKMergerAlgo
+            FTKMerger = FTKMergerAlgo( "FTKMergerAlgo" , OutputLevel=INFO)
+            topSequence+= FTKMerger
+        
+        if TriggerFlags.doLVL2():
+            log.info("configuring LVL2")
+            from TrigSteering.TrigSteeringConfig import TrigSteer_L2, ReruningTrigSteer_L2
+            if TriggerFlags.doFEX():
+                log.info("configuring LVL2 for normal running (FEX + Hypo)")
+                TrigSteer_L2 = TrigSteer_L2('TrigSteer_L2', hltFile=TriggerFlags.inputHLTconfigFile(), lvl1File=TriggerFlags.inputLVL1configFile())
+                TrigSteer_L2.doHypo = TriggerFlags.doHypo()
+                
+            if not TriggerFlags.doFEX() and TriggerFlags.doHypo():
+                log.info("configuring LVL2 for re-running (Hypo only)")
+                TrigSteer_L2 = ReruningTrigSteer_L2('TrigSteer_L2', hltFile=TriggerFlags.inputHLTconfigFile(), lvl1File=TriggerFlags.inputLVL1configFile())
+
+                #            if not TriggerFlags.writeBS():
+            from TrigEDMConfig.TriggerEDM import getL2PreregistrationList, getEDMLibraries
+            TrigSteer_L2.Navigation.ClassesToPreregister = getL2PreregistrationList()
+                    
+            TrigSteer_L2.Navigation.Dlls = getEDMLibraries()
+            
+            monitoringTools(TrigSteer_L2)            
+            topSequence += TrigSteer_L2
+
+        
+        if TriggerFlags.doEF():
+            log.info("configuring EF")
+            from TrigSteering.TrigSteeringConfig import TrigSteer_EF,ReruningAfterL2TrigSteer_EF
+            if TriggerFlags.doFEX():            
+                TrigSteer_EF = TrigSteer_EF('TrigSteer_EF', hltFile=TriggerFlags.inputHLTconfigFile(), lvl1File=TriggerFlags.inputLVL1configFile())
+                TrigSteer_EF.doHypo = TriggerFlags.doHypo()
+                
+            if not TriggerFlags.doFEX() and TriggerFlags.doHypo():
+                TrigSteer_EF = ReruningAfterL2TrigSteer_EF('TrigSteer_EF', hltFile=TriggerFlags.inputHLTconfigFile(), lvl1File=TriggerFlags.inputLVL1configFile())
+
+            # if not TriggerFlags.writeBS():
+            from TrigEDMConfig.TriggerEDM import getEFPreregistrationList, getEDMLibraries
+            TrigSteer_EF.Navigation.ClassesToPreregister = getEFPreregistrationList()
+
+            TrigSteer_EF.Navigation.Dlls = getEDMLibraries()
+
+            monitoringTools(TrigSteer_EF)
+            topSequence += TrigSteer_EF
+
+            
+            ### merged system
+        if TriggerFlags.doHLT():
+            log.info("configuring merged HLT")
+           
+            from TrigSteering.TrigSteeringConfig import TrigSteer_HLT, ReruningTrigSteer_HLT
+            #, ReruningAfterL2TrigSteer_EF
+            if TriggerFlags.doFEX():
+                log.info("configuring HLT merged system, for normal running (FEX + Hypo)")
+                TrigSteer_HLT = TrigSteer_HLT('TrigSteer_HLT', hltFile=TriggerFlags.inputHLTconfigFile(), lvl1File=TriggerFlags.inputLVL1configFile())
+                TrigSteer_HLT.doHypo = TriggerFlags.doHypo()
+ 
+
+            if not TriggerFlags.doFEX() and TriggerFlags.doHypo():
+                log.info("configuring merged HLT for re-running (Hypo only)")
+                TrigSteer_HLT = ReruningTrigSteer_HLT('TrigSteer_HLT', hltFile=TriggerFlags.inputHLTconfigFile(), lvl1File=TriggerFlags.inputLVL1configFile())             
+                #            if not TriggerFlags.writeBS():
+            from TrigEDMConfig.TriggerEDM import getL2PreregistrationList, getEFPreregistrationList, getHLTPreregistrationList, getEDMLibraries
+            TrigSteer_HLT.Navigation.ClassesToPreregister = list(set(getL2PreregistrationList() + getEFPreregistrationList() + getHLTPreregistrationList())) 
+            TrigSteer_HLT.Navigation.Dlls = getEDMLibraries()                       
+
+            monitoringTools(TrigSteer_HLT)
+            topSequence += TrigSteer_HLT
+
+
+        if TriggerFlags.writeBS():            
+            # declare objects to go to BS (from the lists above)
+            if TriggerFlags.doLVL2():                
+                from TrigEDMConfig.TriggerEDM import getL2BSList
+                TrigSteer_L2.Navigation.ClassesToPayload = getL2BSList()
+                TrigSteer_L2.Navigation.ClassesToPreregister = []
+            
+            if TriggerFlags.doEF():
+                from TrigEDMConfig.TriggerEDM import getEFBSList
+                TrigSteer_EF.Navigation.ClassesToPayload = getEFBSList()
+                TrigSteer_EF.Navigation.ClassesToPreregister = []
+                try:
+                    from TrigEDMConfig.TriggerEDM import getEFDSList
+                    TrigSteer_EF.Navigation.ClassesToPayload_DSonly = getEFDSList()
+                except ImportError:
+                    log.warning("DataScouting not available in this release")
+
+                ### merged system
+            if TriggerFlags.doHLT():
+                from TrigEDMConfig.TriggerEDM import getL2BSList, getEFBSList, getHLTBSList
+                TrigSteer_HLT.Navigation.ClassesToPayload = list(set(getL2BSList() + getEFBSList() + getHLTBSList())) 
+                TrigSteer_HLT.Navigation.ClassesToPreregister = []
+                try:
+                    from TrigEDMConfig.TriggerEDM import getEFDSList,getHLTDSList
+                    TrigSteer_HLT.Navigation.ClassesToPayload_DSonly = getEFDSList() + getHLTDSList()
+                except ImportError:
+                    log.warning("DataScouting not available in this release")
+                
+
+            #configure tools for serialization
+            from TrigSerializeTP.TrigSerializeTPConf import TrigSerTPTool
+            TrigSerToolTP = TrigSerTPTool('TrigSerTPTool')
+            from TrigEDMConfig.TriggerEDM import getTPList
+            TrigSerToolTP.TPMap = getTPList()
+            from AthenaCommon.AppMgr import ToolSvc
+            ToolSvc += TrigSerToolTP
+
+            from TrigSerializeCnvSvc.TrigSerializeCnvSvcConf import TrigSerializeConvHelper
+            TrigSerializeConvHelper = TrigSerializeConvHelper(doTP = True)
+            ToolSvc += TrigSerializeConvHelper
+
+            #do not activate T/P of EF classes at L2
+            if TriggerFlags.doLVL2(): 
+                from TrigEDMConfig.TriggerEDM import getL2BSTypeList
+                TrigSerToolTP.ActiveClasses = getL2BSTypeList()
+            if TriggerFlags.doEF():
+                from TrigEDMConfig.TriggerEDM import getL2BSTypeList, getEFBSTypeList
+                TrigSerToolTP.ActiveClasses = getL2BSTypeList() + getEFBSTypeList()
+
+            ### merged system
+            if TriggerFlags.doHLT():
+                from TrigEDMConfig.TriggerEDM import getL2BSTypeList, getEFBSTypeList,getHLTBSTypeList
+                TrigSerToolTP.ActiveClasses = list(set(getL2BSTypeList() + getEFBSTypeList() + getHLTBSTypeList())) 
+
+        from TriggerJobOpts.HLTTriggerResultGetter import HLTTriggerResultGetter
+        result = HLTTriggerResultGetter()
+        return True
+
+
+         
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/HLTTriggerResultGetter.py b/Trigger/TriggerCommon/TriggerJobOpts/python/HLTTriggerResultGetter.py
new file mode 100644
index 0000000000000000000000000000000000000000..772115fb7f72519751fe62718bed144de74a630d
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/HLTTriggerResultGetter.py
@@ -0,0 +1,334 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+from AthenaCommon.Logging import logging  # loads logger
+from AthenaCommon.Include import include
+from AthenaCommon.GlobalFlags import GlobalFlags
+from RegionSelector.RegSelSvcDefault import RegSelSvcDefault
+
+from AthenaCommon.AppMgr import ServiceMgr, ToolSvc, theApp
+from AthenaCommon.Include import include
+
+from RecExConfig.Configured import Configured
+
+from AthenaCommon.Constants import VERBOSE, DEBUG, INFO, ERROR
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+from RecExConfig.RecAlgsFlags import recAlgs
+from RecExConfig.RecFlags import rec
+
+
+class xAODConversionGetter(Configured):
+    def configure(self):
+        log = logging.getLogger('xAODConversionGetter.py')
+        from AthenaCommon.AlgSequence import AlgSequence 
+        topSequence = AlgSequence()
+
+        #schedule xAOD conversions here
+        from TrigBSExtraction.TrigBSExtractionConf import TrigHLTtoxAODConversion
+        xaodconverter = TrigHLTtoxAODConversion()
+        
+        from TrigNavigation.TrigNavigationConfig import HLTNavigationOffline
+        xaodconverter.Navigation = HLTNavigationOffline()
+
+        from TrigEDMConfig.TriggerEDM import getPreregistrationList,getL2PreregistrationList,getEFPreregistrationList,getEDMLibraries
+        xaodconverter.Navigation.ClassesToPreregister = getPreregistrationList()        
+        #we attempt to convert the entire old navigation (L2+EF)
+        xaodconverter.BStoxAOD.ContainersToConvert = list(set(getL2PreregistrationList()+getEFPreregistrationList()))
+
+        xaodconverter.HLTResultKey="HLTResult_EF"
+        topSequence += xaodconverter
+
+        return True
+    
+        
+
+class ByteStreamUnpackGetter(Configured):
+    def configure(self):
+
+        log = logging.getLogger("ByteStreamUnpackGetter.py")
+        from AthenaCommon.AlgSequence import AlgSequence 
+        topSequence = AlgSequence()
+        
+        #if TriggerFlags.readBS():
+        log.info( "TriggerFlags.dataTakingConditions: %s" % TriggerFlags.dataTakingConditions() )
+        # in MC this is always FullTrigger
+        hasHLT = TriggerFlags.dataTakingConditions()=='HltOnly' or TriggerFlags.dataTakingConditions()=='FullTrigger'
+        
+        if hasHLT:
+            from AthenaCommon.AppMgr import ServiceMgr
+            # Decide based on the run number whether to assume a merged, or a
+            # split HLT:
+            if not TriggerFlags.doMergedHLTResult():
+                ServiceMgr.ByteStreamAddressProviderSvc.TypeNames += [
+                    "HLT::HLTResult/HLTResult_L2",
+                    "HLT::HLTResult/HLTResult_EF" ]
+            else:
+                ServiceMgr.ByteStreamAddressProviderSvc.TypeNames += [
+                    "HLT::HLTResult/HLTResult_HLT" ]
+                pass
+            pass
+
+        # BS unpacking
+        from TrigBSExtraction.TrigBSExtractionConf import TrigBSExtraction
+        extr = TrigBSExtraction()
+        
+        if hasHLT:
+            from TrigNavigation.TrigNavigationConfig import HLTNavigationOffline
+            extr.Navigation = HLTNavigationOffline()
+            from TrigEDMConfig.TriggerEDM import getPreregistrationList,getEDMLibraries
+            extr.Navigation.ClassesToPreregister = getPreregistrationList()        
+            extr.Navigation.Dlls = getEDMLibraries()            
+            if not TriggerFlags.doMergedHLTResult():
+                extr.HLTResultKey=""
+            else:
+                extr.L2ResultKey=""
+                extr.EFResultKey=""
+        else:            
+            #if data doesn't have HLT info set HLTResult keys as empty strings to avoid warnings
+            # but the extr alg must run
+            extr.L2ResultKey=""
+            extr.EFResultKey=""
+            extr.HLTResultKey=""
+
+        topSequence += extr
+        
+        from TrigSerializeTP.TrigSerializeTPConf import TrigSerTPTool
+        TrigSerToolTP = TrigSerTPTool('TrigSerTPTool')
+
+        from AthenaCommon.AppMgr import ToolSvc
+        ToolSvc += TrigSerToolTP
+        from TrigEDMConfig.TriggerEDM import getTPList
+        TrigSerToolTP.TPMap = getTPList()
+        
+        from TrigSerializeCnvSvc.TrigSerializeCnvSvcConf import TrigSerializeConvHelper
+        TrigSerializeConvHelper = TrigSerializeConvHelper(doTP = True)
+        ToolSvc += TrigSerializeConvHelper
+
+        return True
+
+
+class TrigDecisionGetter(Configured):
+    #class to setup the writing or just making of TrigDecisionObject
+    def configure(self):
+        
+        log = logging.getLogger("TrigDecisionGetter")
+
+        from AthenaCommon.AlgSequence import AlgSequence 
+        topSequence = AlgSequence()
+        
+        #if hasOnlyLVL1:
+        #from RecExConfig.ObjKeyStore import objKeyStore
+        #objKeyStore.addStreamESD('TrigDec::TrigDecision','TrigDecision')
+        #objKeyStore.addStreamAOD('TrigDec::TrigDecision','TrigDecision')
+        
+        from RecExConfig.RecFlags import rec
+        if ( rec.doWriteESD() or rec.doWriteAOD() or rec.doESD() or rec.doAOD() ) and \
+               ( not ( rec.readAOD() or rec.readESD() ) ):
+            log.info("Will write TrigDecision object to storegate")
+            from TrigDecisionMaker.TrigDecisionMakerConfig import WriteTrigDecision
+            trigDecWriter = WriteTrigDecision()
+            # inform TD maker that some parts may be missing
+            if TriggerFlags.dataTakingConditions()=='Lvl1Only':
+                topSequence.TrigDecMaker.doL2=False
+                topSequence.TrigDecMaker.doEF=False
+                topSequence.TrigDecMaker.doHLT=False
+            elif TriggerFlags.dataTakingConditions()=='HltOnly':
+                from AthenaCommon.AlgSequence import AlgSequence
+                topSequence.TrigDecMaker.doL1=False
+            # Decide based on the run number whether to assume a merged, or a
+            # split HLT:
+            if not TriggerFlags.doMergedHLTResult():
+                topSequence.TrigDecMaker.doHLT = False
+            else:
+                topSequence.TrigDecMaker.doL2 = False
+                topSequence.TrigDecMaker.doEF = False
+                pass
+                
+        else:
+            log.info("Will not write TrigDecision object to storegate")
+
+        return True
+    
+    
+class HLTTriggerResultGetter(Configured):
+
+    log = logging.getLogger("HLTTriggerResultGetter.py")
+
+    def _AddOPIToESD(self):
+
+        log = logging.getLogger("HLTTriggerResultGetter.py")        
+        
+        if rec.doESD():
+            from RecExConfig.InputFilePeeker import inputFileSummary
+            if inputFileSummary.has_key('bs_metadata') and inputFileSummary['bs_metadata'].has_key('Stream'):
+                stream=inputFileSummary['bs_metadata']['Stream']
+                log.debug("the stream found in 'bs_metadata' is "+stream)
+                if "express" in stream:
+                    from TrigEDMConfig.TriggerEDM import getTypeAndKey,EDMDetails
+                    type,key=getTypeAndKey("TrigOperationalInfo#HLT_EXPRESS_OPI_EF")
+                    if EDMDetails[type].has_key('collection'):
+                        colltype = EDMDetails[type]['collection']
+                        log.info("Adding HLT_EXPRESS_OPI_EF to ESD for stream "+stream)                        
+                        from RecExConfig.ObjKeyStore import objKeyStore
+                        objKeyStore.addStreamESD(colltype, key)
+                    return True
+            else:
+                log.warning("Could not determine stream of bytestream file, not adding HLT_EXPRESS_OPI_EF to ESD.")
+        return False
+
+    def configure(self):
+
+        log = logging.getLogger("HLTTriggerResultGetter.py")
+        from RecExConfig.ObjKeyStore import objKeyStore
+
+
+        from AthenaCommon.AlgSequence import AlgSequence
+        topSequence = AlgSequence()
+        log.info("BS unpacking (TF.readBS): %d" % TriggerFlags.readBS() )
+        if TriggerFlags.readBS():
+            bs = ByteStreamUnpackGetter()
+
+        if recAlgs.doTrigger() or TriggerFlags.doTriggerConfigOnly():
+
+            #only convert when running on old trigger
+            if not TriggerFlags.doMergedHLTResult():
+                xaodcnvrt = xAODConversionGetter()
+            
+            tdt = TrigDecisionGetter()
+
+        # TrigJetRec additions
+        if rec.doWriteESD():
+            objKeyStore.addStreamESD("JetKeyDescriptor","JetKeyMap")
+            objKeyStore.addStreamESD("JetMomentMap","TrigJetRecMomentMap")
+
+        if rec.doWriteAOD():
+            objKeyStore.addStreamAOD("JetKeyDescriptor","JetKeyMap")
+            objKeyStore.addStreamAOD("JetMomentMap","TrigJetRecMomentMap")
+                    
+        # ID truth
+        if not rec.readESD() and (not rec.readAOD()) and TriggerFlags.doID() \
+                and rec.doTruth():
+            try:
+                from TrigInDetTruthAlgs.TrigInDetTruthAlgsConfig import \
+                    TrigIDTruthMaker
+                topSequence += TrigIDTruthMaker()
+            except Exception:
+                log.warning( "Couldn't set up the trigger ID truth maker" )
+                pass
+
+        if rec.doESD() or rec.doAOD():
+            from TrigEDMConfig.TriggerEDM import getTrigIDTruthList
+            objKeyStore.addManyTypesStreamESD(getTrigIDTruthList(TriggerFlags.ESDEDMSet()))
+            objKeyStore.addManyTypesStreamAOD(getTrigIDTruthList(TriggerFlags.AODEDMSet()))
+
+
+        #Are we adding operational info objects in ESD?
+        added=self._AddOPIToESD()
+        if added:
+            log.debug("Operational Info object HLT_EXPRESS_OPI_EF with extra information about express stream prescaling added to the data.")
+        
+
+
+        # ESD objects definitions
+        _TriggerESDList = {}
+
+        from TrigEDMConfig.TriggerEDM import getESDList
+        _TriggerESDList.update( getESDList( TriggerFlags.ESDEDMSet() ) )
+        log.info("ESD content set according to the ESDEDMSet flag: %s" % TriggerFlags.ESDEDMSet() )
+
+        # AOD objects choice
+        _TriggerAODList = {}
+        
+        from TrigEDMConfig.TriggerEDM import getAODList    
+        _TriggerAODList.update( getAODList( TriggerFlags.AODEDMSet() ) )
+
+        log.info("AOD content set according to the AODEDMSet flag: %s" % TriggerFlags.AODEDMSet() )
+    
+        # Highlight what is in AOD list but not in ESD list, as this can cause
+        # the "different number of entries in branch" problem, when it is in the
+        # AOD list but the empty container per event is not created
+        # Just compares keys of dicts, which are the class names, not their string keys in StoreGate
+        not_in = [ element for element in  _TriggerAODList if element not in _TriggerESDList ]
+        if (len(not_in)>0):
+            log.warning("In AOD list but not in ESD list: ")
+            log.warning(not_in)
+        else:
+            log.info("AOD list is subset of ESD list - good.")
+
+
+        def _addSlimming(stream, thinningSvc, edm):
+            from AthenaCommon.AlgSequence import AlgSequence 
+            topSequence = AlgSequence()
+            from TrigNavTools.TrigNavToolsConf import HLT__StreamTrigNavSlimming
+
+            edmlist = []
+            for t,kset in edm.iteritems():
+                for k in kset:
+                    edmlist.append('%s#%s' % (t,k)) 
+
+            # from AOD navigation drop L2 navigation part
+            slimmerL2 = HLT__StreamTrigNavSlimming('L2NavSlimmer_%s'%stream)
+            slimmerL2.ResultKey="HLTResult_L2"
+            slimmerL2.SlimmingTool.ResultKey="HLTResult_L2"
+            slimmerL2.SlimmingTool.DropNavigation=True
+            slimmerL2.ThinningSvc = thinningSvc
+            slimmerL2.SlimmingTool.ThinningSvc = thinningSvc            
+            topSequence += slimmerL2
+
+            # for EF drop the features *not* recorded
+
+            slimmerEF = HLT__StreamTrigNavSlimming('EFNavSlimmer_%s' % stream)
+                        
+            slimmerEF.SlimmingTool.FeatureInclusionList = edmlist
+            slimmerEF.ThinningSvc = thinningSvc
+            slimmerEF.SlimmingTool.ThinningSvc = thinningSvc
+            slimmerEF.ResultKey="HLTResult_EF"
+            slimmerEF.SlimmingTool.ResultKey="HLTResult_EF"
+            topSequence += slimmerEF
+
+
+            # from HLT result drop unrecorded features
+            slimmerHLT = HLT__StreamTrigNavSlimming('HLTNavSlimmer_%s'%stream)
+            slimmerHLT.SlimmingTool.FeatureInclusionList = edmlist
+            slimmerHLT.ThinningSvc = thinningSvc
+            slimmerHLT.SlimmingTool.ThinningSvc = thinningSvc
+            slimmerHLT.ResultKey="HLTResult_HLT"
+            slimmerHLT.SlimmingTool.ResultKey="HLTResult_HLT"
+            #slimmerHLT.SlimmingTool.Squeeze=True
+
+            topSequence += slimmerHLT
+            log.info("Configured slimming of HLT results L2 EF and HLT")
+            del edmlist
+
+
+        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
+        from AthenaServices.Configurables import ThinningSvc, createThinningSvc
+        
+        _doSlimming = True
+        if _doSlimming and rec.doWriteAOD(): #  and not rec.readAOD(): why not to run it when we read AOD??
+            # from AOD navigation drop references to the objects related to *not* recorded contaiers
+            try:
+                svcMgr += ThinningSvc() # the default is configured for AODs
+                _addSlimming('StreamAOD', svcMgr.ThinningSvc, _TriggerAODList )
+            except Exception:
+                log.info("could not configure navigation slimming for AOD output")
+        if _doSlimming and rec.doWriteESD(): # and not rec.readESD(): why not to run it when ESD is a source            
+            svcMgr += ThinningSvc(name='ESDThinningSvc', Streams=['StreamESD']) # the default is configured for AODs
+            # this was recommended but does not work
+            # from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
+            # svcMgr += createThinningSvc(svcName="ESDThinningSvc", outStreams=[MSMgr.GetStream('StreamESD').GetEventStream()])
+            try:
+                _addSlimming('StreamESD', svcMgr.ESDThinningSvc, _TriggerESDList )
+            except Exception:
+                log.info("could not configure navigation slimming for ESD output")
+
+        
+        objKeyStore.addManyTypesStreamESD( _TriggerESDList )                        
+        objKeyStore.addManyTypesStreamAOD( _TriggerAODList )        
+            
+        return True
+
+
+
+
+
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1ResultBuilderGetter.py b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1ResultBuilderGetter.py
new file mode 100644
index 0000000000000000000000000000000000000000..72f124adacd330d430a39b23177a095d702b1428
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1ResultBuilderGetter.py
@@ -0,0 +1,65 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+# -------------------------------------------------------------
+# L1 Getter of the result
+# -------------------------------------------------------------
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+from AthenaCommon.GlobalFlags import jobproperties
+from CaloRec.CaloCellFlags import jobproperties
+from AthenaCommon.DetFlags import DetFlags
+from AthenaCommon.Constants import *
+from AthenaCommon.Logging import logging  # loads logger
+from AthenaCommon.Include import include  # to include old style job options
+from AthenaCommon.AppMgr import theApp
+
+from RecExConfig.RecFlags  import rec
+from RecExConfig.RecAlgsFlags import recAlgs
+
+
+from RecExConfig.Configured import Configured
+from RecExConfig.ObjKeyStore import objKeyStore
+
+class Lvl1ResultBuilderGetter(Configured):
+    #_output = {"CTP_Decision":"CTP_Decision", "LVL1_ROI":"LVL1_ROI"}
+
+    def configure(self):
+        log = logging.getLogger( "LVL1ResultBuilderGetter.py" )
+
+        #         from AthenaServices.AthenaServicesConf import AthenaOutputStream
+        #         from AthenaCommon.AppMgr import ServiceMgr
+        #         from AthenaCommon.AlgSequence import AlgSequence
+        #         topSequence = AlgSequence()
+
+        #         ### the following was gotten from the LVL1TriggerGetter not sure if needed when not simulation
+        #         if not (TriggerFlags.fakeLVL1() or TriggerFlags.doLVL1()):
+        #            DetFlags.readRIOPool.LVL1_setOn()
+
+        #         # ***Temp : needed to enable required combination of thresholds
+        #         #           mu4,mu6,mu10,mu11,mu20,mu40
+        #         # Will be replaced by config. from Lvl1ConfigSvc
+        #         if hasattr(ServiceMgr,'RPCcablingSimSvc'):
+        #             ServiceMgr.RPCcablingSimSvc.HackFor1031 = True
+        if jobproperties.Global.InputFormat() == 'bytestream':
+            theApp.Dlls += [ "TrigT1Calo" ]
+            include("TrigT1CaloByteStream/ReadLVL1CaloBS_jobOptions.py")
+        #         ###
+
+        from AthenaCommon.AlgSequence import AlgSequence
+        topSequence = AlgSequence()
+
+
+        if recAlgs.doTrigger():
+            if (rec.doESD() or rec.doAOD()) and (not(rec.readAOD() or \
+                                                         rec.readESD())):
+                from AnalysisTriggerAlgs.AnalysisTriggerAlgsConfig import \
+                    RoIBResultToAOD
+                topSequence += RoIBResultToAOD("RoIBResultToxAOD")
+                pass
+            pass
+
+        from TrigEDMConfig.TriggerEDM import getLvl1ESDList
+        objKeyStore.addManyTypesStreamESD(getLvl1ESDList())
+        from TrigEDMConfig.TriggerEDM import getLvl1AODList
+        objKeyStore.addManyTypesStreamAOD(getLvl1AODList())
+
+        return True
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1TriggerGetter.py b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1TriggerGetter.py
new file mode 100644
index 0000000000000000000000000000000000000000..3994efa54d75932eb5c5c310baa89d2da3256b63
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1TriggerGetter.py
@@ -0,0 +1,236 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+# -------------------------------------------------------------
+# L1 configuration
+# -------------------------------------------------------------
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+from AthenaCommon.GlobalFlags import jobproperties
+from CaloRec.CaloCellFlags import jobproperties
+from AthenaCommon.DetFlags import DetFlags
+from AthenaCommon.Constants import *
+from AthenaCommon.Logging import logging  # loads logger
+from AthenaCommon.Include import include  # to include old style job options
+from AthenaCommon.AppMgr import theApp
+        
+from RecExConfig.Configured import Configured 
+from RecExConfig.ObjKeyStore import objKeyStore
+
+
+def getLvl1OutputLevel():
+    """ Default OutputLevel used by tests run from TriggerTest
+    set an output level in topOptions via
+    Lvl1OutputLevel = DEBUG
+    """
+    import __main__
+    if 'Lvl1OutputLevel' in dir(__main__):
+        return __main__.Lvl1OutputLevel
+    return WARNING
+
+def LVL1MonitoringTools():
+    log = logging.getLogger( "LVL1MonitoringTools" )
+
+    log.debug("Setting up offline THistSvc")
+    from AthenaCommon.AppMgr import ServiceMgr
+    if not hasattr(ServiceMgr, 'THistSvc'):        
+        from GaudiSvc.GaudiSvcConf import THistSvc
+        ServiceMgr += THistSvc()
+
+    if hasattr(ServiceMgr.THistSvc, "Output"): # this is offline THistSvc for which we want to setup files 
+        if 1 not in [ o.count('EXPERT') for o in  ServiceMgr.THistSvc.Output ]:
+            ServiceMgr.THistSvc.Output += [ "EXPERT DATAFILE='expert-monitoring.root' OPT='RECREATE'"]
+
+def keyInInputFile(sgKey):
+    """check, if the given StoreGate key is in the current input file
+    """
+    from RecExConfig.InputFilePeeker import inputFileSummary
+
+    return sgKey in inputFileSummary['eventdata_itemsDic']
+
+
+
+class Lvl1SimulationGetter (Configured):
+
+    def configure(self):
+        log = logging.getLogger( "jobOfragment_LVL1.py" )
+
+        from AthenaServices.AthenaServicesConf import AthenaOutputStream
+        from AthenaCommon.AppMgr import ServiceMgr
+        from AthenaCommon.AlgSequence import AlgSequence 
+        topSequence = AlgSequence()
+        
+        if (not TriggerFlags.fakeLVL1()) and TriggerFlags.doLVL1():
+
+            if TriggerFlags.doCalo():
+                if TriggerFlags.useCaloTTL() and not jobproperties.CaloCellFlags.doFastCaloSim():
+                    if TriggerFlags.doCosmicSim():
+                        include( "TrigT1CaloSim/TrigT1CaloSimJobOptions_TTL1_cosmic.py" )
+                    elif TriggerFlags.useL1CaloCalibration():
+                        include( "TrigT1CaloSim/TrigT1CaloSimJobOptions_TTL1.py")
+                    elif 'pp_v4' in TriggerFlags.triggerMenuSetup(): #temporary should be steered by run configuration
+                        include ( "TrigT1CaloSim/TrigT1CaloSimJobOptions_TTL1_2012.py") 
+                    else:
+                        include ( "TrigT1CaloSim/TrigT1CaloSimJobOptions_TTL1_NoCalib.py")
+                else:
+                    include( "TrigT1CaloSim/TrigT1CaloSimJobOptions_Cell.py")
+                    
+                log.info("adding MBTS simulation to the topSequence")
+                from TrigT1MBTS.TrigT1MBTSConf import LVL1__TrigT1MBTS
+                topSequence += LVL1__TrigT1MBTS()
+
+
+            # schedule simulation
+            if TriggerFlags.doMuon() and (not DetFlags.readRIOPool.LVL1_on() ):
+                include( "MuonByteStreamCnvTest/jobOptions_MuonRDOToDigit.py" )
+                import TrigT1RPCRecRoiSvc.TrigT1RPCRecRoiConfig
+                import TrigT1TGCRecRoiSvc.TrigT1TGCRecRoiConfig
+                import TrigT1RPCsteering.TrigT1RPCsteeringConfig
+                import TrigT1TGC.TrigT1TGCConfig
+                from TrigT1Muctpi.TrigT1MuctpiConfig import L1Muctpi                
+                topSequence += L1Muctpi()
+
+            if TriggerFlags.doBcm():
+                from TrigT1BCM.TrigT1BCMConf import LVL1__TrigT1BCM
+                alg = LVL1__TrigT1BCM()
+                
+                try:
+                    sgKey = alg.BcmL1ContainerName
+                except AttributeError:
+                    sgKey = alg.getDefaultProperty('BcmL1ContainerName')
+
+                if keyInInputFile(sgKey):
+                    log.info("adding BCM simulation to the topSequence")
+                    topSequence += alg
+                else:
+                    log.warning("%s input (%s) missing, not adding to the topSequence" % (alg.getName(), sgKey))
+                    TriggerFlags.doBcm.set_Value(False)
+
+            if TriggerFlags.doTrt():
+                from TrigT1TRT.TrigT1TRTConf import LVL1__TrigT1TRT
+                alg = LVL1__TrigT1TRT()
+                
+                try:
+                    sgKey = alg.TRTL1ContainerName
+                except AttributeError:
+                    sgKey = alg.getDefaultProperty('TRTL1ContainerName')
+
+                if keyInInputFile(sgKey):
+                    log.info("adding TRTfast simulation to the topSequence")
+                    topSequence += alg
+                else:
+                    log.warning("%s input (%s) missing, not adding to the topSequence" % (alg.getName(), sgKey))
+                    TriggerFlags.doTrt.set_Value(False)
+
+            if TriggerFlags.doZdc():
+                from TrigT1ZDC.TrigT1ZDCConf import LVL1__TrigT1ZDC
+                alg = LVL1__TrigT1ZDC()
+
+                # ZDC simulation is using truth information at the moment, so do not do any fancy configuration
+                
+                log.info("adding ZDC simulation to the topSequence")
+                topSequence += alg
+
+            if TriggerFlags.doLucid():
+                from TrigT1Lucid.TrigT1LucidConf import LVL1__TrigT1Lucid
+                alg = LVL1__TrigT1Lucid()
+
+                try:
+                    sgKey = alg.LVL1T1ContainerName
+                except AttributeError:
+                    sgKey = alg.getDefaultProperty('LVL1T1ContainerName')
+                
+                if keyInInputFile(sgKey):
+                    log.info("adding Lucid simulation to the topSequence")
+                    topSequence += alg
+                else:
+                    log.warning("%s input (%s) missing, not adding to the topSequence" % (alg.getName(), sgKey))
+                    TriggerFlags.doLucid.set_Value(False)
+                    
+
+            if TriggerFlags.doL1Topo():
+                from L1TopoSimulation.L1TopoSimulationConfig import L1TopoSimulation
+                topSequence += L1TopoSimulation()
+
+
+
+            log.info("adding ctp simulation to the topSequence")
+            from TrigT1CTP.TrigT1CTPConfig import CTPSimulationInReco
+            topSequence += CTPSimulationInReco("CTPSimulation")
+            
+            log.info("adding ROIB simulation to the topSequence")
+            from TrigT1RoIB.TrigT1RoIBConf import ROIB__RoIBuilder
+            topSequence += ROIB__RoIBuilder("RoIBuilder")
+
+            # monitoring
+            LVL1MonitoringTools()
+
+            #jtb if not TriggerFlags.fakeLVL1():
+                # LVL1
+            #jtb     theApp.Dlls += [ "TrigT1ResultByteStream" ]
+   
+
+        if not (TriggerFlags.fakeLVL1() or TriggerFlags.doLVL1()):
+            DetFlags.readRIOPool.LVL1_setOn()
+
+            # need to following when reading LVL1 to o/p to AOD
+            # RoI reconstruction svc
+
+            #        if ( doWriteESD or readESD) or ( doWriteAOD or readAOD) or doWriteRDO :
+            #            include("TrigT1EventAthenaPool/TrigT1EventAthenaPool_joboptions.py")
+            
+            #        if (doWriteESD or doWriteAOD):
+            # Pool convertors for LVL1
+            #            include("AnalysisTriggerEventAthenaPool/AnalysisTriggerEventAthenaPool_joboptions.py")
+ 
+
+
+        # --------------------------------------------------------------
+        # digitize the muon detector first if needed
+        # --------------------------------------------------------------
+        if TriggerFlags.doMuon() and DetFlags.digitize.Muon_on():
+    
+            # configure Pileup
+            theApp.Dlls += [ "PileUpTools" ]
+            # RPC Digitization 
+            include( "RPC_Digitization/RPC_Digitization_jobOptions.py" )
+            # MDT Digitization 
+            include( "MDT_Digitization/MDT_Digitization_jobOptions.py" )
+            # CSC Digitization 
+            include( "CSC_Digitization/CSC_Digitization_jobOptions.py" )
+            # TGC Digitization 
+            include( "TGC_Digitization/TGC_Digitization_jobOptions.py" )
+    	
+            include( "MuonByteStreamCnvTest/MuonRdoDigit_jobOptions.py" )
+
+#        from TriggerJobOpts.Lvl1ResultBuilderGetter import Lvl1ResultBuilderGetter
+#        result = Lvl1ResultBuilderGetter()
+
+
+        # ***Temp : needed to enable required combination of thresholds
+        #           mu4,mu6,mu10,mu11,mu20,mu40
+        # Will be replaced by config. from Lvl1ConfigSvc
+        if hasattr(ServiceMgr,'RPCcablingSimSvc'):
+            ServiceMgr.RPCcablingSimSvc.HackFor1031 = True
+            
+        if  jobproperties.Global.InputFormat() != 'bytestream':
+            if TriggerFlags.doCalo() and DetFlags.writeBS.Calo_on():
+
+                from AthenaCommon.AppMgr import ToolSvc
+                from LArByteStream.LArByteStreamConfig import LArRawDataContByteStreamToolConfig
+                ToolSvc+=LArRawDataContByteStreamToolConfig(InitializeForWriting=True)                 
+
+#        if jobproperties.Global.InputFormat() == 'bytestream':   
+#            theApp.Dlls += [ "TrigT1Calo" ]   
+#            include("TrigT1CaloByteStream/ReadLVL1CaloBS_jobOptions.py") 
+
+#        from RecExConfig.RecFlags  import rec
+#        if (rec.doESD() or rec.doAOD()) and (not(rec.readAOD() or rec.readESD())): #fix for bug 64345
+#            from AnalysisTriggerAlgs.AnalysisTriggerAlgsConfig import RoIBResultToAOD
+#            topSequence += RoIBResultToAOD("RoIBResultToAOD")
+
+             
+#        from TrigEDMConfig.TriggerEDM import getLvl1ESDList
+#        objKeyStore.addManyTypesStreamESD(getLvl1ESDList())
+#        from TrigEDMConfig.TriggerEDM import getLvl1AODList
+#        objKeyStore.addManyTypesStreamAOD(getLvl1AODList())
+        
+        return True
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1TriggerOnlineGetter.py b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1TriggerOnlineGetter.py
new file mode 100644
index 0000000000000000000000000000000000000000..f89a349a2f2983f987db4fa1c86615d4300b607d
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1TriggerOnlineGetter.py
@@ -0,0 +1,67 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+# -------------------------------------------------------------
+# L1 configuration
+# -------------------------------------------------------------
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+from AthenaCommon.GlobalFlags import GlobalFlags
+from AthenaCommon.DetFlags import DetFlags
+from AthenaCommon.Constants import *
+from AthenaCommon.Logging import logging  # loads logger
+from AthenaCommon.Include import include  # to include old style job options
+from AthenaCommon.AppMgr import theApp
+        
+if (not TriggerFlags.fakeLVL1()) and TriggerFlags.doLVL1():
+    from TrigT1CTP.TrigT1CTPConfig import CTPSimulation
+    from TrigT1RoIB.TrigT1RoIBConf import ROIB__RoIBuilder
+
+    import TrigT1RPCRecRoiSvc.TrigT1RPCRecRoiConfig
+    import TrigT1TGCRecRoiSvc.TrigT1TGCRecRoiConfig
+    import TrigT1RPCsteering.TrigT1RPCsteeringConfig
+    import TrigT1TGC.TrigT1TGCConfig
+    from TrigT1Muctpi.TrigT1MuctpiConfig import L1Muctpi
+    from TrigT1MBTS.TrigT1MBTSConf import LVL1__TrigT1MBTS
+
+
+from RecExConfig.Configured import Configured 
+
+
+
+class Lvl1SimulationGetter (Configured):
+    _output = {"CTP_Decision":"CTP_Decision", "LVL1_ROI":"LVL1_ROI"}
+
+    def configure(self):
+        log = logging.getLogger( "Lvl1TriggerOnlineGetter.py" )
+
+        from AthenaServices.AthenaServicesConf import AthenaOutputStream
+        from AthenaCommon.AppMgr import ServiceMgr
+        from AthenaCommon.AlgSequence import AlgSequence 
+        topSequence = AlgSequence()
+        
+        # initialize LVL1ConfigSvc
+        if not hasattr( ServiceMgr, 'LVL1ConfigSvc' ):
+            from TrigConfigSvc.TrigConfigSvcConfig import LVL1ConfigSvc
+            LVL1ConfigSvc = LVL1ConfigSvc("LVL1ConfigSvc")
+            LVL1ConfigSvc.XMLFile = TriggerFlags.inputLVL1configFile()
+            ServiceMgr += LVL1ConfigSvc
+        else:
+            log.info( "LVL1ConfigSvc already created. Will ignore configuration from xml file="+TriggerFlags.inputLVL1configFile()\
+                      +" and use file="+ServiceMgr.LVL1ConfigSvc.XMLFile )
+
+        if (not TriggerFlags.fakeLVL1()) and TriggerFlags.doLVL1():
+            if TriggerFlags.useCaloTTL():
+                include( "TrigT1CaloSim/TrigT1CaloSimJobOptions_TTL1.py")
+            else:
+                include( "TrigT1CaloSim/TrigT1CaloSimJobOptions_Cell.py")
+            topSequence += LVL1__TrigT1MBTS()
+
+            topSequence += L1Muctpi()
+            
+            log.info("adding ctp simulation to the topSequence")
+            topSequence += CTPSimulation("CTPSimulation")
+            
+            log.info("adding ROIB simulation to the topSequence")
+            topSequence += ROIB__RoIBuilder("RoIBuilder")
+
+        return True
+# end of class  Lvl1SimulationGetter
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/NtupleProdFlags.py b/Trigger/TriggerCommon/TriggerJobOpts/python/NtupleProdFlags.py
new file mode 100644
index 0000000000000000000000000000000000000000..1d6ac5d6a5a49722e0f194f8320bbaeb14f82cae
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/NtupleProdFlags.py
@@ -0,0 +1,183 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer, jobproperties
+
+from AthenaCommon.Logging import logging 
+	
+__author__  = 'Emily Nurse <Emily.Nurse@cern.ch>, Joerg Stelzer <Joerg.Stelzer@cern.ch>'
+__doc__ = "Flags to steer the trigger ntuple production at the various sites and for development"
+
+
+###
+### property container class
+###
+class NtupleProductionFlags(JobPropertyContainer):
+    """Container for trigger ntuple production setup"""
+    log = logging.getLogger("TriggerFlags.NtupleProductionFlags")
+
+    def produceNtuples(self):
+        return self.ProductionLocation() != ''
+
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+TriggerFlags.add_Container(NtupleProductionFlags)
+NPF = TriggerFlags.NtupleProductionFlags
+
+
+
+
+###
+### JobProperty SliceTuples: to group the different ntuples into files
+###
+class SliceTuples(JobProperty):
+    '''Slice specification, and Grouping
+
+    * A list of strings can be specified, each string corresponding to one root file.
+    
+    * Within a string a comma separated list of slices needs to be given, which specifies the
+    ntuples that are contained in that file. For example
+    
+    * e.g. TriggerFlags.NtupleProduction.SliceTuples = ["EGamma, Tau", "MinBias", "MET, Jet", "BPhys, BJet"]
+    '''
+    statusOn=True
+    allowedType=['list']
+    StoredValue=[]
+    # list of possible slice ntuples
+    definedSlices=['EGamma', 'Muon', 'MuonL2', 'MuonEF', 'Tau', 'Jet', 'MET', 'MinBias', 'BPhys', 'BJet','L1Calo']
+    
+    def _do_action(self):
+        """Check if only defined slices are requested"""
+        if self.get_Value()==[]: return
+        for sl in ','.join(self.get_Value()).split(','):
+            if not sl.strip() in self.definedSlices:
+                raise RuntimeError, 'Slice "%s" is not a slice that has an ntuple defined! Must be on of %r !' % (sl,self.definedSlices)
+
+    def doSlice(self,slicename):
+        """Checks if a slice was requested
+
+        This is for the individual slice to ease the entrance to their
+        ntuple production. It respects the DisabledSlices Flag
+        """
+        if not slicename in self.definedSlices:
+            raise RuntimeError, 'Slice "%s" is not a slice that has an ntuple defined! Must be on of %r !' % (slicename,self.definedSlices)
+        inSliceTuples = slicename in [sl.strip() for sl in ','.join(self.get_Value()).split(',')]
+        inDisabledSlices = slicename in [sl.strip() for sl in NPF.DisabledSlices()]
+        return inSliceTuples and not inDisabledSlices
+
+NPF.add_JobProperty(SliceTuples)
+    
+
+
+###
+### JobProperty FileNames: File names for the different groups
+###
+class FileNames(JobProperty):
+    '''File name specification for each group of slices
+
+    * A list of filenames must be specified, each corresponding to the entry in SliceTuples.
+
+    * Must always be set after the SliceTuples are specified, because we are checking that the length is the same
+    
+    * e.g. TriggerFlags.NtupleProduction.FileNames = ["EgammaTau.root", "MinBiasValidation.root", "MissingETandJet.root", "B.root"]
+    '''
+    statusOn=True
+    allowedType=['list']
+    StoredValue=[]
+
+    def _do_action(self):
+        """Check if number of filename agrees with number of slice groups"""
+        if not NPF.SliceTuples.isDefault() and len(NPF.SliceTuples()) != len(self.get_Value()):
+            raise RuntimeError, "Expected %i root file names, since that many slice groups were defined" % len(NPF.SliceTuples())
+
+    def forSlice(self,slicename): 
+        """return the root file name for an individual slice
+        
+        This is not to be used in the production, where one algorithm
+        will write all the files. This function respects the DisabledSlices flag
+        """
+
+        if not NPF.SliceTuples.doSlice(slicename):
+            return ""
+
+        if len(self.get_Value())==0:
+                NPF.log.error("NPF.FileNames is empty, please provide at least one file name")
+
+        for index, group in enumerate(NPF.SliceTuples()):
+            inSliceGroup = slicename in [sl.strip() for sl in group.split(',')]
+            if inSliceGroup:
+                if index>=len(self.get_Value()): index=0
+                return self.get_Value()[index]
+
+        assert RuntimeError, "Should not get here"
+
+        
+NPF.add_JobProperty(FileNames)
+
+
+###
+### JobProperty DisabledSlices: To quickly disable a certain slice from NTuple Production
+###
+class DisabledSlices(JobProperty):
+    '''Names of slices (list) to be excluded from production'''
+    statusOn=True
+    allowedType=['list']
+    StoredValue=[]
+
+    def _do_action(self):
+        """Check if only defined slices are listed"""
+        sl = [x for x in self.get_Value() if not x in NPF.SliceTuples.definedSlices]
+        if sl:
+            raise RuntimeError, 'Slices %s do not have an ntuple defined! Must be on of %r !' % (','.join(sl),NPF.SliceTuples.definedSlices)
+
+NPF.add_JobProperty(DisabledSlices)
+
+
+
+###
+### JobProperty ProductionLocation: to specify where to run and setting the defaults
+###
+class ProductionLocation(JobProperty):
+    '''Production environment'''
+    statusOn=True
+    allowedType=['string']
+    allowedValues=['','Tier0','Tier1','CAF','User']
+    StoredValue=''
+    
+    def _do_action(self):
+        """Define ntuple production at the different places"""
+
+        if NPF.SliceTuples.is_locked(): NPF.SliceTuples.unlock()
+        #if NPF.FileNames.is_locked(): NPF.FileNames.unlock()
+
+        #
+        # Here the default values for ntuple production are set
+        #
+        if self.get_Value() == '':
+            NPF.SliceTuples.set_Value([])
+            NPF.FileNames.set_Value([])
+            NPF.log.info("Disabling Ntuple Production")
+
+        elif self.get_Value() == 'Tier0':
+            NPF.SliceTuples.set_Value(['MinBias, EGamma, Tau, Muon'])
+            #NPF.FileNames.set_Value(['TriggerNT.root'])
+            
+        elif self.get_Value() == 'Tier1':
+            NPF.SliceTuples.set_Value(['L1Calo'])
+            #NPF.FileNames.set_Value(['TriggerNT.root'])
+            
+        elif self.get_Value() == 'CAF':
+            NPF.SliceTuples.set_Value(['MinBias', 'EGamma', 'Tau', 'Muon', 'L1Calo'])
+            if NPF.FileNames()==[]:
+                NPF.FileNames.set_Value(['MinBiasNT.root', 'EGammaNT.root', 'TauNT.root', 'MuonNT.root', 'L1CaloNT.root'])
+            
+        elif self.get_Value() == 'User':
+            pass
+
+        # lock the properties
+        if self.get_Value()!= 'User':
+            NPF.SliceTuples.lock()
+
+        if self.get_Value()!= 'User' and self.get_Value()!= 'Tier0':
+            NPF.FileNames.lock()
+
+NPF.add_JobProperty(ProductionLocation)
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/T0TriggerGetter.py b/Trigger/TriggerCommon/TriggerJobOpts/python/T0TriggerGetter.py
new file mode 100644
index 0000000000000000000000000000000000000000..60ac707c39b75a1943fa59b6da29ba4664e22c09
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/T0TriggerGetter.py
@@ -0,0 +1,83 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+##  from AthenaCommon.GlobalFlags import jobproperties
+## ## from AthenaCommon.GlobalFlags import GlobalFlags
+##  from AthenaCommon.AthenaCommonFlags import jobproperties
+##  from RecExConfig.RecFlags  import jobproperties
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+
+
+from AthenaCommon.Logging import logging
+
+
+
+from AthenaCommon.AppMgr import ServiceMgr
+
+log = logging.getLogger( "T0TriggerGetter.py" )
+
+
+try:
+    from TriggerMenu import useNewTriggerMenu
+    useNewTM = useNewTriggerMenu()
+    log.info("Using new TriggerMenu: %r" % useNewTM)
+except:
+    useNewTM = False
+    log.info("Using old TriggerMenuPython since TriggerMenu.useNewTriggerMenu can't be imported")
+
+if useNewTM:
+    from TriggerMenu.menu.GenerateMenu import GenerateMenu
+else:
+    from TriggerMenuPython.GenerateMenu import GenerateMenu
+
+
+from RecExConfig.Configured import Configured 
+
+def withLVL1():
+    return TriggerFlags.dataTakingConditions()=='Lvl1Only' or TriggerFlags.dataTakingConditions()=='FullTrigger'
+
+def withHLT():
+    return TriggerFlags.dataTakingConditions()=='HltOnly' or TriggerFlags.dataTakingConditions()=='FullTrigger'
+
+class T0TriggerGetter(Configured):
+
+    #_output = {"HLT::HLTResult" : ["HLTResult_L2", "HLTResult_EF"] }
+    _configured=True
+    _done=False
+    
+    def configure(self):
+        if self._done:
+            log.info("configuration already done, who is calling it again?")
+            return True
+        self._done=True
+        
+        # setup configuration services
+        from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter
+        cfg =  TriggerConfigGetter()
+
+        # after the menu xml file has been created or the TriggerDB access is configured,
+        # the COOL/SQlite db can be written 
+        from TrigConfigSvc.TrigConf2COOL import theConfCOOLWriter
+        theConfCOOLWriter.writeConf2COOL()
+
+        if withLVL1():
+            # setup Lvl1
+            # initialize LVL1ConfigSvc
+            log.info("configuring lvl1")
+            from TriggerJobOpts.Lvl1ResultBuilderGetter import Lvl1ResultBuilderGetter
+            lvl1 = Lvl1ResultBuilderGetter()
+
+        if withHLT():
+            # setup HLT
+            # initialize HLT config svc
+            log.info("configuring hlt")
+            from TriggerJobOpts.HLTTriggerResultGetter import HLTTriggerResultGetter
+            hlt = HLTTriggerResultGetter()
+
+        #Call the tools to unpack the bytestream
+        #bsu=ByteStreamUnpackGetter()
+        
+        #Call the tool to make the TrigDecision object for ESD or AOD
+        #tdg=TrigDecisionGetter()
+        
+        return True
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/Tier0TriggerFlags.py b/Trigger/TriggerCommon/TriggerJobOpts/python/Tier0TriggerFlags.py
new file mode 100644
index 0000000000000000000000000000000000000000..e1272e37af0cbd47fa319bd4c49c890a02d95d54
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/Tier0TriggerFlags.py
@@ -0,0 +1,39 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer, jobproperties
+
+	
+__author__  = 'Emily Nurse'
+__doc__="Tier0 trigger ntuple information"
+
+class Tier0TriggerFlags(JobPropertyContainer):
+  """Container for Tier0 trigger ntuple variables"""
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+TriggerFlags.add_Container(Tier0TriggerFlags)
+
+class doTier0TriggerNtuple(JobProperty):
+   """ global flag to switch on/off the ntuple making"""
+   statusOn=True
+   allowedType=['bool']
+   StoredValue=False
+
+TriggerFlags.Tier0TriggerFlags.add_JobProperty(doTier0TriggerNtuple)
+
+
+class ntupleName(JobProperty):
+   """ set the name for the Tier0 trigger ntuple """
+   statusOn = True
+   allowedTypes = ['str']
+   StoredValue = "Tier0.root"
+
+TriggerFlags.Tier0TriggerFlags.add_JobProperty(ntupleName)
+
+class doMinBiasTree(JobProperty):
+   """ do or not the MinBias tree """
+   statusOn=True
+   allowedTypes=['bool']
+   StoredValue=True
+
+TriggerFlags.Tier0TriggerFlags.add_JobProperty(doMinBiasTree)
+                          
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigGetter.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigGetter.py
new file mode 100644
index 0000000000000000000000000000000000000000..b08a2b2136caee41d73941ac0a205f7d61dbd7f4
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigGetter.py
@@ -0,0 +1,412 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+
+__author__  = 'J. Stelzer'
+
+import re
+
+from TrigConfigSvc.TrigConfigSvcUtils import interpretConnection
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+from RecExConfig.RecFlags  import rec
+from AthenaCommon.GlobalFlags  import globalflags
+
+from TrigConfigSvc.TrigConfigSvcConfig import SetupTrigConfigSvc
+
+from RecExConfig.Configured import Configured 
+
+from AthenaCommon.Logging import logging 
+from AthenaCommon.Include import include
+from AthenaCommon.Resilience import protectedInclude
+
+from AthenaCommon.AppMgr import ServiceMgr as svcMgr
+
+class TriggerConfigGetter(Configured):
+    """ This class brings to the job Trigger Configuration.
+    """
+
+    _environment=""
+
+    def __init__(self, environment=""):
+        log = logging.getLogger( "TriggerConfigGetter.py" )
+        if environment:
+            log.info('Initialize (environment "%s")' % environment)
+        else:
+            log.info('Initialize (interpreting rec and trigger flags)')
+        self._environment = environment
+        super(TriggerConfigGetter,self).__init__() # calls configure
+
+    def checkFileMetaData(self):
+        log = logging.getLogger( "TriggerConfigGetter.py" )
+        from RecExConfig.InputFilePeeker import inputFileSummary
+        self.hasLBwiseHLTPrescalesAndL1ItemDef = True
+        if rec.readESD() or rec.readAOD() or "ReadPool" in self._environment:
+            self.hasLBwiseHLTPrescalesAndL1ItemDef = inputFileSummary['metadata'].has_key('/TRIGGER/HLT/Prescales') # they were all added at the same time (Repro with 15.6.3.2 Prod)
+        # protection against early runs
+        if inputFileSummary.has_key('run_number') and self._environment=="" and globalflags.DataSource()=='data' and rec.readRDO() and any([run<134230 for run in inputFileSummary['run_number']]):
+            self.hasLBwiseHLTPrescalesAndL1ItemDef = False
+        if self.hasLBwiseHLTPrescalesAndL1ItemDef:
+            log.info("Using LB-wise HLT prescales")
+        else:
+            log.info("Using run-wise HLT prescales")
+
+    def checkInput(self):
+
+        self.checkFileMetaData()
+
+        log = logging.getLogger( "TriggerConfigGetter.py" )
+        if "ReadPool" in self._environment or "WritePool" in self._environment:
+            log.info("Flags are ignored, since 'ReadPool' or  'WritePool' is specified")
+            return True
+
+        if rec.readESD() or rec.readAOD(): # and globalflags.DataSource()=='data':  # need this for MC as well
+            protectedInclude("TrigTier0/TriggerConfigCheckMetadata.py")
+
+        if rec.readRDO() and globalflags.InputFormat()=='bytestream' and globalflags.DataSource()=='data':
+            protectedInclude("TrigTier0/TriggerConfigCheckHLTpsk.py")
+
+        log.info("The following flags are set:")
+        log.info("globalflags.InputFormat             : %s" % globalflags.InputFormat())
+        log.info("rec.read.*                          : RDO: %s, ESD: %s, AOD: %s, TAG: %s" % (rec.readRDO(), rec.readESD(), rec.readAOD(), rec.readTAG()) )
+        log.info("rec.doWrite.*                       : ESD: %s, AOD: %s, TAG: %s" % (rec.doWriteESD(), rec.doWriteAOD(), rec.doWriteTAG()) )
+        log.info("globalflags.DataSource              : %s" % globalflags.DataSource())
+        log.info("TriggerFlags.configForStartup       : %s" % TriggerFlags.configForStartup())
+        log.info("TriggerFlags.dataTakingConditions   : %s" % TriggerFlags.dataTakingConditions())
+        log.info("TriggerFlags.configurationSourceList: %s" % TriggerFlags.configurationSourceList())
+
+        count = len([1 for x in [rec.readRDO(),rec.readESD(),rec.readAOD()] if x ]) #readTAG is only set with another input
+        if count == 0:
+            log.warning("Don't know what the input format is.")
+            return False
+        if count >= 2:
+            log.warning("More than one input format specified, please set only the appropriate one.")
+            return False
+        return True
+
+
+    def setConfigSvcConnParams(self,connectionParameters):
+        sl = []
+        if hasattr(svcMgr,'LVL1ConfigSvc'): sl += [svcMgr.LVL1ConfigSvc]
+        if hasattr(svcMgr,'HLTConfigSvc'): sl += [svcMgr.HLTConfigSvc]
+
+        if "alias" in connectionParameters:
+            for svc in sl:
+                svc.ConfigSource = 'DBLookUp'
+                svc.DBServer  = connectionParameters["alias"]
+                svc.DBUser = ""
+        else:
+            technology = connectionParameters["techno"]
+            svcMgr.LVL1ConfigSvc.ConfigSource = technology
+            svcMgr.HLTConfigSvc.ConfigSource  = technology
+
+            if technology == 'sqlite':
+                for svc in sl:
+                    svc.DBServer = connectionParameters["filename"]
+                    svc.DBUser = "dummy"
+
+            if technology == 'oracle':
+                for svc in sl:
+                    svc.DBServer  = connectionParameters["server"]
+                    svc.DBAccount = connectionParameters["schema"]
+                    svc.DBUser    = connectionParameters["user"  ]
+                    svc.DBPass    = connectionParameters["passwd"]
+
+        if hasattr(svcMgr,'LVL1ConfigSvc'):
+            svcMgr.LVL1ConfigSvc.DBSMKey     = TriggerFlags.triggerDbKeys()[0]
+            svcMgr.LVL1ConfigSvc.DBLVL1PSKey = TriggerFlags.triggerDbKeys()[1]
+            svcMgr.LVL1ConfigSvc.DBBGSKey    = TriggerFlags.triggerDbKeys()[3]
+            svcMgr.LVL1ConfigSvc.UseFrontier = TriggerFlags.triggerUseFrontier()
+        if hasattr(svcMgr,'HLTConfigSvc'):
+            svcMgr.HLTConfigSvc.DBSMKey      = TriggerFlags.triggerDbKeys()[0]
+            svcMgr.HLTConfigSvc.DBHLTPSKey   = TriggerFlags.triggerDbKeys()[2]
+            svcMgr.HLTConfigSvc.UseFrontier  = TriggerFlags.triggerUseFrontier()
+
+
+    def configure(self):
+        log = logging.getLogger( "TriggerConfigGetter.py" )
+
+        # first check the input
+        if "HIT2RDO" in self._environment:
+            TriggerFlags.doLVL2 = False
+            TriggerFlags.doEF = False
+            log.info("For simulation jobs the following flags are set:")
+            log.info("globalflags.InputFormat             : %s" % globalflags.InputFormat())
+            log.info("globalflags.DataSource              : %s" % globalflags.DataSource())
+            log.info("TriggerFlags.configForStartup       : %s" % TriggerFlags.configForStartup())
+            log.info("TriggerFlags.dataTakingConditions   : %s" % TriggerFlags.dataTakingConditions())
+            log.info("TriggerFlags.doLVL2                 : %s" % TriggerFlags.doLVL2())
+            log.info("TriggerFlags.doEF                   : %s" % TriggerFlags.doEF())
+        else:
+            if not self.checkInput():
+                log.error("Could not determine job input. Can't setup trigger configuration and will return!")
+                return
+
+        self.readPool       = globalflags.InputFormat() == 'pool'
+        self.readRDO        = rec.readRDO()
+        self.writeESDAOD    = rec.doWriteESD() or rec.doWriteAOD()
+        self.ConfigSrcList  = TriggerFlags.configurationSourceList()
+        self.readMC         = globalflags.DataSource()=='geant3' or globalflags.DataSource()=='geant4'
+        self.readTriggerDB  = TriggerFlags.readMenuFromTriggerDb() and self.readRDO
+        self.isCommisioning = globalflags.DataSource()=='data' and globalflags.DetGeo()=='commis' 
+        self.l1Folders      = TriggerFlags.dataTakingConditions()=='FullTrigger' or TriggerFlags.dataTakingConditions()=='Lvl1Only'
+        self.hltFolders     = TriggerFlags.dataTakingConditions()=='FullTrigger' or TriggerFlags.dataTakingConditions()=='HltOnly'
+
+        # the TriggerFlags.readMenuFromTriggerDb() tells us that we read the trigger menu from the database
+        # the connection itself is defined in TriggerFlags.triggerDbConnection()
+
+        # reading from the TriggerDB can mean different things:
+
+        # a) TriggerFlags doLVL2() and doEF() are both False:
+        #    - create a tmp sqlite file with the conditions (menu)
+        #    - use DSConfigSvc
+
+
+        # b) TriggerFlags doLVL2() or doEF() is True:
+        #    - use HLTConfigSvc
+        if self.readTriggerDB and (TriggerFlags.doLVL2() or TriggerFlags.doEF() or TriggerFlags.doHLT()):
+
+            self.ConfigSrcList = ['xml'] # to use L1/HLTConfigSvc and not DSConfigSvc, but only if we are running the HLT
+
+        if self._environment:
+            self.readPool  = False
+            self.writeESDAOD = False
+            self.readHits = False
+            if "ReadPoolRDO" in self._environment:
+                self.readPool = True
+                self.readRDO = True
+            elif "ReadPool" in self._environment:
+                self.readPool = True
+                self.readRDO = False
+            if "WritePool" in self._environment:
+                self.writeESDAOD = True
+            if "HIT2RDO" in self._environment:
+                self.readRDO = False
+                self.readHits = True
+
+        # define ConfigSvc
+        if not self.ConfigSrcList:
+            if (self.readPool and not self.readRDO) or (self.readRDO and not self.readPool): # (ESD, AOD, DPD) or (RDO-BS)
+                self.ConfigSrcList = ['ds']
+            elif (self.readRDO and self.readPool) or rec.readTAG() or self.readHits:           # (RDO-MC) or TAG
+                self.ConfigSrcList = ['xml']
+            else: # should not get here: should be found by checkInput
+                log.fatal('no reading of BS, RDO, AOD, ESD, or TAG specified')
+
+        # we need the temporary COOL database, if we read the configuration from XML and write ESD/AOD (or have 'ds' set for some reason)
+        self.makeTempCool   = self.readRDO and \
+                              ( self.writeESDAOD or 'ds' in self.ConfigSrcList ) and \
+                              ( self.readMC \
+                                or (self.isCommisioning and (TriggerFlags.readLVL1configFromXML() and TriggerFlags.readHLTconfigFromXML())) \
+                                or TriggerFlags.readMenuFromTriggerDb() )
+
+        log.info("Need to create temporary cool file? : %r" % self.makeTempCool)
+
+        log.info('Creating the Trigger Configuration Services')
+        self.svc = SetupTrigConfigSvc()
+
+        #set the merged system
+        #self.svc.doMergedHLT = TriggerFlags.doHLT() 
+
+        if 'xml' in self.ConfigSrcList or self.makeTempCool:
+            # sets them if plain XML reading is to be used
+            self.svc.l1topoXmlFile = TriggerFlags.outputL1TopoConfigFile()  # generated in python
+            self.svc.l1XmlFile     = TriggerFlags.outputLVL1configFile()    # generated in python
+            self.svc.hltXmlFile    = TriggerFlags.outputHLTconfigFile()     # generated in python
+            if TriggerFlags.readL1TopoConfigFromXML():
+                self.svc.l1topoXmlFile  = TriggerFlags.inputL1TopoConfigFile() # given XML
+            if TriggerFlags.readLVL1configFromXML():
+                self.svc.l1XmlFile  = TriggerFlags.inputLVL1configFile() # given XML
+            if TriggerFlags.readHLTconfigFromXML():
+                self.svc.hltXmlFile  = TriggerFlags.inputHLTconfigFile()   # given XML
+
+
+
+        ### preparations are done!
+        try:
+            self.svc.SetStates( self.ConfigSrcList )
+        except:
+            log.error( 'Failed to set state of TrigConfigSvc to %r' % self.ConfigSrcList )
+        else:
+            log.info('The following configuration services will be tried: %r' % self.ConfigSrcList )
+
+
+        try:     self.svc.InitialiseSvc()
+        except Exception, ex: log.error( 'Failed to activate TrigConfigSvc: %r' % ex )
+
+        if self.readTriggerDB:
+            log.info( "Using TriggerDB connection '%s'" % TriggerFlags.triggerDbConnection() )
+            self.trigDbConnectionParameters = interpretConnection(TriggerFlags.triggerDbConnection(), resolveAlias=False)
+            self.setConfigSvcConnParams(self.trigDbConnectionParameters)
+
+        log.info("TriggerFlags.triggerCoolDbConnection is '%s' [default: '']" % TriggerFlags.triggerCoolDbConnection())
+        TrigCoolDbConnection = TriggerFlags.triggerCoolDbConnection()
+
+        if self.makeTempCool:
+            TrigCoolDbConnection = self.setupTempCOOLWriting(TrigCoolDbConnection)
+
+        if 'ds' in self.ConfigSrcList or self.writeESDAOD:
+            self.setupCOOLReading(TrigCoolDbConnection)
+
+
+        if self.writeESDAOD:
+            self.setupCOOLWriting()
+            self.setupxAODWriting()
+
+            # all went fine we are configured
+        return True
+
+
+
+
+
+    def setupTempCOOLWriting(self,TrigCoolDbConnection):
+        log = logging.getLogger( "TriggerConfigGetter.py" )
+
+        log.info( 'Trigger the copying of COOL data into DetectorStore. I am not certain this is needed any longer JS.')
+
+        # if we have MC data (nothing in ORACLE/COOL) we need to write an SQlite file
+        # and change the dbConnection
+        if ( self.readMC \
+             or (self.isCommisioning and (TriggerFlags.readLVL1configFromXML and TriggerFlags.readHLTconfigFromXML)) \
+             or TriggerFlags.readMenuFromTriggerDb ):
+
+            log.info( 'TempCoolSetup: Setting up the writing of a temporary COOL DB')
+
+            from TrigConfigSvc.TrigConf2COOL import theConfCOOLWriter
+            if self.readTriggerDB:
+                log.info("TempCoolSetup: source is db [%s] with keys %s/%s/%s" % (TriggerFlags.triggerDbConnection(),TriggerFlags.triggerDbKeys()[0],TriggerFlags.triggerDbKeys()[1],TriggerFlags.triggerDbKeys()[2]))
+                theConfCOOLWriter.smk        = TriggerFlags.triggerDbKeys()[0]
+                theConfCOOLWriter.l1psk      = TriggerFlags.triggerDbKeys()[1]
+                theConfCOOLWriter.hltpsk     = TriggerFlags.triggerDbKeys()[2]
+                theConfCOOLWriter.setTriggerDBConnection(self.trigDbConnectionParameters)
+            else:
+                log.info("TempCoolSetup: sources are '%s' and '%s'" % (self.svc.l1XmlFile,self.svc.hltXmlFile) )
+                theConfCOOLWriter.lvl1menu = self.svc.l1XmlFile
+                theConfCOOLWriter.hltmenu  = self.svc.hltXmlFile
+            if TrigCoolDbConnection == "": # nothing specified by the user
+                TrigCoolDbConnection = re.match(".*;schema=(.*);dbname=.*",theConfCOOLWriter.dbConnection).group(1)
+                theConfCOOLWriter.isWritingNeeded = True
+                log.info("TempCoolSetup: Setting TrigCoolDbConnection to %s" % TrigCoolDbConnection )
+                log.info("TempCoolSetup: Enabling writing and IOV adjustment")
+
+        return TrigCoolDbConnection
+
+
+
+    def setupCOOLReading(self,TrigCoolDbConnection):
+        log = logging.getLogger( "TriggerConfigGetter.py" )
+        if 'ds' in self.ConfigSrcList:
+            log.info( 'DSConfigSvc enabled, will setup IOVDbSvc to access configuration meta data')
+        if self.writeESDAOD:
+            log.info( 'ESD/AOD writing enabled, will setup IOVDbSvc to access configuration meta data')
+        usePresetConnection = (TrigCoolDbConnection != "")
+
+        ## if we process MC from an XML file the dbConnection needs to
+        ## be set to a local SQlite file
+
+        # when reading from the COOL database (either form
+        # ORACLE/SQlite) we need an algorithm that triggers the
+        # copying
+        #
+        # In addition for MC the IOV has to be adjusted since in COOL the config data is written with IOV=infinity
+        if self.readRDO:
+
+            # setup the IOV Changer
+            from AthenaCommon.AlgSequence import AlgSequence
+            from TrigConfigSvc.TrigConfigSvcConf import TrigConf__TrigConfDataIOVChanger as TrigConfDataIOVChanger
+            topAlgs = AlgSequence()
+            TrigConfDataIOVChanger = TrigConfDataIOVChanger('TrigConfDataIOVChanger')
+            topAlgs += TrigConfDataIOVChanger
+            if self.makeTempCool:
+                TrigConfDataIOVChanger.AdjustIOV = True
+
+
+        if TrigCoolDbConnection=='':
+            log.info("COOL DBConnection: not set, will use default conditions database" )
+            TrigCoolDbConnection = 'TRIGGER'
+            addNewFolders = TriggerFlags.configForStartup()=="HLTonline" and self.readRDO
+        else: # for sqlite COOL: temp (usually /tmp/hltMenu.xxx.db) or predefined (e.g. trigconf.db)
+            log.info("COOL DBConnection: " + TrigCoolDbConnection )
+            addNewFolders = ( ( TriggerFlags.configForStartup()=="HLToffline"
+                                or TriggerFlags.configForStartup()=="HLTonline"
+                                or globalflags.DataSource()!='data')
+                              and self.readRDO )  # bytestream or MC RDO
+
+        # add folders for reading
+        from IOVDbSvc.CondDB import conddb
+        folders = []
+        if self.hltFolders: folders += [ "HLT/Menu", "HLT/HltConfigKeys" ]
+        if self.l1Folders:  folders += [ "LVL1/Lvl1ConfigKey", "LVL1/Menu", "LVL1/Prescales" ]
+        if self.hasLBwiseHLTPrescalesAndL1ItemDef:
+            if self.hltFolders: folders += [ "HLT/Prescales", "HLT/PrescaleKey" ]
+            if self.l1Folders:  folders += [ "LVL1/ItemDef" ]
+
+        log.info("Adding folders to IOVDbSvc")
+
+        if addNewFolders:
+            # Need thresholds folders but only for Tier0 BS->ESD
+            log.info("Also adding new folders to IOVDbSvc")
+            if self.hltFolders: folders += [ "HLT/Groups" ]
+            if self.l1Folders:  folders += [ "LVL1/Thresholds" ]
+            #if self.readRDO:
+            if self.l1Folders:  folders += [ "LVL1/BunchGroupKey", "LVL1/BunchGroupDescription", "LVL1/BunchGroupContent" ]
+
+        for f in folders:
+            log.info("     /TRIGGER/%s" % f)
+            conddb.addFolderWithTag(TrigCoolDbConnection, "/TRIGGER/%s" % f, "HEAD")
+
+
+
+
+    def setupCOOLWriting(self):
+        """method to setup the writing of the configuration
+        to ESD/AOD/poolDPD"""
+        log = logging.getLogger( "TriggerConfigGetter.py" )
+        log.info( 'ESD/AOD writing enabled, will setup IOVDbSvc to write configuration meta data')
+
+        folders = []
+        if self.hltFolders: folders += ["HLT/Menu", "HLT/HltConfigKeys"]
+        if self.l1Folders:  folders += ["LVL1/Lvl1ConfigKey", "LVL1/Menu", "LVL1/Prescales"]
+
+        if self.hasLBwiseHLTPrescalesAndL1ItemDef:
+            if self.hltFolders: folders += [ "HLT/Prescales", "HLT/PrescaleKey" ]
+            if self.l1Folders:  folders += [ "LVL1/ItemDef" ]
+
+        log.info("Adding output folders to IOVDbSvc")
+        for f in folders:
+            log.info("     /TRIGGER/%s" % f)
+            svcMgr.IOVDbSvc.FoldersToMetaData+=["/TRIGGER/%s" % f]
+
+    def setupxAODWriting( self ):
+        """
+        Method setting up the writing of the ROOT-readable trigger configuration
+        metadata.
+        """
+
+        # Get a logger:
+        log = logging.getLogger( "TriggerConfigGetter.py" )
+        log.info( "ESD/AOD writing enabled, will set up xAOD trigger "
+                  "configuration metadata writing" )
+
+        # Get the algorithm sequence:
+        from AthenaCommon.AlgSequence import AlgSequence
+        topAlgs = AlgSequence()
+
+        # Add the algorithm creating the trigger configuration metadata for
+        # the output:
+        try: 
+            from TrigConfxAOD.TrigConfxAODConf import TrigConf__xAODMenuWriter
+            topAlgs += TrigConf__xAODMenuWriter()
+
+            # The metadata objects to add to the output:
+            metadataItems = [ "xAOD::TriggerMenuContainer_v1#TriggerMenu",
+                              "xAOD::TriggerMenuAuxContainer_v1#TriggerMenuAux." ]
+
+            # Set up the metadata for the output ESD and AOD:
+            from RecExConfig.ObjKeyStore import objKeyStore
+            objKeyStore.addManyTypesMetaData( metadataItems )
+        except ImportError: # don't want to branch in rel 18
+            pass
+
+        # Return gracefully:
+        return
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerEDM.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerEDM.py
new file mode 100644
index 0000000000000000000000000000000000000000..c758e3ca384474b496d35b3fc9ed5f8ccdb8e7d4
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerEDM.py
@@ -0,0 +1,8 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from AthenaCommon.Logging import logging
+
+from TrigEDMConfig.TriggerEDM import *
+
+log = logging.getLogger( 'TriggerEDM.py' )
+log.info("Please import TriggerEDM.py from its new location: Trigger/TriggerCommon/TrigEDMConfig")
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py
new file mode 100644
index 0000000000000000000000000000000000000000..4bdafcf71479eed54592660bd23cec44d4920873
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py
@@ -0,0 +1,1291 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+""" Trigger specific flags  """
+
+
+__author__  = 'T. Bold, J. Baines'
+__version__=""
+__doc__="Trigger specific flags  "
+
+
+from AthenaCommon.Logging import logging
+log = logging.getLogger( 'TriggerJobOpts.TriggerFlags' )
+log.setLevel(logging.INFO)
+
+
+#import traceback
+#stack = traceback.extract_stack()
+#log.info( "Imported TriggerFlags from %s, line %i" % (stack[-2][0], stack[-2][1]) )
+
+try:
+    from TriggerMenu import useNewTriggerMenu
+    useNewTM = useNewTriggerMenu()
+    log.info("Using new TriggerMenu: %r" % useNewTM)
+except:
+    useNewTM = False
+    log.info("Using old TriggerMenuPython since TriggerMenu.useNewTriggerMenu can't be imported")
+
+
+from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer, jobproperties
+
+if useNewTM:
+    from TriggerMenu.menu.CommonSliceHelper import AllowedList
+else:
+    from TriggerMenuPython.CommonSliceHelper import AllowedList
+
+from TrigConfigSvc.TrigConfigSvcUtils import getKeysFromNameRelease, getMenuNameFromDB
+
+
+_flags = []
+
+# Define Default Flags
+class doLVL1(JobProperty):
+    """ run the LVL1 simulation (set to FALSE to read the LVL1 result from BS file) """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=True
+
+_flags.append(doLVL1)
+
+class doL1Topo(JobProperty):
+    """ Run the L1 Topo simulation (set to FALSE to read the L1 Topo result from BS file) """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=False
+
+_flags.append(doL1Topo)
+
+class readLVL1Calo(JobProperty):
+    """  read LVL1 Calo info from pool or BS """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=False
+
+_flags.append(readLVL1Calo)
+
+class readLVL1Muon(JobProperty):
+    """ read LVL1 Muon in from Pool or BS """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=False
+
+_flags.append(readLVL1Muon)
+
+class fakeLVL1(JobProperty):
+    """ create fake RoI from KINE info  """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=False
+
+_flags.append(fakeLVL1)
+
+class useCaloTTL(JobProperty):
+    """ False for DC1. Can use True for Rome files with Digits or post-Rome data """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=True
+
+_flags.append(useCaloTTL)
+
+class useL1CaloCalibration(JobProperty):
+    """ Should be false for early data, true for later """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=False
+
+_flags.append(useL1CaloCalibration)
+
+class doCosmicSim(JobProperty):
+    """ run the LVL1 simulation with special setup for cosmic simulation (set to FALSE by default, to do collisions simulation) """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=False
+
+_flags.append(doCosmicSim)
+
+class disableRandomPrescale(JobProperty):
+    """ if True, disable Random Prescales """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=False
+
+_flags.append(disableRandomPrescale)
+
+class doLVL2(JobProperty):
+    """ if False, disable LVL2 selection """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=False
+
+_flags.append(doLVL2)
+
+class doEF(JobProperty):
+    """ if False, disable EF selection """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=False
+
+_flags.append(doEF)
+
+
+class doHLT(JobProperty):
+    """ if False, disable HLT selection """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=True
+    
+    def _do_action(self):
+        """ setup flag level consistency """
+        if self.get_Value() is True:
+            if TriggerFlags.doEF.is_locked():
+                TriggerFlags.doEF.unlock()
+                TriggerFlags.doEF.set_Off()
+                TriggerFlags.doEF.lock()
+            else:
+                TriggerFlags.doEF.set_Off()
+            if TriggerFlags.doEF.is_locked():
+                TriggerFlags.doLVL2.unlock()
+                TriggerFlags.doLVL2.set_Off()
+                TriggerFlags.doLVL2.lock()
+            else:
+                TriggerFlags.doLVL2.set_Off()
+            log = logging.getLogger( 'TriggerJobOpts.TriggerFlags' )
+            log.info("doHLT is True: force doLVL2=False and doEF=False"  )
+
+            
+_flags.append(doHLT)
+
+
+class doMergedHLTResult(JobProperty):
+    """ if False disable decoding of the merged HLT Result (so decoding L2/EF Result) """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=True
+
+_flags.append(doMergedHLTResult)
+
+class doFEX(JobProperty):
+    """ if False disable Feature extraction algorithms """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=True
+
+_flags.append(doFEX)
+
+class doHypo(JobProperty):
+    """ if False disable all Hypothesis algorithms (HYPO)"""
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=True
+
+_flags.append(doHypo)
+
+class doTruth(JobProperty):
+    """ """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=False
+
+_flags.append(doTruth)
+
+# FTK simulation switch
+
+class doFTK(JobProperty):
+    """ if False, disable FTK result reader """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=False
+
+_flags.append(doFTK)
+
+# monitoring switch
+class enableMonitoring(JobProperty):
+    """ enables certain monitoring type: Validation, Online, Time"""
+    statusOn=True
+    allowedType=['list']
+    StoredValue=[]
+
+_flags.append(enableMonitoring)
+
+# trigger configuration source list
+class configurationSourceList(JobProperty):
+    """ define where to read trigger configuration from. Allowed values: ['xml','aod','ds']"""
+    statusOn=True
+    allowedType=['list']
+    StoredValue=[]
+    allowedValues = AllowedList( ['aod','xml','ds'] )
+
+_flags.append(configurationSourceList)
+
+class doTriggerConfigOnly(JobProperty):
+    """ if True only the configuration services should be set, no algorithm """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=False
+
+_flags.append(doTriggerConfigOnly)
+              
+# Flags to switch on/off Detector Slices
+class doID(JobProperty):
+    """ if False, disable ID algos at LVL2 and EF """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=True
+
+_flags.append(doID)
+
+class doCalo(JobProperty):
+    """ if False, disable Calo algorithms at LVL2 & EF """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=True
+
+_flags.append(doCalo)
+
+class doBcm(JobProperty):
+    """ if False, disable BCM algorithms at LVL2 & EF """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=True
+
+_flags.append(doBcm)
+
+class doTrt(JobProperty):
+    """ if False, disable TRT algorithms at LVL2 & EF """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=True
+
+_flags.append(doTrt)
+
+class doZdc(JobProperty):
+    """ if False, disable ZDC algorithms at LVL2 & EF """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=True
+
+_flags.append(doZdc)
+
+class doLucid(JobProperty):
+    """ if False, disable Lucid algorithms at LVL2 & EF """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=True
+
+_flags.append(doLucid)
+
+class doMuon(JobProperty):
+    """ if FAlse, disable Muons, note: muons need input file containing digits"""
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=True
+
+_flags.append(doMuon)
+
+# Flags to switch on/off physics selection slices
+# defaults L2ID, L2Calo, L2Muon, EFID, EFCalo, EFMuon
+#         class TauSlice(JobProperty):---""" """ statusOn=True\allowedType=['bool']\nStoredValue=TriggerSliceFlags(L2ID(JobProperty):True, L2Calo(JobProperty):True, L2Muon(JobProperty):False,
+#                                         EFID(JobProperty):False, EFCalo(JobProperty):False, EFMuon(JobProperty):False)
+
+#         class JetSlice(JobProperty):TriggerSliceFlags(L2ID(JobProperty):False, L2Calo(JobProperty):False, L2Muon(JobProperty):False,
+#                                         EFID(JobProperty):False, EFCalo(JobProperty):False, EFMuon(JobProperty):False)
+
+#         class BphysicsSlice(JobProperty):TriggerSliceFlags(L2ID(JobProperty):False, L2Calo(JobProperty):False, L2Muon(JobProperty):False,
+#                                              EFID(JobProperty):False, EFCalo(JobProperty):False, EFMuon(JobProperty):False)
+
+#         class BjetSlice(JobProperty):TriggerSliceFlags(L2ID(JobProperty):False, L2Calo(JobProperty):False, L2Muon(JobProperty):False,
+#                                          EFID(JobProperty):False, EFCalo(JobProperty):False, EFMuon(JobProperty):False)
+
+#         class METSlice(JobProperty):TriggerSliceFlags(L2ID(JobProperty):False, L2Calo(JobProperty):False, L2Muon(JobProperty):False,
+#                                              EFID(JobProperty):False, EFCalo(JobProperty):False, EFMuon(JobProperty):False)
+
+#         class EgammaSlice(JobProperty):TriggerSliceFlags(L2ID(JobProperty):True, L2Calo(JobProperty):True, L2Muon(JobProperty):False,
+#                                            EFID(JobProperty):True, EFCalo(JobProperty):False, EFMuon(JobProperty):False)
+
+#         class MuonSlice(JobProperty):TriggerSliceFlags(L2ID(JobProperty):False, L2Calo(JobProperty):False, L2Muon(JobProperty):False,
+#                                          EFID(JobProperty):False, EFCalo(JobProperty):False, EFMuon(JobProperty):False)
+
+#         class mySlice(JobProperty):TriggerSliceFlags(L2ID(JobProperty):False, L2Calo(JobProperty):False, L2Muon(JobProperty):False,
+#                                        EFID(JobProperty):False, EFCalo(JobProperty):False, EFMuon(JobProperty):False)
+
+
+class doHLTpersistency(JobProperty):
+    """ serialise L2result """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=True
+
+_flags.append(doHLTpersistency)
+
+class useOfflineSpacePoints(JobProperty):
+    """ use online convertors for Si SpacePoints"""
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=False
+
+_flags.append(useOfflineSpacePoints)
+
+class doNtuple(JobProperty):
+    """ """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=False
+
+_flags.append(doNtuple)
+
+
+class writeBS(JobProperty):
+    """ """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=False
+
+_flags.append(writeBS)
+
+class readBS(JobProperty):
+    """ """
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=False
+
+_flags.append(readBS)
+
+
+class AODEDMSet(JobProperty):
+    """ Define which sets of object go to AOD """
+    statusOn=True
+    allowedType=['list']
+    StoredValue='AODFULL'
+
+_flags.append(AODEDMSet)
+
+class ESDEDMSet(JobProperty):
+    """ Define which sets of object go to ESD (or derived ESD) """
+    statusOn=True
+    allowedType=['list']
+    StoredValue='ESD'
+
+_flags.append(ESDEDMSet)
+
+# =========
+#
+# trigger flags used by trigger configuration
+#
+
+class configForStartup(JobProperty):
+    """ A temporary flag to determine the actions to be taken for the different cases of HLT running in the startup phase"""
+    statusOn=True
+    allowedType=['string']
+    StoredValue = 'HLTonlineNoL1Thr'
+    
+    allowedValues = [
+        'HLTonline',
+        'HLToffline',
+        'HLTonlineNoL1Thr',
+        'HLTofflineNoL1Thr'
+        ]
+
+_flags.append(configForStartup)
+
+class dataTakingConditions(JobProperty):
+    """ A flag that describes the conditions of the Trigger at data taking, and determines which part of it will be processed in reconstruction."""
+    statusOn=True
+    allowedType=['string']
+    StoredValue = 'FullTrigger'
+    
+    allowedValues = [
+        'HltOnly',
+        'Lvl1Only',
+        'FullTrigger',
+        'NoTrigger'
+        ]
+
+_flags.append(dataTakingConditions)
+
+class triggerUseFrontier(JobProperty):
+    """Flag determines if frontier should be used to connect to the oracle database, current default is False"""
+    statusOn=True
+    allowedType=['bool']
+    StoredValue = False
+    def _do_action(self):
+        log = logging.getLogger( 'TriggerJobOpts.TriggerFlags' )
+        log.info("Setting TriggerFlags.triggerUseFrontier to %r" % self.get_Value())
+        
+_flags.append(triggerUseFrontier)
+
+
+
+class triggerConfig(JobProperty):
+    """ Flag to set various menus and options (read from XML or DB)
+    Allowed values:
+
+    Note that we use LVL1 prefix here in order not to touch the
+    HLT if we're only running a LVL1 digitization job. The
+    prefix is automatically added in the Digi job transform.
+    
+    NONE or OFF                             -trigger off 
+
+    For digitization (L1) only use LVL1 prefix:
+    LVL1:DEFAULT                            -default L1 menu
+    LVL1:MenuName                           -takes the L1 xml representation of this menu
+    LVL1:DB:connectionstring:SMKey,L1PSKey  -takes these db keys
+    LVL1:DB:connectionstring:MenuName,Rel   -takes this menu from the db - not yet supported
+
+    For MC reconstruction use MCRECO prefix:
+    MCRECO:DEFAULT                                       -default L1 and HLT menu
+    MCRECO:MenuName                                      -takes the L1 and HLT xml respresentations of the menu
+    MCRECO:L1CaloCalib=True/False:MenuName               -takes the L1 and HLT xml respresentations of the menu, sets L1 calo calib
+    MCRECO:DB:connectionstring:SMKey,L1PSK,HLTPSK[,BGK]  -takes these db keys
+    MCRECO:DB:L1CaloCalib=True/False:connectionstring:SMKey,L1PSK,HLTPSK  -takes these db keys, sets L1 calo calib
+    MCRECO:DB:connectionstring:MenuName,Rel              -takes this menu from the db (looks up the SMK)
+                                                         -NB for the above: move to alias tables?
+                                                   
+    For data reconstruction: use DATARECO prefix. TO BE IMPLEMENTED. 
+    DATARECO:ONLINE
+    DATARECO:OFFLINE
+    DATARECO:DB:connectionstring:SMKey,L1PSK,HLTPSK
+    
+    InFile: TO BE IMPLEMENTED
+
+    connectionstring can be one of the following
+    1)  <ALIAS>                              -- usually TRIGGERDB or TRIGGERDBMC (generally any string without a colon ':')
+    2)  <type>:<detail>                      -- <type> has to be oracle, mysql, or sqlite_file, <detail> is one of the following
+    2a) sqlite_file:filename.db              -- an sqlite file, no authentication needed, will be opened in read-only mode
+    2b) oracle://ATLAS_CONFIG/ATLAS_CONF_TRIGGER_V2  -- a service description type://server/schema without user and password
+    2c) oracle://ATLAS_CONFIG/ATLAS_CONF_TRIGGER_V2;username=ATLAS_CONF_TRIGGER_V2_R;password=<...>  -- a service description with user and password
+
+    Note: specifying :DBF: instead of :DB: will set the trigger flag triggerUseFrontier to true
+    """
+    
+    statusOn=''
+    allowedType=['string']
+    StoredValue = 'MCRECO:DEFAULT';
+
+
+    def _do_action(self):
+        """ setup some consistency """
+        from TriggerJobOpts.TriggerFlags import TriggerFlags as tf
+                
+        log = logging.getLogger( 'TriggerJobOpts.TriggerFlags' )
+        log.info("triggerConfig: \""+self.get_Value()+"\"")
+        # We split the string passed to the flag
+        configs = self.get_Value().split(":")
+        
+        ## ------
+        ##  OFF or NONE: we want to turn everything related to trigger to false (via rec flag)
+        ##  Note that this is true for reconstruction only at the moment. For LVL1 Digitization jobs,
+        ##  which don't use rec flags, this is still done in the skeleton. Might be changed in future.
+        ## ------
+        if (configs[0] == 'OFF' or configs[0] == 'NONE'):
+            from RecExConfig.RecFlags  import rec
+            rec.doTrigger=False
+            log.info("triggerConfig: Setting rec.doTrigger to False")
+            
+            
+        ## ------
+        ## DATARECO : We deal with data (cosmics, single run, collisions)
+        ## ------               
+        elif configs[0] == 'DATARECO':
+            if configs[1] == 'ONLINE': # We read config from COOL directly
+                log.warning("triggerConfig: DATARECO:ONLINE (reco from cool) is not yet implemented. You should not use it.")
+            elif configs[1] == 'OFFLINE': # We read config from XML
+                log.warning("triggerConfig: DATARECO:OFFLINE (reco from xml) is not yet implemented. You should not use it.")
+            elif configs[1] == 'REPR': # We read config from XML
+                log.info("triggerConfig: DATARECO:REPR is designed to configure the offline reconstruction in a trigger reprocessing job")
+                try:
+                    f = open("MenuCoolDbLocation.txt",'r')
+                    tf.triggerCoolDbConnection = f.read()
+                    f.close()
+                except IOError, e:
+                    log.fatal("triggerConfig=DATARECO:REPR requires 'MenuCoolDbLocation.tx' to be present in the local directory (reco part of trigger reprocessing)")
+                    
+            elif configs[1] == 'DB' or configs[1] == 'DBF': # We read config from a private DB
+                ### We read the menu from the TriggerDB
+                tf.readMenuFromTriggerDb=True
+                tf.triggerUseFrontier = (configs[1]=='DBF')
+                tf.triggerDbConnection = ':'.join(configs[2:-1])  # the dbconnection goes from second to last ':', it can contain ':'
+                DBkeys = configs[-1].split(",")
+                if (len(DBkeys) == 3):                            # we got 3 keys (SM, L1PS, HLTPS)
+                    tf.triggerDbKeys=[int(x) for x in DBkeys] + [1]
+                    log.info("triggerConfig: DATARECO from DB with speficied keys SMK %i, L1 PSK %i, and HLT PSK %i." % tuple(tf.triggerDbKeys()[0:3])   )
+                elif (len(DBkeys) == 2):                       # we got a menu name and a release which we need to look up 
+                    log.info("triggerConfig: DATARECO from DB with specified menu name and release: finding keys...")
+                    tf.triggerDbKeys=getKeysFromNameRelease(tf.triggerDbConnection(),DBkeys[0],DBkeys[1],False) + [1]
+                    log.info("triggerConfig: DATARECO from DB with keys SMK %i, L1 PSK %i, and HLT PSK %i." % tuple(tf.triggerDbKeys()[0:3])   )
+                else:
+                    log.info("triggerConfig: DATARECO from DB configured with wrong number of keys/arguments" )
+
+        ## ---------
+        ##  InFile : We wish to read a file with config info already in it (ESD, AOD, ...)
+        ## ---------            
+        elif configs[0] == 'InFile': 
+            log.warning("triggerConfig: Infile is not yet implemented. You should not use it.")
+
+        ## ------
+        ##  LVL1 : For LVL1 simulation only in Digitization job 
+        ## ------
+        elif configs[0] == 'LVL1':
+            if configs[1] == 'DB' or configs[1]=='DBF':
+                ### We read config from the TriggerDB
+                tf.readMenuFromTriggerDb=True
+                tf.triggerUseFrontier = (configs[1]=='DBF')
+                tf.triggerDbConnection = ':'.join(configs[2:-1])  # the dbconnection goes from second to last ':', it can contain ':'
+                DBkeys = configs[-1].split(",")
+                if (len(DBkeys) == 2): #We got either 2 keys (SM, L1PS) or menu name plus release. If latter, second object will contain a .
+                    if not '.' in str(DBkeys[1]):
+                        tf.triggerDbKeys=[int(x) for x in DBkeys] +[-1,1] # SMkey, L1PSkey, HLTPSkey, BGkey
+                        log.info("triggerConfig: LVL1 from DB with specified keys SMK %i and L1 PSK %i." % tuple(tf.triggerDbKeys()[0:2])   )
+                    else:
+                        log.info("triggerConfig: LVL1 from DB with speficied menu name and release: finding keys...")
+                        tf.triggerDbKeys=getKeysFromNameRelease(tf.triggerDbConnection(),DBkeys[0],DBkeys[1],True) + [-1,1]
+                        log.info("triggerConfig: LVl1 from DB with keys SMK %i and L1 PSK %i" % tuple(tf.triggerDbKeys()[0:2])   )
+                else:                  #We got a menu name which we need to look up - not implemented yet
+                    log.info("triggerConfig: LVL1 from DB configured with wrong number of keys/arguments" )
+
+            else:
+                ### We read config from XML
+                tf.readLVL1configFromXML=True
+                if (configs[1] == 'DEFAULT' or configs[1] == 'default'):
+                    tf.triggerMenuSetup = 'default'
+                else:
+                    tf.triggerMenuSetup = configs[1]
+                log.info("triggerConfig: LVL1 menu from xml (%s)" % tf.triggerMenuSetup())
+
+                
+
+        #------
+        # MCRECO: Reconstruction of MC
+        #------            
+        elif configs[0] == 'MCRECO':
+            from RecExConfig.RecFlags  import rec
+            from RecJobTransforms.RecConfig import recConfig
+            rec.doTrigger = True
+
+            if configs[1] == 'DB' or configs[1]=='DBF':
+                ### We read the menu from the TriggerDB
+                tf.readMenuFromTriggerDb=True
+                tf.triggerUseFrontier = (configs[1]=='DBF')
+                
+                #see if L1 calib arg supplied
+                if "L1CaloCalib" in configs[2]:
+                    if configs[2].split("=")[-1] == "True" or configs[2].split("=")[-1] == "true":
+                        log.info("Setting L1CaloCalib from TriggerConfig command to %s " % configs[2].split("=")[-1])
+                        tf.useL1CaloCalibration=True
+                    elif configs[2].split("=")[-1] == "False" or configs[2].split("=")[-1] == "false":
+                        log.info("Setting L1CaloCalib from TriggerConfig command to %s " % configs[2].split("=")[-1])
+                        tf.useL1CaloCalibration=False
+                    else:
+                        log.warning("Unknown value for L1CaloCalib ('%s'), will use default" % configs[2].split("=")[-1])
+                    tf.triggerDbConnection = ':'.join(configs[3:-1])  # the dbconnection goes from third to last ':', it can contain ':'
+                else:
+                    tf.triggerDbConnection = ':'.join(configs[2:-1])  # the dbconnection goes from second to last ':', it can contain ':'
+                DBkeys = configs[-1].split(",")
+                if (len(DBkeys) == 4):                            # we got 4 keys (SM, L1PS, HLTPS,BGK)
+                    tf.triggerDbKeys=[int(x) for x in DBkeys]
+                    log.info("triggerConfig: MCRECO from DB with speficied keys SMK %i, L1 PSK %i, HLT PSK %i, and BGK %i." % tuple(tf.triggerDbKeys()[0:4])   )
+                if (len(DBkeys) == 3):                            # we got 3 keys (SM, L1PS, HLTPS)
+                    tf.triggerDbKeys=[int(x) for x in DBkeys] + [1]
+                    log.info("triggerConfig: MCRECO from DB with speficied keys SMK %i, L1 PSK %i, and HLT PSK %i." % tuple(tf.triggerDbKeys()[0:3])   )
+                elif (len(DBkeys) == 2):                       # we got a menu name and a release which we need to look up 
+                    log.info("triggerConfig: MCRECO from DB with specified menu name and release: finding keys...")
+                    tf.triggerDbKeys=getKeysFromNameRelease(tf.triggerDbConnection(),DBkeys[0],DBkeys[1],False) + [1]
+                    log.info("triggerConfig: MCRECO from DB with keys SMK %i, L1 PSK %i, and HLT PSK %i." % tuple(tf.triggerDbKeys()[0:3])   )
+                else:
+                    log.info("triggerConfig: MCRECO from DB configured with wrong number of keys/arguments" )
+
+                # we need to set triggerMenuSetup to the correct name
+                # that we get from the triggerDB, otherwise
+                # TriggerGetter->GenerateMenu.generateMenu() would be
+                # run with the wrong menu and the configuration of the
+                # algorithms would be incorrect (bug 72547)
+                tf.triggerMenuSetup=getMenuNameFromDB(tf.triggerDbConnection(),tf.triggerDbKeys()[2])
+                log.info("triggerConfig: Setting tf.triggerMenuSetup to " + tf.triggerMenuSetup())
+            else:
+                ### We read the menu from xml
+                tf.readLVL1configFromXML=True
+                tf.readHLTconfigFromXML=True
+                if "L1CaloCalib" in configs[1]:
+                    if configs[1].split("=")[-1] == "True" or configs[1].split("=")[-1] == "true":
+                        log.info("Setting L1CaloCalib from TriggerConfig command to %s " % configs[1].split("=")[-1])
+                        tf.useL1CaloCalibration=True
+                    elif configs[1].split("=")[-1] == "False" or configs[1].split("=")[-1] == "false":
+                        log.info("Setting L1CaloCalib from TriggerConfig command to %s " %  configs[1].split("=")[-1])
+                        tf.useL1CaloCalibration=False
+                    else:
+                        log.warning("Unknown value for L1CaloCalib ('%s'), will use default" % configs[1].split("=")[-1])
+                if (configs[-1] == 'DEFAULT' or configs[-1] == 'default'):
+                    tf.triggerMenuSetup = 'default'
+                else:
+                    tf.triggerMenuSetup = configs[-1]
+                log.info("triggerConfig: MCRECO menu from xml (%s)" % tf.triggerMenuSetup())
+
+            # This part was there in the original (old) csc_reco_trigger.py snippet
+            # Still wanted?
+            if rec.doTrigger:
+                # Switch off trigger of sub-detectors
+                for detOff in recConfig.detectorsOff:
+                    cmd = 'TriggerFlags.do%s = False' % detOff
+                    # possibly not all DetFlags have a TriggerFlag
+                    try:
+                        exec cmd
+                        recoLog.info(cmd)
+                    except AttributeError:
+                        pass
+        #------            
+        # We passed a wrong argument to triggerConfig
+        #------
+        else:
+            log.error("triggerConfig argument \""+self.get_Value()+"\" not understood. "
+                       + "Please check in TriggerFlags.py to see the allowed values.")
+            
+
+_flags.append(triggerConfig)
+
+
+
+class readL1TopoConfigFromXML(JobProperty):
+    """Use to specify external l1topo xml configuration file
+    (e.g. from the release or a local directory)
+    
+    If set to True:
+    the L1Topo config will be taken from TriggerFlags.inputL1TopoConfigFile()
+    
+    If set to False:    
+    the L1Topo config xml file is read from the python generated XML
+    file, which is specified in TriggerFlags.outputL1TopoconfigFile()
+    """
+    statusOn=True
+    allowedType=['bool']
+    # note: if you change the following default value, you must also change the default value in class inputLVL1configFile
+    # StoredValue=False
+    StoredValue = True # once the python generation is implemented the default should be False
+
+    def _do_action(self):
+        """ setup some consistency """
+        if self.get_Value() is False:
+            TriggerFlags.inputL1TopoConfigFile = TriggerFlags.outputL1TopoConfigFile()
+
+_flags.append(readL1TopoConfigFromXML)
+
+
+
+
+class readLVL1configFromXML(JobProperty):
+    """ If set to True the LVL1 config file is read from earlier generated XML file """
+    statusOn=True
+    allowedType=['bool']
+    # note: if you change the following default value, you must also change the default value in class inputLVL1configFile
+    # StoredValue=False
+    StoredValue = False
+
+    def _do_action(self):
+        """ setup some consistency """
+        import os
+        log = logging.getLogger( 'TriggerJobOpts.TriggerFlags' )
+
+        import TriggerMenu.l1.Lvl1Flags
+        
+        if self.get_Value() is False:
+            TriggerFlags.inputLVL1configFile = TriggerFlags.outputLVL1configFile()
+            TriggerFlags.Lvl1.items.set_On()
+        else:
+            xmlFile=TriggerFlags.inputLVL1configFile()
+            from TrigConfigSvc.TrigConfigSvcConfig import findFileInXMLPATH
+            if xmlFile!='NONE' and not os.path.exists(findFileInXMLPATH(xmlFile)):
+                log.debug("The LVL1 xml file is missing. ")
+                nightlyPaths=os.environ['XMLPATH'].split(':')
+                
+                nightlyDir = [ i.split("/") for i in nightlyPaths if "AtlasTrigger" in  i ][0]
+                #print nightlyDir
+                OldMenuVersion = nightlyDir[nightlyDir.index('AtlasTrigger')+1]
+                log.warning("LVL1 xml file will be taken with the older version: "+OldMenuVersion )
+                TriggerFlags.inputLVL1configFile = "LVL1config_"+TriggerFlags.triggerMenuSetup()+"_" + OldMenuVersion + ".xml"
+
+            TriggerFlags.Lvl1.items.set_Off()
+
+_flags.append(readLVL1configFromXML)
+
+
+
+class readHLTconfigFromXML(JobProperty):
+    """ If set to True the HLT config file is read from earlier generated XMl file """
+    statusOn=True
+    allowedType=['bool']
+    # note: if you change the following default value, you must also change the default value in class inputHLTconfigFile
+    # StoredValue=False
+    StoredValue = False
+
+    def _do_action(self):
+        """ Disable all subcontainers defining slices ON/OFF flags """
+
+        import os
+        log = logging.getLogger( 'TriggerJobOpts.TriggerFlags' )
+
+        ## loop over all properties in the container
+        # from AthenaCommon.JobProperties import JobPropertyContainer
+        # from TriggerJobOpts.TriggerFlags import TriggerFlags
+        for prop in TriggerFlags.__dict__.values():
+            if issubclass( prop.__class__, JobPropertyContainer ) and "signatures" in prop.__dict__.keys():
+                for slice_prop_name in prop.__dict__:
+                    slice_prop = prop.__dict__.get(slice_prop_name)
+                    if issubclass(slice_prop.__class__, JobProperty):
+                        if self.get_Value() == True: ## now depending on the value set flags are on/off
+                            slice_prop.set_Off()
+                        else:
+                            slice_prop.set_On()
+        ## in addition set inputLVL1configFile to be the same as outputLVL1configFile
+        if self.get_Value() is False:
+            TriggerFlags.inputHLTconfigFile = TriggerFlags.outputHLTconfigFile()
+        else:
+            if TriggerFlags.inputHLTconfigFile != 'NONE':
+                TriggerFlags.inputHLTconfigFile = "HLTconfig_"+TriggerFlags.triggerMenuSetup()+"_" + TriggerFlags.menuVersion() + ".xml"
+
+                nightlyPaths=os.environ['XMLPATH'].split(':')
+
+                for p in nightlyPaths:
+                    #print p+"/TriggerMenuXML/HLTconfig_"+TriggerFlags.triggerMenuSetup()+"_" + TriggerFlags.menuVersion() + ".xml"
+                    if os.path.exists(p+"/TriggerMenuXML/HLTconfig_"+TriggerFlags.triggerMenuSetup()+"_" + TriggerFlags.menuVersion() + ".xml") is True:
+                        log.info("The HLT xml file is found in "+p+"/TriggerMenuXML/")
+                        success = True
+                        break
+                    else:
+                        success = False
+
+                if success is False:
+                    log.debug("The HLT xml file is missing: HLTconfig_"+TriggerFlags.triggerMenuSetup()+"_" + TriggerFlags.menuVersion() + ".xml")
+
+                    nightlyDir = [ i.split("/") for i in nightlyPaths if "AtlasTrigger" in  i ][0]
+                    #print nightlyDir
+                    OldMenuVersion = nightlyDir[nightlyDir.index('AtlasTrigger')+1]
+                    log.warning("HLT xml file will be taken with the older version: "+OldMenuVersion )
+                    TriggerFlags.inputHLTconfigFile = "HLTconfig_"+TriggerFlags.triggerMenuSetup()+"_" + OldMenuVersion + ".xml"
+
+                
+_flags.append(readHLTconfigFromXML)
+
+
+# trigger configuration source list
+class readMenuFromTriggerDb(JobProperty):
+    """ define the TriggerDb to be the source of the LVL1 and HLT trigger menu"""
+    statusOn=False
+    allowedType=['bool']
+    StoredValue=False
+#    def _do_action(self):
+#        """ setup reading from DB requires menu readingFromXML """
+#        if self.get_Value() is True:
+#            TriggerFlags.readLVL1configFromXML = True
+#            TriggerFlags.readHLTconfigFromXML = True
+_flags.append(readMenuFromTriggerDb)
+
+# trigger configuration source list
+class readConfigFromTriggerDb(JobProperty):
+    """ define the TriggerDb to be the source of the LVL1 and HLT trigger menu"""
+    statusOn=False
+    allowedType=['bool']
+    StoredValue=False
+
+    def _do_action(self):
+        """ setup reading from DB requires menu readingFromXML """
+        if self.get_Value() is True:
+            # readMenuFromTriggerDb dumps only the HLTMenu to an XML file - it is of no use since HLTConfigSvc is set for the DB
+            TriggerFlags.readMenuFromTriggerDb = False
+            TriggerFlags.readLVL1configFromXML = False
+            TriggerFlags.readHLTconfigFromXML = False
+
+_flags.append(readConfigFromTriggerDb)
+
+class triggerDbKeys(JobProperty):
+    """ define the keys [Configuration, LVL1Prescale, HLTPrescale, L1BunchGroupSet] in that order!"""
+    statusOn=False
+    allowedType=['list']
+    StoredValue=[0,0,0,1]
+
+_flags.append(triggerDbKeys)
+
+class triggerDbConnection(JobProperty):
+    """ define triggerDB connection parameters"""
+    statusOn=False
+    allowedType=['dict']
+    StoredValue="TRIGGERDB"
+
+_flags.append(triggerDbConnection)
+
+class triggerCoolDbConnection(JobProperty):
+    """ define connection parameters to cool if external sqlite file is to be used"""
+    statusOn=True
+    allowedType=['str']
+    StoredValue=''
+
+_flags.append(triggerCoolDbConnection)
+
+class outputL1TopoConfigFile(JobProperty):
+    """ File name for output L1Topo configuration XML file produced by the python menu generation """
+    statusOn=True
+    allowedType=['str']
+    StoredValue=""
+
+    def __call__(self):
+        if self.get_Value() == "":
+            return "L1Topoconfig_"+TriggerFlags.triggerMenuSetup()+"_" + TriggerFlags.menuVersion() + ".xml"
+        else:
+            return self.get_Value()
+        
+_flags.append(outputL1TopoConfigFile)
+
+class outputLVL1configFile(JobProperty):
+    """ File name for output LVL1 configuration XML file """
+    statusOn=True
+    StoredValue=""
+
+    def __call__(self):
+        if self.get_Value() == "":
+            return "LVL1config_"+TriggerFlags.triggerMenuSetup()+"_" + TriggerFlags.menuVersion() + ".xml"
+        else:
+            return self.get_Value()
+        
+_flags.append(outputLVL1configFile)
+
+class outputHLTconfigFile(JobProperty):
+    """ File name for output HLT configuration XML file """
+    statusOn=True
+#    allowedType=['str']
+    StoredValue=""
+    
+    def __call__(self):
+        if self.get_Value() == "":
+            return "HLTconfig_"+TriggerFlags.triggerMenuSetup()+"_" + TriggerFlags.menuVersion() + ".xml"
+        else:
+            return self.get_Value()
+
+_flags.append(outputHLTconfigFile)
+
+
+
+class inputL1TopoConfigFile(JobProperty):
+    """Used to define an external L1Topo configuration file. To be
+    used together with trigger flag readL1TopoConfigFromXML.
+
+    If TriggerFlags.readL1TopoConfigFromXML()==True, then this file is
+    used for L1TopoConfiguration.
+    
+    Defaults to L1TopoConfig_<triggerMenuSetup>_<menuVersion>.xml
+    """
+    statusOn=True
+    allowedType=['str']
+    StoredValue="NONE"
+
+    def __call__(self):
+        if self.get_Value() == "":
+            return "L1TopoConfig_"+TriggerFlags.triggerMenuSetup()+"_" + TriggerFlags.menuVersion() + ".xml"
+        else:
+            return self.get_Value()
+        
+_flags.append(inputL1TopoConfigFile)
+
+
+
+class inputLVL1configFile(JobProperty):
+    """ File name for input LVL1 configuration XML file """
+    statusOn=True
+#    allowedType=['str']
+#   The following default is appropriate when XML cofig is the default
+#    StoredValue="TriggerMenuXML/LVL1config_default_" + TriggerFlags.menuVersion() + ".xml"
+#   The following default is appropriate when python config is the default
+    StoredValue=""
+#    StoredValue = "TriggerMenuXML/LVL1config_default_" + TriggerFlags.menuVersion() + ".xml"
+
+    def __call__(self):
+        if self.get_Value() == "":
+            return "LVL1config_"+TriggerFlags.triggerMenuSetup()+"_" + TriggerFlags.menuVersion() + ".xml"
+        else:
+            return self.get_Value()
+        
+_flags.append(inputLVL1configFile)
+
+
+
+class inputHLTconfigFile(JobProperty):
+    """ File name for input HLT configuration XML file """
+    statusOn=True
+    allowedType=['str']
+#   The following default is appropriate when XML cofig is the default
+#    StoredValue="TriggerMenuXML/HLTconfig_default_" + TriggerFlags.menuVersion() + ".xml"
+#   The following default is appropriate when python config is the default
+    StoredValue=""
+#    StoredValue = "TriggerMenuXML/HLTconfig_default_" + TriggerFlags.menuVersion() + ".xml"
+
+    def __call__(self):
+        if self.get_Value() == "":
+            return "HLTconfig_"+TriggerFlags.triggerMenuSetup()+"_" + TriggerFlags.menuVersion() + ".xml"
+        else:
+            return self.get_Value()
+        
+_flags.append(inputHLTconfigFile)
+
+class abortOnConfigurationError(JobProperty):
+    """ Should the job be stoped if there is an error in configuration"""
+    statusOn=True
+    allowedType=['bool']
+    StoredValue=False
+
+_flags.append(abortOnConfigurationError)
+
+
+# =================
+#
+# trigger menu flags - menu version, prescale sets
+#
+# =================
+class menuVersion(JobProperty):
+    """ Defines the menu version to use, usually the same as the release number. This is part of the XML file name. """
+    statusOn=True
+    allowedType=['str']
+    
+    from AthenaCommon.AppMgr import release_metadata
+    StoredValue = release_metadata()['release']  # returns '?' if missing
+    
+_flags.append(menuVersion)
+
+
+class triggerMenuSetup(JobProperty):
+    """ Defines the luminosity dependent setup of trigger lumi01 == 10^33, switches on/off signatures """
+    statusOn=True
+    allowedType=['str']
+    allowedValues = [
+        'default', 'cosmic_default', 'InitialBeam_default',
+        # menus for 10^31 with EMScale L1 calib
+        'Physics_lumi1E31_simpleL1Calib','Physics_lumi1E31_simpleL1Calib_no_prescale',
+        'MC_lumi1E31_simpleL1Calib','MC_lumi1E31_simpleL1Calib_no_prescale',
+        'MC_lumi1E31_simpleL1Calib_physics_prescale',
+        # menus for 10^32 with EMScale L1 calib
+        'Physics_lumi1E32_simpleL1Calib','Physics_lumi1E32_simpleL1Calib_no_prescale',
+        'MC_lumi1E32_simpleL1Calib','MC_lumi1E32_simpleL1Calib_no_prescale',
+        'MC_lumi1E32_simpleL1Calib_physics_prescale',
+        # menus for 10^33
+        'Physics_lumi1E33','Physics_lumi1E33_no_prescale',
+        'MC_lumi1E33','MC_lumi1E33_no_prescale',
+        'Physics_lumi1E34','Physics_lumi1E34_no_prescale',
+        'MC_lumi1E34','MC_lumi1E34_no_prescale',
+        #
+        'Cosmics','Cosmic_v1', 'Cosmic2009_v1', 'Cosmic2009_v2', 
+        'InitialBeam_v1', 'MC_InitialBeam_v1', 'MC_InitialBeam_v1_no_prescale',
+        'Cosmic2009_simpleL1Calib', 'Cosmic2009_inclMuons',
+        'enhBias',
+        # for 2010 running
+        'Cosmic_v2','Cosmic_v3',
+        'InitialBeam_v2', 'MC_InitialBeam_v2', 'MC_InitialBeam_v2_no_prescale',
+        'InitialBeam_v3', 'MC_InitialBeam_v3', 'MC_InitialBeam_v3_no_prescale',
+        #for 2010-2011 running
+        'Physics_pp_v1', 'Physics_pp_v1_no_prescale', 'Physics_pp_v1_cosmics_prescale',
+        'MC_pp_v1', 'MC_pp_v1_no_prescale',
+        'MC_pp_v1_tight_mc_prescale', 'MC_pp_v1_loose_mc_prescale',
+        #v2 
+        'Physics_pp_v2', 'Physics_pp_v2_no_prescale', 'Physics_pp_v2_cosmics_prescale', 
+        'MC_pp_v2', 'MC_pp_v2_primary', 'MC_pp_v2_no_prescale', 
+        'MC_pp_v2_tight_mc_prescale', 'MC_pp_v2_loose_mc_prescale',
+        #v3
+        'Physics_pp_v3', 'Physics_pp_v3_no_prescale', 'Physics_pp_v3_cosmics_prescale', 
+        'MC_pp_v3', 'MC_pp_v3_primary', 'MC_pp_v3_no_prescale', 
+        'MC_pp_v3_tight_mc_prescale', 'MC_pp_v3_loose_mc_prescale',
+        #v4
+        'Physics_pp_v4', 'Physics_pp_v4_no_prescale', 'Physics_pp_v4_cosmics_prescale',
+        'MC_pp_v4', 'MC_pp_v4_primary', 'MC_pp_v4_no_prescale',
+        'MC_pp_v4_upgrade_mc_prescale','MC_pp_v4_tight_mc_prescale', 'MC_pp_v4_loose_mc_prescale',
+        # L1 v2 for testing
+        'L1_pp_v2',
+        'L1_pp_v3',
+        'L1_pp_v4',
+        'L1_pp_test',
+        'L1_alfa_v1',
+        'L1_alfa_v2',
+        # for HeavyIon
+        'InitialBeam_HI_v1', 'InitialBeam_HI_v1_no_prescale',
+        'MC_InitialBeam_HI_v1', 'MC_InitialBeam_HI_v1_no_prescale',
+        'Physics_HI_v1', 'Physics_HI_v1_no_prescale',
+        'MC_HI_v1',     'MC_HI_v1_no_prescale', 'MC_HI_v1_pPb_mc_prescale',
+        #
+        'Physics_HI_v2', 'Physics_HI_v2_no_prescale', 
+        'MC_HI_v2',  'MC_HI_v2_no_prescale', 'MC_HI_v2_pPb_mc_prescale',
+        #
+        'Physics_default', 'MC_loose_default', 'MC_tight_default',
+        # -----------------------------------------------------------------
+        # Run 2
+        'MC_pp_v5', 'MC_pp_v5_no_prescale', 'MC_pp_v5_tight_mc_prescale', 'MC_pp_v5_loose_mc_prescale', # for development and simulation
+        'Physics_pp_v5', # for testing algorithms and software quality during LS1, later for data taking
+        'LS1_v1', # for P1 detector commissioning (cosmics, streamers)
+        'DC14', 'DC14_no_prescale', 'DC14_tight_mc_prescale', 'DC14_loose_mc_prescale', # for DC14
+        'Physics_HI_v3', 'Physics_HI_v3_no_prescale', # for 2015 lead-lead menu 
+        ]
+
+    _default_menu='Physics_pp_v5'
+    _default_cosmic_menu='Physics_pp_v4_cosmics_prescale'
+    _default_InitialBeam_menu='MC_InitialBeam_v3_no_prescale'
+    
+    StoredValue = _default_menu
+
+    def _do_action(self):
+        """ setup some consistency """
+
+        # meaning full default menu
+        if self.get_Value() == 'default':
+            self.set_Value(self._default_menu)
+            self._log.info("%s - trigger menu 'default' changed to '%s'" % (self.__class__.__name__, self.get_Value()))
+        elif self.get_Value() == 'cosmic_default':
+            self.set_Value(self._default_cosmic_menu)
+            self._log.info("%s - trigger menu 'cosmic_default' changed to '%s'" % (self.__class__.__name__, self.get_Value()))
+        elif self.get_Value() == 'InitialBeam_default':
+            self.set_Value(self._default_InitialBeam_menu)
+            self._log.info("%s - trigger menu 'InitialBeam_default' changed to '%s'" % (self.__class__.__name__, self.get_Value()))
+            
+        # filenames for LVL1 and HLT
+        if TriggerFlags.readLVL1configFromXML() is True:
+            TriggerFlags.inputLVL1configFile = "LVL1config_"+self.get_Value()+"_" + TriggerFlags.menuVersion() + ".xml"
+        if TriggerFlags.readHLTconfigFromXML() is True:
+            TriggerFlags.inputHLTconfigFile = "HLTconfig_"+self.get_Value()+"_" + TriggerFlags.menuVersion() + ".xml"
+
+_flags.append(triggerMenuSetup)
+
+class L1PrescaleSet(JobProperty):
+    statusOn = True
+    allowedTypes = ['str']
+    allowedValues = [
+        '', 'None',
+        # Physics menus
+        'L1Prescales100_Physics_lumi1E31_simpleL1Calib','L1PrescalesNone_Physics_lumi1E31_simpleL1Calib',
+        'L1Prescales100_Physics_lumi1E32_simpleL1Calib','L1PrescalesNone_Physics_lumi1E32_simpleL1Calib',
+        'L1Prescales100_Physics_lumi1E33','L1PrescalesNone_Physics_lumi1E33',
+        'L1Prescales100_Physics_lumi1E34','L1PrescalesNone_Physics_lumi1E34',
+        'L1Prescales100_MC_lumi1E31_simpleL1Calib','L1PrescalesNone_MC_lumi1E31_simpleL1Calib',
+        'L1Prescales100_MC_lumi1E32_simpleL1Calib','L1PrescalesNone_MC_lumi1E32_simpleL1Calib',
+        'L1Prescales100_MC_lumi1E33','L1PrescalesNone_MC_lumi1E33',
+        # Enhanced bias
+        'L1Prescales100_enhBias','L1PrescalesNone_enhBias',
+        # Cosmic menus
+        'L1Prescales100_Cosmic_v1', 'L1PrescalesNone_Cosmic_v1',
+        'L1Prescales100_Cosmic2009_v1', 'L1PrescalesNone_Cosmic2009_v1',
+        'L1Prescales100_Cosmic2009_v2', 'L1PrescalesNone_Cosmic2009_v2',
+        'L1Prescales100_Cosmic_v2', 'L1PrescalesNone_Cosmic_v2',
+        'L1Prescales100_Cosmic_v3', 'L1PrescalesNone_Cosmic_v3',
+        'L1Prescales100_Cosmic2009_simpleL1Calib', 'L1PrescalesNone_Cosmic2009_simpleL1Calib',
+        'L1Prescales100_Cosmic2009_inclMuons', 'L1PrescalesNone_Cosmic2009_inclMuons',
+        # Commissioning menus
+        'L1Prescales100_InitialBeam_v1', 'L1PrescalesNone_InitialBeam_v1',
+        'L1Prescales100_MC_InitialBeam_v1', 'L1PrescalesNone_MC_InitialBeam_v1',
+        'L1Prescales100_InitialBeam_v2', 'L1PrescalesNone_InitialBeam_v2',
+        'L1Prescales100_MC_InitialBeam_v2', 'L1PrescalesNone_MC_InitialBeam_v2',
+        'L1Prescales100_InitialBeam_v3', 'L1PrescalesNone_InitialBeam_v3',
+        'L1Prescales100_MC_InitialBeam_v3', 'L1PrescalesNone_MC_InitialBeam_v3',
+        #2010-2011 menus
+        'L1Prescales100_Physics_pp_v1','L1PrescalesNone_Physics_pp_v1',
+        'L1Prescales100_MC_pp_v1','L1PrescalesNone_MC_pp_v1',
+        'L1Prescales100_MC_pp_v1_tight_mc_prescale','L1PrescalesNone_MC_pp_v1_tight_mc_prescale',
+        'L1Prescales100_MC_pp_v1_loose_mc_prescale','L1PrescalesNone_MC_pp_v1_loose_mc_prescale',
+        # HeavyIon
+        'L1Prescales100_InitialBeam_HI_v1','L1PrescalesNone_InitialBeam_HI_v1',
+        'L1Prescales100_MC_InitialBeam_HI_v1', 'L1PrescalesNone_MC_InitialBeam_HI_v1',
+        'L1Prescales100_Physics_HI_v1','L1PrescalesNone_Physics_HI_v1',
+        'L1Prescales100_MC_HI_v1','L1PrescalesNone_MC_HI_v1',
+        'L1Prescales100_Physics_HI_v2','L1PrescalesNone_Physics_HI_v2',
+        'L1Prescales100_MC_HI_v2','L1PrescalesNone_MC_HI_v2',
+        ]
+    StoredValue = ''
+_flags.append(L1PrescaleSet)
+
+class HLTPrescaleSet(JobProperty):
+    statusOn = True
+    allowedTypes = ['str']
+    allowedValues = [
+        '', 'None',
+        # Physics menus
+        'HLTPrescales100_Physics_lumi1E31_simpleL1Calib','HLTPrescalesNone_Physics_lumi1E31_simpleL1Calib',
+        'HLTPrescales100_Physics_lumi1E32_simpleL1Calib','HLTPrescalesNone_Physics_lumi1E32_simpleL1Calib',
+        'HLTPrescales100_Physics_lumi1E33','HLTPrescalesNone_Physics_lumi1E33',
+        'HLTPrescales100_Physics_lumi1E34','HLTPrescalesNone_Physics_lumi1E34',        
+        'HLTPrescales100_MC_lumi1E31_simpleL1Calib','HLTPrescalesNone_MC_lumi1E31_simpleL1Calib',
+        'HLTPrescales100_MC_lumi1E32_simpleL1Calib','HLTPrescalesNone_MC_lumi1E32_simpleL1Calib',
+        'HLTPrescales100_MC_lumi1E33','HLTPrescalesNone_MC_lumi1E33',
+        # Enhanced bias
+        'HLTPrescales100_enhBias','HLTPrescalesNone_enhBias',
+        # Cosmic menus
+        'HLTPrescales100_Cosmic_v1', 'HLTPrescalesNone_Cosmic_v1',
+        'HLTPrescales100_Cosmic2009_v1', 'HLTPrescalesNone_Cosmic2009_v1',
+        'HLTPrescales100_Cosmic2009_v2', 'HLTPrescalesNone_Cosmic2009_v2',
+        'HLTPrescales100_Cosmic2009_simpleL1Calib', 'HLTPrescalesNone_Cosmic2009_simpleL1Calib',
+        'HLTPrescales100_Cosmic2009_inclMuons', 'HLTPrescalesNone_Cosmic2009_inclMuons',
+        'HLTPrescales100_Cosmic_v2', 'HLTPrescalesNone_Cosmic_v2',        
+        'HLTPrescales100_Cosmic_v3', 'HLTPrescalesNone_Cosmic_v3',        
+        # Commissioning menus
+        'HLTPrescales100_InitialBeam_v1', 'HLTPrescalesNone_InitialBeam_v1',
+        'HLTPrescales100_MC_InitialBeam_v1', 'HLTPrescalesNone_MC_InitialBeam_v1',
+        'HLTPrescales100_InitialBeam_v2', 'HLTPrescalesNone_InitialBeam_v2',
+        'HLTPrescales100_MC_InitialBeam_v2', 'HLTPrescalesNone_MC_InitialBeam_v2',
+        'HLTPrescales100_InitialBeam_v3', 'HLTPrescalesNone_InitialBeam_v3',
+        'HLTPrescales100_MC_InitialBeam_v3', 'HLTPrescalesNone_MC_InitialBeam_v3',
+        # 2010-2011 menus
+        #2010-2011 menus
+        'HLTPrescales100_Physics_pp_v1','HLTPrescalesNone_Physics_pp_v1',
+        'HLTPrescales100_MC_pp_v1','HLTPrescalesNone_MC_pp_v1',
+        'HLTPrescales100_MC_pp_v1_tight_mc_prescale','HLTPrescalesNone_MC_pp_v1_tight_mc_prescale',
+        'HLTPrescales100_MC_pp_v1_loose_mc_prescale','HLTPrescalesNone_MC_pp_v1_loose_mc_prescale',
+        # HeavyIon
+        'HLTPrescales100_InitialBeam_HI_v1','HLTPrescalesNone_InitialBeam_HI_v1',
+        'HLTPrescales100_MC_InitialBeam_HI_v1', 'HLTPrescalesNone_MC_InitialBeam_HI_v1',
+        'HLTPrescales100_Physics_HI_v1','HLTPrescalesNone_Physics_HI_v1',
+        'HLTPrescales100_MC_HI_v1','HLTPrescalesNone_MC_HI_v1',
+        'HLTPrescales100_Physics_HI_v2','HLTPrescalesNone_Physics_HI_v2',
+        'HLTPrescales100_MC_HI_v2','HLTPrescalesNone_MC_HI_v2',
+        ]
+    StoredValue = ''
+_flags.append(HLTPrescaleSet)
+
+
+
+
+# the container of all trigger flags
+
+class Trigger(JobPropertyContainer):
+    """ Trigger top flags """
+      
+    def Slices_LVL2_setOn(self):
+        """ Runs setL2 flags in all slices. Effectivelly enable LVL2. """
+        for prop in self.__dict__.values():
+            if issubclass( prop.__class__, JobPropertyContainer ) and "signatures" in prop.__dict__.keys():
+                prop.setL2()
+
+    def Slices_EF_setOn(self):
+        """ Runs setEF flags in all slices. Effectivelly enable EF. """
+        for prop in self.__dict__.values():
+            if issubclass( prop.__class__, JobPropertyContainer ) and "signatures" in prop.__dict__.keys():
+                prop.setEF()
+
+    def Slices_all_setOn(self):
+        """ Runs setL2 and setEF in all slices. Effectivelly enable trigger. """
+        for prop in self.__dict__.values():
+            if issubclass( prop.__class__, JobPropertyContainer ) and "signatures" in prop.__dict__.keys():
+                prop.setAll()
+
+    def Slices_LVL2_setOff(self):
+        """ Runs unsetL2 flags in all slices.  Effectivelly disable LVL2. """
+        for prop in self.__dict__.values():
+            if issubclass( prop.__class__, JobPropertyContainer ) and "signatures" in prop.__dict__.keys():
+                prop.unsetL2()
+
+
+    def Slices_EF_setOff(self):
+        """ Runs unsetEF flags in all slices.  Effectivelly disable EF. """
+        for prop in self.__dict__.values():
+            if issubclass( prop.__class__, JobPropertyContainer ) and "signatures" in prop.__dict__.keys():
+                prop.unsetEF()
+
+    def Slices_all_setOff(self):
+        """ Runs unsetAll in all slices. Effectivelly disable trigger. """
+        for prop in self.__dict__.values():
+            if issubclass( prop.__class__, JobPropertyContainer ) and "signatures" in prop.__dict__.keys():
+                prop.unsetAll()
+
+#    def synchronizeFlgasToRecoSetup(self):
+#        """ When running in the recnstruction framework TriggerFlags must be synchronized with the Reco/Common/Global Flags  """
+#        print 'globals ', globals()
+#        print 'dir ',dir()
+#        if 'doWriteBS' in globals().keys():
+#            if doWriteBS:
+#                self.writeBS = True
+
+        # more to come
+
+
+
+## attach yourself to the RECO flags
+## from RecExConfig.RecFlags import jobproperties
+from RecExConfig.RecFlags import rec
+rec.add_Container(Trigger)
+
+
+for flag in _flags:
+    rec.Trigger.add_JobProperty(flag)
+del _flags
+
+## make an alias for trigger flags which looks like old TriggerFlags class
+TriggerFlags = rec.Trigger
+
+
+
+
+## add online specific flags
+from TriggerJobOpts.TriggerOnlineFlags      import OnlineFlags
+
+## add slices generation flags
+
+if useNewTM:
+
+    try:
+        from TriggerMenu.menu.SliceFlags import *
+    except ImportError:
+        import TriggerMenu.egamma.EgammaSliceFlags
+        import TriggerMenu.jet.JetSliceFlags
+        import TriggerMenu.bjet.BjetSliceFlags
+        import TriggerMenu.muon.MuonSliceFlags
+        import TriggerMenu.met.METSliceFlags
+        import TriggerMenu.tau.TauSliceFlags
+        import TriggerMenu.bphysics.BphysicsSliceFlags
+        import TriggerMenu.minbias.MinBiasSliceFlags
+        import TriggerMenu.combined.CombinedSliceFlags
+        import TriggerMenu.calibcosmicmon.CosmicSliceFlags
+        import TriggerMenu.calibcosmicmon.CalibSliceFlags
+        import TriggerMenu.calibcosmicmon.StreamingSliceFlags
+        import TriggerMenu.calibcosmicmon.MonitorSliceFlags
+
+else:
+    from TriggerMenuPython.Lvl1Flags            import Lvl1Flags
+    from TriggerMenuPython.EgammaSliceFlags     import EgammaSliceFlags
+    from TriggerMenuPython.TauSliceFlags        import TauSliceFlags
+    from TriggerMenuPython.JetSliceFlags        import JetSliceFlags
+    from TriggerMenuPython.MuonSliceFlags       import MuonSliceFlags
+    from TriggerMenuPython.METSliceFlags        import METSliceFlags
+    from TriggerMenuPython.BphysicsSliceFlags   import BphysicsSliceFlags
+    from TriggerMenuPython.BjetSliceFlags       import BjetSliceFlags
+    from TriggerMenuPython.CombinedSliceFlags   import CombinedSliceFlags
+    from TriggerMenuPython.MinBiasSliceFlags    import MinBiasSliceFlags
+    from TriggerMenuPython.CosmicSliceFlags     import CosmicSliceFlags
+    from TriggerMenuPython.HeavyIonSliceFlags   import HeavyIonSliceFlags
+    from TriggerMenuPython.CalibSliceFlags      import CalibSliceFlags
+    from TriggerMenuPython.L1CaloSliceFlags     import L1CaloSliceFlags
+    from TriggerMenuPython.BeamSpotSliceFlags   import BeamSpotSliceFlags
+    from TriggerMenuPython.GenericSliceFlags    import GenericSliceFlags
+    from TriggerMenuPython.MonitorSliceFlags    import MonitorSliceFlags
+    from TriggerMenuPython.StreamingSliceFlags  import StreamingSliceFlags
+
+
+
+
+from TriggerJobOpts.Tier0TriggerFlags       import Tier0TriggerFlags
+from TrigTier0.NtupleProdFlags              import NtupleProductionFlags
+
+
+def sync_Trigger2Reco():
+    from AthenaCommon.Include import include
+    from RecExConfig.RecAlgsFlags import recAlgs
+    from AthenaCommon.GlobalFlags  import globalflags
+    from RecExConfig.RecFlags import rec
+    
+    if  recAlgs.doTrigger() and rec.readRDO() and not globalflags.InputFormat()=='bytestream':
+        include( "TriggerRelease/TransientBS_DetFlags.py" )
+
+    from RecExConfig.RecFlags import rec
+    if globalflags.InputFormat() == 'bytestream':
+        TriggerFlags.readBS = True
+        TriggerFlags.doLVL1 = False
+        TriggerFlags.doLVL2 = False
+        TriggerFlags.doEF   = False
+
+    if rec.doWriteBS():
+        TriggerFlags.writeBS = True
+                    
+                                        
+def sync_Reco2Trigger():
+    #from AthenaCommon.Include import include
+    #include( "TriggerRelease/TransientBS_DetFlags.py" )
+    pass
+
+
+del log
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerGetter.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerGetter.py
new file mode 100644
index 0000000000000000000000000000000000000000..a3c821736d705a18ebcd82227bf25db370dfa15a
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerGetter.py
@@ -0,0 +1,233 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+
+from AthenaCommon.GlobalFlags import jobproperties
+#from AthenaCommon.GlobalFlags import GlobalFlags
+from AthenaCommon.AthenaCommonFlags import jobproperties
+from RecExConfig.RecFlags  import jobproperties
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+TF = TriggerFlags
+from RecExConfig.RecFlags import rec
+from RecExConfig.RecAlgsFlags import recAlgs
+from AthenaCommon.GlobalFlags  import globalflags
+from AthenaCommon.Logging import logging
+log = logging.getLogger( "TriggerGetter.py" )
+
+
+from AthenaCommon.AppMgr import ServiceMgr,ToolSvc
+
+
+try:
+    from TriggerMenu import useNewTriggerMenu
+    useNewTM = useNewTriggerMenu()
+    log.info("Using new TriggerMenu: %r" % useNewTM)
+except:
+    useNewTM = False
+    log.info("Using old TriggerMenuPython since TriggerMenu.useNewTriggerMenu can't be imported")
+
+if useNewTM:
+    from TriggerMenu.menu.GenerateMenu import GenerateMenu
+else:
+    from TriggerMenuPython.GenerateMenu import GenerateMenu
+
+from RecExConfig.Configured import Configured 
+
+# this is to limit messags when running with -s
+from AthenaCommon.Include import excludeTracePattern
+excludeTracePattern.append("*/TriggerPythonConfig.py")
+excludeTracePattern.append("*/TrigMonitorBase/TrigGenericMonitoringToolConfig.py")
+excludeTracePattern.append ("*/TriggerMenuPython/*")
+excludeTracePattern.append("*/TrigSteering/TrigSteeringConfig.py")
+
+
+
+class TriggerGetter(Configured):
+    #    _output = {"HLT::HLTResult" : ["HLTResult_L2", "HLTResult_EF"] }
+    _configured=True
+    _done=False
+
+    def __init__(self):
+        # tell the Configured machinery that we do not care about the objects already there
+        if not TriggerFlags.doFEX() and TriggerFlags.doHypo():
+            Configured.__init__(self, ignoreExistingDataObject=True)
+        else:
+            Configured.__init__(self, ignoreExistingDataObject=False)
+
+
+    def configure(self):
+        
+        if self._done:
+            log.info("configuration already done, who is calling it again?")
+            return True
+        self._done=True
+
+        # start with print some information what this will do
+        log.info("Basic configuration flags RecAlgsFlag.doTrigger: %d   RecFlags.doTrigger: %d TriggerFlags.doTriggerConfigOnly %d" % (recAlgs.doTrigger(), rec.doTrigger(), TriggerFlags.doTriggerConfigOnly()) )
+        log.info("TriggerFlags: doLVL1: %s, doLVL2: %s, doEF: %s, doHLT: %s" % (TriggerFlags.doLVL1(), TriggerFlags.doLVL2(), TriggerFlags.doEF(), TriggerFlags.doHLT() ) )
+
+        willGenerateMenu = recAlgs.doTrigger() and (TF.doLVL1() or TF.doLVL2() or TF.doEF() or TF.doHLT()) and not TF.doTriggerConfigOnly()
+        willRunTriggerConfigGetter = recAlgs.doTrigger() or rec.doTrigger() or TF.doTriggerConfigOnly()
+        willRunLVL1SimulationGetter = recAlgs.doTrigger() and not TriggerFlags.doTriggerConfigOnly()
+        willRunHLTSimulationGetter = willRunLVL1SimulationGetter and (TF.doLVL2() or TF.doEF() or TF.doHLT())
+
+        log.info("Will run: %s%s%s%s" % ("GenerateMenu " if willGenerateMenu else "",
+                                         "TriggerConfigGetter " if willRunTriggerConfigGetter else "",
+                                         "LVL1SimulationGetter " if willRunLVL1SimulationGetter else "",
+                                         "HLTSimulationGetter " if willRunHLTSimulationGetter else "",
+                                         ) )
+        log.info("Will not run: %s%s%s%s" % ("GenerateMenu " if not willGenerateMenu else "",
+                                             "TriggerConfigGetter " if not willRunTriggerConfigGetter else "",
+                                             "LVL1SimulationGetter " if not willRunLVL1SimulationGetter else "",
+                                             "HLTSimulationGetter " if not willRunHLTSimulationGetter else "",
+                                         ) )
+
+        if recAlgs.doTrigger():
+
+            # setup the trigger from the DB
+            if TriggerFlags.readConfigFromTriggerDb():
+                return self.configureTriggerFromDB()
+
+        
+            if ((TriggerFlags.doLVL1()==True or TriggerFlags.doLVL2()==True or TriggerFlags.doEF()==True or TriggerFlags.doHLT()==True) and TriggerFlags.doTriggerConfigOnly()==False):
+                log.info("generating menu")
+                # trigger menu files generation
+                g = GenerateMenu()
+                g.generate()
+
+                # after the menu xml file has been created or the TriggerDB access is configured,
+                # the COOL/SQlite db can be written
+                # TB this needs to be optimized -- we do not need ti always but only when AOD or ESD are created
+                
+
+
+        if recAlgs.doTrigger() or rec.doTrigger() or TriggerFlags.doTriggerConfigOnly():
+            # setup configuration services
+            from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter
+            cfg =  TriggerConfigGetter()
+
+            from TrigConfigSvc.TrigConf2COOL import theConfCOOLWriter
+            theConfCOOLWriter.writeConf2COOL()
+
+        # actuall trigger simulation running
+        if recAlgs.doTrigger() and not TriggerFlags.doTriggerConfigOnly():
+            # setup Lvl1
+            # initialize LVL1ConfigSvc
+            log.info("configuring lvl1")
+            from TriggerJobOpts.Lvl1TriggerGetter import Lvl1SimulationGetter
+            lvl1 = Lvl1SimulationGetter()
+            
+
+            if jobproperties.Global.InputFormat()  != 'bytestream' and (TriggerFlags.doLVL2==True or TriggerFlags.doEF==True or TriggerFlags.doHLT==True):
+                # Transient BS construction and intialization
+                from ByteStreamCnvSvc import WriteByteStream
+                StreamBS = WriteByteStream.getStream("Transient","StreamBS")
+                StreamBS.ForceRead=True
+                StreamBS.ItemList += [ "DataVector<LVL1::TriggerTower>#TriggerTowers" ]
+                StreamBS.ItemList += [ "TRT_RDO_Container#TRT_RDOs" ]
+                StreamBS.ItemList += [ "SCT_RDO_Container#SCT_RDOs" ]
+                StreamBS.ItemList += [ "PixelRDO_Container#PixelRDOs" ]
+                # StreamBS.ItemList +=["LArRawChannelContainer#*"]
+                StreamBS.ItemList +=["2721#*"]
+                # StreamBS.ItemList +=["TileRawChannelContainer#*"]
+                StreamBS.ItemList +=["2927#*"]
+                StreamBS.ItemList +=["2934#*"] # added on request from: Arantxa Ruiz Martinez for TileRODMu
+
+                # don't need Muons in transient BS
+                # StreamBS.ItemList +=["MdtCsmContainer#*"]
+                # StreamBS.ItemList +=["RpcPadContainer#*"]
+                # StreamBS.ItemList +=["TgcRdoContainer#*"]
+                # StreamBS.ItemList +=["CscRawDataContainer#*"]
+
+                from AthenaCommon.Include import include
+                # setup trans BS for the ID
+                include ("InDetRecExample/InDetRecCabling.py")
+
+
+            # setup HLT
+            # initialize HLT config svc
+            log.info("TriggerFlags: doLVL2 %r" % TriggerFlags.doLVL2())
+            log.info("TriggerFlags: doEF   %r" % TriggerFlags.doEF())
+            log.info("TriggerFlags: doHLT  %r" % TriggerFlags.doHLT())
+            if TriggerFlags.doLVL2()==True or TriggerFlags.doEF()==True or TriggerFlags.doHLT()==True:
+                log.info("configuring hlt")
+                from TriggerJobOpts.HLTTriggerGetter import HLTSimulationGetter
+                hlt = HLTSimulationGetter()
+            else:
+                from RegionSelector.RegSelSvcDefault import RegSelSvcDefault
+                from AthenaCommon.AppMgr import ServiceMgr
+                ServiceMgr += RegSelSvcDefault()
+                ServiceMgr.RegSelSvc.enablePixel=False
+                ServiceMgr.RegSelSvc.enableSCT=False
+
+        
+            
+        # prepare result making of L1
+        from TriggerJobOpts.Lvl1ResultBuilderGetter import Lvl1ResultBuilderGetter
+        hltouput = Lvl1ResultBuilderGetter()
+
+        # prepare result making of HLT
+        if TriggerFlags.doLVL2()==True or TriggerFlags.doEF()==True or TriggerFlags.doHLT() or (recAlgs.doTrigger() and TriggerFlags.readBS()):
+            from TriggerJobOpts.HLTTriggerResultGetter import HLTTriggerResultGetter
+            hltouput = HLTTriggerResultGetter()
+
+        # preconfigure TrigDecisionTool
+        from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
+        from AthenaCommon.AppMgr import ToolSvc
+        ToolSvc += Trig__TrigDecisionTool( "TrigDecisionTool" )
+	
+        from TrigEDMConfig.TriggerEDM import EDMLibraries
+        ToolSvc.TrigDecisionTool.Navigation.Dlls = [e for e in  EDMLibraries if 'TPCnv' not in e]
+
+      
+        return True
+
+    def configureTriggerFromDB(self):
+        """ configures trigger from the DB """
+        log = logging.getLogger( "TriggerGetter.py")
+        log.info("configureTriggerFromDb")
+        from TrigConfOffline.HLTConfOffline import HLTConfOffline
+        hltConfOffline = HLTConfOffline()
+        # Set the properties
+        hltConfOffline.setupSource = 'db'
+        hltConfOffline.OutputLevel = 1
+        # Set the connection to the DB
+        if TriggerFlags.triggerDbConnection.statusOn :
+            hltConfOffline.dbType = TriggerFlags.triggerDbConnection()['dbType']
+            hltConfOffline.dbHost = TriggerFlags.triggerDbConnection()['dbServer']
+            hltConfOffline.dbUser = TriggerFlags.triggerDbConnection()['dbUser']
+            hltConfOffline.dbName = TriggerFlags.triggerDbConnection()['dbName']
+            hltConfOffline.dbPasswd = TriggerFlags.triggerDbConnection()['dbPasswd']
+        else:
+            # try to get connection parameters from authentication files
+            if not hltConfOffline.setDbConnectionFromAuthFile() :
+                log.error('failed to set HLTConfOffline service')
+                return False
+            
+        if TriggerFlags.triggerDbKeys.statusOn :
+            hltConfOffline.SMKey = TriggerFlags.triggerDbKeys()[0]
+            hltConfOffline.LVL1PrescaleKey = TriggerFlags.triggerDbKeys()[1]
+            hltConfOffline.HLTPrescaleKey = TriggerFlags.triggerDbKeys()[2]
+        else:
+            log.error( 'missing DB keys, set the TriggerFlags.triggerDBKeys flag')
+            return False
+      
+        if TriggerFlags.doLVL2() and TriggerFlags.doEF() :
+            hltConfOffline.Level = 'BOTH'
+        elif TriggerFlags.doLVL2() :
+            hltConfOffline.Level = 'L2'
+        elif TriggerFlags.doEF() :
+            hltConfOffline.Level = 'EF'
+        elif TriggerFlags.doHLT() :
+            hltConfOffline.Level = 'HLT'
+        else:
+            hltConfOffline.Level = None
+            log.error( 'no trigger level set')
+            return False
+          
+        # Load the setup and set the services on this place
+        hltConfOffline.load()
+              
+        return True
+
+
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerOnlineFlags.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerOnlineFlags.py
new file mode 100644
index 0000000000000000000000000000000000000000..41f8be379835d68c199be99d9c4efc2af727a049
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerOnlineFlags.py
@@ -0,0 +1,53 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+################################################################################
+# @file   TriggerOnlineFlags.py
+# @author Frank Winklmeier
+# @brief  Trigger flags for online running
+# $Id: TriggerOnlineFlags.py 587315 2014-03-12 13:58:52Z krasznaa $
+################################################################################
+
+from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
+from AthenaCommon.JobProperties import jobproperties
+
+_flags = []
+
+class doDBConfig(JobProperty):
+   """ Flag to extract the trigger configuration """
+   statusOn = True
+   allowedTypes = ['bool']
+   StoredValue = False   
+
+_flags += [doDBConfig]
+
+class doDBConfigBaseName(JobProperty):
+   """ Base name of the file that holds the trigger configuration """
+   statusOn = True
+   allowedTypes = ['str']
+   StoredValue = ''   
+
+_flags += [doDBConfigBaseName]
+
+class doValidation(JobProperty):
+   """ Configure job for validation (i.e. remove time stamps from messages) """
+   statusOn = True
+   allowedTypes = ['bool']
+   StoredValue = True
+
+_flags += [doValidation]
+
+# Create "Online" container
+class Online(JobPropertyContainer):
+   """ Trigger online flags
+   """
+   pass
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+TriggerFlags.add_Container(Online)
+
+# Add all flags
+for f in _flags:
+   TriggerFlags.Online.add_JobProperty(f)
+del _flags
+
+OnlineFlags = TriggerFlags.Online
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerOnlineGetter.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerOnlineGetter.py
new file mode 100644
index 0000000000000000000000000000000000000000..e770e8ed15ddeb01ecd9a2c686235617ccbbadea
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerOnlineGetter.py
@@ -0,0 +1,64 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+from AthenaCommon.GlobalFlags  import globalflags
+from AthenaCommon.GlobalFlags import jobproperties
+from AthenaCommon.AthenaCommonFlags import jobproperties
+from RecExConfig.RecFlags  import jobproperties
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+
+
+from AthenaCommon.Logging import logging  # loads logger
+
+from AthenaCommon.Include import include  # to include old style job options
+
+from AthenaCommon.AppMgr import ServiceMgr
+from TriggerMenuPython.GenerateMenu import GenerateMenu
+
+
+from RecExConfig.Configured import Configured 
+
+
+class TriggerOnlineGetter(Configured):
+    _output = {"HLT::HLTResult" : "HLTResult_L2", "HLT::HLTResult" : "HLTResult_EF" }
+    _configured=True
+    _done=False
+    def configure(self):
+        log = logging.getLogger( "TriggerOnlineGetter.py" )
+        if self._done:
+            log.info("configuration already done, who is calling it again?")
+            return True
+        self._done=True
+        
+        # this is to limit messags when running with -s
+        from AthenaCommon.Include import excludeTracePattern
+        excludeTracePattern.append("*/TriggerMenuPython/TriggerPythonConfig.py")
+        excludeTracePattern.append("*/TrigConfigSvc/TrigConfigSvcConfig.py")
+
+        log.info("generating menu")
+        # trigger menu files generation
+        g = GenerateMenu()
+        g.generate()
+
+
+        # setup Lvl1
+        # initialize LVL1ConfigSvc
+        log.info("configuring LVL1")
+        # Xin
+        from TriggerJobOpts.Lvl1TriggerOnlineGetter import Lvl1SimulationGetter
+        lvl1 = Lvl1SimulationGetter()
+
+        if globalflags.InputFormat()=='pool':
+            log.info("setting up transient BS")
+            include( "TriggerRelease/jobOfragment_TransBS_Modern.py" )
+
+        # setup HLT
+        # initialize HLT config svc
+        log.info("configuring hlt")
+        from TriggerJobOpts.HLTTriggerGetter import HLTSimulationGetter
+        hlt = HLTSimulationGetter()
+        
+        
+        return True
+
+
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/__init__.py b/Trigger/TriggerCommon/TriggerJobOpts/python/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..be4e706b0c440a38f59c5ab33bf264bc54422900
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/__init__.py
@@ -0,0 +1,9 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+__version__ = '1.0.0'
+__author__  = 'Xin.Wu@cern.ch, Tomasz.Bold@cern.ch'
+__all__ = [ 'TriggerOnlineGetter', 'Lvl1TriggerOnlineGetter', 'TriggerFlags', 'TriggerGetter' , 'T0TriggerGetter' ]
+
+from TrigEDMConfig.TriggerEDM import * 
+
+
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/ModernTriggerConfig.py b/Trigger/TriggerCommon/TriggerJobOpts/share/ModernTriggerConfig.py
new file mode 100755
index 0000000000000000000000000000000000000000..806757a5704c69fd1acb220fbb12d1d1ad63a966
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/share/ModernTriggerConfig.py
@@ -0,0 +1,6 @@
+IncludedModernTriggerConfig=False
+if not IncludedModernTriggerConfig:
+    from TriggerJobOpts.TriggerGetter import TriggerGetter
+    g = TriggerGetter()
+    g.configure()
+    IncludedModernTriggerConfig=True
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/printTriggerJobProperties.py b/Trigger/TriggerCommon/TriggerJobOpts/share/printTriggerJobProperties.py
new file mode 100755
index 0000000000000000000000000000000000000000..4cdcb31a07040cfbb139e3693f257bc074cf72a2
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/share/printTriggerJobProperties.py
@@ -0,0 +1,8 @@
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+#example 
+TriggerFlags.TauSlice.doL2ID=False
+
+TriggerFlags.print_JobProperties('tree&value')   # dump full container of flags
+raise Exception("Finished, do not worry all was OK, just do not kow how to stop this job other way")
+
+
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/testJob.py b/Trigger/TriggerCommon/TriggerJobOpts/share/testJob.py
new file mode 100755
index 0000000000000000000000000000000000000000..45ce4d154900756a150a8f463f1e282121f4a2ef
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/share/testJob.py
@@ -0,0 +1,131 @@
+# jobO to run Electron slice with athena 
+
+# Set flags for the ntuple Content
+doCBNT=False
+useROOTNtuple=True # False : hbook ntuple
+doTruth=True     # needs to be true if creating Fake RoI 
+
+if not ('EvtMax' in dir()):
+    EvtMax=10
+if not ('OutputLevel' in dir()):
+    OutputLevel=DEBUG
+
+#AllAlgs=False
+doWriteAOD=False
+doWriteESD=False
+doWriteTAG=False
+doAOD=False # make AOD objects
+doESD=False # make ESD objects
+doTAG=False
+
+TriggerModernConfig=True
+doTrigger=True
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+#TriggerFlags.readHLTconfigFromXML=False
+#TriggerFlags.readLVL1configFromXML=False
+#TriggerFlags.inputHLTconfigFile='outputHLTconfig.xml'
+#TriggerFlags.inputLVL1configFile='outputLVL1config.xml'
+
+
+
+include("RecExCommon/RecExCommon_flags.py")
+
+
+
+
+TriggerFlags.doLVL1=True
+TriggerFlags.doEF=True
+TriggerFlags.doID=True
+TriggerFlags.doMuon=True
+
+
+
+TriggerFlags.Slices_all_setOn()
+# use what is below to leave only particular slice
+# TriggerFlags.Slices_all_setOff()
+# TriggerFlags.EgammaSlice.setAll()
+# TriggerFlags.TauSlice.setAll()
+# TriggerFlags.MuonSlice.setAll()
+# TriggerFlags.BphysicsSlice.setAll()
+TriggerFlags.METSlice.signatures = []
+# TriggerFlags.JetSlice.setAll()
+
+#TriggerFlags.EgammaSlice.signatures = ['e10', 'e25i', 'g10', 'e60', '2e15i', '3e15i', 'Zee']
+
+#TriggerFlags.triggerMenuSetup = 'lumi0.01_no_prescale' # this woay one can modifying full menu depending on lumi switches
+#TriggerFlags.triggerMenuSetup = 'undefined_no_prescale' # use this sot set all prescales to 1 (LVL1 and HLT)
+
+
+TriggerFlags.doNtuple=True
+doTrigEgammaBremFit=True
+#doTrigEgammaBremFit=False
+
+
+TriggerFlags.abortOnConfigurationError=True
+TriggerFlags.enableMonitoring = [ 'Validation', 'Time' ]
+
+
+TriggerFlags.print_JobProperties('tree&value')
+
+
+
+
+#-------------------------------------------------------------
+# End of setting flags
+#-------------------------------------------------------------
+
+
+if 'GlobalFlags' not in dir():
+    from AthenaCommon.GlobalFlags import GlobalFlags
+#GlobalFlags.Luminosity.set_zero()
+
+
+
+include( "RecExCommon/RecExCommon_topOptions.py" )
+
+
+
+# uncomment to swicth on the special configuration for the Lvl1 muon barrel trigger
+# i.e. mu4,mu6,mu10,mu11,mu20,mu40
+ServiceMgr.RPCcablingSvc.HackFor1031 = True
+
+
+
+MessageSvc.debugLimit = 10000000
+MessageSvc.Format = "% F%48W%S%7W%R%T %0W%M"
+
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+topSequence.TrigSteer_L2.OutputLevel = DEBUG
+
+if TriggerFlags.doLVL2():
+    for algo in topSequence.TrigSteer_L2.getChildren():
+        algo.OutputLevel = DEBUG
+
+if TriggerFlags.doEF():
+    for algo in topSequence.TrigSteer_EF.getChildren():
+        algo.OutputLevel = DEBUG
+
+from AthenaCommon.AlgSequence import AlgSequence
+job = AlgSequence()
+job.CTPSimulation.OutputLevel=VERBOSE
+job.RoIBuilder.OutputLevel=VERBOSE
+
+
+#get rid of messages and increase speed
+Service ("StoreGateSvc" ).ActivateHistory=False
+
+
+print AlgSequence()
+
+
+print ServiceMgr
+
+
+
+#raise Exception("OK") # you can unsomment this like. Job will stop then but you would be able to see henerated oututputHLconfig.xml and check if it contains wahat you want. It is faster then to work. 
+
+
+
+
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/testJobFromXML.py b/Trigger/TriggerCommon/TriggerJobOpts/share/testJobFromXML.py
new file mode 100755
index 0000000000000000000000000000000000000000..22abccfa5ab8042eca327f737dec0b074b7b8ce2
--- /dev/null
+++ b/Trigger/TriggerCommon/TriggerJobOpts/share/testJobFromXML.py
@@ -0,0 +1,121 @@
+# jobO to run Electron slice with athena 
+
+# Set flags for the ntuple Content
+doCBNT=False
+useROOTNtuple=True # False : hbook ntuple
+doTruth=True     # needs to be true if creating Fake RoI 
+
+if not ('EvtMax' in dir()):
+    EvtMax=10
+if not ('OutputLevel' in dir()):
+    OutputLevel=DEBUG
+
+#AllAlgs=False
+doWriteAOD=False
+doWriteESD=False
+doWriteTAG=False
+doAOD=False # make AOD objects
+doESD=False # make ESD objects
+doTAG=False
+
+TriggerModernConfig=True
+doTrigger=True
+
+from TriggerJobOpts.TriggerFlags import TriggerFlags
+
+
+
+include("RecExCommon/RecExCommon_flags.py")
+TriggerFlags.readHLTconfigFromXML=True
+TriggerFlags.inputHLTconfigFile='outputHLTconfig.xml'
+TriggerFlags.readLVL1configFromXML=True
+TriggerFlags.inputLVL1configFile='outputLVL1config.xml'
+
+
+
+TriggerFlags.doLVL1=True
+TriggerFlags.doEF=True
+TriggerFlags.doID=True
+TriggerFlags.doMuon=True
+
+#TriggerFlags.Slices_all_setOn()
+# use what is below to leave only particular slice
+# TriggerFlags.Slices_all_setOff()
+#
+# TriggerFlags.EgammaSlice.setAll()
+# TriggerFlags.TauSlice.setAll()
+# TriggerFlags.MuonSlice.setAll()
+# TriggerFlags.BphysicsSlice.setAll()
+# TriggerFlags.METSlice.setAll()
+# TriggerFlags.JetSlice.setAll()
+
+#TriggerFlags.EgammaSlice.signatures = ['e10', 'e25i', 'g10', 'e60', '2e15i', '3e15i', 'Zee']
+
+
+TriggerFlags.doNtuple=True
+doTrigEgammaBremFit=True
+#doTrigEgammaBremFit=False
+
+
+TriggerFlags.abortOnConfigurationError=True
+TriggerFlags.enableMonitoring = [ 'Validation', 'Time' ]
+
+
+TriggerFlags.print_JobProperties('tree&value')
+
+
+
+
+#-------------------------------------------------------------
+# End of setting flags
+#-------------------------------------------------------------
+
+
+if 'GlobalFlags' not in dir():
+    from AthenaCommon.GlobalFlags import GlobalFlags
+#GlobalFlags.Luminosity.set_zero()
+
+
+
+include( "RecExCommon/RecExCommon_topOptions.py" )
+
+
+
+# uncomment to swicth on the special configuration for the Lvl1 muon barrel trigger
+# i.e. mu4,mu6,mu10,mu11,mu20,mu40
+ServiceMgr.RPCcablingSvc.HackFor1031 = True
+
+
+
+MessageSvc.debugLimit = 10000000
+MessageSvc.Format = "% F%48W%S%7W%R%T %0W%M"
+
+from AthenaCommon.AlgSequence import AlgSequence 
+topSequence = AlgSequence()
+topSequence.TrigSteer_L2.OutputLevel = DEBUG
+
+if TriggerFlags.doLVL2():
+    for algo in topSequence.TrigSteer_L2.getChildren():
+        algo.OutputLevel = DEBUG
+
+if TriggerFlags.doEF():
+    for algo in topSequence.TrigSteer_EF.getChildren():
+        algo.OutputLevel = DEBUG
+
+from AthenaCommon.AlgSequence import AlgSequence
+job = AlgSequence()
+job.CTPSimulation.OutputLevel=VERBOSE
+job.RoIBuilder.OutputLevel=VERBOSE
+
+
+#get rid of messages and increase speed
+Service ("StoreGateSvc" ).ActivateHistory=False
+
+
+print AlgSequence()
+
+
+print ServiceMgr
+#raise Exception("OK") # you can unsomment this like. Job will stop then but you would be able to see henerated oututputHLconfig.xml and check if it contains wahat you want. It is faster then to work. 
+
+