예제 #1
0
    def configure(self):
        mlog = logging.getLogger('ZdcRawChannelGetter.py::configure:')
        mlog.info('entering')

        from AthenaCommon.DetFlags import DetFlags
        if not DetFlags.detdescr.ZDC_on():
            mlog.info("not DetFlags.detdescr.Zdc_on : Quit.")
            return False

        if not DetFlags.makeRIO.ZDC_on():
            mlog.info("not DetFlags.makeRIO.Zdc_on : Quit.")
            return False

        try:
            from ZdcRec.ZdcRecConf import ZdcRec
            self._zdcRecHandle = ZdcRec()
        except Exception:
            import traceback
            mlog.error("could not get handle to ZdcRec")
            mlog.error(traceback.format_exc())
            return False

        # output to ESD:
        from RecExConfig.ObjKeyStore import objKeyStore
        objKeyStore.addManyTypesStreamESD(self.output())
        # output to AOD:
        objKeyStore.addManyTypesStreamAOD(self.output())

        # add to topsequence
        mlog.info("now adding to topSequence")
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += self.zdcRecHandle()

        return True
예제 #2
0
    def configure(self):
        #         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())):
                if jobproperties.Global.InputFormat() == 'bytestream':
                    # Decode ROIB::RoIBResult from ByteStream
                    from TrigT1ResultByteStream.TrigT1ResultByteStreamConfig import L1ByteStreamDecodersRecExSetup
                    L1ByteStreamDecodersRecExSetup()
                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
