コード例 #1
0
class StdInfoInclude(JobProperty):
    """ Standard include blocks needed by physics groups
    """
    statusOn=True
    allowedTypes=['list']
    StoredValue=[
        JetTagD3PDKeys.BTagWeightsBlockName(),
        JetTagD3PDKeys.TruthInfoBlockName(),
        JetTagD3PDKeys.PUTruthInfoBlockName(),
        JetTagD3PDKeys.IP2DInfoBaseBlockName(),
        JetTagD3PDKeys.IP2DIPInfoBaseBlockName(),
        JetTagD3PDKeys.IP3DInfoBaseBlockName(),
        JetTagD3PDKeys.IP3DIPInfoBaseBlockName(),
        JetTagD3PDKeys.SV1InfoBaseBlockName(),
        JetTagD3PDKeys.SV2InfoBaseBlockName(),
        JetTagD3PDKeys.JetFitterInfoBaseBlockName(),
        JetTagD3PDKeys.JetFitterCombInfoBaseBlockName(),
        JetTagD3PDKeys.JetFitterTagInfoBlockName(),
        JetTagD3PDKeys.IPInfoPlusTrackBlockName(),
        JetTagD3PDKeys.SVInfoPlusBlockName(),
        JetTagD3PDKeys.SV0InfoPlusBlockName()
        ]
