Пример #1
0
    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()

        # preconfigure TrigDecisionTool
        from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
        from AthenaCommon.AppMgr import ToolSvc
        ToolSvc += Trig__TrigDecisionTool( "TrigDecisionTool" )
	# tell TDT to use TrigConfigSvc (Since 00-03-40, defaults to not use it)
        ToolSvc.TrigDecisionTool.TrigConfigSvc = "Trig::TrigConfigSvc/TrigConfigSvc"

        from TrigEDMConfig.TriggerEDM import EDMLibraries
        ToolSvc.TrigDecisionTool.Navigation.Dlls = [e for e in  EDMLibraries if 'TPCnv' not in e]

        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
Пример #2
0
def convert_trigdec(seq, xaod_key, key):
    from AthenaCommon.AppMgr import ToolSvc

    from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
    tdt = Trig__TrigDecisionTool('TrigDecisionToolCnv',
                                 TrigDecisionKey='TrigDecision',
                                 UseAODDecision=True)
    ToolSvc += tdt

    from xAODTriggerCnv.xAODTriggerCnvConf import \
         xAODMaker__TrigDecisionCnvAlg, \
         xAODMaker__TrigDecisionCnvTool
    tdct = xAODMaker__TrigDecisionCnvTool(xaod_key + 'CnvTool',
                                          TrigDecisionTool=tdt)
    alg = xAODMaker__TrigDecisionCnvAlg(xaod_key + 'Cnv',
                                        AODKey=key,
                                        xAODKey=xaod_key,
                                        CnvTool=tdct)
    seq += alg
    return
Пример #3
0
PoolAODInput=["/afs/cern.ch/user/t/tbold/public/TDTtest/attila.AOD.pool.root"]
# PoolAODInput=['/space2/tkohno/data/test/valid1.105144.PythiaZee.recon.AOD.e380_s513_r634_tid043141/AOD.043141._00005.pool.root.1']

import AthenaPoolCnvSvc.ReadAthenaPool
ServiceMgr.EventSelector.InputCollections=PoolAODInput
ServiceMgr.OutputLevel=ERROR
for i in ServiceMgr:  i.OutputLevel=ERROR
#
# TrigDecisionTool
#
from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
tdt = Trig__TrigDecisionTool("TrigDecisionTool")
ToolSvc += tdt
tdt.OutputLevel=ERROR
ToolSvc.TrigDecisionTool.Navigation.OutputLevel = ERROR
tdt.PublicChainGroups = {"EFTau": "EF_[0-9]?tau.*",
                         "EFPhoton": "EF_[0-9]?g*",
                         "EFJets":"EF_J.*",
                         }


#
# Example Code
#
from TrigAnalysisExamples.TrigAnalysisExamplesConf import Trig__TDTExample
from TrigAnalysisExamples.TDTExample import TriggerTree
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
topSequence += Trig__TDTExample("TDTExample")
#? is this necessary if we use the public tdt?
####topSequence.TDTExample.TrigDecisionTool = tdt
Пример #4
0
from tauMonitoring.tauMonitoringConf import *
from AthenaMonitoring.BadLBFilterTool import GetLArBadLBFilterTool
monbadlb = GetLArBadLBFilterTool()

LowStat = True
if DQMonFlags.monManEnvironment() == 'online' :
    LowStat = False 
print "doLowStat " , LowStat

myTDT = None
if DQMonFlags.useTrigger() and LowStat :
    if hasattr(ToolSvc, DQMonFlags.nameTrigDecTool()) :
        myTDT = getattr(ToolSvc, DQMonFlags.nameTrigDecTool())
    else :
        from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
        myTDT = Trig__TrigDecisionTool( "tauDQ_TrigDecisionTool" )
        ToolSvc += myTDT
    
tauMonTool           = tauMonTool (name = "tauMonTool")
tauMonTool.doLowStat = LowStat

if myTDT is None :
    tauMonTool.doTrigger = False
else :
    tauMonTool.doTrigger = DQMonFlags.useTrigger()
    tauMonTool.TrigDecisionTool = myTDT

print "doTrigger " , tauMonTool.doTrigger

