コード例 #1
0
def _jetFilterAlgHook(c, prefix, sgkey, JetContainer, **kw):

    preseq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName())

    # Is the container already in SG?
    if cfgKeyStore.isInInput('JetContainer', sgkey):
        return

    # Is the algorithm already in the sequence?
    algname = sgkey + JetTagD3PDKeys.FilteredJetMakerAlgPostfix()
    if hasattr(preseq, algname):
        return

    # select valid argument for JetTagJetFilterAlg
    filterargs = kw
    for k in filterargs.keys():
        if not hasattr(JetTagD3PDMaker.JetTagJetFilterAlg, k):
            del filterargs[k]

    del filterargs['name']

    ### if some argument do not exist set them to the flag values
    if not 'PtMinCut' in filterargs:
        filterargs['PtMinCut'] = JetTagD3PDFlags.JetFilterPtMinCut()
    if not 'EtaCut' in filterargs:
        filterargs['EtaCut'] = JetTagD3PDFlags.JetFilterEtaCut()
    if not 'UseEMScale' in filterargs:
        filterargs['UseEMScale'] = JetTagD3PDFlags.JetFilterUseEMScale()

    preseq += JetTagD3PDMaker.JetTagJetFilterAlg(algname,
                                                 FilteredJetContainer=sgkey,
                                                 JetContainer=JetContainer,
                                                 **filterargs)

    return
コード例 #2
0
def addToIncludeBlocks(jetname, list):

    key = jetname + "_include"
    dict = JetTagD3PDFlags.D3PDPropDict()
    if key in dict.keys():
        list += dict[key]
    JetTagD3PDFlags.D3PDPropDict().update({key: list})
コード例 #3
0
def getJetTagMSVVtxInfoInJetD3PDObject(level, jetCollections, **kw):

    if JetTagD3PDFlags.TrackAssocLabel() != "":
        kw = _updateDict("JetTag_JetMultiSVVtxAssoc",
                         JetTagD3PDFlags.TrackAssocLabel(), kw)

    return JetTagMSVVtxInfoInJetD3PDObject(level=level,
                                           jetCollections=jetCollections,
                                           **kw)
コード例 #4
0
def addTrackGhostAssociation(jetcollection):

    ### assoc name is TrackAssoc
    ### using the default assoc otherwise use setupGhostAssociator to get a custom assoc
    if JetTagD3PDFlags.TrackAssocLabel() != "":
        JetTagD3PDFlags.D3PDPropDict().update(
            {
                jetcollection + "_" + JetTagD3PDKeys.JetTrackGhostAssocBlockName(
                ) + "_target":
                JetTagD3PDFlags.TrackAssocLabel()
            })
コード例 #5
0
def getJetTagPrimaryVertexD3PDObject(level=10, **kw):

    if JetTagD3PDFlags.TrackAssocLabel() == "":
        TrackD3PDFlags.storeVertexTrackIndexAssociation = False

    JetTagPrimaryVertexD3PDObject = \
        BuildxAODVertexD3PDObject(_prefix=JetTagD3PDKeys.PrimaryVertexPrefix(),
                                  _label=JetTagD3PDKeys.PrimaryVertexGetterLabel(),
                                  _sgkey=JetTagD3PDFlags.PrimaryVertexSGKey(),
                                  trackTarget=JetTagD3PDFlags.TrackAssocLabel(),
                                  trackPrefix='trk_')

    return JetTagPrimaryVertexD3PDObject(level=level, **kw)
コード例 #6
0
def _modifyMuonObject(MuonD3PDObject):
    if not MuonD3PDObject.allBlocknames().has_key(
            "BtagMuonTrackMatchingBlock"):
        if JetTagD3PDFlags.TrackAssocLabel() != "":
            from D3PDMakerCoreComps.IndexAssociation import IndexAssociation
            import MuonD3PDMaker
            mtassoc = IndexAssociation(
                MuonD3PDObject,
                MuonD3PDMaker.MuonTrackParticleAssociationTool,
                JetTagD3PDFlags.TrackAssocLabel(),
                level=500,
                prefix=JetTagD3PDKeys.MuonInDetTrackAssocPrefix(),
                blockname="BtagMuonTrackMatchingBlock",
                Type='InDet')
コード例 #7
0
def getJetTagPrimaryVertexD3PDObject(level=10, **kw):

    if JetTagD3PDFlags.TrackAssocLabel() == "":
        TrackD3PDFlags.storeVertexTrackIndexAssociation = False

    JetTagPrimaryVertexD3PDObject = BuildVertexD3PDObject(
        _prefix=JetTagD3PDKeys.PrimaryVertexPrefix(),
        _label=JetTagD3PDKeys.PrimaryVertexGetterLabel(),
        _sgkey=JetTagD3PDFlags.PrimaryVertexSGKey(),
        #_object_name='JetTagPrimaryVertexD3PDObject',
        trackTarget=JetTagD3PDFlags.TrackAssocLabel(),
        trackPrefix='trk_',
        trackType='Rec::TrackParticleContainer')

    return JetTagPrimaryVertexD3PDObject(level=level, **kw)
コード例 #8
0
def AddBTaggingInfo(obj, level=0, block_prefix="my"):

    obj.defineBlock(level,
                    block_prefix + JetTagD3PDKeys.BTagWeightsBlockName(),
                    JetTagD3PDMaker.JetTagBTagWeightsFillerTool,
                    prefix=JetTagD3PDKeys.BTagWeightsPrefix(),
                    TaggerNames=JetTagD3PDFlags.Taggers())
コード例 #9
0
def _jetTwoTrackVertexTagAlgHook(
        c,
        prefix,
        sgkey,
        jetCollections,
        InfoName=JetTagD3PDFlags.JetFitterVertexFinderObjects(),
        **kw):

    preseq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName())

    # Is the container already in SG?
    if cfgKeyStore.isInInput('JetTagTwoTrackVertexDataHolder', sgkey):
        return

    # Is the algorithm already in the sequence?
    algname = sgkey + JetTagD3PDKeys.JFTwoTrackVertexMakerAlgPostfix()
    if hasattr(preseq, algname):
        return

    filterargs = kw
    for k in filterargs.keys():
        if not hasattr(JetTagD3PDMaker.JetTagJetFitterDataToSGAlg, k):
            del filterargs[k]

    del filterargs['name']
    preseq += JetTagD3PDMaker.JetTagJetFitterDataToSGAlg(
        algname,
        TwoTrackVertexName=sgkey,
        FillTwoTrackVertex=True,
        JetCollections=jetCollections,
        InfoName=InfoName,
        **filterargs)

    return
コード例 #10
0
    def addToAlg(self,alg):
               
        alg += self.MyJetD3PDObject(0, 
                                    prefix='jet_' + self.parentJets + '_', 
                                    sgkey=self.parentJets+'Jets',
                                    exclude=self.commonExcludeList, 
                                    include = self.commonIncludeList + self.VtxInclude + self.JetQualInclude)
 
        for idx,gr in enumerate(self.groomedJetsList):
                       
            kw = {}
            includelist = []
            includelist_unique = []
           
            if 'Trim' in gr:
                includelist_unique += ['TrimConfigMoments']
               
            elif 'Filt' in gr and 'Subjets' not in gr:
                includelist += ['FiltMoments']
                includelist_unique += ['FiltConfigMoments']
                if len(self.groomedJetsList) > idx+1 and 'Subjets' in self.groomedJetsList[idx+1]:
                    includelist += ['blockbtag'+self.groomedJetsList[idx+1], self.groomedJetsList[idx+1]+'blockindex']
                   
            elif 'Subjets' in gr:
                includelist += [JetTagD3PDKeys.BTagWeightsBlockName()]               
                includelist += [JetTagD3PDKeys.JetTrackAssocBlockName()] 
                includelist += [JetTagD3PDKeys.JetTrackBlockName()] 
                includelist += [JetTagD3PDKeys.IPInfoPlusTrackAssocBlockName()] 
                includelist += [JetTagD3PDKeys.IPInfoPlusTrackBlockName()] 
                if JetTagD3PDFlags.TrackAssocLabel()!= "":
                    kw[JetTagD3PDKeys.JetTrackAssocBlockName()+'_target']=  JetTagD3PDFlags.TrackAssocLabel()
                    kw[JetTagD3PDKeys.IPInfoPlusTrackAssocBlockName()+'_target']=  JetTagD3PDFlags.TrackAssocLabel()
               
            alg += self.MyGroomedJetD3PDObject(0, 
                                               prefix='jet_' + self.parentJets + gr + '_', 
                                               sgkey=self.parentJets + gr +'Jets', 
                                               include = includelist + self.commonIncludeList,
                                               exclude=self.commonExcludeList,**kw)
       
            alg += self.MyGroomedJetCollectionD3PDObject(0, 
                                                         prefix='jet_' + self.parentJets + gr + '_config_', 
                                                         sgkey=self.parentJets + gr +'Jets', 
                                                         include = includelist_unique)

        return
コード例 #11
0
def getJetTagTrackD3PDObject(level=20, **kw):

    if not rec.doTruth:
        TrackD3PDFlags.doTruth = False

    if TruthD3PDFlags.GenParticleAssocLabel() == None or TruthD3PDFlags.GenParticleAssocLabel() == "":
        TrackD3PDFlags.doTruth = False
        
 
    JetTagTrackParticleD3PDObject = xAODTrackD3PDObject(_label=JetTagD3PDKeys.TrackGetterLabel(),
                                                        _prefix=JetTagD3PDKeys.TrackPrefix(),
                                                        _sgkey=JetTagD3PDFlags.TrackParticleSGKey(),
                                                        vertexSGKey=JetTagD3PDFlags.PrimaryVertexSGKey(),
                                                        vertexTarget=JetTagD3PDKeys.PrimaryVertexGetterLabel(),
                                                        vertexPrefix=JetTagD3PDKeys.PrimaryVertexPrefix(),
                                                        flags=TrackD3PDFlags)

    from AthenaCommon.AppMgr import ToolSvc
    from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetTrackSelectorTool
    jetTagD3PDInDetTrackSelectorTool = InDet__InDetTrackSelectorTool("JetTagD3PDInDetTrackSelectorTool")
    jetTagD3PDInDetTrackSelectorTool.minPt = JetTagD3PDFlags.TrackPtCut()
    jetTagD3PDInDetTrackSelectorTool.IPz0Max = 99999.
    jetTagD3PDInDetTrackSelectorTool.maxZ0 = 99999.
    jetTagD3PDInDetTrackSelectorTool.maxD0 = 99999.
    jetTagD3PDInDetTrackSelectorTool.maxD0overSigmaD0 = 99999.
    jetTagD3PDInDetTrackSelectorTool.numberOfPixelHits = -99
    jetTagD3PDInDetTrackSelectorTool.numberOfInnermostPixelLayerHits = -99
    jetTagD3PDInDetTrackSelectorTool.Extrapolator = ToolSvc.InDetExtrapolator 
    jetTagD3PDInDetTrackSelectorTool.TrackSummaryTool = ToolSvc.InDetTrackSummaryTool
    ToolSvc+=jetTagD3PDInDetTrackSelectorTool

    from InDetD3PDMaker import TrackParticleGetterTool
    jetTagD3PDTrackGetterTool = TrackParticleGetterTool("jetTagD3PDTrackGetterTool")
    jetTagD3PDTrackGetterTool.VertexSGKey = JetTagD3PDFlags.PrimaryVertexSGKey() ## no need to resolve for now 
    jetTagD3PDTrackGetterTool.TrackSelector = jetTagD3PDInDetTrackSelectorTool
    jetTagD3PDTrackGetterTool.Label = JetTagD3PDKeys.TrackGetterLabel()
    jetTagD3PDTrackGetterTool.SGKey = JetTagD3PDFlags.TrackParticleSGKey()
    jetTagD3PDTrackGetterTool.TypeName = 'Rec::TrackParticleContainer'

    
    return JetTagTrackParticleD3PDObject(level=level,
                                         getter=jetTagD3PDTrackGetterTool, **kw)
コード例 #12
0
def addBHadronGhostAssociation(jetcollection):

    if TruthD3PDFlags.GenParticleAssocLabel() != "":
        addToIncludeBlocks(
            jetcollection,
            [JetTagD3PDKeys.JetBHadronGhostAssocBlockName() + "tmp"])
        JetTagD3PDFlags.D3PDPropDict().update({
            jetcollection + "_" + JetTagD3PDKeys.JetBHadronGhostAssocBlockName(
            ) + "_target":
            TruthD3PDFlags.GenParticleAssocLabel()
        })
コード例 #13
0
from JetTagD3PDMaker.JetTagD3PDMakerKeys import JetTagD3PDKeys
from JetTagD3PDMaker.JetTagD3PDMakerFlags import JetTagD3PDFlags
from RecExConfig.RecFlags import rec


### hack to make it work until remi fixes the label in BuildVertexD3PDObject
JetTagD3PDKeys.PrimaryVertexGetterLabel = JetTagD3PDKeys.PrimaryVertexPrefix()

### switch on second muon
from BTagging.BTaggingFlags import BTaggingFlags
if BTaggingFlags.SecondSoftMu:
    JetTagD3PDFlags.AddSecondMuonCollection=True

### which ntuple configuration to load?
if JetTagD3PDFlags.NtupleType() == "":
    print "custom configuration used for JetTagD3PD"
if JetTagD3PDFlags.NtupleType() == "Debug":
    include("JetTagD3PDMaker/DebugNtuple_LoadConfig.py")
    print "Debug configuration used for JetTagD3PD"
if JetTagD3PDFlags.NtupleType() == "Full":
    include("JetTagD3PDMaker/FullNtuple_LoadConfig.py")
    print "Full configuration used for JetTagD3PD"
if JetTagD3PDFlags.NtupleType() == "Efficiency":
    include("JetTagD3PDMaker/EffNtuple_LoadConfig.py")
    print "Efficiency configuration used for JetTagD3PD"
    