예제 #3
0
    def configure(self):

        log = logging.getLogger("HLTTriggerResultGetter.py")
        from RecExConfig.ObjKeyStore import objKeyStore

        # set EDMDecodingVersion
        EDMDecodingVersion()

        # Set AODFULL for data unless it was set explicitly already
        if TriggerFlags.AODEDMSet.isDefault() and globalflags.DataSource(
        ) == 'data':
            TriggerFlags.AODEDMSet = 'AODFULL'

        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        log.info("BS unpacking (TF.readBS): %d", TriggerFlags.readBS())
        if TriggerFlags.readBS():
            if TriggerFlags.EDMDecodingVersion() <= 2:
                bs = ByteStreamUnpackGetterRun2()  # noqa: F841
            else:
                bs = ByteStreamUnpackGetter()  # noqa: F841

        xAODContainers = {}
        #        if not recAlgs.doTrigger():      #only convert when running on old data
        if TriggerFlags.EDMDecodingVersion() == 1:
            xaodcnvrt = xAODConversionGetter()
            xAODContainers = xaodcnvrt.xaodlist

        if recAlgs.doTrigger() or TriggerFlags.doTriggerConfigOnly():
            if TriggerFlags.EDMDecodingVersion() <= 2:
                tdt = TrigDecisionGetterRun2()  # noqa: F841
            else:
                tdt = TrigDecisionGetter()  # noqa: F841

        # Temporary hack to add Run-3 navigation to ESD and AOD
        if (rec.doESD()
                or rec.doAOD()) and TriggerFlags.EDMDecodingVersion() == 3:
            # The hack with wildcards is needed for BS->ESD because we don't know the exact keys
            # of HLT navigation containers before unpacking them from the BS event.
            objKeyStore._store['streamESD'].allowWildCard(True)
            objKeyStore._store['streamAOD'].allowWildCard(True)
            objKeyStore.addManyTypesStreamESD([
                'xAOD::TrigCompositeContainer#HLTNav*',
                'xAOD::TrigCompositeAuxContainer#HLTNav*'
            ])
            objKeyStore.addManyTypesStreamAOD([
                'xAOD::TrigCompositeContainer#HLTNav*',
                'xAOD::TrigCompositeAuxContainer#HLTNav*'
            ])

        # 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()))

        if (rec.doESD() or rec.doAOD()) and TriggerFlags.writeL1TopoValData():
            objKeyStore.addManyTypesStreamESD([
                'xAOD::TrigCompositeContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValData',
                'xAOD::TrigCompositeAuxContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValDataAux.'
            ])
            objKeyStore.addManyTypesStreamAOD([
                'xAOD::TrigCompositeContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValData',
                'xAOD::TrigCompositeAuxContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValDataAux.'
            ])
            log.debug(
                "HLT_xAOD__TrigCompositeContainer_L1TopoValData(Aux.) for L1Topo validation added to the data."
            )

        if rec.doAOD() or rec.doWriteAOD():
            # schedule the RoiDescriptorStore conversion
            # log.warning( "HLTTriggerResultGetter - setting up RoiWriter" )
            roiWriter = RoiWriter()
            # Add fictional input to ensure data dependency in AthenaMT
            roiWriter.ExtraInputs += [("TrigBSExtractionOutput",
                                       "StoreGateSvc+TrigBSExtractionOutput")]
            topSequence += roiWriter
            # write out the RoiDescriptorStores
            from TrigEDMConfig.TriggerEDMRun2 import TriggerRoiList
            objKeyStore.addManyTypesStreamAOD(TriggerRoiList)

        #Are we adding operational info objects in ESD?
        added = self._AddOPIToESD()
        if added:
            log.debug(
                "Operational Info object HLT_EXPRESS_OPI_HLT with extra information about express stream prescaling added to the data."
            )

        # ESD objects definitions
        _TriggerESDList = {}

        from TrigEDMConfig.TriggerEDM import getTriggerEDMList
        # we have to store xAOD containers in the root file, NOT AOD,
        # if the xAOD container list is not empty
        if (xAODContainers):
            _TriggerESDList.update(xAODContainers)
        else:
            _TriggerESDList.update(
                getTriggerEDMList(TriggerFlags.ESDEDMSet(),
                                  TriggerFlags.EDMDecodingVersion()))

        log.info(
            "ESD content set according to the ESDEDMSet flag: %s and EDM version %d",
            TriggerFlags.ESDEDMSet(), TriggerFlags.EDMDecodingVersion())

        # AOD objects choice
        _TriggerAODList = {}

        #from TrigEDMConfig.TriggerEDM import getAODList
        _TriggerAODList.update(
            getTriggerEDMList(TriggerFlags.AODEDMSet(),
                              TriggerFlags.EDMDecodingVersion()))

        log.info(
            "AOD content set according to the AODEDMSet flag: %s and EDM version %d",
            TriggerFlags.AODEDMSet(), TriggerFlags.EDMDecodingVersion())

        log.debug("ESD EDM list: %s", _TriggerESDList)
        log.debug("AOD EDM list: %s", _TriggerAODList)

        # 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, edm):
            from TrigNavTools.TrigNavToolsConfig import navigationThinningSvc

            edmlist = list(y.split('-')[0] for x in edm.values()
                           for y in x)  #flatten names

            svc = navigationThinningSvc({
                'name': 'HLTNav_%s' % stream,
                'mode': 'cleanup',
                'result': 'HLTResult_HLT',
                'features': edmlist
            })

            from OutputStreamAthenaPool.CreateOutputStreams import registerTrigNavThinningSvc
            registerTrigNavThinningSvc(stream, svc)

            log.info("Configured slimming of HLT for %s", stream)
            print(svc)  # noqa: ATL901
            del edmlist

        if TriggerFlags.doNavigationSlimming() and rec.readRDO(
        ) and rec.doWriteAOD():
            _addSlimming('StreamAOD',
                         _TriggerESDList)  #Use ESD item list also for AOD!
            log.info("configured navigation slimming for AOD output")

        if TriggerFlags.doNavigationSlimming() and rec.readRDO(
        ) and rec.doWriteESD():
            _addSlimming('StreamESD', _TriggerESDList)
            log.info("configured navigation slimming for ESD output")

        objKeyStore.addManyTypesStreamESD(_TriggerESDList)
        objKeyStore.addManyTypesStreamAOD(_TriggerAODList)

        return True