if tauMonTool.doTrigger :
    tauMonTool.TauEleJetMbtsTriggerItems = [ [ "L1_TAU1.*" , "L1_TAU2.*" , "L1_TAU60" , "L1_EM15VHI_2TAU.*" , "L1_EM15VHI_TAU40.*" , "L1_MU10_TAU.*" , "L1_J25_3J12_EM15-TAU.*" ] , [ "HLT_e2.*" , "L1_EM2.*" , "L1_2EM15" ] , [ "HLT_j55" , "HLT_j60" , "HLT_j85" , "HLT_j110" , "HLT_j175" , "HLT_4j85" , "HLT_4j10.*" ] , [ "HLT_mb_sp2000_trk70_hmt" ] ]
Пример #5
0
    ToolSvc += IOVDbMetaDataTool("IOVDbMetaDataTool")
    from AthenaServices.AthenaServicesConf import MetaDataSvc
    ServiceMgr += MetaDataSvc("MetaDataSvc")
    ServiceMgr.MetaDataSvc.MetaDataContainer = "MetaDataHdr"
    ServiceMgr.MetaDataSvc.MetaDataTools += ["IOVDbMetaDataTool"]
    import IOVDbSvc.IOVDb

    from RecExConfig.RecFlags import rec
    rec.readAOD = True
    rec.doWriteAOD = False
    rec.doWriteESD = False

    #    from TrigDecisionTool.TrigDecisionConf import TrigDecisionTool
    #    tdt = TrigDecisionTool()
    from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
    tdt = Trig__TrigDecisionTool()
    ToolSvc += tdt
    # flags needed for TriggerConfigGetter

    # To read AOD produced with 13.0.30 you need to change ds to aod:
    from TriggerJobOpts.TriggerFlags import TriggerFlags
    TriggerFlags.configurationSourceList = ['ds']

    # set up trigger config service
    from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter
    cfg = TriggerConfigGetter()

from AthenaCommon.AppMgr import ServiceMgr as svcMgr
svcMgr.MessageSvc.OutputLevel = INFO

## read pool data
Пример #6
0
SFtool.WorkingPoint = "CBandST"
SFtool.DataPeriod = "2012"
SFtool.OutputLevel = INFO

from MuonMomentumCorrections.MuonMomentumCorrectionsConf import CP__MuonCalibrationAndSmearingTool
CalibrationTool = CP__MuonCalibrationAndSmearingTool()
CalibrationTool.Year = 'Data12'
CalibrationTool.Release = 'Rel17.2Sum13'
CalibrationTool.OutputLevel = INFO

from MuonSelectorTools.MuonSelectorToolsConf import CP__MuonSelectionTool
SelectionTool = CP__MuonSelectionTool()
SelectionTool.OutputLevel = INFO

from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
TriggerTool = Trig__TrigDecisionTool("TrigDecTool")
ToolSvc += TriggerTool
TriggerTool.TrigDecisionKey = "xTrigDecision"
TriggerTool.OutputLevel = INFO

from TrigMuonMatching.TrigMuonMatchingConf import Trig__TrigMuonMatching
MatchingTool = Trig__TrigMuonMatching("TrigMatchTool")
MatchingTool.dRmin = 0.1
MatchingTool.LVL1dRmin = 0.2
MatchingTool.TriggerTool = TriggerTool
MatchingTool.OutputLevel = INFO

# Create an instance of the Resonance selection tool for Zmumu
from MuonResonanceTools.MuonResonanceToolsConf import MuonResonanceSelectionTool
ToolSvc += MuonResonanceSelectionTool("MuonZSelectionTool")
ToolSvc.MuonZSelectionTool.PtCut = 20000
Пример #7
0
from glob import glob

import AthenaPoolCnvSvc.ReadAthenaPool
svcMgr.EventSelector.InputCollections = glob(inputFiles)

#ToolSvc += CfgMgr.TrigConf__xAODConfigTool("xAODConfigTool")
#ToolSvc += CfgMgr.Trig__TrigDecisionTool("TrigDecisionTool",
#ConfigTool = ToolSvc.xAODConfigTool,
#TrigDecisionKey = "xTrigDecision",
#OutputLevel = 1)

from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
trigDecTool = Trig__TrigDecisionTool('TrigDecisionTool')
ToolSvc += trigDecTool