## create the D3PD alg
import D3PDMakerCoreComps
alg = D3PDMakerCoreComps.MakerAlg(JetTagD3PDKeys.D3PDAlgName(), topSequence,
                                  file = JetTagD3PDKeys.D3PDFileName(),
コード例 #14
0
    def __init__(self,jetsToWrite):

        self.commonExcludeList = ['El02Match','Mu02Match','L1Info','L2Info','EFInfo']
        self.commonIncludeList = []

        MyJetD3PDObject = getJetD3PDObject(objectname='MyJetD3PDObject')
        MyGroomedJetD3PDObject = getJetD3PDObject(objectname='MyGroomedJetD3PDObject')
   
        import re
        JetAlgPattern = re.compile(r'^(\D+)(\d{1,2})(\D+)Jets')  #assuming standard notation
        ars = JetAlgPattern.match(jetsToWrite[0]).groups()
   
        self.parentJets = ''.join(ars)  #remove the 'Jets' at the end


        self.groomedJetsList = jetsToWrite[1]
           
        if 'Track' in self.parentJets and JetTagD3PDFlags.TrackAssocLabel()!= "":
            AddConstitIndex(MyGroomedJetD3PDObject, typename='Rec::TrackParticle', 
                            target=JetTagD3PDFlags.TrackAssocLabel())
            AddConstitIndex(MyJetD3PDObject, typename='Rec::TrackParticle', 
                            target=JetTagD3PDFlags.TrackAssocLabel())
        elif 'Topo' in self.parentJets and False:
            AddConstitIndex(MyGroomedJetD3PDObject)
            AddConstitIndex(MyJetD3PDObject)
        elif 'Truth' in self.parentJets:
            AddConstitTruthIndex(MyJetD3PDObject)
            AddConstitTruthIndex(MyGroomedJetD3PDObject)

        #if 'Track' not in self.parentJets and 'Truth' not in self.parentJets:
        #    AddAssocJetsIndex(MyJetD3PDObject, 'TrackJets', 'jet_' + ars[0] + ars[1] + 'TrackZ_')
        #    if rec.doTruth():
        #       AddAssocJetsIndex(MyJetD3PDObject, 'TruthJets', 'jet_' + ars[0] + ars[1] + 'Truth_')
       
        self.JetQualInclude = []

        if 'Topo' in self.parentJets:
            self.commonIncludeList += ['ConstituentScale', 'EMScale']
            AddHadronicInfo(MyJetD3PDObject, 
                            ['OriginIndex','nTrk','sumPtTrk','EtaOrigin', 'PhiOrigin', 'MOrigin'],
                            theblockname = 'OriginIndexBlock')
            AddHadronicInfo(MyGroomedJetD3PDObject, 
                            ['EtaOrigin', 'PhiOrigin', 'MOrigin' ],
                            theblockname = 'OriginIndexBlock')


            if (self.parentJets == 'AntiKt10LCTopo') or (self.parentJets == 'CamKt12LCTopo'):
                AddHadronicInfo(MyJetD3PDObject, 
                                ['LCJES', 'LCJES_EtaCorr', 'LCJES_MassCorr' ], 
                                theblockname='LCJESBlock')
                AddHadronicInfo(MyGroomedJetD3PDObject, 
                                ['LCJES', 'LCJES_EtaCorr', 'LCJES_MassCorr' ],
                                theblockname='LCJESBlock')
               
        self.VtxInclude = []

        if 'Topo' in self.parentJets:
            self.VtxInclude += ['JVtx','JetVertexFraction']
           
        AddAssocJetsIndex(MyGroomedJetD3PDObject, 'Parent', 'jet_' + self.parentJets + '_')
        for gr in self.groomedJetsList:
            AddAssocJetsIndex(MyJetD3PDObject, gr, 'jet_' + self.parentJets + gr + '_')

        MyGroomedJetCollectionD3PDObject = getJetCollectionD3PDObject(objectname = "MyGroomedJetCollectionD3PDObject")
        AddUniqueMoments(MyGroomedJetCollectionD3PDObject,  
                         ['SmallR','PtFrac', 'NSub'],
                         theblockname = 'TrimConfigMoments', level=99)
        AddUniqueMoments(MyGroomedJetCollectionD3PDObject,   
                         ['NSubjets','ktycut2','massFraction','minRfilt','minSplitR'], 
                         theblockname = 'FiltConfigMoments', level = 99)
       
        AddHadronicInfo(MyGroomedJetD3PDObject, ['CORE_RBB','CORE_RFILT'], 
                        theblockname = 'FiltMoments', level=99)

        ## in groomedJetsList, subjets name should follow the name of the 'full/composite' jet.
        for idx,gr in enumerate(self.groomedJetsList):
                ## names are unique
            if 'Subjets' in gr and idx != 0 and 'Subjets' not in self.groomedJetsList[idx-1]:
                AddBTaggingInfoFromSubjets(MyGroomedJetD3PDObject, 
                                           sj_assoc_name = gr, 
                                           sj_prefix = gr, 
                                           level = 99)
                AddAssocJetsIndex(MyGroomedJetD3PDObject, 
                                  gr, 
                                  'jet_' + self.parentJets + gr + '_', 
                                  intermediate_names = ['Parent'], 
                                  level=99)             
            elif 'Subjets' in gr:
                raise ValueError("Subjets without full composite jet ?") ## not suppose to happen

        self.MyJetD3PDObject = MyJetD3PDObject
        self.MyGroomedJetD3PDObject = MyGroomedJetD3PDObject
        self.MyGroomedJetCollectionD3PDObject = MyGroomedJetCollectionD3PDObject
コード例 #15
0
#JetTagD3PDFlags.JFVxOnJetAxisAssocLabel = JetTagD3PDKeys.JFVxOnJetAxisGetterLabel()
#JetTagD3PDFlags.JFTwoTrackVertexAssocLabel = JetTagD3PDKeys.JFTwoTrackVertexGetterLabel()
TruthD3PDFlags.GenParticleAssocLabel = TruthD3PDKeys.GenParticleGetterLabel()
TruthD3PDFlags.GenVertexAssocLabel = ""
TruthD3PDFlags.GenEventAssocLabel = TruthD3PDKeys.GenEventGetterLabel()
TruthD3PDFlags.TruthTrackAssocLabel = ""
JetTagD3PDFlags.MSVVtxInfoAssocLabel = JetTagD3PDKeys.MSVVtxInfoInJetGetterLabel(
)

### configure jet tag flags
JetTagD3PDFlags.SkimD3PD = True
JetTagD3PDFlags.FilterMinNJets = 1
JetTagD3PDFlags.FilterMinNJetsMuon = 1
JetTagD3PDFlags.TrackPtCut = 250.
JetTagD3PDFlags.MCPtMinCut = 250.
JetTagD3PDFlags.Taggers = JetTagD3PDFlags.AllTaggers()
JetTagD3PDFlags.JetFitterFlipTwoTrackVertexAssoc = False
JetTagD3PDFlags.JetFitterFlipVxOnJetAxisAssoc = False
JetTagD3PDFlags.JetFitterVertexFinderInfo = False
JetTagD3PDFlags.JetVKalVxBadTrack = False
JetTagD3PDFlags.InfoBaseCalib = True
JetTagD3PDFlags.JetFitterTagFlipInfo = True

### 25-11-2010 all other flags are as default - no need to change them
JetTagD3PDFlags.AddVxOnJetAxisInJetsObject = False
JetTagD3PDFlags.AddTwoTrackVertexInJetsObject = False
JetTagD3PDFlags.METObjects = []
JetTagD3PDFlags.AddPixelClusterObject = False
JetTagD3PDFlags.AddTruthTrackObjects = False
JetTagD3PDFlags.AddGenVertexObjects = False
### remove muon hit summary
コード例 #16
0
def BTaggingD3PD(alg=None,
                 file=JetTagD3PDKeys.D3PDFileName(),
                 algname=JetTagD3PDKeys.D3PDAlgName(),
                 **kw):

    print "printing additional d3pd properties from dictionary"
    print kw

    if not alg:
        from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
        alg = MSMgr.NewRootStream(JetTagD3PDKeys.D3PDAlgName(),
                                  JetTagD3PDKeys.D3PDFileName(),
                                  JetTagD3PDKeys.D3PDTupleName())

    selectedJetCollections = []

    if len(JetTagD3PDFlags.JetCollections()) != 0:

        from JetTagD3PDMaker.JetTagJetD3PDObject import getJetTagJetD3PDObject
        for jetcoll in JetTagD3PDFlags.JetCollections():
            filteredcoll = jetcoll + JetTagD3PDKeys.FilteredJetCollectionPostfix(
            )
            ### you can add specific selection for a certain jet collection as argument to the function bellow
            ### otherwise the one specified by JetTagD3PDFlags will be used
            alg += getJetTagJetD3PDObject(**_args(
                jetcoll, kw, filteredsgkey=filteredcoll, origsgkey=jetcoll))
            selectedJetCollections.append(filteredcoll)
    else:
        print "Warning: you didn't specify any jet collection for the JetTag D3PD"

    if len(selectedJetCollections) != 0:

        ### add muon in jets object
        if JetTagD3PDFlags.AddMuonInJetsObject():
            from JetTagD3PDMaker.JetTagMuonInJetD3PDObject import getJetTagMuonInJetObject
            alg += getJetTagMuonInJetObject(
                **_args("muon1injet",
                        kw,
                        level=10,
                        jetCollections=selectedJetCollections))

            if JetTagD3PDFlags.AddSecondMuonCollection():
                alg += getJetTagMuonInJetObject(
                    **_args("muon2injet",
                            kw,
                            level=10,
                            jetCollections=selectedJetCollections,
                            prefix=JetTagD3PDKeys.Muon2InJetPrefix(),
                            object_name='JetTagMuon2InJetD3PDObject',
                            label=JetTagD3PDKeys.Muon2InJetGetterLabel(),
                            muonsName="SecondMuons"))

    ### add electron in jets object
        if JetTagD3PDFlags.AddElectronInJetsObject():
            from JetTagD3PDMaker.JetTagElectronInJetD3PDObject import getJetTagElectronInJetD3PDObject
            alg += getJetTagElectronInJetD3PDObject(
                **_args("electroninjet",
                        kw,
                        level=10,
                        jetCollections=selectedJetCollections))

    ### add photon in jets object
        if JetTagD3PDFlags.AddPhotonInJetsObject():
            from JetTagD3PDMaker.JetTagPhotonInJetD3PDObject import getJetTagPhotonInJetD3PDObject
            alg += getJetTagPhotonInJetD3PDObject(
                **_args("photoninjet",
                        kw,
                        level=10,
                        jetCollections=selectedJetCollections))

    ### add VxOnJetAxis object
        if JetTagD3PDFlags.AddVxOnJetAxisInJetsObject():
            from JetTagD3PDMaker.JetTagVxOnJetAxisD3PDObject import getJetTagVxOnJetAxisD3PDObject
            alg += getJetTagVxOnJetAxisD3PDObject(
                **_args("vxonjetaxis",
                        kw,
                        level=0,
                        jetCollections=selectedJetCollections))

    ### add TwoTrackVertex object
        if JetTagD3PDFlags.AddTwoTrackVertexInJetsObject():
            from JetTagD3PDMaker.JetTagTwoTrackVertexD3PDObject import getJetTagTwoTrackVertexD3PDObject
            alg += getJetTagTwoTrackVertexD3PDObject(
                **_args("twotrackvertex",
                        kw,
                        level=0,
                        jetCollections=selectedJetCollections))

    ### add MSVVtxInfo object
        if JetTagD3PDFlags.AddMSVVtxInfoInJetsObject():
            from JetTagD3PDMaker.JetTagMSVVtxInJetD3PDObject import getJetTagMSVVtxInfoInJetD3PDObject
            alg += getJetTagMSVVtxInfoInJetD3PDObject(
                **_args("msvvtxinfo",
                        kw,
                        level=1,
                        jetCollections=selectedJetCollections))

### add event info object
    if JetTagD3PDFlags.AddEventInfoObject():
        from JetTagD3PDMaker.JetTagEventInfoD3PDObject import getJetTagEventInfoD3PDObject
        alg += getJetTagEventInfoD3PDObject(**_args("eventinfo", kw, level=1))

### add pileup event info object
    if rec.doTruth and JetTagD3PDFlags.AddPileUpEventInfoObject():
        from TruthD3PDMaker.PileUpInfoD3PDObject import PileUpInfoD3PDObject
        alg += PileUpInfoD3PDObject(0,
                                    "pileupinfo",
                                    "pileupinfo_",
                                    allowMissing=True)

### add track object
    if JetTagD3PDFlags.AddTrackObject():
        from JetTagD3PDMaker.JetTagTrackD3PDObject import getJetTagTrackD3PDObject
        alg += getJetTagTrackD3PDObject(**_args("track", kw))

### add MET objects
    for MET in JetTagD3PDFlags.METObjects():
        from JetTagD3PDMaker.JetTagMETD3PDObject import getJetTagMETD3PDObject
        alg += getJetTagMETD3PDObject(**_args(MET, kw, sgkey=MET))

### add event shape objects
    from QcdD3PDMaker.QcdEventShapeD3PDObject import EventShapeD3PDObject
    alg += EventShapeD3PDObject(level=0)

    ### add pixel clusters object
    if JetTagD3PDFlags.AddPixelClusterObject():
        from JetTagD3PDMaker.JetTagClustersD3PDObject import getJetTagClusterD3PDObject
        alg += getJetTagClusterD3PDObject(**_args("pixelcluster", kw, level=0))

### add primary vertex object
    if JetTagD3PDFlags.AddPrimaryVertexObject():
        from JetTagD3PDMaker.JetTagPrimaryVertexD3PDObject import getJetTagPrimaryVertexD3PDObject
        alg += getJetTagPrimaryVertexD3PDObject(**_args("pv", kw))

### add beam spot object
    if JetTagD3PDFlags.AddBeamSpotObject():
        from TrackD3PDMaker.BeamSpotD3PDObject import BeamSpotD3PDObject
        alg += BeamSpotD3PDObject(10)

### add muid object
    if JetTagD3PDFlags.AddMuonMuidObject():
        from MuonD3PDMaker.MuonD3PDObject import MuonD3PDObject
        _modifyMuonObject(MuonD3PDObject)
        alg += MuonD3PDObject(**_args(
            'MuonMuid',
            kw,
            level=10,
            sgkey='MuidMuonCollection',
            prefix='mu_muid_',
            allowMissing=True,
            exclude=["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
            include=[
                "BtagMuonTrackMatchingBlock", "EFCBInfoIndex", "EFMGInfoIndex",
                "EFMEInfoIndex", "L2CBInfoIndex", "L1InfoIndex"
            ]))

    if JetTagD3PDFlags.AddMuonStacoObject():
        from MuonD3PDMaker.MuonD3PDObject import MuonD3PDObject
        _modifyMuonObject(MuonD3PDObject)
        alg += MuonD3PDObject(**_args(
            'MuonStaco',
            kw,
            level=10,
            sgkey='StacoMuonCollection',
            prefix='mu_staco_',
            allowMissing=True,
            exclude=["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
            include=[
                "BtagMuonTrackMatchingBlock", "EFCBInfoIndex", "EFMGInfoIndex",
                "EFMEInfoIndex", "L2CBInfoIndex", "L1InfoIndex"
            ]))

### add truth info with a filter

    if rec.doTruth and JetTagD3PDFlags.AddGenObjects():

        from AthenaCommon.AppMgr import ToolSvc
        from TruthD3PDAnalysis.TruthD3PDAnalysisConf import D3PD__GenObjectsFilterTool
        jetTagGenObjectsFilterTool = D3PD__GenObjectsFilterTool(
            "JetTagGenObjectsFilterTool")
        ToolSvc += jetTagGenObjectsFilterTool

        jetTagGenObjectsFilterTool.SelectTruthTracks = False
        jetTagGenObjectsFilterTool.PtMin = JetTagD3PDFlags.MCPtMinCut()
        jetTagGenObjectsFilterTool.EtaMax = JetTagD3PDFlags.MCEtaCut()
        jetTagGenObjectsFilterTool.RemoveEmptyEvents = not JetTagD3PDFlags.MCEmptyEvents(
        )
        jetTagGenObjectsFilterTool.RemoveDummyEvents = not JetTagD3PDFlags.MCDummyEvents(
        )

        if not JetTagD3PDFlags.MCPileUp():
            jetTagGenObjectsFilterTool.RemoveInTimePileUp = True
            jetTagGenObjectsFilterTool.Remove2BCPileUp = True
            jetTagGenObjectsFilterTool.Remove800nsPileUp = True
            jetTagGenObjectsFilterTool.RemoveCavernBkg = True
            jetTagGenObjectsFilterTool.RemoveEmptyEvents = True
            jetTagGenObjectsFilterTool.RemoveDummyEvents = True

        if JetTagD3PDFlags.AddGenEventObjects():
            from TruthD3PDMaker.GenEventD3PDObject import GenEventD3PDObject
            alg += GenEventD3PDObject(**_args("genevent", kw, level=10,
                                              filter = jetTagGenObjectsFilterTool,
                                              pileup_CollectionGetterRegistry=\
                                                  alg.name()+'_CollectionGetterRegistry'
                                              )
                                        )

        if JetTagD3PDFlags.AddGenVertexObjects():
            from TruthD3PDMaker.GenVertexD3PDObject import GenVertexD3PDObject
            alg += GenVertexD3PDObject(**_args(
                "genvertex", kw, level=10, filter=jetTagGenObjectsFilterTool))

        if JetTagD3PDFlags.AddGenParticleObjects():
            from TruthD3PDMaker.GenParticleD3PDObject import GenParticleD3PDObject
            alg += GenParticleD3PDObject(**_args(
                "genparticle", kw, level=10,
                filter=jetTagGenObjectsFilterTool))

        if JetTagD3PDFlags.AddTruthTrackObjects():
            jetTagTruthTrackObjectsFilterTool = D3PD__GenObjectsFilterTool(
                "JetTagTruthTrackObjectsFilterTool")
            ToolSvc += jetTagTruthTrackObjectsFilterTool

            jetTagTruthTrackObjectsFilterTool.SelectTruthTracks = True

            jetTagTruthTrackObjectsFilterTool.PtMin = JetTagD3PDFlags.MCPtMinCut(
            )
            jetTagTruthTrackObjectsFilterTool.EtaMax = JetTagD3PDFlags.MCEtaCut(
            )
            jetTagTruthTrackObjectsFilterTool.RemoveEmptyEvents = not JetTagD3PDFlags.MCEmptyEvents(
            )
            jetTagTruthTrackObjectsFilterTool.RemoveDummyEvents = not JetTagD3PDFlags.MCDummyEvents(
            )

            if not JetTagD3PDFlags.MCPileUp():
                jetTagTruthTrackObjectsFilterTool.RemoveInTimePileUp = True
                jetTagTruthTrackObjectsFilterTool.Remove2BCPileUp = True
                jetTagTruthTrackObjectsFilterTool.Remove800nsPileUp = True
                jetTagTruthTrackObjectsFilterTool.RemoveCavernBkg = True
                jetTagTruthTrackObjectsFilterTool.RemoveEmptyEvents = True
                jetTagTruthTrackObjectsFilterTool.RemoveDummyEvents = True

            from TruthD3PDMaker.GenParticleD3PDObject import GenTruthTrackD3PDObject
            alg += GenTruthTrackD3PDObject(
                **_args("truthtrack",
                        kw,
                        level=10,
                        filter=jetTagTruthTrackObjectsFilterTool))

### add trigger
    if JetTagD3PDFlags.AddTriggerObject():
        from TriggerD3PDMaker.TrigDecisionD3PDObject import TrigDecisionD3PDObject
        alg += TrigDecisionD3PDObject(**_args("trigdecision", kw, level=2))
        from TriggerD3PDMaker.TrigConfMetadata import addTrigConfMetadata
        addTrigConfMetadata(alg)

        if JetTagD3PDFlags.AddTriggerBits():
            from JetTagD3PDMaker.JetTagTriggerBitsD3PDObject import getJetTagTriggerBitsD3PDObject
            alg += getJetTagTriggerBitsD3PDObject(
                JetTagD3PDFlags.TriggerBitsList())

        if JetTagD3PDFlags.AddJetTriggerObject():
            from TrigJetD3PDMaker.TrigJetD3PD import TrigJetD3PDObjects
            TrigJetD3PDObjects(alg,
                               level=10,
                               addNaviInfo=True,
                               addConfigInfo=False)

        if JetTagD3PDFlags.AddBJetTriggerObject():

            from TrigBJetD3PDMaker.TrigBJetD3PD import TrigBJetD3PDObjects
            bjettriglevel = 1
            if JetTagD3PDFlags.AddTrigL2IDTracks(
            ) or JetTagD3PDFlags.AddTrigEFIDTracks():
                bjettriglevel = 11
            TrigBJetD3PDObjects(alg,
                                level=bjettriglevel,
                                doAddL2ID=JetTagD3PDFlags.AddTrigL2IDTracks(),
                                doAddEFID=JetTagD3PDFlags.AddTrigEFIDTracks())

    if JetTagD3PDFlags.AddPixCond():
        if hasattr(ServiceMgr, "PixelConditionsSummarySvc"):
            from JetTagD3PDMaker.JetTagPixModCondD3PDObject import getJetTagPixModCondD3PDObject
            alg += getJetTagPixModCondD3PDObject(
                PixSummarySvc=ServiceMgr.PixelConditionsSummarySvc)
        else:
            print "Warning: JetTagPixModCondD3PDObject requested but PixelConditionsSummarySvc not configured"

    #### add fat jets and subjets
    if JetTagD3PDFlags.AddFatJets():
        from JetTagD3PDMaker.JetTagJSD3PDObjects import JSD3PD_Tool
        for xx in JetTagD3PDKeys.FatJetsList():
            if xx[0] != None and xx[1] != None:
                jsD3PD = JSD3PD_Tool(xx)
                jsD3PD.addToAlg(alg)

### add skiming
    if JetTagD3PDFlags.SkimD3PD():

        __muonAssocObjects = ["Muons"]
        if JetTagD3PDFlags.AddSecondMuonCollection():
            __muonAssocObjects = ["Muons", "Muons2"]

        from JetTagD3PDMaker.JetTagD3PDMakerConf import D3PD__JetTagD3PDEventFilter
        JetTagD3PDEventFilter = D3PD__JetTagD3PDEventFilter(
            "JetTagD3PDEventFilter",
            UseMuonFilter=JetTagD3PDFlags.UseMuonEventFilter(),
            UseJetFilter=JetTagD3PDFlags.UseJetEventFilter(),
            JetCollections=selectedJetCollections,
            JetPtCut=JetTagD3PDFlags.FilterJetPtCut(),
            JetEtaCut=JetTagD3PDFlags.FilterJetEtaCut(),
            JetWithMuonPtCut=JetTagD3PDFlags.FilterJetWithMuonPtCut(),
            SoftMuonPtCut=JetTagD3PDFlags.FilterMuonInJetPtCut(),
            MinNumberOfJets=JetTagD3PDFlags.FilterMinNJets(),
            MinNumberOfJetsWithMuon=JetTagD3PDFlags.FilterMinNJetsMuon(),
            MuonAssocObjects=__muonAssocObjects,
            MuonCollections=JetTagD3PDFlags.FilterMuonCollections(),
            MuonPtCut=JetTagD3PDFlags.FilterMuonPtCut(),
            MuonEtaCut=JetTagD3PDFlags.FilterMuonEtaCut(),
            MuonIsTightCut=JetTagD3PDFlags.FilterMuonTightCut(),
            MinNumberOfMuons=JetTagD3PDFlags.FilterMinNumberOfMuons())

        alg.filterSeq += JetTagD3PDEventFilter

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

    return alg
コード例 #17
0
def getJetTagJetD3PDObject(filteredsgkey,
                           origsgkey,
                           level=4,
                           prefix=None,
                           exclude=[
                               'TrueFlavorComponents', 'BTagComponents',
                               'BTagDefault', 'BTag'
                           ],
                           **kw):

    if prefix == None:
        import re
        prefix = re.sub('Jets', '', origsgkey)
        prefix = re.sub('AOD', '', prefix)
        prefix = re.sub('ReTagged', '', prefix)
        prefix = re.sub('MuonNonInteracting', 'MNI', prefix)
        prefix = prefix.lower()
        prefix = "jet_" + prefix + "_"

    if JetTagD3PDFlags.TrackAssocLabel() != "":
        kw = _updateDict(JetTagD3PDKeys.JetTrackAssocBlockName(),
                         JetTagD3PDFlags.TrackAssocLabel(), kw)
        kw = _updateDict(JetTagD3PDKeys.IPInfoPlusTrackAssocBlockName(),
                         JetTagD3PDFlags.TrackAssocLabel(), kw)
        kw = _updateDict(JetTagD3PDKeys.SVInfoPlusTrackAssocBlockName(),
                         JetTagD3PDFlags.TrackAssocLabel(), kw)
        kw = _updateDict(JetTagD3PDKeys.SV0InfoPlusTrackAssocBlockName(),
                         JetTagD3PDFlags.TrackAssocLabel(), kw)

    if JetTagD3PDFlags.MuonAssocLabel() != "":
        kw = _updateDict(JetTagD3PDKeys.JetMuonAssocBlockName(),
                         JetTagD3PDFlags.MuonAssocLabel(), kw)
        kw = _updateDict(JetTagD3PDKeys.SoftMuonInfoMuonAssocBlockName(),
                         JetTagD3PDFlags.MuonAssocLabel(), kw)
        kw = _updateDict(JetTagD3PDKeys.SoftMuonChi2InfoMuonAssocBlockName(),
                         JetTagD3PDFlags.MuonAssocLabel(), kw)

    if JetTagD3PDFlags.Muon2AssocLabel() != "":
        kw = _updateDict(JetTagD3PDKeys.JetMuon2AssocBlockName(),
                         JetTagD3PDFlags.Muon2AssocLabel(), kw)
        kw = _updateDict(JetTagD3PDKeys.SoftMuon2InfoMuon2AssocBlockName(),
                         JetTagD3PDFlags.Muon2AssocLabel(), kw)
        kw = _updateDict(JetTagD3PDKeys.SoftMuon2Chi2InfoMuon2AssocBlockName(),
                         JetTagD3PDFlags.Muon2AssocLabel(), kw)

    if JetTagD3PDFlags.ElectronAssocLabel() != "":
        kw = _updateDict(JetTagD3PDKeys.JetElectronAssocBlockName(),
                         JetTagD3PDFlags.ElectronAssocLabel(), kw)
        kw = _updateDict(
            JetTagD3PDKeys.SoftElectronInfoElectronAssocBlockName(),
            JetTagD3PDFlags.ElectronAssocLabel(), kw)

    if JetTagD3PDFlags.PhotonAssocLabel() != "":
        kw = _updateDict(JetTagD3PDKeys.JetPhotonAssocBlockName(),
                         JetTagD3PDFlags.PhotonAssocLabel(), kw)

    if TruthD3PDFlags.GenParticleAssocLabel() != "":
        kw = _updateDict(JetTagD3PDKeys.JetGenSoftLeptonAssocBlockName(),
                         TruthD3PDFlags.GenParticleAssocLabel(), kw)

    if JetTagD3PDFlags.MSVVtxInfoAssocLabel() != "":
        kw = _updateDict(JetTagD3PDKeys.MultiSVInfoPlusMSVVtxAssocBlockName(),
                         JetTagD3PDFlags.MSVVtxInfoAssocLabel(), kw)

    return JetTagJetD3PDObject(level,
                               sgkey=filteredsgkey,
                               prefix=prefix,
                               label="JetTag_" + origsgkey,
                               exclude=exclude,
                               JetContainer=origsgkey,
                               **kw)
コード例 #18
0
def addBTagInfoToJetObject(JetD3PDObject,
                           btagLevelOffset=0,
                           LocalFlags=JetTagD3PDFlags):

    ## first check if the blocks are already added to the JetD3PDObject
    ## the weight block is always added so check for it
    from AthenaCommon.Logging import logging
    addBTagInfoLogger = logging.getLogger("addBTagInfoToJetObject")

    if JetD3PDObject.allBlocknames().has_key(
            JetTagD3PDKeys.BTagWeightsBlockName()):
        addBTagInfoLogger.warning(
            "btag blocks already added to JetD3PDObject - ignore")
        return

    addBTagInfoLogger.info("Adding btag blocks to JetD3PDObject")

    #
    ## now add the block fillers
    ## basic info weights and truth if available
    ## specify a list of taggers via LocalFlags.Taggers()
    #

    JetD3PDObject.defineBlock(btagLevelOffset + 0,
                              JetTagD3PDKeys.BTagWeightsBlockName(),
                              JetTagD3PDMaker.JetTagBTagWeightsFillerTool,
                              prefix=JetTagD3PDKeys.BTagWeightsPrefix(),
                              TaggerNames=LocalFlags.Taggers())

    if rec.doTruth:

        JetD3PDObject.defineBlock(btagLevelOffset + 0,
                                  JetTagD3PDKeys.TruthInfoBlockName(),
                                  JetTagD3PDMaker.JetTagTruthInfoFillerTool,
                                  prefix=JetTagD3PDKeys.TruthInfoPrefix(),
                                  InfoType="TruthInfo")

        if LocalFlags.QGInfo():
            JetD3PDObject.defineBlock(
                btagLevelOffset + 0,
                JetTagD3PDKeys.QGPartonTruthInfoBlockName(),
                JetTagD3PDMaker.JetTagQGPartonTruthInfoFillerTool,
                prefix=JetTagD3PDKeys.QGPartonTruthInfoPrefix(),
                InfoType="QGPartonTruthInfo")

        if LocalFlags.PileupLabeling():
            JetD3PDObject.defineBlock(
                btagLevelOffset + 0,
                JetTagD3PDKeys.PUTruthInfoBlockName(),
                JetTagD3PDMaker.JetTagTruthInfoFillerTool,
                prefix=JetTagD3PDKeys.PUTruthInfoPrefix(),
                InfoType="TruthInfoPU")

            if LocalFlags.QGInfo():
                JetD3PDObject.defineBlock(
                    btagLevelOffset + 0,
                    JetTagD3PDKeys.PUQGPartonTruthInfoBlockName(),
                    JetTagD3PDMaker.JetTagQGPartonTruthInfoFillerTool,
                    prefix=JetTagD3PDKeys.PUQGPartonTruthInfoPrefix(),
                    InfoType="QGPartonTruthInfoPU")
    #
    ##association to tracks, electron, muons, and photons
    ##if the getter labels are not specified no association is done
    ##can add contained information if needed
    #

    if LocalFlags.JetTrackAssoc():

        JetTrackAssoc = IndexMultiAssociation(
            JetD3PDObject,
            JetTagD3PDMaker.JetTagJetTrackAssociationTool,
            '',  ## set target when calling the JetD3PDObject
            level=_jetTagAssocLevel,
            prefix=JetTagD3PDKeys.JetTrackAssocPrefix(),
            blockname=JetTagD3PDKeys.JetTrackAssocBlockName(),
            FillVariables=False)

        JetTagD3PDTrackToVertexIPEstimator = None
        from AthenaCommon.AppMgr import ToolSvc
        if hasattr(ToolSvc, 'BTagTrackToVertexIPEstimator'):
            JetTagD3PDTrackToVertexIPEstimator = ToolSvc.BTagTrackToVertexIPEstimator
            print("JetTagD3PD Info: found BTagTrackToVertexIPEstimator")
        elif hasattr(ToolSvc, 'JetTagD3PDTrackToVertexIPEstimator'):
            print("JetTagD3PD Info: found JetTagD3PDTrackToVertexIPEstimator")
            JetTagD3PDTrackToVertexIPEstimator = ToolSvc.JetTagD3PDTrackToVertexIPEstimator
        else:
            print("JetTagD3PD Info: configure TrackToVertexIPEstimator")
            from TrkVertexFitterUtils.TrkVertexFitterUtilsConf import Trk__FullLinearizedTrackFactory
            extrap = AtlasExtrapolator()
            ToolSvc += extrap
            JetTagD3PDLinTrkFactory = Trk__FullLinearizedTrackFactory(
                name="JetTagD3PDFullLinearizedTrackFactory",
                Extrapolator=extrap)
            ToolSvc += JetTagD3PDLinTrkFactory
            from TrkVertexFitterUtils.TrkVertexFitterUtilsConf import Trk__TrackToVertexIPEstimator
            JetTagD3PDTrackToVertexIPEstimator = Trk__TrackToVertexIPEstimator(\
                name="JetTagD3PDTrackToVertexIPEstimator",
                Extrapolator=extrap,
                LinearizedTrackFactory=JetTagD3PDLinTrkFactory)
            ToolSvc += JetTagD3PDTrackToVertexIPEstimator

        JetTrack = ContainedVectorMultiAssociation(
            JetD3PDObject,
            JetTagD3PDMaker.JetTagJetTrackAssociationTool,
            level=btagLevelOffset + 4,
            prefix=JetTagD3PDKeys.JetTrackAssocPrefix(),
            blockname=JetTagD3PDKeys.JetTrackBlockName(),
            nrowName='',
            TrackToVertexIPEstimator=JetTagD3PDTrackToVertexIPEstimator,
            PrimaryVertexCollection=JetTagD3PDFlags.PrimaryVertexSGKey())

    if LocalFlags.JetTrackGhostAssoc():
        JetTrackAssoc = IndexMultiAssociation(
            JetD3PDObject,
            JetTagD3PDMaker.JetTagJetTrackAssociationTool,
            '',  ## set target when calling the JetD3PDObject
            level=_jetTagAssocLevel,
            prefix=JetTagD3PDKeys.JetTrackGhostAssocPrefix(),
            blockname=JetTagD3PDKeys.JetTrackGhostAssocBlockName(),
            FillVariables=False,
            TrackAssocName=LocalFlags.JetTrackGhostAssocName())

    if LocalFlags.JetBHadronGhostAssoc():
        JetBHadronAssoc = ContainedVectorMultiAssociation(\
            JetD3PDObject,
            JetTagD3PDMaker.JetTagJetNavigable4MomentumAssociationTool,
            JetTagD3PDKeys.JetBHadronGhostAssocPrefix(),
            level = 900,
            blockname=JetTagD3PDKeys.JetBHadronGhostAssocBlockName()+"tmp",
            Navigable4MomentumAssocName=LocalFlags.JetBHadronGhostAssocName())

        IndexAssociation(
            JetBHadronAssoc,
            TruthD3PDMaker.TruthParticleGenParticleAssociationTool,
            '',
            level=_jetTagAssocLevel,
            blockname=JetTagD3PDKeys.JetBHadronGhostAssocBlockName(),
            prefix="")

    if LocalFlags.JetTruthGhostAssoc():
        JetTruthAssoc = ContainedVectorMultiAssociation(
            JetD3PDObject,
            JetTagD3PDMaker.JetTagJetNavigable4MomentumAssociationTool,
            JetTagD3PDKeys.JetTruthGhostAssocPrefix(),
            level=900,
            blockname=JetTagD3PDKeys.JetTruthGhostAssocBlockName() + "tmp",
            Navigable4MomentumAssocName=LocalFlags.JetTruthGhostAssocName())

        IndexAssociation(
            JetTruthAssoc,
            TruthD3PDMaker.TruthParticleGenParticleAssociationTool,
            '',
            level=_jetTagAssocLevel,
            blockname=JetTagD3PDKeys.JetTruthGhostAssocBlockName(),
            prefix="")

    if LocalFlags.JetConstituantTruthAssoc():
        ConstitAssoc = ContainedVectorMultiAssociation \
            (JetD3PDObject,
             EventCommonD3PDMaker.NavigableConstituentAssociationTool,
             'constit_',
             nrowName = '',
             TypeName = 'TruthParticle',
             blockname= JetTagD3PDKeys.JetConstituantTruthAssocBlockName()+"tmp",
             level = 900 )

        IndexAssociation(
            ConstitAssoc,
            TruthD3PDMaker.TruthParticleGenParticleAssociationTool,
            '',
            level=_jetTagAssocLevel,
            blockname=JetTagD3PDKeys.JetConstituantTruthAssocBlockName(),
            prefix="mcpart_")

    if LocalFlags.JetMuonAssoc():

        JetMuonAssoc = IndexMultiAssociation(
            JetD3PDObject,
            JetTagD3PDMaker.JetTagJetMuonAssociationTool,
            '',  ## set target when calling the JetD3PDObject
            level=_jetTagAssocLevel,
            prefix=JetTagD3PDKeys.JetMuonAssocPrefix(),
            blockname=JetTagD3PDKeys.JetMuonAssocBlockName())

        if LocalFlags.AddSecondMuonCollection():

            JetMuon2Assoc = IndexMultiAssociation(
                JetD3PDObject,
                JetTagD3PDMaker.JetTagJetMuonAssociationTool,
                '',
                level=_jetTagAssocLevel,
                prefix=JetTagD3PDKeys.JetMuon2AssocPrefix(),
                blockname=JetTagD3PDKeys.JetMuon2AssocBlockName(),
                MuonsName="SecondMuons")

    if LocalFlags.JetElectronAssoc():

        JetElectronAssoc = IndexMultiAssociation(
            JetD3PDObject,
            JetTagD3PDMaker.JetTagJetElectronAssociationTool,
            '',
            level=_jetTagAssocLevel,
            prefix=JetTagD3PDKeys.JetElectronAssocPrefix(),
            blockname=JetTagD3PDKeys.JetElectronAssocBlockName())

    if LocalFlags.JetPhotonAssoc():

        JetPhotonAssoc = IndexMultiAssociation(
            JetD3PDObject,
            JetTagD3PDMaker.JetTagJetPhotonAssociationTool,
            '',
            level=_jetTagAssocLevel,
            prefix=JetTagD3PDKeys.JetPhotonAssocPrefix(),
            blockname=JetTagD3PDKeys.JetPhotonAssocBlockName())

    if rec.doTruth and LocalFlags.JetGenSoftLeptonAssoc():

        JetGenSoftLeptonAssoc = IndexMultiAssociation(\
            JetD3PDObject,
            JetTagD3PDMaker.JetTagJetGenSoftLeptonAssociationTool,
            '',
            level = _jetTagAssocLevel,
            prefix=JetTagD3PDKeys.JetGenSoftLeptonAssocPrefix(),
            blockname=JetTagD3PDKeys.JetGenSoftLeptonAssocBlockName(),
            MCCollections = D3PDMakerFlags.TruthSGKey(),
            FillVariables=False)



        JetGenSoftLepton = ContainedVectorMultiAssociation(\
            JetD3PDObject,
            JetTagD3PDMaker.JetTagJetGenSoftLeptonAssociationTool,
            level = btagLevelOffset+4,
            prefix=JetTagD3PDKeys.JetGenSoftLeptonAssocPrefix(),
            blockname=JetTagD3PDKeys.JetGenSoftLeptonBlockName(),
            nrowName = '',
            MCCollections = D3PDMakerFlags.TruthSGKey())

        JetGenSoftLepton.defineBlock(
            btagLevelOffset + 20,
            JetTagD3PDKeys.JetGenSoftLeptonPropBlockName(),
            EventCommonD3PDMaker.GenParticleFillerTool)

    #
    ## info base for each tagger: basicaly B/U/C probabilities
    #

    if LocalFlags.InfoBase():

        JetD3PDObject.defineBlock(btagLevelOffset + 1,
                                  JetTagD3PDKeys.IP2DInfoBaseBlockName(),
                                  JetTagD3PDMaker.JetTagInfoBaseFillerTool,
                                  prefix=JetTagD3PDKeys.IP2DInfoBasePrefix(),
                                  InfoType="IP2D",
                                  AddPC=True)

        JetD3PDObject.defineBlock(btagLevelOffset + 1,
                                  JetTagD3PDKeys.IP2DIPInfoBaseBlockName(),
                                  JetTagD3PDMaker.JetTagIPInfoBaseFillerTool,
                                  prefix=JetTagD3PDKeys.IP2DInfoBasePrefix(),
                                  InfoType="IP2D")

        JetD3PDObject.defineBlock(btagLevelOffset + 1,
                                  JetTagD3PDKeys.IP3DInfoBaseBlockName(),
                                  JetTagD3PDMaker.JetTagInfoBaseFillerTool,
                                  prefix=JetTagD3PDKeys.IP3DInfoBasePrefix(),
                                  InfoType="IP3D",
                                  AddPC=True)

        JetD3PDObject.defineBlock(btagLevelOffset + 1,
                                  JetTagD3PDKeys.IP3DIPInfoBaseBlockName(),
                                  JetTagD3PDMaker.JetTagIPInfoBaseFillerTool,
                                  prefix=JetTagD3PDKeys.IP3DInfoBasePrefix(),
                                  InfoType="IP3D")

        JetD3PDObject.defineBlock(
            btagLevelOffset + 1,
            JetTagD3PDKeys.JetProbInfoBaseBlockName(),
            JetTagD3PDMaker.JetTagJetProbInfoBaseFillerTool,
            prefix=JetTagD3PDKeys.JetProbInfoBasePrefix(),
            InfoType="JetProb",
            # This may be missing in 17.2 samples.
            AllowMissing=at_least_version('17.2.0'))

        JetD3PDObject.defineBlock(btagLevelOffset + 1,
                                  JetTagD3PDKeys.SV1InfoBaseBlockName(),
                                  JetTagD3PDMaker.JetTagInfoBaseFillerTool,
                                  prefix=JetTagD3PDKeys.SV1InfoBasePrefix(),
                                  InfoType="SV1",
                                  AddPC=True)

        JetD3PDObject.defineBlock(btagLevelOffset + 1,
                                  JetTagD3PDKeys.SV2InfoBaseBlockName(),
                                  JetTagD3PDMaker.JetTagInfoBaseFillerTool,
                                  prefix=JetTagD3PDKeys.SV2InfoBasePrefix(),
                                  InfoType="SV2")

        JetD3PDObject.defineBlock(
            btagLevelOffset + 0,
            JetTagD3PDKeys.JetFitterInfoBaseBlockName(),
            JetTagD3PDMaker.JetTagInfoBaseFillerTool,
            prefix=JetTagD3PDKeys.JetFitterTagInfoPrefix(),
            InfoType="JetFitterTagNN,JetFitterTag",
            AddPC=True)

        JetD3PDObject.defineBlock(
            btagLevelOffset + 0,
            JetTagD3PDKeys.JetFitterCombInfoBaseBlockName(),
            JetTagD3PDMaker.JetTagInfoBaseFillerTool,
            prefix=JetTagD3PDKeys.JetFitterCombInfoBasePrefix(),
            InfoType="JetFitterCOMBNN,JetFitterCOMB",
            AddPC=True)

        if LocalFlags.GbbNNInfo():
            JetD3PDObject.defineBlock(
                btagLevelOffset + 1,
                JetTagD3PDKeys.GbbNNInfoBlockName(),
                JetTagD3PDMaker.JetTagGbbNNInfoFillerTool,
                prefix=JetTagD3PDKeys.GbbNNInfoPrefix(),
                InfoType="GbbNN")

        if LocalFlags.NewGbbNNInfo():
            JetD3PDObject.defineBlock(
                btagLevelOffset + 1,
                JetTagD3PDKeys.NewGbbNNInfoBlockName(),
                JetTagD3PDMaker.JetTagHadFlavorTagInfoFillerTool,
                prefix=JetTagD3PDKeys.NewGbbNNInfoPrefix(),
                InfoType="NewGbbNN")

        if LocalFlags.QGInfo():
            JetD3PDObject.defineBlock(
                btagLevelOffset + 1,
                JetTagD3PDKeys.QGInfoBlockName(),
                JetTagD3PDMaker.JetTagHadFlavorTagInfoFillerTool,
                prefix=JetTagD3PDKeys.QGInfoPrefix(),
                InfoType="QG")

        if LocalFlags.InfoBaseCalib():

            JetD3PDObject.defineBlock(
                btagLevelOffset + 3,
                JetTagD3PDKeys.JetFitterFlipInfoBaseBlockName(),
                JetTagD3PDMaker.JetTagInfoBaseFillerTool,
                prefix=JetTagD3PDKeys.JetFitterTagFlipInfoPrefix(),
                InfoType="JetFitterTagNNFlip,JetFitterTagFlip",
                AddPC=True)

            JetD3PDObject.defineBlock(
                btagLevelOffset + 3,
                JetTagD3PDKeys.JetFitterCombIP3DPosInfoBaseBlockName(),
                JetTagD3PDMaker.JetTagInfoBaseFillerTool,
                prefix=JetTagD3PDKeys.JetFitterCombIP3DPosInfoBasePrefix(),
                InfoType="JetFitterCOMBNNIP3DPos,JetFitterCOMBIP3DPos",
                AddPC=True)

            JetD3PDObject.defineBlock(
                btagLevelOffset + 3,
                JetTagD3PDKeys.JetFitterCombIP3DNegInfoBaseBlockName(),
                JetTagD3PDMaker.JetTagInfoBaseFillerTool,
                prefix=JetTagD3PDKeys.JetFitterCombIP3DNegInfoBasePrefix(),
                InfoType="JetFitterCOMBNNIP3DNeg,JetFitterCOMBIP3DNeg",
                AddPC=True)

    # if LocalFlags.InfoBaseGaia():

    #     JetD3PDObject.defineBlock(
    #         btagLevelOffset+1, "JetTag_Gaia",
    #         JetTagD3PDMaker.JetTagInfoBaseFillerTool,
    #         prefix="flavor_component_gaia_",
    #         InfoType="Gaia",
    #         AddPC=True,
    #         AddPTau=False)

    #     JetD3PDObject.defineBlock(
    #         btagLevelOffset+1, "JetTag_GaiaNeg",
    #         JetTagD3PDMaker.JetTagInfoBaseFillerTool,
    #         prefix="flavor_component_gaianeg_",
    #         InfoType="GaiaNeg",
    #         AddPC=True,
    #         AddPTau=False)

    #     # TODO: this should get its own block
    #     JetD3PDObject.defineBlock(
    #         btagLevelOffset+1, "JetTag_IPFordG", # also needs a rename
    #         JetTagD3PDMaker.JetTagInfoBaseFillerTool,
    #         prefix="flavor_component_ip3dloose_",
    #         InfoType="IPFordG", # also needs to be changed in JetTagTools
    #         AddPC=True)

    ## some additional info for jet fitter
    #

    if LocalFlags.JetFitterTagInfo():

        JetD3PDObject.defineBlock(
            btagLevelOffset + 2,
            JetTagD3PDKeys.JetFitterTagInfoBlockName(),
            JetTagD3PDMaker.JetTagJetFitterTagInfoFillerTool,
            prefix=JetTagD3PDKeys.JetFitterTagInfoPrefix(),
            InfoType="JetFitterTagNN,JetFitterTag")

        if LocalFlags.JetFitterTagFlipInfo():

            JetD3PDObject.defineBlock(
                btagLevelOffset + 2,
                JetTagD3PDKeys.JetFitterTagFlipInfoBlockName(),
                JetTagD3PDMaker.JetTagJetFitterTagInfoFillerTool,
                prefix=JetTagD3PDKeys.JetFitterTagFlipInfoPrefix(),
                InfoType="JetFitterTagNNFlip,JetFitterTagFlip")

    if LocalFlags.JetFitterCharmTagInfo():

        JetD3PDObject.defineBlock(
            btagLevelOffset + 2,
            JetTagD3PDKeys.JetFitterCharmTagInfoBlockName(),
            JetTagD3PDMaker.JetTagJetFitterGenericTagInfoFillerTool,
            prefix=JetTagD3PDKeys.JetFitterCharmTagInfoPrefix(),
            InfoType="JetFitterCharm")

        JetD3PDObject.defineBlock(
            btagLevelOffset + 0,
            JetTagD3PDKeys.JetFitterCharmInfoBaseBlockName(),
            JetTagD3PDMaker.JetTagInfoBaseFillerTool,
            prefix=JetTagD3PDKeys.JetFitterCharmTagInfoPrefix(),
            InfoType="JetFitterCharm",
            AddPC=True)

        if LocalFlags.InfoBaseCalib():
            JetD3PDObject.defineBlock(
                btagLevelOffset + 0,
                JetTagD3PDKeys.JetFitterCharmInfoBaseBlockName() + "NEG",
                JetTagD3PDMaker.JetTagInfoBaseFillerTool,
                prefix="flavor_component_jfitcneg_",
                InfoType="JetFitterCharmNeg",
                AddPC=True)

    #
    ## track information used for IP taggers
    #

    if LocalFlags.IPInfoPlus():

        IPInfoPlusTrackAssoc = IndexMultiAssociation(
            JetD3PDObject,
            JetTagD3PDMaker.JetTagIPInfoPlusTrackAssociationTool,
            '',
            level=_jetTagAssocLevel,
            prefix=JetTagD3PDKeys.IPInfoPlusTrackAssocPrefix(),
            blockname=JetTagD3PDKeys.IPInfoPlusTrackAssocBlockName(),
            FillVariables=False,
            AllowMissing=True)

        IPInfoPlusTrack = ContainedVectorMultiAssociation(
            JetD3PDObject,
            JetTagD3PDMaker.JetTagIPInfoPlusTrackAssociationTool,
            level=btagLevelOffset + 2,
            prefix=JetTagD3PDKeys.IPInfoPlusTrackAssocPrefix(),
            blockname=JetTagD3PDKeys.IPInfoPlusTrackBlockName(),
            nrowName='',
            AllowMissing=True)

        IPInfoPlusTrack.defineBlock(btagLevelOffset + 20,
                                    JetTagD3PDKeys.IPInfoPlusTrkP4BlockName(),
                                    EventCommonD3PDMaker.FourMomFillerTool,
                                    prefix="",
                                    WriteM=False)

    #
    ## vertex information used for SV1/SV2 taggers
    #

    if LocalFlags.SVInfoPlus():
        JetD3PDObject.defineBlock(btagLevelOffset + 2,
                                  JetTagD3PDKeys.SVInfoPlusBlockName(),
                                  JetTagD3PDMaker.JetTagSVInfoPlusFillerTool,
                                  prefix=JetTagD3PDKeys.SVInfoPlusPrefix(),
                                  InfoType="SVInfoPlus",
                                  AllowMissing=True,
                                  AddNormDist=True)

        SVInfoPlusTrackAssoc = IndexMultiAssociation(
            JetD3PDObject,
            JetTagD3PDMaker.JetTagSVInfoPlusTrackAssociationTool,
            '',
            level=_jetTagAssocLevel,
            prefix=JetTagD3PDKeys.SVInfoPlusTrackAssocPrefix(),
            blockname=JetTagD3PDKeys.SVInfoPlusTrackAssocBlockName(),
            AllowMissing=True)

        SVInfoPlusTrack = ContainedVectorMultiAssociation(
            JetD3PDObject,
            JetTagD3PDMaker.JetTagSVInfoPlusTrackAssociationTool,
            level=btagLevelOffset + 20,
            prefix=JetTagD3PDKeys.SVInfoPlusTrackAssocPrefix(),
            blockname=JetTagD3PDKeys.SVInfoPlusTrackBlockName(),
            nrowName='',
            AllowMissing=True)

        SVInfoPlusTrack.defineBlock(btagLevelOffset + 20,
                                    JetTagD3PDKeys.SVInfoPlusTrkP4BlockName(),
                                    EventCommonD3PDMaker.FourMomFillerTool,
                                    prefix='',
                                    WriteM=False)

    #
    ## vertex information used for the SV0 tagger
    #

    if LocalFlags.SV0InfoPlus():

        JetD3PDObject.defineBlock(btagLevelOffset + 2,
                                  JetTagD3PDKeys.SV0InfoPlusBlockName(),
                                  JetTagD3PDMaker.JetTagSVInfoPlusFillerTool,
                                  prefix=JetTagD3PDKeys.SV0InfoPlusPrefix(),
                                  InfoType="SV0InfoPlus",
                                  AllowMissing=True)

        SV0InfoPlusTrackAssoc = IndexMultiAssociation(
            JetD3PDObject,
            JetTagD3PDMaker.JetTagSVInfoPlusTrackAssociationTool,
            '',
            level=_jetTagAssocLevel,
            prefix=JetTagD3PDKeys.SV0InfoPlusTrackAssocPrefix(),
            blockname=JetTagD3PDKeys.SV0InfoPlusTrackAssocBlockName(),
            InfoType="SV0InfoPlus",
            AllowMissing=True)

        SV0InfoPlusTrack = ContainedVectorMultiAssociation(
            JetD3PDObject,
            JetTagD3PDMaker.JetTagSVInfoPlusTrackAssociationTool,
            level=btagLevelOffset + 20,
            prefix=JetTagD3PDKeys.SV0InfoPlusTrackAssocPrefix(),
            blockname=JetTagD3PDKeys.SV0InfoPlusTrackBlockName(),
            nrowName='',
            InfoType="SV0InfoPlus",
            AllowMissing=True)

        SV0InfoPlusTrack.defineBlock(
            btagLevelOffset + 20,
            JetTagD3PDKeys.SV0InfoPlusTrkP4BlockName(),
            EventCommonD3PDMaker.FourMomFillerTool,
            prefix='',
            WriteM=False)

    #
    ## muon information used for the soft muon tagger
    #

    if LocalFlags.SoftMuonInfo():

        SoftMuonInfoMuonAssoc = IndexMultiAssociation(
            JetD3PDObject,
            JetTagD3PDMaker.JetTagSoftMuonInfoMuonAssociationTool,
            '',
            level=_jetTagAssocLevel,
            prefix=JetTagD3PDKeys.SoftMuonInfoMuonAssocPrefix(),
            blockname=JetTagD3PDKeys.SoftMuonInfoMuonAssocBlockName(),
            FillVariables=False,
            AllowMissing=True)

        SoftMuonInfoMuon = ContainedVectorMultiAssociation(
            JetD3PDObject,
            JetTagD3PDMaker.JetTagSoftMuonInfoMuonAssociationTool,
            level=btagLevelOffset + 2,
            prefix=JetTagD3PDKeys.SoftMuonInfoMuonAssocPrefix(),
            blockname=JetTagD3PDKeys.SoftMuonInfoMuonBlockName(),
            nrowName='',
            AllowMissing=True)

        leveloffset = 20
        if LocalFlags.AddInlineSoftMuonProperties():
            leveloffset = -btagLevelOffset

        SoftMuonInfoMuon.defineBlock(btagLevelOffset + leveloffset,
                                     JetTagD3PDKeys.SoftMuonInfoP4BlockName(),
                                     EventCommonD3PDMaker.FourMomFillerTool,
                                     prefix='',
                                     WriteM=False,
                                     WriteE=True)

        SoftMuonInfoMuon.defineBlock(
            btagLevelOffset + leveloffset,
            JetTagD3PDKeys.SoftMuonInfoChargeBlockName(),
            EventCommonD3PDMaker.ChargeFillerTool)
        SoftMuonInfoMuon.defineBlock(
            btagLevelOffset + leveloffset,
            JetTagD3PDKeys.SoftMuonInfoAuthorBlockName(),
            MuonD3PDMaker.MuonAuthorFillerTool)
        SoftMuonInfoMuon.defineBlock(
            btagLevelOffset + leveloffset,
            JetTagD3PDKeys.SoftMuonInfomatchChi2BlockName(),
            MuonD3PDMaker.MuonMatchQualityFillerTool)
        SoftMuonInfoMuon.defineBlock(
            btagLevelOffset + leveloffset,
            JetTagD3PDKeys.SoftMuonInfoAcceptBlockName(),
            MuonD3PDMaker.MuonAcceptMethodFillerTool)
        SoftMuonInfoMuon.defineBlock(
            btagLevelOffset + leveloffset,
            JetTagD3PDKeys.SoftMuonInfoELossBlockName(),
            MuonD3PDMaker.MuonELossFillerTool)
        SoftMuonInfoMuon.defineBlock(
            btagLevelOffset + leveloffset,
            JetTagD3PDKeys.SoftMuonInfoHitsBlockName(),
            MuonD3PDMaker.MuonTrkHitFillerTool,
            SaveIDMuonHitSummary=False)

        if LocalFlags.AddSecondMuonCollection():

            SoftMuon2InfoMuon2Assoc =  IndexMultiAssociation(\
                JetD3PDObject,
                JetTagD3PDMaker.JetTagSoftMuonInfoMuonAssociationTool,
                '',
                level = _jetTagAssocLevel,
                prefix=JetTagD3PDKeys.SoftMuon2InfoMuon2AssocPrefix(),
                blockname=JetTagD3PDKeys.SoftMuon2InfoMuon2AssocBlockName(),
                InfoType="SecondSoftMuonTag",
                FillVariables=False,
                AllowMissing = True)

            SoftMuon2InfoMuon2 =  ContainedVectorMultiAssociation(\
                JetD3PDObject,
                JetTagD3PDMaker.JetTagSoftMuonInfoMuonAssociationTool,
                level = btagLevelOffset+3,
                prefix=JetTagD3PDKeys.SoftMuon2InfoMuon2AssocPrefix(),
                blockname=JetTagD3PDKeys.SoftMuon2InfoMuon2BlockName(),
                nrowName = '',
                InfoType="SecondSoftMuonTag",
                AllowMissing = True)

            SoftMuon2InfoMuon2.defineBlock(
                btagLevelOffset + 20,
                JetTagD3PDKeys.SoftMuon2InfoP4BlockName(),
                EventCommonD3PDMaker.FourMomFillerTool,
                prefix='',
                WriteM=False)

    #
    ## muon information used for soft muon chi2 tagger
    #

    if LocalFlags.SoftMuonChi2Info():

        SoftMuonChi2InfoMuonAssoc = IndexMultiAssociation(
            JetD3PDObject,
            JetTagD3PDMaker.JetTagSoftMuonInfoMuonAssociationTool,
            '',
            level=_jetTagAssocLevel,
            prefix=JetTagD3PDKeys.SoftMuonChi2InfoMuonAssocPrefix(),
            blockname=JetTagD3PDKeys.SoftMuonChi2InfoMuonAssocBlockName(),
            InfoType="SoftMuonTagChi2",
            FillVariables=False,
            AllowMissing=True)

        SoftMuonChi2InfoMuon = ContainedVectorMultiAssociation(
            JetD3PDObject,
            JetTagD3PDMaker.JetTagSoftMuonInfoMuonAssociationTool,
            level=btagLevelOffset + 2,
            prefix=JetTagD3PDKeys.SoftMuonChi2InfoMuonAssocPrefix(),
            blockname=JetTagD3PDKeys.SoftMuonChi2InfoMuonBlockName(),
            InfoType="SoftMuonTagChi2",
            nrowName='',
            AllowMissing=True)

        leveloffset = 20
        if LocalFlags.AddInlineSoftMuonChi2Properties():
            leveloffset = -btagLevelOffset

        SoftMuonChi2InfoMuon.defineBlock(
            btagLevelOffset + leveloffset,
            JetTagD3PDKeys.SoftMuonChi2InfoP4BlockName(),
            EventCommonD3PDMaker.FourMomFillerTool,
            prefix='',
            WriteM=False,
            WriteE=True)

        SoftMuonChi2InfoMuon.defineBlock(
            btagLevelOffset + leveloffset,
            JetTagD3PDKeys.SoftMuonChi2InfoChargeBlockName(),
            EventCommonD3PDMaker.ChargeFillerTool)
        SoftMuonChi2InfoMuon.defineBlock(
            btagLevelOffset + leveloffset,
            JetTagD3PDKeys.SoftMuonChi2InfoAuthorBlockName(),
            MuonD3PDMaker.MuonAuthorFillerTool)
        SoftMuonChi2InfoMuon.defineBlock(
            btagLevelOffset + leveloffset,
            JetTagD3PDKeys.SoftMuonChi2InfomatchChi2BlockName(),
            MuonD3PDMaker.MuonMatchQualityFillerTool)
        SoftMuonChi2InfoMuon.defineBlock(
            btagLevelOffset + leveloffset,
            JetTagD3PDKeys.SoftMuonChi2InfoAcceptBlockName(),
            MuonD3PDMaker.MuonAcceptMethodFillerTool)
        SoftMuonChi2InfoMuon.defineBlock(
            btagLevelOffset + leveloffset,
            JetTagD3PDKeys.SoftMuonChi2InfoELossBlockName(),
            MuonD3PDMaker.MuonELossFillerTool)
        SoftMuonChi2InfoMuon.defineBlock(
            btagLevelOffset + leveloffset,
            JetTagD3PDKeys.SoftMuonChi2InfoHitsBlockName(),
            MuonD3PDMaker.MuonTrkHitFillerTool,
            SaveIDMuonHitSummary=False)

        if LocalFlags.AddSecondMuonCollection():

            SoftMuon2Chi2InfoMuon2Assoc =  IndexMultiAssociation(\
                JetD3PDObject,
                JetTagD3PDMaker.JetTagSoftMuonInfoMuonAssociationTool,
                '',
                level = _jetTagAssocLevel,
                prefix=JetTagD3PDKeys.SoftMuon2Chi2InfoMuon2AssocPrefix(),
                blockname=JetTagD3PDKeys.SoftMuon2Chi2InfoMuon2AssocBlockName(),
                InfoType="SecondSoftMuonTagChi2",
                FillVariables=False,
                AllowMissing = True)

            SoftMuon2Chi2InfoMuon2 =  ContainedVectorMultiAssociation(\
                JetD3PDObject,
                JetTagD3PDMaker.JetTagSoftMuonInfoMuonAssociationTool,
                level = btagLevelOffset+3,
                prefix=JetTagD3PDKeys.SoftMuon2Chi2InfoMuon2AssocPrefix(),
                blockname=JetTagD3PDKeys.SoftMuon2Chi2InfoMuon2BlockName(),
                nrowName = '',
                InfoType="SecondSoftMuonTagChi2",
                AllowMissing = True)

            SoftMuon2Chi2InfoMuon2.defineBlock(
                btagLevelOffset + 20,
                JetTagD3PDKeys.SoftMuon2Chi2InfoP4BlockName(),
                EventCommonD3PDMaker.FourMomFillerTool,
                prefix='',
                WriteM=False)

    #
    ## electron information used for the soft electron tagger
    #

    if LocalFlags.SoftElectronInfo():

        SoftElectronInfoElectronAssoc =  IndexMultiAssociation(\
            JetD3PDObject,
            JetTagD3PDMaker.JetTagSoftElecInfoegammaAssociationTool,
            '',
            level = _jetTagAssocLevel,
            prefix=JetTagD3PDKeys.SoftElectronInfoElectronAssocPrefix(),
            blockname=JetTagD3PDKeys.SoftElectronInfoElectronAssocBlockName(),
            FillVariables=False,
            AllowMissing = True)


        SoftElectronInfoElectron =  ContainedVectorMultiAssociation(\
            JetD3PDObject,
            JetTagD3PDMaker.JetTagSoftElecInfoegammaAssociationTool,
            level = btagLevelOffset+2,
            prefix=JetTagD3PDKeys.SoftElectronInfoElectronAssocPrefix(),
            blockname=JetTagD3PDKeys.SoftElectronInfoElectronBlockName(),
            nrowName = '',
            AllowMissing = True)

        SoftElectronInfoElectron.defineBlock(\
            btagLevelOffset+20, JetTagD3PDKeys.SoftElectronInfoP4BlockName(),
            EventCommonD3PDMaker.FourMomFillerTool,
            prefix='',
            WriteM=False)

    if LocalFlags.MultiSVInfoPlus():

        JetD3PDObject.defineBlock(
            btagLevelOffset + 3,
            JetTagD3PDKeys.MultiSVInfoPlusBlockName(),
            JetTagD3PDMaker.JetTagMultiSVInfoPlusFillerTool,
            prefix=JetTagD3PDKeys.MultiSVInfoPlusPrefix(),
            InfoType="MultiSVInfoPlus",
            AllowMissing=True)


        MultiSVInfoPlusTrackAssoc = IndexMultiAssociation(\
            JetD3PDObject,
            JetTagD3PDMaker.JetTagMultiSVInfoMSVVtxInfoAssociationTool,
                '',
            level = _jetTagAssocLevel,
            prefix=JetTagD3PDKeys.MultiSVInfoPlusMSVVtxAssocPrefix(),
            blockname=JetTagD3PDKeys.MultiSVInfoPlusMSVVtxAssocBlockName(),
            AllowMissing = True)

#### from here keep the ifs for association labels. These are used only by btag.

#
## additional information about the VKal secondary vertex finder used for SV tagger
#

    if LocalFlags.JetVKalVxBadTrack():

        if LocalFlags.TrackAssocLabel() != "":

            JetVKalVxBadTrackAssoc = IndexMultiAssociation(\
                JetD3PDObject,
                JetTagD3PDMaker.JetTagVKalVxInJetBadTrackAssociationTool,
                LocalFlags.TrackAssocLabel(),
                level = btagLevelOffset+5,
                prefix=JetTagD3PDKeys.JetVKalVxBadTrackAssocPrefix(),
                blockname=JetTagD3PDKeys.JetVKalVxBadTrackAssocBlockName())

            if LocalFlags.AddContainedTrackP4():
                JetVKalVxBadTrackAssoc.defineBlock(
                    btagLevelOffset + 10,
                    JetTagD3PDKeys.SV0InfoPlusTrkP4BlockName(),
                    EventCommonD3PDMaker.FourMomFillerTool,
                    prefix='',
                    WriteM=False)

        else:
            JetVKalVxBadTrackAssoc = ContainedVectorMultiAssociation(\
                JetD3PDObject,
                JetTagD3PDMaker.JetTagVKalVxInJetBadTrackAssociationTool,
                level = btagLevelOffset+6,
                prefix=JetTagD3PDKeys.JetVKalVxBadTrackAssocPrefix(),
                blockname=JetTagD3PDKeys.JetVKalVxBadTrackAssocBlockName())

            JetVKalVxBadTrackAssoc.defineBlock(
                btagLevelOffset + 6,
                JetTagD3PDKeys.SV0InfoPlusTrkP4BlockName(),
                EventCommonD3PDMaker.FourMomFillerTool,
                prefix='',
                WriteM=False)

    #
    ## additional information about the vertex finding for JetFitter*
    ## need to be associated with three additional D3PD objects defined in:
    ## JetTagVxOnJetAxisD3PDObject.py
    ## JetTagTwoTrackVertexD3PDObject.py
    #

    if LocalFlags.JetFitterVertexFinderInfo():

        JetD3PDObject.defineBlock(
            btagLevelOffset + 5,
            JetTagD3PDKeys.JetFitterVxAssocBlockName(),
            JetTagD3PDMaker.JetTagJetFitterVxFillerTool,
            prefix=JetTagD3PDKeys.JetFitterVxAssocPrefix())

        if LocalFlags.JFVxOnJetAxisAssocLabel() != "":

            JetVxOnJetAxisAssoc = IndexMultiAssociation(
                JetD3PDObject,
                JetTagD3PDMaker.JetTagJetVxOnJetAxisAssociationTool,
                LocalFlags.JFVxOnJetAxisAssocLabel(),
                level=btagLevelOffset + 5,
                prefix=JetTagD3PDKeys.JetJFVxOnJetAxisAssocPrefix(),
                blockname=JetTagD3PDKeys.JetJFVxOnJetAxisAssocBlockName(),
                VxOnJetHolderName=LocalFlags.JetJFVxOnJetAxisAssocSGKey(),
                InfoName="NewJetFitterVxFinder")

            if LocalFlags.JetFitterFlipVxOnJetAxisAssoc():

                JFFlipJetVxOnJetAxisAssoc = IndexMultiAssociation(\
                    JetD3PDObject,
                    JetTagD3PDMaker.JetTagJetVxOnJetAxisAssociationTool,
                    LocalFlags.JFVxOnJetAxisAssocLabel(),
                    level = btagLevelOffset+6,
                    prefix=JetTagD3PDKeys.JetJFFlipVxOnJetAxisAssocPrefix(),
                    blockname=JetTagD3PDKeys.JetJFFlipVxOnJetAxisAssocBlockName(),
                    VxOnJetHolderName=LocalFlags.JetJFVxOnJetAxisAssocSGKey(),
                    InfoName="NewJetFitterVxFinderFlip")

        if LocalFlags.JFTwoTrackVertexAssocLabel() != "":

            JetJFTwoTrackVertexAssoc = IndexMultiAssociation(\
                JetD3PDObject,
                JetTagD3PDMaker.JetTagJetJFTwoTrackVertexAssociationTool,
                LocalFlags.JFTwoTrackVertexAssocLabel(),
                level = btagLevelOffset+5,
                prefix=JetTagD3PDKeys.JetJFTwoTrackVertexAssocPrefix(),
                blockname=JetTagD3PDKeys.JetJFTwoTrackVertexAssocBlockName(),
                TwoTrackVertexName=LocalFlags.JetJFTwoTrackVertexAssocSGKey(),
                InfoName="NewJetFitterVxFinder")

            if LocalFlags.JetFitterFlipTwoTrackVertexAssoc():

                JetJFFlipTwoTrackVertexAssoc = IndexMultiAssociation(\
                JetD3PDObject,
                JetTagD3PDMaker.JetTagJetJFTwoTrackVertexAssociationTool,
                LocalFlags.JFTwoTrackVertexAssocLabel(),
                level = btagLevelOffset+6,
                prefix=JetTagD3PDKeys.JetJFFlipTwoTrackVertexAssocPrefix(),
                blockname=JetTagD3PDKeys.JetJFFlipTwoTrackVertexAssocBlockName(),
                TwoTrackVertexName=LocalFlags.JetJFTwoTrackVertexAssocSGKey(),
                InfoName="NewJetFitterVxFinderFlip")
コード例 #19
0
)
JetTagD3PDFlags.JFTwoTrackVertexAssocLabel = JetTagD3PDKeys.JFTwoTrackVertexGetterLabel(
)
TruthD3PDFlags.GenParticleAssocLabel = TruthD3PDKeys.GenParticleGetterLabel()
TruthD3PDFlags.GenVertexAssocLabel = TruthD3PDKeys.GenVertexGetterLabel()
TruthD3PDFlags.GenEventAssocLabel = TruthD3PDKeys.GenEventGetterLabel()
TruthD3PDFlags.TruthTrackAssocLabel = TruthD3PDKeys.TruthTrackGetterLabel()
JetTagD3PDFlags.MSVVtxInfoAssocLabel = JetTagD3PDKeys.MSVVtxInfoInJetGetterLabel(
)

### configure jet tag flags
JetTagD3PDFlags.SkimD3PD = True
JetTagD3PDFlags.FilterMinNJets = 1
JetTagD3PDFlags.TrackPtCut = 250.
JetTagD3PDFlags.MCPtMinCut = 250.
JetTagD3PDFlags.Taggers = JetTagD3PDFlags.AllTaggers()
JetTagD3PDFlags.JetFitterFlipTwoTrackVertexAssoc = True
JetTagD3PDFlags.JetFitterFlipVxOnJetAxisAssoc = True
JetTagD3PDFlags.JetFitterVertexFinderInfo = True
JetTagD3PDFlags.JetVKalVxBadTrack = True
JetTagD3PDFlags.InfoBaseCalib = True
JetTagD3PDFlags.JetFitterTagFlipInfo = True

JetTagD3PDFlags.AddVxOnJetAxisInJetsObject = True
JetTagD3PDFlags.AddTwoTrackVertexInJetsObject = True
JetTagD3PDFlags.METObjects = []
JetTagD3PDFlags.AddPixelClusterObject = False
JetTagD3PDFlags.AddTruthTrackObjects = True
JetTagD3PDFlags.AddGenVertexObjects = True

JetTagD3PDFlags.JetElectronAssoc = True
コード例 #20
0
def ZPrimeMMD3PD(alg=None,
                 file='smwz.root',
                 tuplename='physics',
                 streamname='d3pdstream',
                 doSoftQCD=False,
                 doThirdMuonChain=True,
                 **kw):

    # define associations

    if not PhotonD3PDObject.allBlocknames().has_key('RecoveryMatch'):
        from PhotonD3PDMaker.PhotonRecoveryAssociation import PhotonRecoveryAssociation
        PhotonRecoveryAssoc = PhotonRecoveryAssociation(
            PhotonD3PDObject,
            'ElectronContainer',
            D3PDMakerFlags.ElectronSGKey(),
            prefix='el_',
            blockname='RecoveryMatch',
            target='ph_ElectronRecovered_')

    # define track and cluster filters

    preseq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName())

    if not hasattr(preseq, "GoodTracks"):
        filter1 = makeTrackFilterAlg(TracksName=D3PDMakerFlags.TrackSGKey(),
                                     OutputTracksName='GoodTracks',
                                     ptCut=0.,
                                     nSCTPix=4)
        preseq += filter1

    if not hasattr(preseq, "HighPtTracks"):
        filter2 = makeTrackFilterAlg(TracksName=D3PDMakerFlags.TrackSGKey(),
                                     OutputTracksName='HighPtTracks',
                                     ptCut=4000.,
                                     nSCTPix=4)
        preseq += filter2

    if not hasattr(preseq, "HighPtClusters"):
        filter3 = makeClusterFilter(InputName=D3PDMakerFlags.ClusterSGKey(),
                                    OutputName='HighPtClusters',
                                    ptCut=10000.)
        preseq += filter3

    if not hasattr(preseq, "HighPtEMClusters"):
        filter4 = makeClusterFilter(
            InputName=D3PDMakerFlags.EMTopoClusterSGKey(),
            OutputName='HighPtEMClusters',
            ptCut=10000.)
        preseq += filter4

    # perform recoil calculation

    import HadronicRecoil.Configurables as hrc
    preseq = hrc.add_hadronic_recoil_filters(preseq)

    # now configure the D3PD

    if not alg:
        alg = MSMgr.NewRootStream(StreamName=streamname,
                                  FileName=file,
                                  TreeName=tuplename)

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

    from TriggerD3PDMaker.BunchStructureMetadata import addBunchStructureMetadata
    addBunchStructureMetadata(alg)

    # Electron/Photon blocks

    alg += ElectronD3PDObject(**_args(10, 'Electron', kw))

    if testSGKey('ElectronContainer', D3PDMakerFlags.GSFElectronSGKey()):
        alg += GSFElectronD3PDObject(
            **_args(10,
                    'GSFElectron',
                    kw,
                    sgkey=D3PDMakerFlags.GSFElectronSGKey(),
                    prefix='el_gsf_'))

    alg += PhotonD3PDObject(**_args(10, 'Photon', kw))

    # Muon blocks

    ### add the scattering significance filler - to be removed when added in the MuonD3PDMaker
    if not MuonD3PDObject.allBlocknames().has_key(
            "MuonScatteringAngleSignificance"):
        from AthenaCommon.AppMgr import ToolSvc
        muonScatteringSigTool = None
        if hasattr(ToolSvc, "MuonScatteringSigTool"):
            muonScatteringSigTool = ToolSvc.MuonScatteringSigTool
        from JetTagD3PDMaker import MuonScatteringAngleSignificanceFillerTool
        MuonD3PDObject.defineBlock(100,
                                   "MuonScatteringAngleSignificance",
                                   MuonScatteringAngleSignificanceFillerTool,
                                   ScatteringSigTool=muonScatteringSigTool)

### Third muon chain variables!
    if doThirdMuonChain:
        if cfgKeyStore.isInInput("Analysis::MuonContainer", "Muons"):
            alg += MuonD3PDObject(**_args(
                10,
                'Muon',
                kw,
                sgkey='Muons',
                prefix='mu_',
                include=[
                    "EFCBInfoIndex", "EFMGInfoIndex", "EFMEInfoIndex",
                    "L2CBInfoIndex", "L1InfoIndex",
                    "MuonScatteringAngleSignificance"
                ],
                exclude=[
                    "EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"
                ],
                allowMissing=True))
### Third muon chain variables!

    if cfgKeyStore.isInInput("Analysis::MuonContainer", "MuidMuonCollection"):
        alg += MuonD3PDObject(**_args(
            10,
            'MuidMuon',
            kw,
            sgkey='MuidMuonCollection',
            prefix='mu_muid_',
            include=[
                "EFCBInfoIndex", "EFMGInfoIndex", "EFMEInfoIndex",
                "L2CBInfoIndex", "L1InfoIndex",
                "MuonScatteringAngleSignificance"
            ],
            exclude=["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
            allowMissing=True))

    if cfgKeyStore.isInInput("Analysis::MuonContainer", "StacoMuonCollection"):
        alg += MuonD3PDObject(**_args(
            10,
            'StacoMuon',
            kw,
            sgkey='StacoMuonCollection',
            prefix='mu_staco_',
            include=[
                "EFCBInfoIndex", "EFMGInfoIndex", "EFMEInfoIndex",
                "L2CBInfoIndex", "L1InfoIndex",
                "MuonScatteringAngleSignificance"
            ],
            exclude=["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
            allowMissing=True))

    if cfgKeyStore.isInInput("Analysis::MuonContainer", "CaloMuonCollection"):
        alg += MuonD3PDObject(
            **_args(0,
                    'CaloMuon',
                    kw,
                    sgkey='CaloMuonCollection',
                    prefix='mu_calo_',
                    include=[
                        "MuonHitSummary", "Authors", "Likelihood", "Isolation",
                        "CaloEnergyLoss", "Quality"
                    ]))

    # Tau block

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

    # Jet blocks

    from JetTagD3PDMaker.JetTagD3PDMakerFlags import JetTagD3PDFlags
    from JetTagD3PDMaker.JetTagD3PDMakerKeys import JetTagD3PDKeys

    ## add MSV target to the jetd3pd object properties
    if not kw.has_key('AK4TopoEMJet_' +
                      JetTagD3PDKeys.MultiSVInfoPlusMSVVtxAssocBlockName() +
                      '_target'):
        kw['AK4TopoEMJet_' +
           JetTagD3PDKeys.MultiSVInfoPlusMSVVtxAssocBlockName() +
           '_target'] = JetTagD3PDKeys.MSVVtxInfoInJetGetterLabel()
    if not kw.has_key('AK6TopoEMJet_' +
                      JetTagD3PDKeys.MultiSVInfoPlusMSVVtxAssocBlockName() +
                      '_target'):
        kw['AK6TopoEMJet_' +
           JetTagD3PDKeys.MultiSVInfoPlusMSVVtxAssocBlockName() +
           '_target'] = JetTagD3PDKeys.MSVVtxInfoInJetGetterLabel()

    ## add track index for IPInfoPlus
    if not kw.has_key('AK4TopoEMJet_' +
                      JetTagD3PDKeys.IPInfoPlusTrackAssocBlockName() +
                      '_target'):
        kw['AK4TopoEMJet_' + JetTagD3PDKeys.IPInfoPlusTrackAssocBlockName() +
           '_target'] = "trk"
    if not kw.has_key('AK6TopoEMJet_' +
                      JetTagD3PDKeys.IPInfoPlusTrackAssocBlockName() +
                      '_target'):
        kw['AK6TopoEMJet_' + JetTagD3PDKeys.IPInfoPlusTrackAssocBlockName() +
           '_target'] = "trk"
    ## add track index for SVInfoPlus
    if not kw.has_key('AK4TopoEMJet_' +
                      JetTagD3PDKeys.SVInfoPlusTrackAssocBlockName() +
                      '_target'):
        kw['AK4TopoEMJet_' + JetTagD3PDKeys.SVInfoPlusTrackAssocBlockName() +
           '_target'] = "trk"
    if not kw.has_key('AK6TopoEMJet_' +
                      JetTagD3PDKeys.SVInfoPlusTrackAssocBlockName() +
                      '_target'):
        kw['AK6TopoEMJet_' + JetTagD3PDKeys.SVInfoPlusTrackAssocBlockName() +
           '_target'] = "trk"
    ## add track index for SV0InfoPlus
    if not kw.has_key('AK4TopoEMJet_' +
                      JetTagD3PDKeys.SV0InfoPlusTrackAssocBlockName() +
                      '_target'):
        kw['AK4TopoEMJet_' + JetTagD3PDKeys.SV0InfoPlusTrackAssocBlockName() +
           '_target'] = "trk"
    if not kw.has_key('AK6TopoEMJet_' +
                      JetTagD3PDKeys.SV0InfoPlusTrackAssocBlockName() +
                      '_target'):
        kw['AK6TopoEMJet_' + JetTagD3PDKeys.SV0InfoPlusTrackAssocBlockName() +
           '_target'] = "trk"

    alg += JetD3PDObject(**_args(3,
                                 'AK4TopoEMJet',
                                 kw,
                                 sgkey='AntiKt4TopoEMJets',
                                 prefix='jet_AntiKt4TopoEM_',
                                 include=JetTagD3PDFlags.StdInfoInclude() +
                                 [JetTagD3PDKeys.MultiSVInfoPlusBlockName()],
                                 JetVertexFraction_FromUD=True,
                                 JetVertexFraction_FillFullJVF=True,
                                 allowMissing=True))

    alg += JetD3PDObject(**_args(3,
                                 'AK6TopoEMJet',
                                 kw,
                                 sgkey='AntiKt6TopoEMJets',
                                 prefix='jet_AntiKt6TopoEM_',
                                 include=JetTagD3PDFlags.StdInfoInclude() +
                                 [JetTagD3PDKeys.MultiSVInfoPlusBlockName()],
                                 JetVertexFraction_FromUD=True,
                                 JetVertexFraction_FillFullJVF=True,
                                 allowMissing=True))

    alg += JetD3PDObject(**_args(3,
                                 'AK4LCTopoJet',
                                 kw,
                                 sgkey='AntiKt4LCTopoJets',
                                 prefix='jet_AntiKt4LCTopo_',
                                 JetVertexFraction_FromUD=True,
                                 JetVertexFraction_FillFullJVF=True,
                                 allowMissing=True))

    alg += JetD3PDObject(**_args(3,
                                 'AK6LCTopoJet',
                                 kw,
                                 sgkey='AntiKt6LCTopoJets',
                                 prefix='jet_AntiKt6LCTopo_',
                                 JetVertexFraction_FromUD=True,
                                 JetVertexFraction_FillFullJVF=True,
                                 allowMissing=True))

    ### add the MSV block
    MSVJetCollections = ['AntiKt4TopoEMJets', 'AntiKt6TopoEMJets']
    ### link multisv to tracks
    if not kw.has_key('msvvtxinfo_JetTag_JetMultiSVVtxAssoc_target'):
        kw['msvvtxinfo_JetTag_JetMultiSVVtxAssoc_target'] = "trk"

    from JetTagD3PDMaker.JetTagMSVVtxInJetD3PDObject import getJetTagMSVVtxInfoInJetD3PDObject
    alg += getJetTagMSVVtxInfoInJetD3PDObject(
        **_args(1, "msvvtxinfo", kw, jetCollections=MSVJetCollections))

    from TopInputsD3PDMaker.HforD3PDObject import HforD3PDObject
    alg += HforD3PDObject(**_args(0, 'HforInfo', kw))

    # EventShape variables
    alg += EventShapeD3PDObject(**_args(0, 'rho', kw))

    # 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', 'MET_Comps', 'MET_Track_Weights',
            'MET_Cluster_Weights'
            'MET_RefFinal_STVF', 'MET_RefJet_JVF', 'MET_RefJet_JVFCut',
            'MET_CellOut_Eflow_STVF', 'MET_CellOut_Eflow_JetArea'
        ],
        allowMissing=True))

    # ... DR = 0.15

    alg += MissingETD3PDObject(0,
                               sgkey="RoughRecoil_15",
                               prefix="hr_roughRecoil_15",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="ueCorrection_15",
                               prefix="hr_ueCorrection_15",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="RefinedRecoil_15",
                               prefix="hr_corrRecoil_15",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="MET_HR_15",
                               prefix="hr_MET_15",
                               exclude=['MET_Regions', 'MET_Comps'])

    alg += MissingETD3PDObject(0,
                               sgkey="RoughRecoil_Eflow_15",
                               prefix="hr_roughRecoil_Eflow_15",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="ueCorrection_Eflow_15",
                               prefix="hr_ueCorrection_Eflow_15",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="RefinedRecoil_Eflow_15",
                               prefix="hr_corrRecoil_Eflow_15",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="MET_HR_Eflow_15",
                               prefix="hr_MET_Eflow_15",
                               exclude=['MET_Regions', 'MET_Comps'])

    # ... DR = 0.20

    alg += MissingETD3PDObject(0,
                               sgkey="RoughRecoil_20",
                               prefix="hr_roughRecoil_20",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="ueCorrection_20",
                               prefix="hr_ueCorrection_20",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="RefinedRecoil_20",
                               prefix="hr_corrRecoil_20",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="MET_HR_20",
                               prefix="hr_MET_20",
                               exclude=['MET_Regions', 'MET_Comps'])

    alg += MissingETD3PDObject(0,
                               sgkey="RoughRecoil_track_20",
                               prefix="hr_roughRecoil_track_20",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="ueCorrection_track_20",
                               prefix="hr_ueCorrection_track_20",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="RefinedRecoil_track_20",
                               prefix="hr_corrRecoil_track_20",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="MET_HR_track_20",
                               prefix="hr_MET_track_20",
                               exclude=['MET_Regions', 'MET_Comps'])

    alg += MissingETD3PDObject(0,
                               sgkey="RoughRecoil_clusNoTrack_20",
                               prefix="hr_roughRecoil_clusNoTrack_20",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="ueCorrection_clusNoTrack_20",
                               prefix="hr_ueCorrection_clusNoTrack_20",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="RefinedRecoil_clusNoTrack_20",
                               prefix="hr_corrRecoil_clusNoTrack_20",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="MET_HR_clusNoTrack_20",
                               prefix="hr_MET_clusNoTrack_20",
                               exclude=['MET_Regions', 'MET_Comps'])

    alg += MissingETD3PDObject(0,
                               sgkey="RoughRecoil_Eflow_20",
                               prefix="hr_roughRecoil_Eflow_20",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="ueCorrection_Eflow_20",
                               prefix="hr_ueCorrection_Eflow_20",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="RefinedRecoil_Eflow_20",
                               prefix="hr_corrRecoil_Eflow_20",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="MET_HR_Eflow_20",
                               prefix="hr_MET_Eflow_20",
                               exclude=['MET_Regions', 'MET_Comps'])

    # ... DR = 0.25

    alg += MissingETD3PDObject(0,
                               sgkey="RoughRecoil_25",
                               prefix="hr_roughRecoil_25",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="ueCorrection_25",
                               prefix="hr_ueCorrection_25",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="RefinedRecoil_25",
                               prefix="hr_corrRecoil_25",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="MET_HR_25",
                               prefix="hr_MET_25",
                               exclude=['MET_Regions', 'MET_Comps'])

    alg += MissingETD3PDObject(0,
                               sgkey="RoughRecoil_Eflow_25",
                               prefix="hr_roughRecoil_Eflow_25",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="ueCorrection_Eflow_25",
                               prefix="hr_ueCorrection_Eflow_25",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="RefinedRecoil_Eflow_25",
                               prefix="hr_corrRecoil_Eflow_25",
                               exclude=['MET_Regions', 'MET_Comps'])
    alg += MissingETD3PDObject(0,
                               sgkey="MET_HR_Eflow_25",
                               prefix="hr_MET_Eflow_25",
                               exclude=['MET_Regions', 'MET_Comps'])

    # track and cluster blocks

    # ... all clusters, very low LOD

    alg += ClusterD3PDObject(
        **_args(0, 'Clusters1', kw, exclude='SamplingBasics'))

    # ... higher LOD for pt>10 GeV

    alg += ClusterD3PDObject(
        **_args(2, 'Clusters2', kw, sgkey='HighPtClusters', prefix='clpt10_'))

    alg += ClusterD3PDObject(**_args(
        3, 'Clusters3', kw, sgkey='HighPtEMClusters', prefix='emclpt10_'))

    from TrackD3PDMaker.TrackD3PDObject import TrackD3PDObject

    # ... good tracks only (nSCT>3; no pt cut)

    # turn on detailed track info if writing SoftQCD version of D3PD
    if doSoftQCD:

        from TrackD3PDMaker.TrackD3PDMakerFlags import TrackD3PDFlags as softQcdFlags

        softQcdFlags.doTruth = True
        softQcdFlags.storeDetailedTruth = False
        softQcdFlags.storeDiagonalCovarianceAsErrors = True
        softQcdFlags.storeHitTruthMatching = True
        softQcdFlags.storePixelHitsOnTrack = False
        softQcdFlags.storePixelHolesOnTrack = False
        softQcdFlags.storePixelOutliersOnTrack = False
        softQcdFlags.storeSCTHitsOnTrack = False
        softQcdFlags.storeSCTHolesOnTrack = False
        softQcdFlags.storeSCTOutliersOnTrack = False
        softQcdFlags.storeTRTHitsOnTrack = False
        softQcdFlags.storeTRTHolesOnTrack = False
        softQcdFlags.storeTRTOutliersOnTrack = False
        softQcdFlags.storeTrackFitQuality = True
        softQcdFlags.storeTrackInfo = True
        softQcdFlags.storeTrackMomentum = True
        softQcdFlags.storeTrackPredictionAtBLayer = True
        softQcdFlags.storeTrackSummary = True
        softQcdFlags.trackParametersAtBeamSpotLevelOfDetails = 0
        softQcdFlags.trackParametersAtGlobalPerigeeLevelOfDetails = 2
        softQcdFlags.trackParametersAtPrimaryVertexLevelOfDetails = 2

        SoftQCDTrackParticleD3PDObject = TrackD3PDObject(
            _label='trk',
            _prefix='trk_',
            _sgkey='GoodTracks',
            typeName='Rec::TrackParticleContainer',
            flags=softQcdFlags)

        alg += SoftQCDTrackParticleD3PDObject(**_args(
            3, 'Tracks1', kw, sgkey='GoodTracks', label='trk', prefix='trk_'))

    else:

        # ... use standard level of track info for 'GoodTracks'

        alg += TrackParticleD3PDObject(**_args(
            3, 'Tracks1', kw, sgkey='GoodTracks', 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.storeTrackSummary.IDOutliers = True
        highPtFlags.storeTrackSummary.PixelInfoPlus = True
        highPtFlags.storeTrackSummary.SCTInfoPlus = True
        highPtFlags.storeTrackSummary.TRTInfoPlus = True
        highPtFlags.storeTrackSummary.InfoPlus = True
        highPtFlags.trackParametersAtBeamSpotLevelOfDetails = 0
        highPtFlags.trackParametersAtGlobalPerigeeLevelOfDetails = 2
        highPtFlags.trackParametersAtPrimaryVertexLevelOfDetails = 3

        HighPtTrackParticleD3PDObject = TrackD3PDObject(
            _label='trkpt4',
            _prefix='trkpt4_',
            _sgkey='HighPtTracks',
            typeName='Rec::TrackParticleContainer',
            flags=highPtFlags)

        alg += HighPtTrackParticleD3PDObject(**_args(3,
                                                     'Tracks2',
                                                     kw,
                                                     sgkey='HighPtTracks',
                                                     label='trkpt4',
                                                     prefix='trkpt4_'))

    # Primary vertex block - May be missing in single-beam data.

    alg += PrimaryVertexD3PDObject(**_args(1,
                                           'PrimaryVertex',
                                           kw,
                                           allowMissing=True,
                                           sgkey=D3PDMakerFlags.VertexSGKey(),
                                           prefix='vxp_'))

    # MBTS

    alg += MBTSD3PDObject(**_args(10, 'MBTS', kw))
    alg += MBTSTimeD3PDObject(**_args(10, 'MBTSTime', kw))
    alg += MBTSTriggerBitsD3PDObject(**_args(10, 'MBTSTriggerBits', kw))
    #alg += CollisionDecisionD3PDObject(**_args (10, 'CollisionDecision', kw))

    # Truth

    if rec.doTruth():

        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))
        alg += JetD3PDObject(**_args(1,
                                     'AK6TruthJet',
                                     kw,
                                     sgkey='AntiKt6TruthJets',
                                     prefix='jet_AntiKt6Truth_',
                                     allowMissing=True))
        alg += JetD3PDObject(**_args(1,
                                     'AK4TruthJetALL',
                                     kw,
                                     sgkey='AntiKt4TruthJets_ALL',
                                     prefix='jet_AntiKt4TruthALL_',
                                     allowMissing=True))
        alg += JetD3PDObject(**_args(1,
                                     'AK6TruthJetALL',
                                     kw,
                                     sgkey='AntiKt6TruthJets_ALL',
                                     prefix='jet_AntiKt6TruthALL_',
                                     allowMissing=True))
        alg += JetD3PDObject(**_args(1,
                                     'AK4TruthJetWZ',
                                     kw,
                                     sgkey='AntiKt4TruthJets_WZ',
                                     prefix='jet_AntiKt4TruthWZ_',
                                     allowMissing=True))
        alg += JetD3PDObject(**_args(1,
                                     'AK6TruthJetWZ',
                                     kw,
                                     sgkey='AntiKt6TruthJets_WZ',
                                     prefix='jet_AntiKt6TruthWZ_',
                                     allowMissing=True))

        ### heavy flavor truth information
        from AthenaCommon.AppMgr import ToolSvc
        from TruthD3PDAnalysis.TruthD3PDAnalysisConf import D3PD__GenObjectsFilterTool
        smwzhfGenVtxFilterTool = D3PD__GenObjectsFilterTool(
            "SMWZHFGenVtxFilterTool")
        ToolSvc += smwzhfGenVtxFilterTool

        smwzhfGenVtxFilterTool.RemoveInTimePileUp = False
        smwzhfGenVtxFilterTool.Remove2BCPileUp = True
        smwzhfGenVtxFilterTool.Remove800nsPileUp = True
        smwzhfGenVtxFilterTool.RemoveCavernBkg = True
        smwzhfGenVtxFilterTool.RemoveEmptyEvents = True
        smwzhfGenVtxFilterTool.RemoveDummyEvents = True
        smwzhfGenVtxFilterTool.RemoveUnrequestedParticles = True
        smwzhfGenVtxFilterTool.KeepBCHadrons = True

        from TruthD3PDMaker.GenVertexD3PDObject import GenVertexD3PDObject
        alg += GenVertexD3PDObject(**_args(0,
                                           "hfgenvertex",
                                           kw,
                                           prefix='mchfvtx_',
                                           filter=smwzhfGenVtxFilterTool))

        smwzhfGenPartFilterTool = D3PD__GenObjectsFilterTool(
            "SMWZHFGenPartFilterTool")
        ToolSvc += smwzhfGenPartFilterTool

        smwzhfGenPartFilterTool.RemoveInTimePileUp = False
        smwzhfGenPartFilterTool.Remove2BCPileUp = True
        smwzhfGenPartFilterTool.Remove800nsPileUp = True
        smwzhfGenPartFilterTool.RemoveCavernBkg = True
        smwzhfGenPartFilterTool.RemoveEmptyEvents = True
        smwzhfGenPartFilterTool.RemoveDummyEvents = True
        smwzhfGenPartFilterTool.RemoveUnrequestedParticles = True
        smwzhfGenPartFilterTool.KeepBCQuarks = True
        smwzhfGenPartFilterTool.KeepBCQuarkAncestors = True
        smwzhfGenPartFilterTool.KeepBCHadrons = True
        smwzhfGenPartFilterTool.KeepBCHadronDecayChain = True
        smwzhfGenPartFilterTool.BCHadronsDescendantsPtCut = 200
        smwzhfGenPartFilterTool.BCHadronsDescendantsBarcodeCut = 300000
        smwzhfGenPartFilterTool.BCHadronsDescendantsEtaCut = 5

        from TruthD3PDMaker.GenParticleD3PDObject import GenParticleD3PDObject
        alg += GenParticleD3PDObject(
            **_args(10,
                    "hfgenparticle",
                    kw,
                    prefix='mchfpart_',
                    filter=smwzhfGenPartFilterTool,
                    GenParticle_WriteMotherType=False,
                    GenParticle_WriteMotherBarcode=False))

        ### leptonic W/Z truth information
        smwzlepwzGenPartFilterTool = D3PD__GenObjectsFilterTool(
            "SMWZLepWZGenPartFilterTool")
        ToolSvc += smwzlepwzGenPartFilterTool

        smwzlepwzGenPartFilterTool.RemoveInTimePileUp = True
        smwzlepwzGenPartFilterTool.Remove2BCPileUp = True
        smwzlepwzGenPartFilterTool.Remove800nsPileUp = True
        smwzlepwzGenPartFilterTool.RemoveCavernBkg = True
        smwzlepwzGenPartFilterTool.RemoveEmptyEvents = True
        smwzlepwzGenPartFilterTool.RemoveDummyEvents = True
        smwzlepwzGenPartFilterTool.RemoveUnrequestedParticles = True
        smwzlepwzGenPartFilterTool.KeepLeptonicWZBosons = True
        smwzlepwzGenPartFilterTool.KeepLeptonicWZBosonDecayChains = True
        smwzlepwzGenPartFilterTool.KeepLeptonicWZBosonsParents = True

        from TruthD3PDMaker.GenParticleD3PDObject import GenParticleD3PDObject
        alg += GenParticleD3PDObject(**_args(
            10,
            "lepwzgenparticle",
            kw,
            prefix='mclepwzpart_',
            filter=smwzlepwzGenPartFilterTool,
            label="LepWZTruthD3PDObject",
            exclude=["GenPartProdVertexAssoc", "GenPartDecayVertexAssoc"],
            GenParticle_WriteMotherType=False,
            GenParticle_WriteMotherBarcode=False,
            GenPartMotherAssoc_target="LepWZTruthD3PDObject",
            GenPartChildAssoc_target="LepWZTruthD3PDObject"))

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

    # Trigger

    if D3PDMakerFlags.DoTrigger():

        alg += ZPrimeMMTriggerBitsD3PDObject(
            **_args(10, 'ZPrimeMMTriggerBits', kw))

        # Trigger Decision + metadata

        alg += TrigDecisionD3PDObject(**_args(10, 'TrigDecision', kw))
        addTrigConfMetadata(alg)

        # Bunch group info

        alg += BGCodeD3PDObject(**_args(2, 'BGCode', kw))

        # Egamma and Mu

        TrigEgammaD3PDObjects(alg, 1)
        TrigMuonD3PDObjects(alg, 1)

        # Esum

        alg += EnergySumROID3PDObject(
            **_args(2, 'EnergySumROI', kw, prefix="trig_L1_esum_"))

        # The LVL2 information:

        alg += TrigMETD3PDObject(**_args(
            2, 'TrigMETL2', kw, prefix="trig_L2_met_",
            sgkey="HLT_T2MissingET"))
        # The EF information:

        alg += TrigMETD3PDObject(**_args(2,
                                         'TrigMETEF',
                                         kw,
                                         prefix="trig_EF_met_",
                                         sgkey="HLT_TrigEFMissingET"))

        # The BJet information:
        TrigBJetD3PDObjects(alg, 10, False, False, True, True, True)