예제 #4
0
    def configure(self):
        mlog = logging.getLogger('TauCoreBuilder.py::configure:')
        mlog.info('entering')

        from RecExConfig.RecFlags import rec

        from RecExConfig.ObjKeyStore import objKeyStore
        objKeyStore.addManyTypesStreamESD(self._output)
        objKeyStore.addManyTypesStreamAOD(self._output)
        objKeyStore.addManyTypesTransient(self._output)

        import tauRec.TauAlgorithmsHolder as taualgs
        from tauRec.tauRecFlags import tauFlags

        #switch off TJVA if jet reco don't use tracks.
        from JetRec.JetRecFlags import jetFlags
        if not tauFlags.isStandalone() and not jetFlags.useTracks():
            self.do_TJVA = False  # switch off TJVA

        tools = []
        try:
            tools.append(taualgs.getJetSeedBuilder())

            # run vertex finder only in case vertexing is available. This check can also be done in TauAlgorithmsHolder instead doing it here.
            from InDetRecExample.InDetJobProperties import InDetFlags
            from tauRec.tauRecFlags import jobproperties
            doMVATrackClassification = jobproperties.tauRecFlags.tauRecMVATrackClassification(
            )
            doRNNTrackClassification = jobproperties.tauRecFlags.tauRecRNNTrackClassification(
            )

            if tauFlags.isStandalone() or InDetFlags.doVertexFinding():
                tools.append(
                    taualgs.getTauVertexFinder(doUseTJVA=self.do_TJVA))
            tools.append(taualgs.getTauAxis())
            tools.append(
                taualgs.getTauTrackFinder(
                    removeDuplicateTracks=(not doMVATrackClassification)))
            if doMVATrackClassification:
                tools.append(taualgs.getTauTrackClassifier())
            if not doMVATrackClassification and doRNNTrackClassification:
                tools.append(taualgs.getTauTrackRNNClassifier())
            if jobproperties.Beam.beamType() != "cosmics":
                tools.append(
                    taualgs.getEnergyCalibrationLC(correctEnergy=True,
                                                   correctAxis=False,
                                                   postfix='_onlyEnergy'))
            tools.append(taualgs.getCellVariables())
            tools.append(taualgs.getElectronVetoVars())
            tools.append(taualgs.getTauShotFinder())
            if self.doPi0Clus:
                tools.append(taualgs.getPi0ClusterFinder())

            from tauRec.tauRecFlags import tauFlags
            tools += tauFlags.tauRecToolsDevToolList()

        except Exception:
            mlog.error("could not append tools to TauBuilder")
            traceback.print_exc()
            return False

        # run first part of Tau Builder
        TauRecConfigured.WrapTauRecToolExecHandle(self, tool=tools)
        return True
예제 #5
0
    _TriggerESDList = {}
    _TriggerAODList = {}
    from TrigEDMConfig.TriggerEDM import getTriggerEDMList
    _TriggerAODList.update(
        getTriggerEDMList(TriggerFlags.AODEDMSet(),
                          TriggerFlags.EDMDecodingVersion()))
    _TriggerESDList.update(
        getTriggerEDMList(TriggerFlags.ESDEDMSet(),
                          TriggerFlags.EDMDecodingVersion()))
    from TrigEDMConfig.TriggerEDM import getLvl1ESDList
    from TrigEDMConfig.TriggerEDM import getLvl1AODList
    from RecExConfig.ObjKeyStore import objKeyStore
    from TrigEDMConfig.TriggerEDM import getTrigIDTruthList
    objKeyStore.addManyTypesStreamESD(
        getTrigIDTruthList(TriggerFlags.ESDEDMSet()))
    objKeyStore.addManyTypesStreamAOD(
        getTrigIDTruthList(TriggerFlags.AODEDMSet()))
    objKeyStore.addManyTypesStreamESD(getLvl1ESDList())
    objKeyStore.addManyTypesStreamAOD(getLvl1AODList())
    objKeyStore.addManyTypesStreamESD(_TriggerESDList)
    objKeyStore.addManyTypesStreamAOD(_TriggerAODList)
    if rec.doFileMetaData():
        metadataItems = [
            "xAOD::TriggerMenuContainer#TriggerMenu",
            "xAOD::TriggerMenuAuxContainer#TriggerMenuAux."
        ]
        objKeyStore.addManyTypesMetaData(metadataItems)