svcMgr += CfgMgr.AthenaEventLoopMgr(EventPrintoutInterval=1000)

from AthenaCommon.AlgSequence import AlgSequence
algSeq = AlgSequence()

from TrigTauMatching.TrigTauMatchingConf import Trig__TrigTauMatchingTool
tauMatchingTool = Trig__TrigTauMatchingTool('TrigTauMatchingTool')
tauMatchingTool.TrigDecisionTool = trigDecTool
ToolSvc += tauMatchingTool

from TrigTauMatching.TrigTauMatchingConf import TrigTauMatching_example
alg = TrigTauMatching_example()
alg.TrigTauMatchingTool = tauMatchingTool

algSeq += alg
Пример #8
0
from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
tdt =Trig__TrigDecisionTool("TrigDecisionTool")
ToolSvc += tdt
tdt.OutputLevel = WARNING
ToolSvc.TrigDecisionTool.Navigation.OutputLevel = ERROR
Пример #9
0
include("RecExCond/AllDet_detDescr.py")

#-- import BS reading JO ------------------------------------------------------------------------------

include("RecExCommon/BSRead_config.py")

#-- get Trigger Configuration ------------------------------------------------------------------------------

from TriggerJobOpts.T0TriggerGetter import T0TriggerGetter
gettrigger = T0TriggerGetter()

#-- set up TrigDecision Tool ------------------------------------------------------------------------------

from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
monTrigDecTool = Trig__TrigDecisionTool("monTrigDecTool")
ToolSvc += monTrigDecTool

#-- run reconstruction ------------------------------------------------------------------------------
    # bug https://savannah.cern.ch/bugs/?54123

if not conddb.folderRequested('PIXEL/PixReco'):
   conddb.addFolder('PIXEL_OFL','/PIXEL/PixReco');

#protectedInclude( "InDetRecExample/InDetRec_jobOptions.py" )
#protectedInclude ("CaloRec/CaloRec_jobOptions.py")
#include ("MuonRecExample/MuonRec_jobOptions.py")
#
#protectedInclude( "egammaRec/egammaRec_jobOptions.py" )
#include ("MuonCombinedRecExample/MuonCombinedRec_config.py")
#include( "JetRec/JetRec_jobOptions.py" )
      # for ESD->AOD use trigger config stored as in-file meta-data,
      if not 'TriggerFlags' in dir():
         from TriggerJobOpts.TriggerFlags import TriggerFlags
      TriggerFlags.configurationSourceList = ['ds']

      # set up trigger config service
      if not 'TriggerConfigGetter' in dir():
         from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter
         cfg = TriggerConfigGetter()

   if not hasattr(ToolSvc, DQMonFlags.nameTrigDecTool()):
      from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
      monTrigDecTool = Trig__TrigDecisionTool(name=DQMonFlags.nameTrigDecTool(),
                                              OutputLevel=ERROR,
                                              PublicChainGroups = {"EFTau": "EF_[0-9]?tau.*",
                                                                   "EFPhoton": "EF_[0-9]?g*",
                                                                   "EFJets":"EF_J.*",
                                                                  }
                                             )
      ToolSvc += monTrigDecTool

   tdt_local_logger.info('Scheduling the trigger translator')
   # Look up all monitoring menu lists, shove into trigger translator
   # pass them in as joined strings, unpack in tool
   from TrigHLTMonitoring.HLTMonTriggerList import HLTMonTriggerList
   tdt_local_hltconfig = HLTMonTriggerList()
   import collections
   tdt_mapping = {}
   for tdt_menu, tdt_menu_item in tdt_local_hltconfig.__dict__.items():
      if not isinstance(tdt_menu_item, collections.Iterable): continue
      # work around possibly buggy category items