# Event metadata

    alg.MetadataTools += [LBMetadataConfig()]

    if D3PDMakerFlags.FilterCollCand():
        from CaloD3PDMaker.CollisionFilterAlg import CollisionFilterAlg
        alg.filterSeq += CollisionFilterAlg(tuplename + '_CollCandFilter')

    return alg
コード例 #21
0
def SMWZD3PD (alg = None,
              file = 'smwz.root',
              tuplename = 'physics',
              streamname = 'd3pdstream',
              doSoftQCD = False,
              doThirdMuonChain = True,
              stdElectronContainer = D3PDMakerFlags.ElectronSGKey(),
              gsfElectronContainer = D3PDMakerFlags.GSFElectronSGKey(),
              muonContainer        = 'None', # can be 'Muons' for third muon chain
              stacoMuonContainer   = 'StacoMuonCollection',
              muidMuonContainer    = 'MuidMuonCollection',
              caloMuonContainer    = 'CaloMuonCollection',
              photonContainer      = D3PDMakerFlags.PhotonSGKey(),
              tauContainer         = D3PDMakerFlags.TauSGKey(),
              jetEM4Container      = 'AntiKt4TopoEMJets', #Commented by Bertrand
              jetEM6Container      = 'AntiKt6TopoEMJets',
              jetLC4Container      = 'AntiKt4LCTopoJets',
              jetLC6Container      = 'AntiKt6LCTopoJets',
              #jetEM4Container      = 'AntiKt4TopoEMJetsReTagged',
              #jetEM6Container      = 'AntiKt6TopoEMJetsReTagged',
              #jetLC4Container      = 'AntiKt4LCTopoJetsReTagged',
              #jetLC6Container      = 'AntiKt6LCTopoJetsReTagged',
              jetDetails           = 3, # for the moment only level 2 and 3 are defined
              METDetails           = 3, # for the moment only level 2 and 3 are defined
              **kw):

    if doThirdMuonChain and muonContainer == 'None':
        muonContainer = 'Muons'

    # define associations
    
    if not PhotonD3PDObject.allBlocknames().has_key('RecoveryMatch'):
        from PhotonD3PDMaker.PhotonRecoveryAssociation import PhotonRecoveryAssociation
        if (stdElectronContainer != 'None'):
            PhotonRecoveryAssoc = PhotonRecoveryAssociation(PhotonD3PDObject,
                                                            'ElectronContainer',
                                                            stdElectronContainer,
                                                            prefix = 'el_',
                                                            blockname = 'RecoveryMatch',
                                                            target = 'ph_ElectronRecovered_')

    # define track and cluster filters

    preseq = AlgSequence (D3PDMakerFlags.PreD3PDAlgSeqName())

    if not hasattr( preseq, "GoodTracks" ):
        filter1 = makeTrackFilterAlg(TracksName = D3PDMakerFlags.TrackSGKey(),
                                     OutputTracksName='GoodTracks',
                                     ptCut=0.,nSCTPix=4)
        preseq += filter1

    if not hasattr( preseq, "HighPtTracks" ):
        filter2 = makeTrackFilterAlg(TracksName = D3PDMakerFlags.TrackSGKey(),
                                     OutputTracksName='HighPtTracks',
                                     ptCut=4000.,nSCTPix=4)
        preseq += filter2
    
    if not hasattr( preseq, "HighPtClusters" ):
        filter3 = makeClusterFilter(InputName  = D3PDMakerFlags.ClusterSGKey(),
                                    OutputName = 'HighPtClusters',
                                    ptCut=10000.)
        preseq += filter3

    if not hasattr( preseq, "HighPtEMClusters" ):
        filter4 = makeClusterFilter(InputName  = D3PDMakerFlags.EMTopoClusterSGKey(),
                                    OutputName = 'HighPtEMClusters',
                                    ptCut=10000.)
        preseq += filter4


    # perform recoil calculation

    import HadronicRecoil.Configurables as hrc
    preseq = hrc.add_hadronic_recoil_filters(preseq)


    # beam background stuff

    from RecBackgroundAlgs.RecBackgroundAlgsConf import BeamBackgroundFiller
    if not hasattr( preseq, "BeamBackgroundFiller" ):
        BeamBackgroundFiller=BeamBackgroundFiller()
        preseq += BeamBackgroundFiller



    # now configure the D3PD
    
    if not alg:
        alg = MSMgr.NewRootStream(StreamName = streamname, FileName = file, TreeName = tuplename)
        
    
    alg += EventInfoD3PDObject        (**_args (10, 'EventInfo', kw))
    alg += LArCollisionTimeD3PDObject (**_args (10, 'LArCollisionTime', kw))

    from TriggerD3PDMaker.BunchStructureMetadata import addBunchStructureMetadata
    addBunchStructureMetadata (alg)

    from BackgroundD3PDMaker.BeamBackgroundD3PDObject import BeamBackgroundD3PDObject
    from BackgroundD3PDMaker.BackgroundWordD3PDObject import BackgroundWordD3PDObject
    alg += BackgroundWordD3PDObject (**_args(0, 'BkgWord', kw))
    alg += BeamBackgroundD3PDObject(1)

    
    # Electron/Photon blocks
    
    if (stdElectronContainer != 'None'):
        alg += ElectronD3PDObject         (**_args (10, 'Electron', kw, sgkey = stdElectronContainer))
        
    if (gsfElectronContainer != 'None') and testSGKey ('ElectronContainer', gsfElectronContainer):
        alg += GSFElectronD3PDObject  (**_args (10, 'GSFElectron', kw,
                                                sgkey = gsfElectronContainer,
                                                prefix = 'el_gsf_'))

    if (photonContainer != 'None'):
        alg += PhotonD3PDObject           (**_args (10, 'Photon', kw, sgkey = photonContainer))
            
    
    # Muon blocks