コード例 #2
0
def addJetsInfo(alg=None,
                file='physics.root',
                tuplename='physics',
                tmpFlag=True,
                **kw):

    print "adding Jets info..."

    if not alg:
        from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
        alg = MSMgr.NewRootStream(tuplename, file)

    flags = CommonD3PDMakerFlags

    #ExtendedJetD3PDObject = JetD3PDObject.copy()

    # add track index for track jets
    if not kw.has_key('AntiKt4Track_' +
                      JetTagD3PDKeys.JetTrackAssocBlockName() + '_target'):
        kw['AntiKt4Track_' + JetTagD3PDKeys.JetTrackAssocBlockName() +
           '_target'] = "trk"
    if not kw.has_key('AntiKt3Track_' +
                      JetTagD3PDKeys.JetTrackAssocBlockName() + '_target'):
        kw['AntiKt3Track_' + JetTagD3PDKeys.JetTrackAssocBlockName() +
           '_target'] = "trk"
    if not kw.has_key('AntiKt2Track_' +
                      JetTagD3PDKeys.JetTrackAssocBlockName() + '_target'):
        kw['AntiKt2Track_' + JetTagD3PDKeys.JetTrackAssocBlockName() +
           '_target'] = "trk"
    if not kw.has_key('Kt3Track_' + JetTagD3PDKeys.JetTrackAssocBlockName() +
                      '_target'):
        kw['Kt3Track_' + JetTagD3PDKeys.JetTrackAssocBlockName() +
           '_target'] = "trk"
    if not kw.has_key('AntiKt4TopoEMJets_' +
                      JetTagD3PDKeys.JetTrackAssocBlockName() + '_target'):
        kw['AntiKt4TopoEMJets_' + JetTagD3PDKeys.JetTrackAssocBlockName() +
           '_target'] = "trk"
    if not kw.has_key('AntiKt4LCTopoJets_' +
                      JetTagD3PDKeys.JetTrackAssocBlockName() + '_target'):
        kw['AntiKt4LCTopoJets_' + JetTagD3PDKeys.JetTrackAssocBlockName() +
           '_target'] = "trk"
    if not kw.has_key('AntiKt5LCTopo_' +
                      JetTagD3PDKeys.JetTrackAssocBlockName() + '_target'):
        kw['AntiKt5LCTopo_' + JetTagD3PDKeys.JetTrackAssocBlockName() +
           '_target'] = "trk"

    AddConstitIndex(ExtendedJetD3PDObject,
                    typename='CaloCluster',
                    target='cl_lc_',
                    level=99)
    AddTrackAssocIndex(ExtendedJetD3PDObject, level=99)
    from JetTagD3PDMaker.JetTagD3PDMakerFlags import JetTagD3PDFlags

    # Jet information
    jetInclude = flags.smallJetInclude()
    jetIncludeTrack = jetInclude[:]
    jetIncludeTrack += [
        'Rec::TrackParticleNavigableConstituentAssociationTool', 'WIDTH',
        'DQMoments'
    ]
    jetIncludeTower = jetInclude[:]
    jetIncludeTower += ['JVtx', 'JetVertexFraction']
    jetInclude += [
        'Samplings', 'CaloClusterNavigableConstituentAssociationTool',
        'TrackAssocblockindex', 'TracksMoments', 'Special', 'TrackMF',
        'JetClusterMoment'
    ]
    jetIncludeLC = jetInclude[:]
    jetIncludeLC += ['ConstituentScale']
    jetIncludeALL = jetInclude[:]

    btagging_blocks = [
        JetTagD3PDKeys.BTagWeightsBlockName(),
        JetTagD3PDKeys.TruthInfoBlockName(),
        JetTagD3PDKeys.IP2DInfoBaseBlockName(),
        JetTagD3PDKeys.IP2DIPInfoBaseBlockName(),
        JetTagD3PDKeys.IP3DInfoBaseBlockName(),
        JetTagD3PDKeys.IP3DIPInfoBaseBlockName(),
        JetTagD3PDKeys.JetFitterInfoBaseBlockName(),
        JetTagD3PDKeys.JetFitterTagInfoBlockName(),
        JetTagD3PDKeys.SVInfoPlusBlockName(),
        JetTagD3PDKeys.JetFitterCombInfoBaseBlockName(),
        "JetTag_Gaia",
        JetTagD3PDKeys.JetFitterCharmInfoBaseBlockName(),
        JetTagD3PDKeys.JetFitterCharmTagInfoBlockName(),  # "JetTag_GaiaNeg",]
        JetTagD3PDKeys.JetJFTwoTrackVertexAssocBlockName(),
        JetTagD3PDKeys.JetFitterVxAssocBlockName(),
        JetTagD3PDKeys.SV1InfoBaseBlockName(),
        JetTagD3PDKeys.SV0InfoPlusBlockName()
    ]

    #jetIncludeALL += btagging_blocks
    jetIncludeALL += [
        'Uncertainties', 'BeamBackground', 'JetVertexFraction', 'CaloQual'
    ]

    jetIncludeALL_LC = jetIncludeALL[:]
    jetIncludeALL_LC += ['ConstituentScale']

    jetExclude = flags.smallJetExclude()[:]
    jetExclude += ['JES', 'JESMoments', 'Layer']

    alg += ExtendedJetD3PDObject(**_args(
        3,
        'AntiKt4TopoEMJets',
        kw,
        #sgkey='AntiKt4TopoEMJetsReTagged', prefix='jet_AntiKt4TopoEM_',
        sgkey='AntiKt4TopoEMNewJets',
        prefix='jet_AntiKt4TopoEM_',
        include=jetIncludeALL + ['SplitInfo', 'ConstituentScale'] +
        btagging_blocks,
        exclude=jetExclude,
        JetVertexFraction_FromUD=True,
        JetVertexFraction_FillFullJVF=True,
        #AssocTrackCont_target="trk",
        JetTag_SoftMuonChi2InfoMuonAssoc_target="mu_staco_",
        allowMissing=True))

    #alg += ExtendedJetD3PDObject              (**_args ( 3, 'AntiKt6TopoEMJets', kw,
    #                                             sgkey='AntiKt6TopoEMNewJets', prefix='jet_AntiKt6TopoEM_',
    #                                             include = jetIncludeALL+['SplitInfo'],
    #                                             exclude = jetExclude,
    #                                             JetVertexFraction_FromUD=True,
    #                                             JetVertexFraction_FillFullJVF=True,
    #                                             allowMissing = True))

    alg += ExtendedJetD3PDObject(
        **_args(3,
                'AntiKt4LCTopoJets',
                kw,
                sgkey='AntiKt4LCTopoNewJets',
                prefix='jet_AntiKt4LCTopo_',
                include=jetIncludeALL_LC + ['SplitInfo'] + btagging_blocks,
                exclude=jetExclude,
                JetVertexFraction_FromUD=True,
                JetVertexFraction_FillFullJVF=True,
                JetTag_SoftMuonChi2InfoMuonAssoc_target="mu_staco_",
                allowMissing=True))

    #alg += ExtendedJetD3PDObject              (**_args ( 3, 'AntiKt6LCTopoJets', kw,
    #                                             sgkey='AntiKt6LCTopoNewJets', prefix='jet_AntiKt6LCTopo_',
    #                                             include = jetIncludeALL_LC+['SplitInfo'],
    #                                             exclude = jetExclude,
    #                                             JetVertexFraction_FromUD=True,
    #                                             JetVertexFraction_FillFullJVF=True,
    #                                             allowMissing = True))

    alg += ExtendedJetD3PDObject(
        **_args(2,
                'JetElectronContainer90',
                kw,
                sgkey='JetElectronContainer90',
                prefix='eljet_',
                include=flags.eljetInclude(),
                exclude=[
                    'Constituents', 'ConstituentScale', 'JetShape', 'WIDTH',
                    'DQMoments', 'ActiveArea', 'OriginCorrection'
                ],
                allowMissing=True))

    ### add the MSV block
    MSVJetCollections = []
    MSVJetCollections += ['AntiKt4TopoEMNewJets', 'AntiKt4LCTopoNewJets'
                          ]  #, 'AntiKt6LCTopoNewJets', 'AntiKt6TopoEMNewJets']

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

    # add TwoTrackVertex object
    alg += getJetTagTwoTrackVertexD3PDObject(level=0,
                                             jetCollections=MSVJetCollections)

    if rec.doTruth():
        AddConstitTruthIndex(ExtendedJetD3PDObject,
                             typename='TruthParticle',
                             target='mc_',
                             level=99)