Пример #11
0
def HSG2physicsD3PD(name, file, tuplename='physics', **kw):

    from AthenaCommon.AlgSequence import AlgSequence  # needed for attila's code
    from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags  # needed for attila's code

    # define track and cluster filters
    filter1 = makeTrackFilterAlg(TracksName=D3PDMakerFlags.TrackSGKey(),
                                 OutputTracksName='GoodTracks' + name,
                                 ptCut=0.,
                                 nSCTPix=4)

    filter2 = makeTrackFilterAlg(TracksName=D3PDMakerFlags.TrackSGKey(),
                                 OutputTracksName='HighPtTracks' + name,
                                 ptCut=5000.,
                                 nSCTPix=4)

    preseq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName())
    preseq += filter1
    preseq += filter2

    # now configure the D3PD
    from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
    alg = MSMgr.NewRootStream(name, file, TreeName=tuplename)

    #alg = D3PDMakerCoreComps.MakerAlg(tuplename, seq,
    #                                  file = file,
    #                                  D3PDSvc = D3PDSvc,
    #                                  streamNameRoot = streamNameRoot)

    alg += EventInfoD3PDObject(**_args(10, 'EventInfo', kw))
    alg += LArCollisionTimeD3PDObject(**_args(10, 'LArCollisionTime', kw))

    from D3PDMakerCoreComps.D3PDObject import make_SG_D3PDObject

    import EventCommonD3PDMaker

    # Electron/Photon block
    alg += ElectronD3PDObject(
        **_args(10,
                'Electron',
                kw,
                exclude=[
                    'L1Index', 'L2Index', 'EMTrackFitDetails',
                    'EgammaJetSignedIPAndPTRelKin'
                ]))
    # Photon block
    alg += PhotonD3PDObject(**_args(10, 'Photon', kw))

    # Muon blocks
    alg += MuonD3PDObject(**_args(
        10,
        'MuidMuon',
        kw,
        sgkey='MuidMuonCollection',
        prefix='mu_muid_',
        include=["EFCBInfoIndex", "EFMGInfoIndex", "EFMEInfoIndex"],
        exclude=["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
        allowMissing=True))
    alg += MuonD3PDObject(**_args(
        10,
        'StacoMuon',
        kw,
        sgkey='StacoMuonCollection',
        prefix='mu_staco_',
        include=["EFCBInfoIndex", "EFMGInfoIndex", "EFMEInfoIndex"],
        exclude=["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
        allowMissing=True))
    alg += MuonD3PDObject(**_args(
        10,
        'CaloMuon',
        kw,
        sgkey='CaloMuonCollection',
        prefix='mu_calo_',
        include=["EFCBInfoIndex", "EFMGInfoIndex", "EFMEInfoIndex"],
        exclude=["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
        allowMissing=True))

    alg += MuonD3PDObject(**_args(
        10,
        'Muons',
        kw,
        sgkey='Muons',
        prefix='mu_muon_',
        include=["EFCBInfoIndex", "EFMGInfoIndex", "EFMEInfoIndex"],
        exclude=["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
        allowMissing=True))
    # Quadruplet vertex block
    from AthenaCommon.AlgSequence import AlgSequence
    from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
    from HSG2VertexCreation.HSG2VertexReconstruction import HSG2VertexReconstruction
    HSG2VertexReconstruction("HSG2VertexReconstruction",
                             AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName()))

    from HiggsD3PDMaker.HSG2VertexReconstruction import addHSG2VertexReconstruction
    addHSG2VertexReconstruction(alg,
                                electron_target="el_",
                                muid_target="mu_muid_",
                                staco_target="mu_staco_",
                                calo_target="mu_calo_",
                                muon_target="mu_muon_")

    # Tau block
    alg += TauD3PDObject(**_args(1, 'Tau', kw))

    # Jet blocks
    alg += JetD3PDObject(**_args(
        3,
        'AK4TopoEMJet',
        kw,
        sgkey='AntiKt4TopoEMJets' + JetTagD3PD_CollectionPostfix,
        prefix='jet_akt4topoem_',
        #include = ['BTag','TrueFlavorComponents','BTagComponents'],
        include=[
            JetTagD3PDKeys.BTagWeightsBlockName(),
            JetTagD3PDKeys.JetFitterCharmTagInfoBlockName(),
            JetTagD3PDKeys.JetFitterCharmInfoBaseBlockName(),
            JetTagD3PDKeys.TruthInfoBlockName(),
            "Constituents",
            'TracksMoments',
            'Samplings',  # For GSC corrections
        ],
        allowMissing=True))
    # For VBF and ZH(->inv) analyses
    alg += JetD3PDObject(**_args(
        3,
        'AK4LCTopoJet',
        kw,
        sgkey='AntiKt4LCTopoJets' + JetTagD3PD_CollectionPostfix,
        prefix='jet_AntiKt4LCTopo_',
        include=[
            JetTagD3PDKeys.BTagWeightsBlockName(),
            JetTagD3PDKeys.JetFitterCharmTagInfoBlockName(),
            JetTagD3PDKeys.JetFitterCharmInfoBaseBlockName(),
            JetTagD3PDKeys.TruthInfoBlockName(),
            "Constituents",
            "ConstituentScale",  # For ZH(->inv) analysis
            'TracksMoments',
            'Samplings',  # For GSC corrections
        ],
        allowMissing=True))

    # MET blocks
    # a whole mess to remove x,y components separately for all flavours
    alg += MissingETD3PDObject(**_args(
        10,
        'MissingET',
        kw,
        exclude=[
            'MET_Base', 'MET_Base0', 'MET_Truth_Int', 'MET_RefFinal_Comps',
            'MET_Calib_Comps', 'MET_CellOut_Comps', 'MET_CorrTopo_Comps',
            'MET_Cryo_Comps', 'MET_CryoCone_Comps', 'MET_Final_Comps',
            'MET_LocHadTopo_Comps', 'MET_LocHadTopoObj_Comps',
            'MET_Muid_Comps', 'MET_Muid_Spectro_Comps', 'MET_Muid_Track_Comps',
            'MET_MuonBoy_Comps', 'MET_MuonBoy_Spectro_Comps',
            'MET_MuonBoy_Track_Comps', 'MET_MuonMuid_Comps', 'MET_Muon_Comps',
            'MET_Muon_Isol_Muid_Comps', 'MET_Muon_Isol_Staco_Comps',
            'MET_Muon_NonIsol_Muid_Comps', 'MET_Muon_NonIsol_Staco_Comps',
            'MET_Muon_Total_Muid_Comps', 'MET_Muon_Total_Staco_Comps',
            'MET_RefEle_Comps', 'MET_RefEle_em_Comps', 'MET_RefGamma_Comps',
            'MET_RefGamma_em_Comps', 'MET_RefJet_Comps', 'MET_RefJet_em_Comps',
            'MET_RefMuon_Comps', 'MET_RefMuon_Muid_Comps',
            'MET_RefMuon_Staco_Comps', 'MET_RefMuon_Track_Muid_Comps',
            'MET_RefMuon_Track_Staco_Comps', 'MET_RefMuon_Track_em_Comps',
            'MET_RefMuon_Track_Comps', 'MET_RefMuon_em_Comps',
            'MET_RefTau_Comps', 'MET_RefTau_em_Comps', 'MET_SoftJets_Comps',
            'MET_SoftJets_em_Comps', 'MET_Topo_Comps', 'MET_TopoObj_Comps',
            'MET_Track_Comps'
        ],
        allowMissing=True))

    # Pileup-subtracted MET RefFinal for ZH(->inv) analysis
    alg += MissingETCompositionD3PDObject(level=4,
                                          sgkey='MET_RefComposition_STVF',
                                          suffix='STVF_',
                                          allowMissing=True,
                                          jetSGKey='AntiKt4LCTopoJets',
                                          jetPrefix='jet_AntiKt4LCTopo_MET_')

    # ... good tracks only (nSCT>3; no pt cut)
    alg += TrackParticleD3PDObject(**_args(3,
                                           'Tracks1',
                                           kw,
                                           sgkey='GoodTracks' + name,
                                           label='trk',
                                           prefix='trk_'))

    # ... high-pt tracks (nSCT>3; pt>5 GeV)
    from TrackD3PDMaker.TrackD3PDMakerFlags import TrackD3PDFlags as highPtFlags
    highPtFlags.doTruth = True
    highPtFlags.storeDiagonalCovarianceAsErrors = True
    highPtFlags.storeHitTruthMatching = True
    highPtFlags.storePixelHitsOnTrack = False
    highPtFlags.storePixelHolesOnTrack = False
    highPtFlags.storePixelOutliersOnTrack = False
    highPtFlags.storeSCTHitsOnTrack = False
    highPtFlags.storeSCTHolesOnTrack = False
    highPtFlags.storeSCTOutliersOnTrack = False
    highPtFlags.storeTRTHitsOnTrack = False
    highPtFlags.storeTRTHolesOnTrack = False
    highPtFlags.storeTRTOutliersOnTrack = False
    highPtFlags.storeTrackFitQuality = True
    highPtFlags.storeTrackMomentum = True
    highPtFlags.storeTrackSummary = True
    highPtFlags.trackParametersAtBeamSpotLevelOfDetails = 0
    highPtFlags.trackParametersAtGlobalPerigeeLevelOfDetails = 2
    highPtFlags.trackParametersAtPrimaryVertexLevelOfDetails = 3

    alg += TrackParticleD3PDObject(**_args(3,
                                           'Tracks2',
                                           kw,
                                           sgkey='HighPtTracks' + name,
                                           label='trkpt5',
                                           prefix='trkpt5_'))

    # Primary vertex block - May be missing in single-beam data.
    alg += PrimaryVertexD3PDObject(**_args(1,
                                           'PrimaryVertex',
                                           kw,
                                           allowMissing=True,
                                           sgkey=D3PDMakerFlags.VertexSGKey(),
                                           prefix='vxp_'))

    # Truth
    if rec.doTruth():

        from TruthD3PDMaker.GenEventD3PDObject import GenEventD3PDObject
        from TruthD3PDMaker.TruthParticleD3PDObject import TruthParticleD3PDObject
        from MuonD3PDMaker.TruthMuonD3PDObject import TruthMuonD3PDObject

        alg += TruthMuonD3PDObject(**_args(2, 'TruthMuon', kw))
        alg += GenEventD3PDObject(**_args(1, 'GenEvent', kw))
        alg += TruthParticleD3PDObject(**_args(1, 'TruthParticle', kw))

        # TruthJets
        alg += JetD3PDObject(**_args(1,
                                     'AK4TruthJet',
                                     kw,
                                     sgkey='AntiKt4TruthJets',
                                     prefix='jet_antikt4truth_',
                                     allowMissing=True))

        # add Heavy flavour overlap
        from TopInputsD3PDMaker.HforD3PDObject import HforD3PDObject
        alg += HforD3PDObject(**_args(0, 'HforD3PD', kw))

        # add mcVx information
        from TrackD3PDMaker.TruthVertexD3PDObject import TruthVertexD3PDObject
        alg += TruthVertexD3PDObject(**_args(0, 'TruthVertex', kw))

    if not rec.doTruth():
        alg += BeamSpotD3PDObject(10)

    if D3PDMakerFlags.DoTrigger():

        # Trigger Decision + metadata
        alg += TrigDecisionD3PDObject(**_args(10, 'TrigDecision', kw))
        addTrigConfMetadata(alg)

        from TrigMissingETD3PDMaker.TrigMETD3PD import TrigMETD3PDObjects
        TrigMETD3PDObjects(alg)

        from TrigEgammaD3PDMaker.TrigEgammaD3PD import TrigEgammaD3PDObjects
        TrigMuonD3PDObjects(alg, 1)
        TrigEgammaD3PDObjects(alg, level=10)

    # Event metadata
    alg.MetadataTools += [LBMetadataConfig()]

    from EventCommonD3PDMaker.CutFlowMetadataConfig import CutFlowMetadataConfig
    alg.MetadataTools += [CutFlowMetadataConfig(alg)]

    # Bunch train information
    from TriggerD3PDMaker.BunchStructureMetadata import addBunchStructureMetadata
    addBunchStructureMetadata(alg)

    ## Silence the trigger navigation warnings about missing containers:
    from AthenaCommon.AppMgr import ToolSvc
    if not hasattr(ToolSvc, "TrigDecisionTool"):
        from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool
        ToolSvc += Trig__TrigDecisionTool("TrigDecisionTool")
        pass
    ToolSvc.TrigDecisionTool.Navigation.OutputLevel = 5

    # EventShape variables
    # https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/D3PDVariablesForPileup#EventShape_variables
    from QcdD3PDMaker.QcdEventShapeD3PDObject import EventShapeD3PDObject
    alg += EventShapeD3PDObject(**_args(0, 'rho', kw))

    return alg