### Third muon chain variables!
    if (muonContainer != 'None'):
        alg += MuonD3PDObject             (**_args (10, 'Muon', kw,
                                                    sgkey=muonContainer, prefix='mu_',
                                                    include = ["EFCBInfoIndex", "EFMGInfoIndex", "EFMEInfoIndex",
                                                               "L2CBInfoIndex", "L1InfoIndex"],
                                                    exclude = ["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
                                                    allowMissing = True ))
### Third muon chain variables!

    if (muidMuonContainer != 'None'):
        alg += MuonD3PDObject             (**_args (10, 'MuidMuon', kw,
                                                    sgkey=muidMuonContainer, prefix='mu_muid_',
                                                    include = ["EFCBInfoIndex", "EFMGInfoIndex", "EFMEInfoIndex",
                                                               "L2CBInfoIndex", "L1InfoIndex"],
                                                    exclude = ["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
                                                    allowMissing = True ))

    if (stacoMuonContainer != 'None'):
        alg += MuonD3PDObject             (**_args (10, 'StacoMuon', kw,
                                                    sgkey=stacoMuonContainer, prefix='mu_staco_',
                                                    include = ["EFCBInfoIndex", "EFMGInfoIndex", "EFMEInfoIndex",
                                                               "L2CBInfoIndex", "L1InfoIndex"],
                                                    exclude = ["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
                                                    allowMissing = True ))

    if (caloMuonContainer != 'None'):
        alg += MuonD3PDObject             (**_args (10, 'CaloMuon', kw,
                                                    sgkey=caloMuonContainer, prefix='mu_calo_',
                                                    include = ["MuonHitSummary", "Authors", "Likelihood",
                                                               "Isolation", "CaloEnergyLoss", "Quality"] ))
    
    # Tau block
    
    if (tauContainer != 'None'):
        alg += TauD3PDObject              (**_args ( 1, 'Tau', kw, sgkey = tauContainer))
    

    # Jet blocks
    from JetTagD3PDMaker.JetTagD3PDMakerFlags import JetTagD3PDFlags
    from JetTagD3PDMaker.JetTagD3PDMakerKeys import JetTagD3PDKeys

    ## add MSV target to the jetd3pd object properties 
    if not kw.has_key ('AK4TopoEMJet_'+JetTagD3PDKeys.MultiSVInfoPlusMSVVtxAssocBlockName()+'_target'):
        kw['AK4TopoEMJet_'+JetTagD3PDKeys.MultiSVInfoPlusMSVVtxAssocBlockName()+'_target']= JetTagD3PDKeys.MSVVtxInfoInJetGetterLabel()
    if not kw.has_key ('AK6TopoEMJet_'+JetTagD3PDKeys.MultiSVInfoPlusMSVVtxAssocBlockName()+'_target'):
        kw['AK6TopoEMJet_'+JetTagD3PDKeys.MultiSVInfoPlusMSVVtxAssocBlockName()+'_target']= JetTagD3PDKeys.MSVVtxInfoInJetGetterLabel()

    ## add track index for IPInfoPlus
    if not kw.has_key ('AK4TopoEMJet_'+JetTagD3PDKeys.IPInfoPlusTrackAssocBlockName()+'_target'):
        kw['AK4TopoEMJet_'+JetTagD3PDKeys.IPInfoPlusTrackAssocBlockName()+'_target']= "trk"
    if not kw.has_key ('AK6TopoEMJet_'+JetTagD3PDKeys.IPInfoPlusTrackAssocBlockName()+'_target'):
        kw['AK6TopoEMJet_'+JetTagD3PDKeys.IPInfoPlusTrackAssocBlockName()+'_target']= "trk"
    ## add track index for SVInfoPlus
    if not kw.has_key ('AK4TopoEMJet_'+JetTagD3PDKeys.SVInfoPlusTrackAssocBlockName()+'_target'):
        kw['AK4TopoEMJet_'+JetTagD3PDKeys.SVInfoPlusTrackAssocBlockName()+'_target']= "trk"
    if not kw.has_key ('AK6TopoEMJet_'+JetTagD3PDKeys.SVInfoPlusTrackAssocBlockName()+'_target'):
        kw['AK6TopoEMJet_'+JetTagD3PDKeys.SVInfoPlusTrackAssocBlockName()+'_target']= "trk"
    ## add track index for SV0InfoPlus
    if not kw.has_key ('AK4TopoEMJet_'+JetTagD3PDKeys.SV0InfoPlusTrackAssocBlockName()+'_target'):
        kw['AK4TopoEMJet_'+JetTagD3PDKeys.SV0InfoPlusTrackAssocBlockName()+'_target']= "trk"
    if not kw.has_key ('AK6TopoEMJet_'+JetTagD3PDKeys.SV0InfoPlusTrackAssocBlockName()+'_target'):
        kw['AK6TopoEMJet_'+JetTagD3PDKeys.SV0InfoPlusTrackAssocBlockName()+'_target']= "trk"

  
      ## add MSV target to the jetd3pd object properties 
    if not kw.has_key ('AK4LCTopoJet_'+JetTagD3PDKeys.MultiSVInfoPlusMSVVtxAssocBlockName()+'_target'):
        kw['AK4LCTopoJet_'+JetTagD3PDKeys.MultiSVInfoPlusMSVVtxAssocBlockName()+'_target']= JetTagD3PDKeys.MSVVtxInfoInJetGetterLabel()
    if not kw.has_key ('AK6LCTopoJet_'+JetTagD3PDKeys.MultiSVInfoPlusMSVVtxAssocBlockName()+'_target'):
        kw['AK6LCTopoJet_'+JetTagD3PDKeys.MultiSVInfoPlusMSVVtxAssocBlockName()+'_target']= JetTagD3PDKeys.MSVVtxInfoInJetGetterLabel()

    ## add track index for IPInfoPlus
    if not kw.has_key ('AK4LCTopoJet_'+JetTagD3PDKeys.IPInfoPlusTrackAssocBlockName()+'_target'):
        kw['AK4LCTopoJet_'+JetTagD3PDKeys.IPInfoPlusTrackAssocBlockName()+'_target']= "trk"
    if not kw.has_key ('AK6LCTopoJet_'+JetTagD3PDKeys.IPInfoPlusTrackAssocBlockName()+'_target'):
        kw['AK6LCTopoJet_'+JetTagD3PDKeys.IPInfoPlusTrackAssocBlockName()+'_target']= "trk"
    ## add track index for SVInfoPlus
    if not kw.has_key ('AK4LCTopoJet_'+JetTagD3PDKeys.SVInfoPlusTrackAssocBlockName()+'_target'):
        kw['AK4LCTopoJet_'+JetTagD3PDKeys.SVInfoPlusTrackAssocBlockName()+'_target']= "trk"
    if not kw.has_key ('AK6LCTopoJet_'+JetTagD3PDKeys.SVInfoPlusTrackAssocBlockName()+'_target'):
        kw['AK6LCTopoJet_'+JetTagD3PDKeys.SVInfoPlusTrackAssocBlockName()+'_target']= "trk"
    ## add track index for SV0InfoPlus
    if not kw.has_key ('AK4LCTopoJet_'+JetTagD3PDKeys.SV0InfoPlusTrackAssocBlockName()+'_target'):
        kw['AK4LCTopoJet_'+JetTagD3PDKeys.SV0InfoPlusTrackAssocBlockName()+'_target']= "trk"
    if not kw.has_key ('AK6LCTopoJet_'+JetTagD3PDKeys.SV0InfoPlusTrackAssocBlockName()+'_target'):
        kw['AK6LCTopoJet_'+JetTagD3PDKeys.SV0InfoPlusTrackAssocBlockName()+'_target']= "trk"

    if jetDetails == 3:
        jetInclude = JetTagD3PDFlags.StdInfoInclude()+[JetTagD3PDKeys.MultiSVInfoPlusBlockName()]
        jetInclude += [JetTagD3PDKeys.JetFitterCharmTagInfoBlockName(), JetTagD3PDKeys.JetFitterCharmInfoBaseBlockName()]
    else:
        jetInclude = [ JetTagD3PDKeys.BTagWeightsBlockName(), JetTagD3PDKeys.TruthInfoBlockName() ]


    if (jetEM4Container != 'None'):
        alg += JetD3PDObject              (**_args ( 4, 'AK4TopoEMJet', kw,
                                                     sgkey=jetEM4Container, prefix='jet_AntiKt4TopoEM_',
                                                     include = jetInclude+['BeamBackground','ConstituentScale','TracksMoments'],
                                                     JetVertexFraction_FromUD=False,
                                                     JetVertexFraction_FillFullJVF=False,
                                                     allowMissing = True))
    
    if (jetEM6Container != 'None'):
        alg += JetD3PDObject              (**_args ( 4, 'AK6TopoEMJet', kw,
                                                     sgkey=jetEM6Container, prefix='jet_AntiKt6TopoEM_',
                                                     include = jetInclude+['BeamBackground','ConstituentScale','TracksMoments'],
                                                     JetVertexFraction_FromUD=False,
                                                     JetVertexFraction_FillFullJVF=False,
                                                     allowMissing = True))

    if (jetLC4Container != 'None'):
        alg += JetD3PDObject              (**_args ( 4, 'AK4LCTopoJet', kw,
                                                     sgkey=jetLC4Container, prefix='jet_AntiKt4LCTopo_',
                                                     include = jetInclude+['BeamBackground','ConstituentScale','TracksMoments'],
                                                     JetVertexFraction_FromUD=False,
                                                     JetVertexFraction_FillFullJVF=False,
                                                     allowMissing = True))
    
    if (jetLC6Container != 'None'):
        alg += JetD3PDObject              (**_args ( 4, 'AK6LCTopoJet', kw,
                                                     sgkey=jetLC6Container, prefix='jet_AntiKt6LCTopo_',
                                                     include = jetInclude+['BeamBackground','ConstituentScale','TracksMoments'],
                                                     JetVertexFraction_FromUD=False,
                                                     JetVertexFraction_FillFullJVF=False,
                                                     allowMissing = True))

        
    ### add the MSV block
    MSVJetCollections = []
    if (jetEM4Container != 'None'):
        MSVJetCollections += [jetEM4Container]
    if (jetEM6Container != 'None'):
        MSVJetCollections += [jetEM6Container]
    if (jetLC4Container != 'None'):
        MSVJetCollections += [jetLC4Container]
    if (jetLC6Container != 'None'):
        MSVJetCollections += [jetLC6Container]
    ### link multisv to tracks
    if not kw.has_key ('msvvtxinfo_JetTag_JetMultiSVVtxAssoc_target'):
        kw['msvvtxinfo_JetTag_JetMultiSVVtxAssoc_target']= "trk"

    from JetTagD3PDMaker.JetTagMSVVtxInJetD3PDObject import getJetTagMSVVtxInfoInJetD3PDObject
    alg += getJetTagMSVVtxInfoInJetD3PDObject(**_args(1,"msvvtxinfo", kw,
                                                      jetCollections=MSVJetCollections)
                                                )
 
    from TopInputsD3PDMaker.HforD3PDObject import HforD3PDObject
    alg += HforD3PDObject(**_args (0, 'HforInfo', kw))


    # MET blocks
    # a whole mess to remove x,y components separately for all flavours

    if METDetails >= 3:
        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','MET_Comps',
                                                         'MET_Track_Weights','MET_Cluster_Weights'],
                                                allowMissing=True))
    elif METDetails > 0:
        alg += MissingETD3PDObject   (**_args (10, 'MissingET', kw,
                                           exclude=['MET_Base','MET_Base0','MET_Truth',
                                                    'MET_CellOut_Comps','MET_CellOut_Regions',
                                                    'MET_CellOut_em_Comps','MET_CellOut_em_Regions',
                                                    'MET_CellOut_Eflow_Comps','MET_CellOut_Eflow_Regions',
                                                    'MET_Calib',
                                                    'MET_CorrTopo',
                                                    'MET_Cryo',
                                                    'MET_CryoCone',
                                                    'MET_Final',
                                                    'MET_LocHadTopo_Comps',
                                                    'MET_LocHadTopoObj',
                                                    'MET_Muid',
                                                    'MET_Muid_Spectro',
                                                    'MET_Muid_Track',
                                                    'MET_MuonBoy_Regions',
                                                    'MET_MuonBoy_Spectro',
                                                    'MET_MuonBoy_Track',
                                                    'MET_MuonMuid',
                                                    'MET_Muon',
                                                    'MET_Muon_Isol_Muid',
                                                    'MET_Muon_Isol_Staco',
                                                    'MET_Muon_NonIsol_Muid',
                                                    'MET_Muon_NonIsol_Staco',
                                                    'MET_Muon_Total_Muid',
                                                    'MET_Muon_Total_Staco',
                                                    'MET_RefEle_Comps','MET_RefEle_Regions',
                                                    'MET_RefEle_em_Comps','MET_RefEle_em_Regions',
                                                    'MET_RefGamma_Comps','MET_RefGamma_Regions',
                                                    'MET_RefGamma_em_Comps','MET_RefGamma_em_Regions',
                                                    'MET_RefJet_Comps','MET_RefJet_Regions',
                                                    'MET_RefJet_em_Comps','MET_RefJet_em_Regions',
                                                    'MET_RefMuon_Comps','MET_RefMuon_Regions',
                                                    'MET_RefMuon_Muid_Comps','MET_RefMuon_Muid_Regions',
                                                    'MET_RefMuon_Staco_Comps','MET_RefMuon_Staco_Regions',
                                                    'MET_RefMuon_Track_Muid_Comps','MET_RefMuon_Track_Muid_Regions',
                                                    'MET_RefMuon_Track_Staco_Comps','MET_RefMuon_Track_Staco_Regions',
                                                    'MET_RefMuon_Track_em_Comps','MET_RefMuon_Track_em_Regions',
                                                    'MET_RefMuon_Track_Comps','MET_RefMuon_Track_Regions',
                                                    'MET_RefMuon_em_Comps','MET_RefMuon_em_Regions',
                                                    'MET_RefTau_Comps','MET_RefTau_Regions',
                                                    'MET_RefTau_em_Comps','MET_RefTau_em_Regions',
                                                    'MET_SoftJets_Comps','MET_SoftJets_Regions',
                                                    'MET_SoftJets_em_Comps','MET_SoftJets_em_Regions',
                                                    'MET_Topo',
                                                    'MET_TopoObj_Comps','MET_TopoObj_Regions',
                                                    'MET_Track_Comps','MET_Track_Regions',
                                                    'MET_Track_Weights','MET_Cluster_Weights',
                                                    'MET_Comps'
                                                    ],
                                           allowMissing=True ))


    if METDetails > 0:
        add_met (alg)


    # track and cluster blocks

    # ... all clusters, very low LOD
    
    alg += ClusterD3PDObject          (**_args ( 0, 'Clusters1', kw,
                                                 exclude='SamplingBasics'))

    # ... higher LOD for pt>10 GeV
    
    alg += ClusterD3PDObject          (**_args ( 2, 'Clusters2', kw,
                                                 sgkey  = 'HighPtClusters',
                                                 prefix = 'clpt10_'))
    
    alg += ClusterD3PDObject          (**_args ( 3, 'Clusters3', kw,
                                                 sgkey  = 'HighPtEMClusters',
                                                 prefix = 'emclpt10_'))

    from TrackD3PDMaker.TrackD3PDObject import TrackD3PDObject    

    # ... good tracks only (nSCT>3; no pt cut)

    # turn on detailed track info if writing SoftQCD version of D3PD
    if doSoftQCD :

        from TrackD3PDMaker.TrackD3PDMakerFlags                import TrackD3PDFlags as softQcdFlags

        softQcdFlags.doTruth = True
        softQcdFlags.storeDetailedTruth = False
        softQcdFlags.storeDiagonalCovarianceAsErrors = True
        softQcdFlags.storeHitTruthMatching = True
        softQcdFlags.storePixelHitsOnTrack = False
        softQcdFlags.storePixelHolesOnTrack = False
        softQcdFlags.storePixelOutliersOnTrack = False
        softQcdFlags.storeSCTHitsOnTrack = False
        softQcdFlags.storeSCTHolesOnTrack = False
        softQcdFlags.storeSCTOutliersOnTrack = False
        softQcdFlags.storeTRTHitsOnTrack = False
        softQcdFlags.storeTRTHolesOnTrack = False
        softQcdFlags.storeTRTOutliersOnTrack = False
        softQcdFlags.storeTrackFitQuality = True
        softQcdFlags.storeTrackInfo = True
        softQcdFlags.storeTrackMomentum = True
        softQcdFlags.storeTrackPredictionAtBLayer = True
        softQcdFlags.storeTrackSummary = True
        softQcdFlags.trackParametersAtBeamSpotLevelOfDetails = 0
        softQcdFlags.trackParametersAtGlobalPerigeeLevelOfDetails = 2
        softQcdFlags.trackParametersAtPrimaryVertexLevelOfDetails = 2 

        SoftQCDTrackParticleD3PDObject = TrackD3PDObject(_label='trk',
                                                         _prefix='trk_',
                                                         _sgkey='GoodTracks',
                                                         typeName='Rec::TrackParticleContainer',
                                                         truthMapKey='TrackParticleTruthCollection',
                                                         SGKeyForTruth=D3PDMakerFlags.TrackSGKey(),
                                                         flags=softQcdFlags)

        alg += SoftQCDTrackParticleD3PDObject(**_args ( 3, 'Tracks1', kw,
                                                        sgkey  = 'GoodTracks',
                                                        label  = 'trk',
                                                        prefix = 'trk_'))

    else :

        # ... use standard level of track info for 'GoodTracks'

        alg += TrackParticleD3PDObject    (**_args ( 3, 'Tracks1', kw,
                                                     sgkey  = 'GoodTracks',
                                                     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.storeTrackSummary.IDOutliers = True
        highPtFlags.storeTrackSummary.PixelInfoPlus = True
        highPtFlags.storeTrackSummary.SCTInfoPlus = True
        highPtFlags.storeTrackSummary.TRTInfoPlus = True
        highPtFlags.storeTrackSummary.InfoPlus = True
        highPtFlags.trackParametersAtBeamSpotLevelOfDetails = 0
        highPtFlags.trackParametersAtGlobalPerigeeLevelOfDetails = 2
        highPtFlags.trackParametersAtPrimaryVertexLevelOfDetails = 3  

        HighPtTrackParticleD3PDObject = TrackD3PDObject(_label='trkpt4',
                                                        _prefix='trkpt4_',
                                                        _sgkey='HighPtTracks',
                                                        typeName='Rec::TrackParticleContainer',
                                                        truthMapKey='TrackParticleTruthCollection',
                                                        SGKeyForTruth=D3PDMakerFlags.TrackSGKey(),
                                                        flags=highPtFlags)

        alg += HighPtTrackParticleD3PDObject(**_args ( 3, 'Tracks2', kw,
                                                     sgkey  = 'HighPtTracks',
                                                     label  = 'trkpt4',
                                                     prefix = 'trkpt4_'))

    
    # Primary vertex block - May be missing in single-beam data.

    alg += PrimaryVertexD3PDObject (**_args (1, 'PrimaryVertex', kw,
                                             allowMissing = True,
                                             sgkey = D3PDMakerFlags.VertexSGKey(),
                                             prefix = 'vxp_'))
    
    # MBTS 

    alg += MBTSD3PDObject             (**_args (10, 'MBTS', kw))
    alg += MBTSTimeD3PDObject         (**_args (10, 'MBTSTime', kw))
    alg += MBTSTriggerBitsD3PDObject  (**_args (10, 'MBTSTriggerBits', kw))
    #alg += CollisionDecisionD3PDObject(**_args (10, 'CollisionDecision', kw))


    ### EventShape variables  Bertrand
    alg += EventShapeD3PDObject(**_args(0, 'rho', kw))

        
    # Truth

    if rec.doTruth():

        from TruthD3PDMaker.TruthParticleD3PDObject            import TruthParticleD3PDObject
        alg += TruthParticleD3PDObject(**_args ( 1, 'TruthParticle', kw))

        from MuonD3PDMaker.TruthMuonD3PDObject                 import TruthMuonD3PDObject
        alg += TruthMuonD3PDObject    (**_args ( 2, 'TruthMuon', kw))


        from AthenaCommon.AppMgr import ToolSvc
        from TruthD3PDAnalysis.TruthD3PDAnalysisConf import D3PD__GenObjectsFilterTool

        # ... remove empty GenEvents

        smwzGenEvtFilterTool = D3PD__GenObjectsFilterTool( "smwzGenEvtFilterTool" )
        ToolSvc += smwzGenEvtFilterTool
        smwzGenEvtFilterTool.RemoveDummyEvents = True
        smwzGenEvtFilterTool.RemoveInTimePileUp = True
        smwzGenEvtFilterTool.Remove2BCPileUp = True
        smwzGenEvtFilterTool.Remove800nsPileUp = True
        smwzGenEvtFilterTool.RemoveCavernBkg = True
        smwzGenEvtFilterTool.RemoveEmptyEvents = True

        from TruthD3PDMaker.GenEventD3PDObject                 import GenEventD3PDObject
        alg += GenEventD3PDObject     (**_args ( 0, 'GenEvent', kw, filter = smwzGenEvtFilterTool ))


        # ... TruthJets
        if not testSGKey ('JetCollection', 'AntiKt6TruthJets'):
            make_StandardJetGetter('AntiKt', 0.6, 'Truth')

        alg += JetD3PDObject          (**_args ( 1, 'AK4TruthJet', kw,
                                                 sgkey='AntiKt4TruthJets',prefix='jet_AntiKt4Truth_',
                                                 allowMissing = True))
        alg += JetD3PDObject          (**_args ( 1, 'AK6TruthJet', kw,
                                                 sgkey='AntiKt6TruthJets', prefix='jet_AntiKt6Truth_',
                                                 allowMissing = True))
        alg += JetD3PDObject          (**_args ( 1, 'AK4TruthJetALL', kw,
                                                 sgkey='AntiKt4TruthJets_ALL', prefix='jet_AntiKt4TruthALL_',
                                                 allowMissing = True))
        alg += JetD3PDObject          (**_args ( 1, 'AK6TruthJetALL', kw,
                                                 sgkey='AntiKt6TruthJets_ALL', prefix='jet_AntiKt6TruthALL_',
                                                 allowMissing = True))
        alg += JetD3PDObject          (**_args ( 1, 'AK4TruthJetWZ', kw,
                                                 sgkey='AntiKt4TruthJets_WZ', prefix='jet_AntiKt4TruthWZ_',
                                                 allowMissing = True))
        alg += JetD3PDObject          (**_args ( 1, 'AK6TruthJetWZ', kw,
                                                 sgkey='AntiKt6TruthJets_WZ', prefix='jet_AntiKt6TruthWZ_',
                                                 allowMissing = True))
        

        # ... heavy flavor truth information

        from AthenaCommon.AppMgr import ToolSvc
        from TruthD3PDAnalysis.TruthD3PDAnalysisConf import D3PD__GenObjectsFilterTool
        smwzhfGenVtxFilterTool = D3PD__GenObjectsFilterTool( "SMWZHFGenVtxFilterTool" )
        ToolSvc += smwzhfGenVtxFilterTool

        smwzhfGenVtxFilterTool.RemoveInTimePileUp = False
        smwzhfGenVtxFilterTool.Remove2BCPileUp = True
        smwzhfGenVtxFilterTool.Remove800nsPileUp = True
        smwzhfGenVtxFilterTool.RemoveCavernBkg =  True
        smwzhfGenVtxFilterTool.RemoveEmptyEvents = True
        smwzhfGenVtxFilterTool.RemoveDummyEvents = True
        smwzhfGenVtxFilterTool.RemoveUnrequestedParticles=True
        smwzhfGenVtxFilterTool.KeepBCHadrons=True

        from TruthD3PDMaker.GenVertexD3PDObject import GenVertexD3PDObject
        alg += GenVertexD3PDObject( **_args(0, "hfgenvertex", kw, prefix='mchfvtx_',
                                            filter = smwzhfGenVtxFilterTool )
                                      )

        smwzhfGenPartFilterTool = D3PD__GenObjectsFilterTool( "SMWZHFGenPartFilterTool" )
        ToolSvc += smwzhfGenPartFilterTool

        smwzhfGenPartFilterTool.RemoveInTimePileUp = False
        smwzhfGenPartFilterTool.Remove2BCPileUp = True
        smwzhfGenPartFilterTool.Remove800nsPileUp = True
        smwzhfGenPartFilterTool.RemoveCavernBkg =  True
        smwzhfGenPartFilterTool.RemoveEmptyEvents = True
        smwzhfGenPartFilterTool.RemoveDummyEvents = True
        smwzhfGenPartFilterTool.RemoveUnrequestedParticles=True
        smwzhfGenPartFilterTool.KeepBCQuarks=True
        smwzhfGenPartFilterTool.KeepBCQuarkAncestors=True
        smwzhfGenPartFilterTool.KeepBCHadrons=True
        smwzhfGenPartFilterTool.KeepBCHadronDecayChain=True
        smwzhfGenPartFilterTool.BCHadronsDescendantsPtCut=200
        smwzhfGenPartFilterTool.BCHadronsDescendantsBarcodeCut=300000
        smwzhfGenPartFilterTool.BCHadronsDescendantsEtaCut=5

        from TruthD3PDMaker.GenParticleD3PDObject import GenParticleD3PDObject
        alg += GenParticleD3PDObject( **_args(10, "hfgenparticle", kw, prefix='mchfpart_',
                                              filter = smwzhfGenPartFilterTool,
                                              GenParticle_WriteMotherType=False,
                                              GenParticle_WriteMotherBarcode=False
                                              )
                                        )

        # ...  leptonic W/Z truth information

        smwzlepwzGenPartFilterTool = D3PD__GenObjectsFilterTool( "SMWZLepWZGenPartFilterTool" )
        ToolSvc += smwzlepwzGenPartFilterTool

        smwzlepwzGenPartFilterTool.RemoveInTimePileUp = True
        smwzlepwzGenPartFilterTool.Remove2BCPileUp = True
        smwzlepwzGenPartFilterTool.Remove800nsPileUp = True
        smwzlepwzGenPartFilterTool.RemoveCavernBkg =  True
        smwzlepwzGenPartFilterTool.RemoveEmptyEvents = True
        smwzlepwzGenPartFilterTool.RemoveDummyEvents = True
        smwzlepwzGenPartFilterTool.RemoveUnrequestedParticles=True
        smwzlepwzGenPartFilterTool.KeepLeptonicWZBosons=True
        smwzlepwzGenPartFilterTool.KeepLeptonicWZBosonDecayChains=True
        smwzlepwzGenPartFilterTool.KeepLeptonicWZBosonsParents=True

        from TruthD3PDMaker.GenParticleD3PDObject import GenParticleD3PDObject
        alg += GenParticleD3PDObject( **_args(10, "lepwzgenparticle", kw, prefix='mclepwzpart_',
                                              filter = smwzlepwzGenPartFilterTool,
                                              label = "LepWZTruthD3PDObject",
                                              exclude = ["GenPartProdVertexAssoc","GenPartDecayVertexAssoc"],
                                              GenParticle_WriteMotherType=False,
                                              GenParticle_WriteMotherBarcode=False,
                                              GenPartMotherAssoc_target="LepWZTruthD3PDObject",
                                              GenPartChildAssoc_target="LepWZTruthD3PDObject"
                                              )
                                        )


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

    if D3PDMakerFlags.DoTrigger():

        alg += SMWZTriggerBitsD3PDObject      (**_args (10, 'SMWZTriggerBits', kw))
        
        # Trigger Decision + metadata

        alg += TrigDecisionD3PDObject  (**_args(10, 'TrigDecision', kw))
        addTrigConfMetadata(alg)
        
        # Bunch group info

        alg += BGCodeD3PDObject (**_args (2, 'BGCode', kw))

        # Egamma and Mu
        
        TrigEgammaD3PDObjects (alg, 1)
        TrigMuonD3PDObjects( alg, 1)

        # MET
        
        TrigMETD3PDObjects (alg, 2)

        # The BJet information:

        TrigBJetD3PDObjects(alg,10, False, False, True, True, True)

# Event metadata

    alg.MetadataTools += [LBMetadataConfig()]

    if D3PDMakerFlags.FilterCollCand():
        from CaloD3PDMaker.CollisionFilterAlg import CollisionFilterAlg
        alg.filterSeq += CollisionFilterAlg (tuplename + '_CollCandFilter')

    return alg
コード例 #22
0

#from JetD3PDMaker.JetD3PDObject import JetD3PDObject
#from JetTagD3PDMaker.AddBTagD3PDInfo import addBTagInfoToJetObject
#### use a deepcopy of the JetD3PDObject before changing it - not to break other d3pds if runned at the same time
#import copy
#JetTagJetD3PDObject=copy.deepcopy(JetD3PDObject)
#JetTagJetD3PDObject = JetD3PDObject
# # ### add btag blocks
# addBTagInfoToJetObject(JetTagJetD3PDObject,-10)

## create a new JetD3PDObject for btagging
JetTagJetD3PDObject = getJetD3PDObject(
    objectname='JetTagJetD3PDObject',
    prefix='jet_',
    btagleveloffset=JetTagD3PDFlags.LevelOffset())

### change the maker. needed to pass extra argument to the hook function
JetTagJetD3PDObject._maker = make_JetTagJet_D3PDObject
### define hook ### add the filter at the beggining
hooklist = JetTagJetD3PDObject._hooks
JetTagJetD3PDObject._hooks = [_jetFilterAlgHook] + hooklist
#JetTagJetD3PDObject.defineHook(_jetFilterAlgHook)

#
## get the configured JetTagJetD3PDObject
## jet collection storegate key should be specified. Also the key to be used for the filtered collection
## use multiple call for different jet collections
#

コード例 #23
0
def HSG5D3PD (alg = None,
              file = 'hsg5.root',
              tuplename = 'physics',
              streamname = 'd3pdstream',
              flags=HSG5Flags,
              **kw):

    if flags.doTaus():
        # tau
        from TauD3PDMaker.TauD3PDObject                        import TauD3PDObject

    # define associations
    if flags.doPhotons() and not PhotonD3PDObject.allBlocknames().has_key('RecoveryMatch'):
        from PhotonD3PDMaker.PhotonRecoveryAssociation import PhotonRecoveryAssociation
        PhotonRecoveryAssoc = PhotonRecoveryAssociation(PhotonD3PDObject,
                                                        'ElectronContainer',
                                                        D3PDMakerFlags.ElectronSGKey(),
                                                        prefix = 'el_',
                                                        blockname = 'RecoveryMatch',
                                                        target = 'ph_ElectronRecovered_')
        

    # define track and cluster filters

    preseq = AlgSequence (D3PDMakerFlags.PreD3PDAlgSeqName())

    if flags.doGoodTracks() and not hasattr( preseq, "GoodTracks" ):
        filter1 = makeTrackFilterAlg(TracksName = D3PDMakerFlags.TrackSGKey(),
                                     OutputTracksName='GoodTracks',
                                     ptCut=0.,nSCTPix=4)
        preseq += filter1
                    
    if flags.doHighPtTracks() and not hasattr( preseq, "HighPtTracks" ):
        filter2 = makeTrackFilterAlg(TracksName = D3PDMakerFlags.TrackSGKey(),
                                     OutputTracksName='HighPtTracks',
                                     ptCut=5000.,nSCTPix=4)
        preseq += filter2


    if flags.doHighPtClusters() and not hasattr( preseq, "HighPtClusters" ):
        filter3 = makeClusterFilter(InputName  = D3PDMakerFlags.ClusterSGKey(),
                                    OutputName = 'HighPtClusters',
                                    ptCut=10000.)
        preseq += filter3

    if flags.doHighPtEMClusters() and not hasattr( preseq, "HighPtEMClusters" ):
        filter4 = makeClusterFilter(InputName  = D3PDMakerFlags.EMTopoClusterSGKey(),
                                    OutputName = 'HighPtEMClusters',
                                    ptCut=10000.)
        preseq += filter4

    # perform recoil calculation
     
    if flags.doHadronicRecoil(): 
        from HadronicRecoil.HadronicRecoilConf import HadronicRecoil__ElectronSelector
        from HadronicRecoil.HadronicRecoilConf import HadronicRecoil__MuonSelector
        from HadronicRecoil.HadronicRecoilConf import HadronicRecoil__EflowSelector
        from HadronicRecoil.HadronicRecoilConf import HadronicRecoil__RecoilCalculation
        from HadronicRecoil.HadronicRecoilConf import HadronicRecoil__EflowRecoil
        
        if not hasattr( preseq, "HadronicRecoil::ElectronSelector" ):
            preseq += HadronicRecoil__ElectronSelector()
        if not hasattr( preseq, "HadronicRecoil::MuonSelector" ):
            preseq += HadronicRecoil__MuonSelector()
        if not hasattr( preseq, "HadronicRecoil::EflowSelector" ):
            preseq += HadronicRecoil__EflowSelector()
        if not hasattr( preseq, "HadronicRecoil::RecoilCalculation" ):
            preseq += HadronicRecoil__RecoilCalculation( ConeSizes = [0.20] )
        if not hasattr( preseq, "EflowRecoil_20" ):
            preseq += HadronicRecoil__EflowRecoil("EflowRecoil_20", 
                                                  TrackRough       = "RoughRecoil_track_20", 
                                                  TrackUE          = "ueCorrection_track_20", 
                                                  TrackRef         = "RefinedRecoil_track_20", 
                                                  ClusNoTrackRough = "RoughRecoil_clusNoTrack_20", 
                                                  ClusNoTrackUE    = "ueCorrection_clusNoTrack_20", 
                                                  ClusNoTrackRef   = "RefinedRecoil_clusNoTrack_20", 
                                                  RoughRecoil_out  = "RoughRecoil_Eflow_20", 
                                                  ueCorrection_out = "ueCorrection_Eflow_20", 
                                                  RefinedRecoil_out= "RefinedRecoil_Eflow_20", 
                                                  MET_out          = "MET_HR_Eflow_20" ) 
            
    # now configure the D3PD
    
    if not alg:
        alg = MSMgr.NewRootStream(StreamName = streamname, FileName = file, TreeName = tuplename)

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

    from TriggerD3PDMaker.BunchStructureMetadata import addBunchStructureMetadata
    addBunchStructureMetadata (alg)

    # Eta rings of energy
    # FIXME brian crashing aod running
    if not rec.readAOD:
        from CaloD3PDMaker.RapgapD3PDObject       import EtaRingsNonTileD3PDObject
        from CaloD3PDMaker.RapgapD3PDObject       import EtaRingsD3PDObject

        alg += EtaRingsNonTileD3PDObject  ( **_args ( 0, 'EtaRings', kw) )
        alg += EtaRingsD3PDObject         ( **_args ( 0, 'EtaRings', kw) )
    
    # Electron/Photon blocks
    
    alg += ElectronD3PDObject         (**_args (10, 'Electron', kw))

    if testSGKey ('ElectronContainer', D3PDMakerFlags.GSFElectronSGKey()):
        alg += GSFElectronD3PDObject  (**_args (10, 'GSFElectron', kw,
                                                sgkey = D3PDMakerFlags.GSFElectronSGKey(),
                                                prefix = 'el_gsf_'))

    if flags.doPhotons():
        print "adding photons"
        alg += PhotonD3PDObject           (**_args (10, 'Photon', kw))


    # Muon blocks

     ### add the scattering significance filler - to be removed when added in the MuonD3PDMaker
    if not MuonD3PDObject.allBlocknames().has_key("MuonScatteringAngleSignificance"):
        from AthenaCommon.AppMgr import ToolSvc
        muonScatteringSigTool=None
        if hasattr(ToolSvc, "MuonScatteringSigTool"):
            muonScatteringSigTool=ToolSvc.MuonScatteringSigTool
        from JetTagD3PDMaker import MuonScatteringAngleSignificanceFillerTool
        MuonD3PDObject.defineBlock (100, "MuonScatteringAngleSignificance",
                                    MuonScatteringAngleSignificanceFillerTool,
                                    ScatteringSigTool=muonScatteringSigTool)

    alg += MuonD3PDObject             (**_args (10, 'MuidMuon', kw,
                                                sgkey='MuidMuonCollection', prefix='mu_muid_',
                                                include = ["EFCBInfoIndex", "EFMGInfoIndex", "EFMEInfoIndex",
                                                           "L2CBInfoIndex", "L1InfoIndex"],
                                                exclude = ["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
                                                allowMissing = True ))

    alg += MuonD3PDObject             (**_args (10, 'StacoMuon', kw,
                                                sgkey='StacoMuonCollection', prefix='mu_staco_',
                                                include = ["EFCBInfoIndex", "EFMGInfoIndex", "EFMEInfoIndex",
                                                           "L2CBInfoIndex", "L1InfoIndex"],
                                                exclude = ["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
                                                allowMissing = True ))
    
    from AthenaCommon.KeyStore import CfgItemList
    if CfgItemList("KeyStore_inputFile").has_item("Analysis::MuonContainer#Muons"):
        alg += MuonD3PDObject             (**_args (10, 'Muons', kw,
                                                    sgkey='Muons', prefix='mu_muons_',
                                                    include = ["EFCBInfoIndex", "EFMGInfoIndex", "EFMEInfoIndex",
                                                               "L2CBInfoIndex", "L1InfoIndex"],
                                                    exclude = ["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
                                                    allowMissing = True ))

    alg += MuonD3PDObject             (**_args (0, 'CaloMuon', kw, sgkey='CaloMuonCollection', prefix='mu_calo_',
                                                include = ["MuonHitSummary", "Authors", "Likelihood",
                                                           "Isolation", "CaloEnergyLoss", "Quality"] ))
    
    # Tau block

    if flags.doTaus():
        alg += TauD3PDObject              (**_args ( 1, 'Tau', kw))



     # track and cluster blocks

    # ... all clusters, very low LOD
    
    alg += ClusterD3PDObject          (**_args ( 0, 'Clusters1', kw,
                                                 exclude='SamplingBasics'))

    # ... higher LOD for pt>10 GeV
    if flags.doHighPtClusters():
        alg += ClusterD3PDObject          (**_args ( 2, 'Clusters2', kw,
                                                     sgkey  = 'HighPtClusters',
                                                     prefix = 'clpt10_'))

    if flags.doHighPtEMClusters():    
        alg += ClusterD3PDObject          (**_args ( 3, 'Clusters3', kw,
                                                     sgkey  = 'HighPtEMClusters',
                                                     prefix = 'emclpt10_'))

    from TrackD3PDMaker.TrackD3PDObject import TrackD3PDObject    

    # ... good tracks only (nSCT>3; no pt cut)

    # use standard level of track info for 'GoodTracks'

    if flags.doGoodTracks():
        # use standard level of track info for 'GoodTracks'
        alg += TrackParticleD3PDObject    (**_args ( 3, 'Tracks1', kw,
                                                     sgkey  = 'GoodTracks',
                                                     label  = 'trk',
                                                     prefix = 'trk_'))
            
        # ... high-pt tracks (nSCT>3; pt>5 GeV)
            
    if flags.doHighPtTracks():
        
        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.storeTrackSummary.IDOutliers = True
        highPtFlags.storeTrackSummary.PixelInfoPlus = True
        highPtFlags.storeTrackSummary.SCTInfoPlus = True
        highPtFlags.storeTrackSummary.TRTInfoPlus = True
        highPtFlags.storeTrackSummary.InfoPlus = True
        highPtFlags.trackParametersAtBeamSpotLevelOfDetails = 0
        highPtFlags.trackParametersAtGlobalPerigeeLevelOfDetails = 2
        highPtFlags.trackParametersAtPrimaryVertexLevelOfDetails = 3  

        HighPtTrackParticleD3PDObject = TrackD3PDObject(_label='trkpt5',
                                                        _prefix='trkpt5_',
                                                        _sgkey='HighPtTracks',
                                                        typeName='Rec::TrackParticleContainer',
                                                        flags=highPtFlags)
            
        alg += HighPtTrackParticleD3PDObject(**_args ( 3, 'Tracks2', kw,
                                                       sgkey  = 'HighPtTracks',
                                                       label  = 'trkpt5',
                                                       prefix = 'trkpt5_'))

  
    # Jet blocks
    
    from JetTagD3PDMaker.JetTagD3PDMakerFlags import JetTagD3PDFlags

    # include list modified for HSG5D3PD
    
    includelist = JetTagD3PDFlags.StdInfoInclude()

    from JetTagD3PDMaker.JetTagD3PDMakerKeys import JetTagD3PDKeys
    includelist += [JetTagD3PDKeys.BTagWeightsBlockName()]
    #includelist += [JetTagD3PDKeys.JetFitterInfoBaseBlockName()] 
    #includelist += [JetTagD3PDKeys.JetFitterTagInfoBlockName()] 
    #includelist += [JetTagD3PDKeys.IP3DInfoBaseBlockName()] 
    #includelist += [JetTagD3PDKeys.IP3DIPInfoBaseBlockName()] 
    #includelist += [JetTagD3PDKeys.JetFitterCombInfoBaseBlockName()] 
    includelist += [JetTagD3PDKeys.JetTrackAssocBlockName()] 
    includelist += [JetTagD3PDKeys.JetTrackBlockName()] 
    includelist += [JetTagD3PDKeys.IPInfoPlusTrackAssocBlockName()] 
    includelist += [JetTagD3PDKeys.IPInfoPlusTrackBlockName()] 
    includelist += ['ConstituentScale']
    
    jetkw = kw
    if not jetkw.has_key ( 'AK4TopoEMJet_'+JetTagD3PDKeys.JetTrackAssocBlockName()+'_target'):
        jetkw['AK4TopoEMJet_'+JetTagD3PDKeys.JetTrackAssocBlockName()+'_target']= "trk" 
    if not jetkw.has_key ( 'AK4TopoEMJet_'+JetTagD3PDKeys.IPInfoPlusTrackAssocBlockName()+'_target'):
        jetkw['AK4TopoEMJet_'+JetTagD3PDKeys.IPInfoPlusTrackAssocBlockName()+'_target']= "trk" 

    alg += JetD3PDObject              (**_args ( 3, 'AK4TopoEMJet', jetkw,
                                                 sgkey='AntiKt4TopoEMJets', prefix='jet_AntiKt4TopoEM_',
                                                 include = includelist,
                                                 JetVertexFraction_FromUD=True,
                                                 JetVertexFraction_FillFullJVF=True,
                                                 allowMissing = True))

    alg += JetD3PDObject              (**_args ( 3, 'AK6TopoEMJet', kw,
                                                 sgkey='AntiKt6TopoEMJets', prefix='jet_AntiKt6TopoEM_',
                                                 include = [JetTagD3PDFlags.StdInfoInclude(),'ConstituentScale'],
                                                 JetVertexFraction_FromUD=True,
                                                 JetVertexFraction_FillFullJVF=True,
                                                 allowMissing = True))

    alg += JetD3PDObject              (**_args ( 3, 'AK4LCTopoJet', kw,
                                                 sgkey='AntiKt4LCTopoJets', prefix='jet_AntiKt4LCTopo_',
                                                 exclude=['Layer'],
                                                 include=['ConstituentScale'],
                                                 JetVertexFraction_FromUD=True,
                                                 JetVertexFraction_FillFullJVF=True,
                                                 allowMissing = True))
    
    alg += JetD3PDObject              (**_args ( 3, 'AK6LCTopoJet', kw,
                                                 sgkey='AntiKt6LCTopoJets', prefix='jet_AntiKt6LCTopo_',
                                                 exclude=['Layer'],
                                                 include=['ConstituentScale'],
                                                 JetVertexFraction_FromUD=True,
                                                 JetVertexFraction_FillFullJVF=True,
                                                 allowMissing = True))


    from TopInputsD3PDMaker.HforD3PDObject import HforD3PDObject
    alg += HforD3PDObject(**_args (0, 'HforInfo', kw))


    # MET blocks
    # a whole mess to remove x,y components separately for all flavours

    if flags.doAllMissingET() :
        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_Muons_Comps','MET_Muons_Spectro_Comps','MET_Muons_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_RefMons_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_RefMuons_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','MET_Comps',
                                                             'MET_Track_Weights','MET_Cluster_Weights'],
                                                    allowMissing=True))
    else :
        alg += MissingETD3PDObject(0, sgkey = "MET_RefFinal",                prefix = "MET_RefFinal")

        # MuonBoy terms used in RefFinal
        alg += MissingETD3PDObject(0, sgkey = "MET_MuonBoy",                 prefix = "MET_MuonBoy")
        alg += MissingETD3PDObject(0, sgkey = "MET_RefMuon",                 prefix = "MET_RefMuon")
        alg += MissingETD3PDObject(0, sgkey = "MET_CellOut_Eflow",           prefix = "MET_CellOut_Eflow")

        # terms needed to calculate RefFinal with Muid instead of Staco
        alg += MissingETD3PDObject(0, sgkey = "MET_RefMuon_Muid",            prefix = "MET_RefMuon_Muid")
        alg += MissingETD3PDObject(0, sgkey = "MET_MuonMuid",                prefix = "MET_MuonMuid")
        alg += MissingETD3PDObject(0, sgkey = "MET_Muid",                    prefix = "MET_Muid")
        alg += MissingETD3PDObject(0, sgkey = "MET_CellOut_Eflow_Muid",      prefix = "MET_CellOut_Eflow_Muid")

        # terms needed to calculate RefFinal with third chain instead of Staco
        from AthenaCommon.KeyStore import CfgItemList
        keystore = CfgItemList("KeyStore_inputFile")
        if keystore.has_item("MissingET#MET_Muons"):
            alg += MissingETD3PDObject(0, sgkey = "MET_Muons",                    prefix = "MET_Muons")
        if keystore.has_item("MissingET#MET_RefMuons"):
            alg += MissingETD3PDObject(0, sgkey = "MET_RefMuons",                 prefix = "MET_RefMuons")
        if keystore.has_item("MissingET#MET_CellOut_Eflow_Muons"):
            alg += MissingETD3PDObject(0, sgkey = "MET_CellOut_Eflow_Muons",      prefix = "MET_CellOut_Eflow_Muons")
        
        # I have no idea what these are for
        alg += MissingETD3PDObject(0, sgkey = "MET_SoftJets",                prefix = "MET_SoftJets")
        alg += MissingETD3PDObject(0, sgkey = "MET_RefFinal_em",             prefix = "MET_RefFinal_em")
        alg += MissingETD3PDObject(0, sgkey = "MET_CellOut_em",              prefix = "MET_CellOut_em")
        alg += MissingETD3PDObject(0, sgkey = "MET_SoftJets_em",             prefix = "MET_SoftJets_em")
                   

    # HadronicRecoil blocks

    if flags.doHadronicRecoil():
        alg += ElectronD3PDObject(0,  sgkey = "HR_selectedElectrons",       prefix = "hr_el_")
        alg += MuonD3PDObject( 0,     sgkey = "HR_selectedMuons",           prefix = "hr_mu_" )
        
        alg += MissingETD3PDObject(0, sgkey = "RoughRecoil_20",                prefix = "hr_roughRecoil_20", 
                                   exclude=['MET_Regions','MET_Comps'] )  
        alg += MissingETD3PDObject(0, sgkey = "ueCorrection_20",               prefix = "hr_ueCorrection_20",
                                   exclude=['MET_Regions','MET_Comps'] )  
        alg += MissingETD3PDObject(0, sgkey = "RefinedRecoil_20",              prefix = "hr_corrRecoil_20",
                                   exclude=['MET_Regions','MET_Comps'] )  
        alg += MissingETD3PDObject(0, sgkey = "MET_HR_20",                     prefix = "hr_MET_20",
                                   exclude=['MET_Regions','MET_Comps'] )  
        
        alg += MissingETD3PDObject(0, sgkey = "RoughRecoil_track_20",          prefix = "hr_roughRecoil_track_20",
                                   exclude=['MET_Regions','MET_Comps'] )  
        alg += MissingETD3PDObject(0, sgkey = "ueCorrection_track_20",         prefix = "hr_ueCorrection_track_20",
                                   exclude=['MET_Regions','MET_Comps'] )  
        alg += MissingETD3PDObject(0, sgkey = "RefinedRecoil_track_20",        prefix = "hr_corrRecoil_track_20",
                                   exclude=['MET_Regions','MET_Comps'] )  
        alg += MissingETD3PDObject(0, sgkey = "MET_HR_track_20",               prefix = "hr_MET_track_20",
                                   exclude=['MET_Regions','MET_Comps'] )  
        
        alg += MissingETD3PDObject(0, sgkey = "RoughRecoil_clusNoTrack_20",    prefix = "hr_roughRecoil_clusNoTrack_20",
                                   exclude=['MET_Regions','MET_Comps'] )  
        alg += MissingETD3PDObject(0, sgkey = "ueCorrection_clusNoTrack_20",   prefix = "hr_ueCorrection_clusNoTrack_20",
                                   exclude=['MET_Regions','MET_Comps'] )  
        alg += MissingETD3PDObject(0, sgkey = "RefinedRecoil_clusNoTrack_20",  prefix = "hr_corrRecoil_clusNoTrack_20",
                                   exclude=['MET_Regions','MET_Comps'] )  
        alg += MissingETD3PDObject(0, sgkey = "MET_HR_clusNoTrack_20",         prefix = "hr_MET_clusNoTrack_20",
                                   exclude=['MET_Regions','MET_Comps'] )  
        
        alg += MissingETD3PDObject(0, sgkey = "RoughRecoil_Eflow_20",          prefix = "hr_roughRecoil_Eflow_20",
                                   exclude=['MET_Regions','MET_Comps'] )  
        alg += MissingETD3PDObject(0, sgkey = "ueCorrection_Eflow_20",         prefix = "hr_ueCorrection_Eflow_20",
                                   exclude=['MET_Regions','MET_Comps'] )  
        alg += MissingETD3PDObject(0, sgkey = "RefinedRecoil_Eflow_20",        prefix = "hr_corrRecoil_Eflow_20",
                                   exclude=['MET_Regions','MET_Comps'] )  
        alg += MissingETD3PDObject(0, sgkey = "MET_HR_Eflow_20",               prefix = "hr_MET_Eflow_20", 
                                   exclude=['MET_Regions','MET_Comps'] )  


    """
    # track and cluster blocks

    # ... all clusters, very low LOD
    
    alg += ClusterD3PDObject          (**_args ( 0, 'Clusters1', kw,
                                                 exclude='SamplingBasics'))

    # ... higher LOD for pt>10 GeV
    if flags.doHighPtClusters():
        alg += ClusterD3PDObject          (**_args ( 2, 'Clusters2', kw,
                                                     sgkey  = 'HighPtClusters',
                                                     prefix = 'clpt10_'))

    if flags.doHighPtEMClusters():    
        alg += ClusterD3PDObject          (**_args ( 3, 'Clusters3', kw,
                                                     sgkey  = 'HighPtEMClusters',
                                                     prefix = 'emclpt10_'))

    from TrackD3PDMaker.TrackD3PDObject import TrackD3PDObject    

    # ... good tracks only (nSCT>3; no pt cut)

    # use standard level of track info for 'GoodTracks'

    if flags.doGoodTracks():
        # use standard level of track info for 'GoodTracks'
        alg += TrackParticleD3PDObject    (**_args ( 3, 'Tracks1', kw,
                                                     sgkey  = 'GoodTracks',
                                                     label  = 'trk',
                                                     prefix = 'trk_'))
            
        # ... high-pt tracks (nSCT>3; pt>5 GeV)
            
    if flags.doHighPtTracks():
        
        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.storeTrackSummary.IDOutliers = True
        highPtFlags.storeTrackSummary.PixelInfoPlus = True
        highPtFlags.storeTrackSummary.SCTInfoPlus = True
        highPtFlags.storeTrackSummary.TRTInfoPlus = True
        highPtFlags.storeTrackSummary.InfoPlus = True
        highPtFlags.trackParametersAtBeamSpotLevelOfDetails = 0
        highPtFlags.trackParametersAtGlobalPerigeeLevelOfDetails = 2
        highPtFlags.trackParametersAtPrimaryVertexLevelOfDetails = 3  

        HighPtTrackParticleD3PDObject = TrackD3PDObject(_label='trkpt5',
                                                        _prefix='trkpt5_',
                                                        _sgkey='HighPtTracks',
                                                        typeName='Rec::TrackParticleContainer',
                                                        flags=highPtFlags)
            
        alg += HighPtTrackParticleD3PDObject(**_args ( 3, 'Tracks2', kw,
                                                       sgkey  = 'HighPtTracks',
                                                       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_'))
            
    # MBTS 
            
    alg += MBTSD3PDObject             (**_args (10, 'MBTS', kw))
    alg += MBTSTimeD3PDObject         (**_args (10, 'MBTSTime', kw))
    alg += MBTSTriggerBitsD3PDObject  (**_args (10, 'MBTSTriggerBits', kw))
    #alg += CollisionDecisionD3PDObject(**_args (10, 'CollisionDecision', kw))
    
    # Truth

    if rec.doTruth():

        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))
        alg += JetD3PDObject          (**_args ( 1, 'AK6TruthJet', kw,
                                                 sgkey='AntiKt6TruthJets', prefix='jet_AntiKt6Truth_',
                                                 allowMissing = True))
        alg += JetD3PDObject          (**_args ( 1, 'AK4TruthJetALL', kw,
                                                 sgkey='AntiKt4TruthJets_ALL', prefix='jet_AntiKt4TruthALL_',
                                                 allowMissing = True))
        alg += JetD3PDObject          (**_args ( 1, 'AK6TruthJetALL', kw,
                                                 sgkey='AntiKt6TruthJets_ALL', prefix='jet_AntiKt6TruthALL_',
                                                 allowMissing = True))
        alg += JetD3PDObject          (**_args ( 1, 'AK4TruthJetWZ', kw,
                                                 sgkey='AntiKt4TruthJets_WZ', prefix='jet_AntiKt4TruthWZ_',
                                                 allowMissing = True))
        alg += JetD3PDObject          (**_args ( 1, 'AK6TruthJetWZ', kw,
                                                 sgkey='AntiKt6TruthJets_WZ', prefix='jet_AntiKt6TruthWZ_',
                                                 allowMissing = True))
        

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

    from TrigMissingETD3PDMaker.TrigMETD3PD import TrigMETD3PDObjects
    TrigMETD3PDObjects(alg,10)
    
    # Trigger

    if D3PDMakerFlags.DoTrigger():

        alg += SMWZTriggerBitsD3PDObject      (**_args (10, 'SMWZTriggerBits', kw))
        
        # Trigger Decision + metadata

        alg += TrigDecisionD3PDObject  (**_args(10, 'TrigDecision', kw))
        addTrigConfMetadata(alg)
        
        # Bunch group info

        alg += BGCodeD3PDObject (**_args (2, 'BGCode', kw))

        # Egamma and Mu
        
        TrigEgammaD3PDObjects (alg, 1)
        TrigMuonD3PDObjects( alg, 1)

        # Esum

        #alg += EnergySumROID3PDObject(**_args (2, 'EnergySumROI', kw,
        #                                       prefix = "trig_L1_esum_"))

        # The LVL2 information:

        #alg += TrigMETD3PDObject(**_args( 2, 'TrigMETL2', kw,
        #                                  prefix = "trig_L2_met_",
        #                                  sgkey = "HLT_T2MissingET" ))
        # The EF information:

        #alg += TrigMETD3PDObject(**_args ( 2, 'TrigMETEF', kw,
        #                                   prefix = "trig_EF_met_",
        #                                   sgkey = "HLT_TrigEFMissingET" ))

# Event metadata

    alg.MetadataTools += [LBMetadataConfig()]

# Invoke routine to write GSCFactor and WidthFraction jet moments

    #addSTRUCTCalib('AntiKt4LCTopoJets', input='Topo', mainParam=0.4)
    #addSTRUCTCalib('AntiKt6LCTopoJets', input='Topo', mainParam=0.6)
    #addSTRUCTCalib('AntiKt4TopoEMJets', input='Topo', mainParam=0.4)
    #addSTRUCTCalib('AntiKt6TopoEMJets', input='Topo', mainParam=0.6)
    
    if D3PDMakerFlags.FilterCollCand():
        from CaloD3PDMaker.CollisionFilterAlg import CollisionFilterAlg
        alg.filterSeq += CollisionFilterAlg (tuplename + '_CollCandFilter')

    return alg
コード例 #24
0
    level=1,
    matched='hastrack',
    blockname="",
    prefix="me_",
    Type='MuonExtrapolated')

ExTrackParticlePerigeeAssoc = SimpleAssociation(
    MuonExtrapolatedTrackAssoc,
    TrackD3PDMaker.TrackParticlePerigeeAtPVAssociationTool,
    level=1,
    prefix='')

ExTrackParticlePerigeeAssoc.defineBlock(1, 'ExTrkParameters',
                                        TrackD3PDMaker.PerigeeFillerTool)

if JetTagD3PDFlags.TrackAssocLabel() != "":

    MuonInDetTrackAssoc = IndexAssociation(
        JetTagMuonInJetD3PDObject,
        MuonD3PDMaker.MuonTrackParticleAssociationTool,
        JetTagD3PDFlags.TrackAssocLabel(),
        level=0,
        prefix=JetTagD3PDKeys.MuonInDetTrackAssocPrefix(),
        Type='InDet')

#
## get the MuonInJetObject
## jet collections to be used should be specified
#

コード例 #25
0
    addToIncludeBlocks('AntiKt4LCTopoJets' + jettagd3pd_jetnamepostfix,
                       ['ConstituentScale', 'TracksMoments'])
if JetTagD3PD_AntiKt6LCTopo:
    JetTagD3PDFlags.JetCollections += [
        'AntiKt6LCTopoJets' + jettagd3pd_jetnamepostfix
    ]
    addToIncludeBlocks('AntiKt6LCTopoJets' + jettagd3pd_jetnamepostfix,
                       ['ConstituentScale', 'TracksMoments'])

    ### configure btagging for additional jet collections
if JetTagD3PD_AntiKt4MuonNonInteractingTruth:
    JetTagD3PDFlags.JetCollections += [
        'AntiKt4MuonNonInteractingTruthJets' + jettagd3pd_jetnamepostfix
    ]
    JetTagD3PDFlags.D3PDPropDict().update({
        "AntiKt4MuonNonInteractingTruthJets" + jettagd3pd_jetnamepostfix + "_level":
        0
    })
    if JetTagD3PD_runJVF:
        JetTagD3PDFlags.D3PDPropDict().update({
            "AntiKt4MuonNonInteractingTruthJets" + jettagd3pd_jetnamepostfix + "_include":
            ["JVtx"]
        })

if JetTagD3PD_AntiKt6MuonNonInteractingTruth:
    JetTagD3PDFlags.JetCollections += [
        'AntiKt6MuonNonInteractingTruthJets' + jettagd3pd_jetnamepostfix
    ]
    JetTagD3PDFlags.D3PDPropDict().update({
        "AntiKt6MuonNonInteractingTruthJets" + jettagd3pd_jetnamepostfix + "_level":
        0
    })