# below all for QCD group

#TopoJets (EM, GCW)

# lowPt jets
    if flags.doRecJet() and flags.doTopoEMLowPtJet() and objKeyStore.isInInput(
            "CaloClusterContainer", "CaloCalTopoCluster"):
        alg += ExtendedJetD3PDObject(
            **_args(flags.smallJetLevel(),
                    'AntiKt4TopoEMLowPt',
                    kw,
                    prefix='jet_AntiKt4TopoEMLowPt_',
                    sgkey='AntiKt4TopoEMLowPtJets',
                    include=jetInclude,
                    exclude=jetExclude,
                    JetVertexFraction_FromUD=True,
                    JetVertexFraction_FillFullJVF=True))

        #alg += ExtendedJetD3PDObject (**_args(flags.smallJetLevel(), 'AntiKt6TopoEMLowPt', kw, prefix = 'jet_AntiKt6TopoEMLowPt_', sgkey = 'AntiKt6TopoEMLowPtJets',
        #                              include = jetInclude, exclude = jetExclude, JetVertexFraction_FromUD=True,
        #                              JetVertexFraction_FillFullJVF=True))

    # Tower Jets (EM)
    if flags.doTowerJet() and rec.readAOD():
        #alg += ExtendedJetD3PDObject (**_args(flags.towerJetLevel(), 'AntiKt6Tower', kw, prefix = 'jet_AntiKt6Tower_', sgkey = 'AntiKt6TowerAODJets',
        #                              include = jetIncludeTower, exclude = jetExclude, JetVertexFraction_FromUD=True, JetVertexFraction_FillFullJVF=True))
        pass

    # additional: TowerEM
    if not rec.readAOD() and flags.doRecJet() and flags.doTowerEMJet():
        alg += ExtendedJetD3PDObject(
            **_args(flags.towerJetLevel(),
                    'AntiKt4TowerEM',
                    kw,
                    prefix='jet_AntiKt4TowerEMNew_',
                    sgkey='AntiKt4TowerEMNewJets',
                    include=jetIncludeTower,
                    exclude=jetExclude,
                    JetVertexFraction_FromUD=True,
                    JetVertexFraction_FillFullJVF=True))
        #alg += ExtendedJetD3PDObject (**_args(flags.towerJetLevel(), 'AntiKt6TowerEM', kw, prefix = 'jet_AntiKt6TowerEMNew_', sgkey = 'AntiKt6TowerEMNewJets',
        #                              include = jetIncludeTower, exclude = jetExclude, JetVertexFraction_FromUD=True, JetVertexFraction_FillFullJVF=True))

    # additional: LCTopo addional R-sizes
    if flags.doRecJet() and flags.doLCTopoJet() and objKeyStore.isInInput(
            "CaloClusterContainer", "CaloCalTopoCluster"):
        alg += ExtendedJetD3PDObject(
            **_args(flags.smallJetLevel(),
                    'AntiKt5LCTopo',
                    kw,
                    prefix='jet_AntiKt5LCTopo_',
                    sgkey='AntiKt5LCTopoNewJets',
                    include=btagging_blocks,
                    exclude=jetExclude + ['DQMoments'],
                    JetVertexFraction_FromUD=True,
                    JetVertexFraction_FillFullJVF=True))
        #alg += ExtendedJetD3PDObject (**_args(flags.smallJetLevel(), 'AntiKt7LCTopo', kw, prefix = 'jet_AntiKt7LCTopo_', sgkey = 'AntiKt7LCTopoNewJets',
        #                              exclude = jetExclude+['DQMoments'], JetVertexFraction_FromUD=True, JetVertexFraction_FillFullJVF=True))
        alg += ExtendedJetD3PDObject(
            **_args(flags.smallJetLevel(),
                    'AntiKt2LCTopo',
                    kw,
                    prefix='jet_AntiKt2LCTopo_',
                    sgkey='AntiKt2LCTopoNewJets',
                    exclude=jetExclude + ['DQMoments'],
                    JetVertexFraction_FromUD=True,
                    JetVertexFraction_FillFullJVF=True))
        alg += ExtendedJetD3PDObject(
            **_args(flags.smallJetLevel(),
                    'AntiKt3LCTopo',
                    kw,
                    prefix='jet_AntiKt3LCTopo_',
                    sgkey='AntiKt3LCTopoNewJets',
                    exclude=jetExclude + ['DQMoments'],
                    JetVertexFraction_FromUD=True,
                    JetVertexFraction_FillFullJVF=True))

    # additional: LCTopoLowPt
    if flags.doRecJet() and flags.doLCTopoLowPtJet() and objKeyStore.isInInput(
            "CaloClusterContainer", "CaloCalTopoCluster"):
        alg += ExtendedJetD3PDObject(
            **_args(flags.smallJetLevel(),
                    'AntiKt4LCTopoLowPt',
                    kw,
                    prefix='jet_AntiKt4LCTopoLowPt_',
                    sgkey='AntiKt4LCTopoLowPtJets',
                    include=jetIncludeLC,
                    exclude=jetExclude,
                    JetVertexFraction_FromUD=True,
                    JetVertexFraction_FillFullJVF=True))

        #alg += ExtendedJetD3PDObject (**_args(flags.smallJetLevel(), 'AntiKt6LCTopoLowPt', kw, prefix = 'jet_AntiKt6LCTopoLowPt_', sgkey = 'AntiKt6LCTopoLowPtJets',
        #                              include = jetIncludeLC, exclude = jetExclude, JetVertexFraction_FromUD=True, JetVertexFraction_FillFullJVF=True))

    # additional: LCTopo CB
    if flags.doRecJet() and flags.doLCTopoCBJet() and objKeyStore.isInInput(
            "CaloClusterContainer", "CaloCalTopoCluster"):
        alg += ExtendedJetD3PDObject(
            **_args(flags.smallJetLevel(),
                    'AntiKt4LCTopoCB',
                    kw,
                    prefix='jet_AntiKt4LCTopoCB_',
                    sgkey='AntiKt4LCTopoCBJets',
                    include=jetIncludeLC,
                    exclude=jetExclude,
                    JetVertexFraction_FromUD=True,
                    JetVertexFraction_FillFullJVF=True))

        #alg += ExtendedJetD3PDObject (**_args(flags.smallJetLevel(), 'AntiKt6LCTopoCB', kw, prefix = 'jet_AntiKt6LCTopoCB_', sgkey = 'AntiKt6LCTopoCBJets',
        #                              include = jetIncludeLC, exclude = jetExclude, JetVertexFraction_FromUD=True, JetVertexFraction_FillFullJVF=True))

    # GhostJets
    if ((not flags.doRecJet())
            or flags.doRecJetOnlyAdditional()) and rec.readAOD():
        if flags.doGhostJet():
            #alg += ExtendedJetD3PDObject (**_args(0, 'AntiKt6GhostTower', kw, prefix = 'jet_AntiKt6GhostTower_', sgkey = 'AntiKt6GhostTowerAODJets',
            #                              include = jetIncludeTower, exclude = jetExclude))
            pass
    else:
        if not rec.readAOD() and flags.doRecJet() and flags.doGhostJet():
            alg += ExtendedJetD3PDObject(
                **_args(0,
                        'AntiKt4GhostTowerNew',
                        kw,
                        prefix='jet_AntiKt4GhostTowerNew_',
                        sgkey='AntiKt4GhostTowerNewJets',
                        include=jetIncludeTower,
                        exclude=jetExclude))

            #alg += ExtendedJetD3PDObject (**_args(0, 'AntiKt6GhostTowerNew', kw, prefix = 'jet_AntiKt6GhostTowerNew_', sgkey = 'AntiKt6GhostTowerNewJets',
            #                              include = jetIncludeTower, exclude = jetExclude))

    # TrackJets

    trackjets_btag_include = btagging_blocks
    jetExcludeTrack = jetExclude[:]
    #jetExcludeTrack += ['JetSamplingsFrac','EMFraction','ActiveArea','JES','JESMoments','EMScale']

    AddConstitIndex(ExtendedJetD3PDObject,
                    typename='Rec::TrackParticle',
                    target='trk',
                    level=99)
    if flags.doRecJet() and flags.doTrackJet():
        alg += ExtendedJetD3PDObject(
            **_args(0,
                    'AntiKt4Track',
                    kw,
                    prefix='jet_AntiKt4Track_',
                    sgkey='AntiKt4TrackJets',
                    include=jetIncludeTrack +
                    ['SplitInfo', 'substructureblocks'] +
                    trackjets_btag_include,
                    exclude=jetExcludeTrack,
                    JetVertexFraction_FromUD=False,
                    JetVertexFraction_FillFullJVF=False))

        #alg += ExtendedJetD3PDObject (**_args(0, 'AntiKt6Track', kw, prefix = 'jet_AntiKt6Track_', sgkey = 'AntiKt6TrackJets',
        #                              include = jetIncludeTrack, exclude = jetExcludeTrack, JetVertexFraction_FromUD=False, JetVertexFraction_FillFullJVF=False))

        #alg += ExtendedJetD3PDObject (**_args(0, 'AntiKt5Track', kw, prefix = 'jet_AntiKt5Track_', sgkey = 'AntiKt5TrackJets',
        #                              include = jetIncludeTrack, exclude = jetExcludeTrack, JetVertexFraction_FromUD=False, JetVertexFraction_FillFullJVF=False))

        #alg += ExtendedJetD3PDObject (**_args(0, 'AntiKt7Track', kw, prefix = 'jet_AntiKt7Track_', sgkey = 'AntiKt7TrackJets',
        #                              include = jetIncludeTrack, exclude = jetExcludeTrack, JetVertexFraction_FromUD=False, JetVertexFraction_FillFullJVF=False))

        alg += ExtendedJetD3PDObject(
            **_args(0,
                    'AntiKt2Track',
                    kw,
                    prefix='jet_AntiKt2Track_',
                    sgkey='AntiKt2TrackJets',
                    include=jetIncludeTrack + trackjets_btag_include,
                    exclude=jetExcludeTrack,
                    JetVertexFraction_FromUD=False,
                    JetVertexFraction_FillFullJVF=False))

        alg += ExtendedJetD3PDObject(
            **_args(0,
                    'AntiKt3Track',
                    kw,
                    prefix='jet_AntiKt3Track_',
                    sgkey='AntiKt3TrackJets',
                    include=jetIncludeTrack + trackjets_btag_include,
                    exclude=jetExcludeTrack,
                    JetVertexFraction_FromUD=False,
                    JetVertexFraction_FillFullJVF=False))

        alg += ExtendedJetD3PDObject(
            **_args(0,
                    'Kt3Track',
                    kw,
                    prefix='jet_Kt3Track_',
                    sgkey='Kt3TrackJets',
                    include=jetIncludeTrack + trackjets_btag_include,
                    exclude=jetExcludeTrack,
                    JetVertexFraction_FromUD=False,
                    JetVertexFraction_FillFullJVF=False))

    # Truth
    if rec.doTruth():
        D3PDMakerFlags.TruthWriteHadrons.set_Value_and_Lock(True)
        #if ( stdTruthParticleContainer != 'None'):
        #    alg += TruthParticleD3PDObject (**_args(1, 'TruthParticle', kw, sgkey = stdTruthParticleContainer, prefix='mcQCD_', exclude=['child_TruthParticleChildAssociation','parent_TruthParticleParentAssociation']))
        truthjetInclude = flags.truthJetInclude()
        truthjetInclude += [
            'TruthParticleNavigableConstituentAssociationTool', 'WIDTH'
        ]

        if flags.doTruthJet():
            if flags.doRecTruthJet():
                alg += ExtendedJetD3PDObject(
                    **_args(flags.truthJetLevel(),
                            'AntiKt4TruthNew',
                            kw,
                            sgkey='AntiKt4TruthNewJets',
                            prefix='AntiKt4Truth_',
                            include=truthjetInclude +
                            [JetTagD3PDKeys.TruthInfoBlockName()],
                            exclude=flags.truthJetExclude()))
                #alg += ExtendedJetD3PDObject (**_args(flags.truthJetLevel(), 'AntiKt6TruthNew', kw, sgkey='AntiKt6TruthNewJets', prefix='AntiKt6Truth_',
                #                              include=truthjetInclude, exclude=flags.truthJetExclude()))
                alg += ExtendedJetD3PDObject(
                    **_args(flags.truthJetLevel(),
                            'AntiKt4TruthWithNu',
                            kw,
                            sgkey='AntiKt4TruthWithNuJets',
                            prefix='AntiKt4TruthWithNu_',
                            include=truthjetInclude,
                            exclude=flags.truthJetExclude()))
                #alg += ExtendedJetD3PDObject (**_args(flags.truthJetLevel(), 'AntiKt6TruthWithNu', kw, sgkey='AntiKt6TruthWithNuJets', prefix='AntiKt6TruthWithNu_',
                #                              include=truthjetInclude, exclude=flags.truthJetExclude()))
                alg += ExtendedJetD3PDObject(
                    **_args(flags.truthJetLevel(),
                            'AntiKt4TruthWithMuNu',
                            kw,
                            sgkey='AntiKt4TruthWithMuNuJets',
                            prefix='AntiKt4TruthWithMuNu_',
                            include=truthjetInclude,
                            exclude=flags.truthJetExclude()))
                #alg += ExtendedJetD3PDObject (**_args(flags.truthJetLevel(), 'AntiKt6TruthWithMuNu', kw, sgkey='AntiKt6TruthWithMuNuJets', prefix='AntiKt6TruthWithMuNu_',
                #                              include=truthjetInclude, exclude=flags.truthJetExclude()))
                alg += ExtendedJetD3PDObject(
                    **_args(flags.truthJetLevel(),
                            'AntiKt4TruthWithMu',
                            kw,
                            sgkey='AntiKt4TruthWithMuJets',
                            prefix='AntiKt4TruthWithMu_',
                            include=truthjetInclude,
                            exclude=flags.truthJetExclude()))
                #alg += ExtendedJetD3PDObject (**_args(flags.truthJetLevel(), 'AntiKt6TruthWithMu', kw, sgkey='AntiKt6TruthWithMuJets', prefix='AntiKt6TruthWithMu_',
                #                              include=truthjetInclude, exclude=flags.truthJetExclude()))

                alg += ExtendedJetD3PDObject(
                    **_args(flags.truthJetLevel(),
                            'AntiKt5TruthNew',
                            kw,
                            sgkey='AntiKt5TruthNewJets',
                            prefix='AntiKt5Truth_',
                            include=truthjetInclude,
                            exclude=flags.truthJetExclude()))
                #alg += ExtendedJetD3PDObject (**_args(flags.truthJetLevel(), 'AntiKt7TruthNew', kw, sgkey='AntiKt7TruthNewJets', prefix='AntiKt7Truth_',
                #                              include=truthjetInclude, exclude=flags.truthJetExclude()))
                alg += ExtendedJetD3PDObject(
                    **_args(flags.truthJetLevel(),
                            'AntiKt5TruthWithNu',
                            kw,
                            sgkey='AntiKt5TruthWithNuJets',
                            prefix='AntiKt5TruthWithNu_',
                            include=truthjetInclude,
                            exclude=flags.truthJetExclude()))
                #alg += ExtendedJetD3PDObject (**_args(flags.truthJetLevel(), 'AntiKt7TruthWithNu', kw, sgkey='AntiKt7TruthWithNuJets', prefix='AntiKt7TruthWithNu_',
                #                              include=truthjetInclude, exclude=flags.truthJetExclude()))
                alg += ExtendedJetD3PDObject(
                    **_args(flags.truthJetLevel(),
                            'AntiKt5TruthWithMuNu',
                            kw,
                            sgkey='AntiKt5TruthWithMuNuJets',
                            prefix='AntiKt5TruthWithMuNu_',
                            include=truthjetInclude,
                            exclude=flags.truthJetExclude()))
                #alg += ExtendedJetD3PDObject (**_args(flags.truthJetLevel(), 'AntiKt7TruthWithMuNu', kw, sgkey='AntiKt7TruthWithMuNuJets', prefix='AntiKt7TruthWithMuNu_',
                #                              include=truthjetInclude, exclude=flags.truthJetExclude()))
                alg += ExtendedJetD3PDObject(
                    **_args(flags.truthJetLevel(),
                            'AntiKt5TruthWithMu',
                            kw,
                            sgkey='AntiKt5TruthWithMuJets',
                            prefix='AntiKt5TruthWithMu_',
                            include=truthjetInclude,
                            exclude=flags.truthJetExclude()))
                #alg += ExtendedJetD3PDObject (**_args(flags.truthJetLevel(), 'AntiKt7TruthWithMu', kw, sgkey='AntiKt7TruthWithMuJets', prefix='AntiKt7TruthWithMu_',
                #                              include=truthjetInclude, exclude=flags.truthJetExclude()))

                alg += ExtendedJetD3PDObject(
                    **_args(flags.truthJetLevel(),
                            'AntiKt2TruthNew',
                            kw,
                            sgkey='AntiKt2TruthNewJets',
                            prefix='AntiKt2Truth_',
                            include=truthjetInclude,
                            exclude=flags.truthJetExclude()))
                alg += ExtendedJetD3PDObject(
                    **_args(flags.truthJetLevel(),
                            'AntiKt3TruthNew',
                            kw,
                            sgkey='AntiKt3TruthNewJets',
                            prefix='AntiKt3Truth_',
                            include=truthjetInclude,
                            exclude=flags.truthJetExclude()))
                alg += ExtendedJetD3PDObject(
                    **_args(flags.truthJetLevel(),
                            'AntiKt2TruthWithNu',
                            kw,
                            sgkey='AntiKt2TruthWithNuJets',
                            prefix='AntiKt2TruthWithNu_',
                            include=truthjetInclude,
                            exclude=flags.truthJetExclude()))
                alg += ExtendedJetD3PDObject(
                    **_args(flags.truthJetLevel(),
                            'AntiKt3TruthWithNu',
                            kw,
                            sgkey='AntiKt3TruthWithNuJets',
                            prefix='AntiKt3TruthWithNu_',
                            include=truthjetInclude,
                            exclude=flags.truthJetExclude()))
                alg += ExtendedJetD3PDObject(
                    **_args(flags.truthJetLevel(),
                            'AntiKt2TruthWithMuNu',
                            kw,
                            sgkey='AntiKt2TruthWithMuNuJets',
                            prefix='AntiKt2TruthWithMuNu_',
                            include=truthjetInclude,
                            exclude=flags.truthJetExclude()))
                alg += ExtendedJetD3PDObject(
                    **_args(flags.truthJetLevel(),
                            'AntiKt3TruthWithMuNu',
                            kw,
                            sgkey='AntiKt3TruthWithMuNuJets',
                            prefix='AntiKt3TruthWithMuNu_',
                            include=truthjetInclude,
                            exclude=flags.truthJetExclude()))
                alg += ExtendedJetD3PDObject(
                    **_args(flags.truthJetLevel(),
                            'AntiKt2TruthWithMu',
                            kw,
                            sgkey='AntiKt2TruthWithMuJets',
                            prefix='AntiKt2TruthWithMu_',
                            include=truthjetInclude,
                            exclude=flags.truthJetExclude()))
                alg += ExtendedJetD3PDObject(
                    **_args(flags.truthJetLevel(),
                            'AntiKt3TruthWithMu',
                            kw,
                            sgkey='AntiKt3TruthWithMuJets',
                            prefix='AntiKt3TruthWithMu_',
                            include=truthjetInclude,
                            exclude=flags.truthJetExclude()))

                # truth WZ jets
                alg += JetD3PDObject(**_args(1,
                                             'AK4TruthJetWZ',
                                             kw,
                                             sgkey='AntiKt4TruthJets_WZ',
                                             prefix='jet_AntiKt4TruthWZ_',
                                             allowMissing=True))

        if flags.doTruthPileupJet():
            if objKeyStore.isInInput("JetCollection",
                                     "InTimeAntiKt4TruthJets"):
                alg += ExtendedJetD3PDObject(
                    **_args(flags.truthJetLevel(),
                            'InTimeAntiKt4Truth',
                            kw,
                            sgkey='InTimeAntiKt4TruthJets',
                            prefix='InTimeAntiKt4Truth_',
                            include=truthjetInclude,
                            exclude=flags.truthJetExclude()))
            if objKeyStore.isInInput("JetCollection",
                                     "OutOfTimeAntiKt4TruthJets"):
                alg += ExtendedJetD3PDObject(
                    **_args(flags.truthJetLevel(),
                            'OutOfTimeAntiKt4Truth',
                            kw,
                            sgkey='OutOfTimeAntiKt4TruthJets',
                            prefix='OutOfTimeAntiKt4Truth_',
                            include=truthjetInclude,
                            exclude=flags.truthJetExclude()))
            pass

    return alg
コード例 #3
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")