if hasattr(runArgs, "inputRDO_FILTFile"):
    rec.readRDO.set_Value_and_Lock(True)
    globalflags.InputFormat.set_Value_and_Lock('pool')
    athenaCommonFlags.PoolRDOInput.set_Value_and_Lock(
예제 #6
0
    def configure(self):
        mlog = logging.getLogger('TauRecRunner.py::configure:')
        mlog.info('entering')

        from RecExConfig.RecFlags import rec

        # xxx ToDo: still needed?
        from RecExConfig.ObjKeyStore import objKeyStore
        objKeyStore.addManyTypesStreamESD(self._output)
        objKeyStore.addManyTypesStreamAOD(self._output)

        import tauRec.TauAlgorithmsHolder as taualgs

        from tauRec.tauRecFlags import tauFlags

        tools = []
        try:

            ### TauRecPi0EflowProcessor ###
            # Tools in this section were originally in TauRecPi0EflowProcessor
            if self.doPi0Clus: tools.append(taualgs.getPi0ClusterCreator())

            ###############################

            ### TauRecVariablesProcessor ###
            from InDetRecExample.InDetJobProperties import InDetFlags
            # Tools in this section were originally in TauRecVariablesProcessor
            if tauFlags.isStandalone() or InDetFlags.doVertexFinding():
                tools.append(taualgs.getTauVertexVariables())

            tools.append(taualgs.getTauCommonCalcVars())
            tools.append(taualgs.getTauSubstructure())

            if self.doPi0Clus:
                tools.append(taualgs.getPi0ClusterScaler())
                tools.append(taualgs.getPi0ScoreCalculator())
                # SWITCHED OFF SELECTOR< SINCE NO CHARGED PFOS AVAILABLE ATM
                tools.append(taualgs.getPi0Selector())

            tools.append(
                taualgs.getEnergyCalibrationLC(correctEnergy=False,
                                               correctAxis=True,
                                               postfix='_onlyAxis'))

            # PanTau:
            if tauFlags.doPanTau():
                import PanTauAlgs.JobOptions_Main_PanTau as pantau
                tools.append(pantau.getPanTau())

            # these tools need pantau info
            tools.append(taualgs.getCombinedP4FromRecoTaus())
            if jobproperties.Beam.beamType() != "cosmics":
                tools.append(taualgs.getMvaTESVariableDecorator())
                tools.append(taualgs.getMvaTESEvaluator())

            if tauFlags.doRunTauDiscriminant():
                tools.append(taualgs.getTauIDVarCalculator())
                tools.append(
                    taualgs.getTauJetBDTEvaluator(
                        "TauJetBDT1P",
                        weightsFile="vars2016_pt_gamma_1p_isofix.root",
                        minNTracks=0,
                        maxNTracks=1))  #update config?
                tools.append(
                    taualgs.getTauJetBDTEvaluator(
                        "TauJetBDT3P",
                        weightsFile="vars2016_pt_gamma_3p_isofix.root",
                        minNTracks=2,
                        maxNTracks=1000))  #update config?
                tools.append(taualgs.getTauWPDecoratorJetBDT())
                tools.append(
                    taualgs.getTauJetRNNEvaluator(
                        "TauJetRNN",
                        NetworkFile1P="rnnid_mc16d_config_1p.json",
                        NetworkFile3P="rnnid_mc16d_config_3p.json",
                        OutputVarname="RNNJetScore",
                        MaxTracks=10,
                        MaxClusters=6))
                tools.append(taualgs.getTauWPDecoratorJetRNN())
                tools.append(
                    taualgs.getTauJetBDTEvaluator(
                        "TauEleBDT_def",
                        weightsFile="",
                        outputVarName="BDTEleScore"))  #just inits values
                tools.append(
                    taualgs.getTauJetBDTEvaluator(
                        "TauEleBDT_bar",
                        weightsFile="EleBDT1PBar.root",
                        minNTracks=1,
                        maxAbsTrackEta=1.37,
                        outputVarName="BDTEleScore"))  #update config?
                tools.append(
                    taualgs.getTauJetBDTEvaluator(
                        "TauEleBDT_end1",
                        weightsFile="EleBDT1PEnd1.root",
                        minNTracks=1,
                        minAbsTrackEta=1.37,
                        maxAbsTrackEta=2.0,
                        outputVarName="BDTEleScore"))  #update config?
                tools.append(
                    taualgs.getTauJetBDTEvaluator(
                        "TauEleBDT_end23",
                        weightsFile="EleBDT1PEnd23.root",
                        minNTracks=1,
                        minAbsTrackEta=2.0,
                        maxAbsTrackEta=3.0,
                        outputVarName="BDTEleScore"))  #update config?
                tools.append(taualgs.getTauWPDecoratorEleBDT())
                tools.append(taualgs.getTauDecayModeNNClassifier())
                tools.append(taualgs.getTauEleOLRDecorator())

            ################################

            from tauRec.tauRecFlags import tauFlags
            tools += tauFlags.tauRecToolsDevToolList()
            #self.TauBuilderToolHandle().Tools = tools

        except Exception:
            mlog.error("could not append tools to TauRunner")
            traceback.print_exc()
            return False

        # run first part of Tau Builder
        TauRecRunConfigured.WrapTauRecToolExecHandle(self, tool=tools)
        return True
예제 #7
0
    def configure(self):

        log = logging.getLogger("HLTTriggerResultGetter.py")
        from RecExConfig.ObjKeyStore import objKeyStore

        # set EDMDecodingVersion
        EDMDecodingVersion()

        # Set AODFULL for data unless it was set explicitly already
        if TriggerFlags.AODEDMSet.isDefault() and globalflags.DataSource()=='data':
            TriggerFlags.AODEDMSet = 'AODFULL'
            
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        log.info("BS unpacking (TF.readBS): %d" % TriggerFlags.readBS() )
        if TriggerFlags.readBS():
            bs = ByteStreamUnpackGetter()

        xAODContainers = {}
#        if not recAlgs.doTrigger():      #only convert when running on old data
        if TriggerFlags.EDMDecodingVersion()==1:
            xaodcnvrt = xAODConversionGetter()
            xAODContainers = xaodcnvrt.xaodlist

        if recAlgs.doTrigger() or TriggerFlags.doTriggerConfigOnly():
            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()))

        if (rec.doESD() or rec.doAOD()) and TriggerFlags.writeL1TopoValData():
            objKeyStore.addManyTypesStreamESD(['xAOD::TrigCompositeContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValData',
                                               'xAOD::TrigCompositeAuxContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValDataAux.'])
            objKeyStore.addManyTypesStreamAOD(['xAOD::TrigCompositeContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValData',
                                               'xAOD::TrigCompositeAuxContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValDataAux.'])
            log.debug("HLT_xAOD__TrigCompositeContainer_L1TopoValData(Aux.) for L1Topo validation added to the data.")

        if rec.doAOD() or rec.doWriteAOD():
            # schedule the RoiDescriptorStore conversion
            # log.warning( "HLTTriggerResultGetter - setting up RoiWriter" )
            topSequence += RoiWriter()
            # write out the RoiDescriptorStores
            from TrigEDMConfig.TriggerEDM import TriggerRoiList
            objKeyStore.addManyTypesStreamAOD( TriggerRoiList )

        #Are we adding operational info objects in ESD?
        added=self._AddOPIToESD()
        if added:
            log.debug("Operational Info object HLT_EXPRESS_OPI_HLT with extra information about express stream prescaling added to the data.")
        


        # ESD objects definitions
        _TriggerESDList = {}

        from TrigEDMConfig.TriggerEDM import getTriggerEDMList 
        # we have to store xAOD containers in the root file, NOT AOD,
        # if the xAOD container list is not empty
        if(xAODContainers):
            _TriggerESDList.update( xAODContainers )
        else:
            _TriggerESDList.update( getTriggerEDMList(TriggerFlags.ESDEDMSet(),  TriggerFlags.EDMDecodingVersion()) ) 
        
        log.info("ESD content set according to the ESDEDMSet flag: %s and EDM version %d" % (TriggerFlags.ESDEDMSet() ,TriggerFlags.EDMDecodingVersion()) )

        # AOD objects choice
        _TriggerAODList = {}
        
        #from TrigEDMConfig.TriggerEDM import getAODList    
        _TriggerAODList.update( getTriggerEDMList(TriggerFlags.AODEDMSet(),  TriggerFlags.EDMDecodingVersion()) ) 

        log.info("AOD content set according to the AODEDMSet flag: %s and EDM version %d" % (TriggerFlags.AODEDMSet(),TriggerFlags.EDMDecodingVersion()) )

        log.debug("ESD EDM list: %s", _TriggerESDList)
        log.debug("AOD EDM list: %s", _TriggerAODList)
        
        # 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, HLT__TrigNavigationSlimming
            from TrigNavTools.TrigNavToolsConfig import navigationSlimming

            edmlist = list(y.split('-')[0] for x in edm.values() for y in x) #flatten names
          
            # from HLT result drop unrecorded features
            # slimmerHLT = HLT__StreamTrigNavSlimming('HLTNavSlimmer_%s'%stream)
            slimmerHLT = HLT__TrigNavigationSlimming('TrigNavigationSlimmer_%s'%stream)
            tHLT = navigationSlimming({'name':'HLTNav_%s'%stream, 'mode':'cleanup', 
                                                          'ThinningSvc':thinningSvc, 'result':'HLTResult_HLT',
                                                          'features':edmlist})
            #tHLT.SlimmingTool.OutputLevel=DEBUG
            tHLT.ActInPlace=True
            slimmerHLT.ThinningTool = tHLT
            print slimmerHLT.ThinningTool
            topSequence += slimmerHLT
            log.info("Configured slimming of HLT")
            del edmlist


        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
        from AthenaServices.Configurables import ThinningSvc, createThinningSvc
        
        _doSlimming = True
        if _doSlimming and rec.readRDO() and rec.doWriteAOD():
            if not hasattr(svcMgr, 'ThinningSvc'): # if the default is there it is configured for AODs
                svcMgr += ThinningSvc(name='ThinningSvc', Streams=['StreamAOD'])             
            _addSlimming('StreamAOD', svcMgr.ThinningSvc, _TriggerESDList ) #Use ESD item list also for AOD!
            log.info("configured navigation slimming for AOD output")
            
        if _doSlimming and rec.readRDO() and rec.doWriteESD(): #rec.doWriteESD() and not rec.readESD(): 
            if not  hasattr(svcMgr, 'ESDThinningSvc'):
                svcMgr += ThinningSvc(name='ESDThinningSvc', Streams=['StreamESD']) # the default is configured for AODs
            _addSlimming('StreamESD', svcMgr.ESDThinningSvc, _TriggerESDList )                
            log.info("configured navigation slimming for ESD output")              
            



        objKeyStore.addManyTypesStreamESD( _TriggerESDList )                        
        objKeyStore.addManyTypesStreamAOD( _TriggerAODList )        
            
        return True