示例#1
0
def scheduleTauTruthTools(kernel=None):
    # Ensure that we are running on MC!
    from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkIsMonteCarlo
    if not DerivationFrameworkIsMonteCarlo:
        return
    # Ensure that we are adding it to something
    if kernel is None:
        from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob
        kernel = DerivationFrameworkJob
    if hasattr(kernel, 'TauTruthCommonKernel'):
        # Already there!  Carry on...
        return

    DFCommonTauTruthWrapperTools = []

    from AthenaCommon.AppMgr import ToolSvc
    # Matching
    # Only do if working with AOD
    from RecExConfig.ObjKeyStore import objKeyStore
    if objKeyStore.isInInput("xAOD::TauJetContainer", "TauJets"):
        from TauAnalysisTools.TauAnalysisToolsConf import TauAnalysisTools__TauTruthMatchingTool
        DFCommonTauTruthMatchingTool = TauAnalysisTools__TauTruthMatchingTool(
            name="DFCommonTauTruthMatchingTool")
        DFCommonTauTruthMatchingTool.WriteTruthTaus = True
        DFCommonTauTruthMatchingTool.WriteInvisibleFourMomentum = True
        DFCommonTauTruthMatchingTool.WriteVisibleNeutralFourMomentum = True
        ToolSvc += DFCommonTauTruthMatchingTool

        from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauTruthMatchingWrapper
        DFCommonTauTruthMatchingWrapper = DerivationFramework__TauTruthMatchingWrapper(
            name="DFCommonTauTruthMatchingWrapper",
            TauTruthMatchingTool=DFCommonTauTruthMatchingTool,
            TauContainerName="TauJets")
        ToolSvc += DFCommonTauTruthMatchingWrapper
        print(DFCommonTauTruthMatchingWrapper)
        DFCommonTauTruthWrapperTools.append(DFCommonTauTruthMatchingWrapper)
    else:
        # No reco taus, so just build the truth tau container
        from TauAnalysisTools.TauAnalysisToolsConf import TauAnalysisTools__BuildTruthTaus
        btt = TauAnalysisTools__BuildTruthTaus(
            WriteTruthTaus=True,
            WriteInvisibleFourMomentum=True,
            WriteVisibleNeutralFourMomentum=True)
        ToolSvc += btt
        from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthCollectionMakerTau
        DFCommonTruthTauCollectionMaker = DerivationFramework__TruthCollectionMakerTau(
        )
        DFCommonTruthTauCollectionMaker.BuildTruthTaus = btt
        ToolSvc += DFCommonTruthTauCollectionMaker
        print(DFCommonTruthTauCollectionMaker)
        DFCommonTauTruthWrapperTools.append(DFCommonTruthTauCollectionMaker)

    #=======================================
    # CREATE THE DERIVATION KERNEL ALGORITHM
    #=======================================
    from AthenaCommon import CfgMgr
    kernel += CfgMgr.DerivationFramework__CommonAugmentation(
        "TauTruthCommonKernel", AugmentationTools=DFCommonTauTruthWrapperTools)
示例#2
0
    name="HIGG6D1TauSelectionWrapper",
    #IsTauFlag			= IsTauFlag.JetBDTSigLoose,
    IsTauFlag=19,
    CollectionName="TauJets",
    StoreGateEntryName="HIGG6D1JetBDTSigLoose")
ToolSvc += HIGG6D1TauWrapper
augmentationTools.append(HIGG6D1TauWrapper)

#=======================================
# Tau truth matching tool
#=======================================

#truth matching
if is_MC:
    from TauAnalysisTools.TauAnalysisToolsConf import TauAnalysisTools__TauTruthMatchingTool
    HIGG6D1TauTruthMatchingTool = TauAnalysisTools__TauTruthMatchingTool(
        name="HIGG6D1TauTruthMatchingTool", WriteTruthTaus=True)

    ToolSvc += HIGG6D1TauTruthMatchingTool

    from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauTruthMatchingWrapper
    HIGG6D1TauTruthMatchingWrapper = DerivationFramework__TauTruthMatchingWrapper(
        name="HIGG6D1TauTruthMatchingWrapper",
        TauTruthMatchingTool=HIGG6D1TauTruthMatchingTool,
        TauContainerName="TauJets")

    ToolSvc += HIGG6D1TauTruthMatchingWrapper
    augmentationTools.append(HIGG6D1TauTruthMatchingWrapper)

#====================================================================
# MC selection
#====================================================================
示例#3
0
def setup(ToolSvc):

    augmentationTools = []

    #==============================================================================
    # Set up the MCTruthClassifier
    #==============================================================================
    from MCTruthClassifier.MCTruthClassifierConf import MCTruthClassifier
    TOPQClassifier = MCTruthClassifier(name="TOPQClassifier",
                                       ParticleCaloExtensionTool="")
    ToolSvc += TOPQClassifier
    print "TOPQClassifier: ", TOPQClassifier

    #===============================================================================
    # Add Decoration Tool to Dress the Main Truth Collection with the Classification
    #===============================================================================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/trunk/src/TruthClassificationDecorator.cxx
    from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthClassificationDecorator
    TOPQClassificationDecorator = DerivationFramework__TruthClassificationDecorator(
        name="TOPQClassificationDecorator",
        ParticlesKey="TruthParticles",
        MCTruthClassifier=TOPQClassifier)
    ToolSvc += TOPQClassificationDecorator
    augmentationTools.append(TOPQClassificationDecorator)
    print "TOPQClassificationDecorator: ", TOPQClassificationDecorator

    #==============================================================================
    # Schedule the tool for adding new truth collection
    #==============================================================================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/trunk/src/TruthCollectionMaker.cxx
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/trunk/src/TruthCollectionMakerTau.cxx
    from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthCollectionMaker
    from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthCollectionMakerTau

    #===========
    # TruthMuons
    #===========
    TOPQMuonTool = DerivationFramework__TruthCollectionMaker(
        name="TOPQMuonTool",
        NewCollectionName="TruthMuons",
        ParticleSelectionString=
        "(abs(TruthParticles.pdgId) == 13) && (TruthParticles.status == 1) && (TruthParticles.barcode < 200000) "
    )
    ToolSvc += TOPQMuonTool
    print "TOPQMuonTool: ", TOPQMuonTool
    augmentationTools.append(TOPQMuonTool)

    #===============
    # TruthElectrons
    #===============
    TOPQElectronTool = DerivationFramework__TruthCollectionMaker(
        name="TOPQElectronTool",
        NewCollectionName="TruthElectrons",
        ParticleSelectionString=
        "(abs(TruthParticles.pdgId) == 11) && (TruthParticles.status == 1) && (TruthParticles.barcode < 200000)"
    )
    ToolSvc += TOPQElectronTool
    augmentationTools.append(TOPQElectronTool)
    print "TOPQElectronTool: ", TOPQElectronTool

    #=============
    # TruthPhotons
    #=============
    TOPQPhotonTool = DerivationFramework__TruthCollectionMaker(
        name="TOPQPhotonTool",
        NewCollectionName="TruthPhotons",
        ParticleSelectionString=
        "(abs(TruthParticles.pdgId) == 22) && (TruthParticles.status == 1) && (TruthParticles.barcode < 200000)"
    )
    ToolSvc += TOPQPhotonTool
    augmentationTools.append(TOPQPhotonTool)
    print "TOPQPhotonTool: ", TOPQPhotonTool

    #===============
    # TruthNeutrinos
    #===============
    TOPQneutrinoexpression = "(abs(TruthParticles.pdgId) == 12 || abs(TruthParticles.pdgId) == 14 || abs(TruthParticles.pdgId) == 16) && (TruthParticles.status == 1) && (TruthParticles.barcode < 200000)"
    TOPQNeutrinoTool = DerivationFramework__TruthCollectionMaker(
        name="TOPQNeutrinoTool",
        NewCollectionName="TruthNeutrinos",
        ParticleSelectionString=TOPQneutrinoexpression)
    ToolSvc += TOPQNeutrinoTool
    augmentationTools.append(TOPQNeutrinoTool)
    print "TOPQNeutrinoTool: ", TOPQNeutrinoTool

    #==========
    # TruthTaus
    #==========
    TOPQTauTool = DerivationFramework__TruthCollectionMakerTau(
        name="TOPQTauTool",
        NewCollectionName="TruthTaus",
        MCTruthClassifier=TOPQClassifier,
        RunClassifier=True)
    ToolSvc += TOPQTauTool
    augmentationTools.append(TOPQTauTool)
    print "TOPQTauTool: ", TOPQTauTool

    #==============================================================================
    # TRUTH DRESSING
    #==============================================================================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/trunk/src/TruthDressingTool.cxx
    from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthDressingTool
    TOPQMuonDressingTool = DerivationFramework__TruthDressingTool(
        name="TOPQMuonDressingTool",
        dressParticlesKey="TruthMuons",
        usePhotonsFromHadrons=False,
        dressingConeSize=0.1,
        particleIDsToDress=[13],
        useAntiKt=True)
    ToolSvc += TOPQMuonDressingTool
    augmentationTools.append(TOPQMuonDressingTool)
    print "TOPQMuonDressingTool: ", TOPQMuonDressingTool

    TOPQElectronDressingTool = DerivationFramework__TruthDressingTool(
        name="TOPQElectronDressingTool",
        dressParticlesKey="TruthElectrons",
        usePhotonsFromHadrons=False,
        dressingConeSize=0.1,
        particleIDsToDress=[11],
        useAntiKt=True)
    ToolSvc += TOPQElectronDressingTool
    augmentationTools.append(TOPQElectronDressingTool)
    print "TOPQElectronDressingTool: ", TOPQElectronDressingTool

    #==============================================================================
    # TRUTH ISOLATION
    #==============================================================================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/trunk/src/TruthIsolationTool.cxx
    from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthIsolationTool
    TOPQElectronIsolationTool1 = DerivationFramework__TruthIsolationTool(
        name="TOPQElectronIsolationTool1",
        isoParticlesKey="TruthElectrons",
        allParticlesKey="TruthParticles",
        particleIDsToCalculate=[11],
        IsolationConeSizes=[0.2],
        IsolationVarNamePrefix='etcone',
        ChargedParticlesOnly=False)
    ToolSvc += TOPQElectronIsolationTool1
    augmentationTools.append(TOPQElectronIsolationTool1)
    print "TOPQElectronIsolationTool1: ", TOPQElectronIsolationTool1

    TOPQElectronIsolationTool2 = DerivationFramework__TruthIsolationTool(
        name="TOPQElectronIsolationTool2",
        isoParticlesKey="TruthElectrons",
        allParticlesKey="TruthParticles",
        particleIDsToCalculate=[11],
        IsolationConeSizes=[0.3],
        IsolationVarNamePrefix='ptcone',
        ChargedParticlesOnly=True)
    ToolSvc += TOPQElectronIsolationTool2
    augmentationTools.append(TOPQElectronIsolationTool2)
    print "TOPQElectronIsolationTool2: ", TOPQElectronIsolationTool2

    TOPQMuonIsolationTool1 = DerivationFramework__TruthIsolationTool(
        name="TOPQMuonIsolationTool1",
        isoParticlesKey="TruthMuons",
        allParticlesKey="TruthParticles",
        particleIDsToCalculate=[13],
        IsolationConeSizes=[0.2],
        IsolationVarNamePrefix='etcone',
        ChargedParticlesOnly=False)
    ToolSvc += TOPQMuonIsolationTool1
    augmentationTools.append(TOPQMuonIsolationTool1)
    print "TOPQMuonIsolationTool1: ", TOPQMuonIsolationTool1

    TOPQMuonIsolationTool2 = DerivationFramework__TruthIsolationTool(
        name="TOPQMuonIsolationTool2",
        isoParticlesKey="TruthMuons",
        allParticlesKey="TruthParticles",
        particleIDsToCalculate=[13],
        IsolationConeSizes=[0.3],
        IsolationVarNamePrefix='ptcone',
        ChargedParticlesOnly=True)
    ToolSvc += TOPQMuonIsolationTool2
    augmentationTools.append(TOPQMuonIsolationTool2)
    print "TOPQMuonIsolationTool2: ", TOPQMuonIsolationTool2

    TOPQPhotonIsolationTool1 = DerivationFramework__TruthIsolationTool(
        name="TOPQPhotonIsolationTool1",
        isoParticlesKey="TruthPhotons",
        allParticlesKey="TruthParticles",
        particleIDsToCalculate=[22],
        IsolationConeSizes=[0.2],
        IsolationVarNamePrefix='etcone',
        ChargedParticlesOnly=False)
    ToolSvc += TOPQPhotonIsolationTool1
    augmentationTools.append(TOPQPhotonIsolationTool1)
    print "TOPQPhotonIsolationTool1: ", TOPQPhotonIsolationTool1

    TOPQPhotonIsolationTool2 = DerivationFramework__TruthIsolationTool(
        name="TOPQPhotonIsolationTool2",
        isoParticlesKey="TruthPhotons",
        allParticlesKey="TruthParticles",
        particleIDsToCalculate=[22],
        IsolationConeSizes=[0.3],
        IsolationVarNamePrefix='ptcone',
        ChargedParticlesOnly=True)
    ToolSvc += TOPQPhotonIsolationTool2
    augmentationTools.append(TOPQPhotonIsolationTool2)
    print "TOPQPhotonIsolationTool2: ", TOPQPhotonIsolationTool2

    #==============================================================================
    # BACKGROUND ELECTRON DECORATION TYPE/ORIGIN
    #==============================================================================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/trunk/src/BkgElectronClassification.cxx
    from MCTruthClassifier.MCTruthClassifierBase import MCTruthClassifier as BkgElectronMCTruthClassifier
    from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__BkgElectronClassification
    BkgElectronClassificationTool = DerivationFramework__BkgElectronClassification(
        name="BkgElectronClassificationTool",
        MCTruthClassifierTool=BkgElectronMCTruthClassifier)
    ToolSvc += BkgElectronClassificationTool
    augmentationTools.append(BkgElectronClassificationTool)
    print "BkgElectronClassificationTool: ", BkgElectronClassificationTool

    #==============================================================================
    # BOOSTED TOP PAIR DECORATION
    #==============================================================================
    # /PhysicsAnalysis/DerivationFramework/DerivationFrameworkTop/trunk/src/BoostedHadTopAndTopPairFilterTool.cxx
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkTop/trunk/src/BoostedHadTopAndTopPairAugmentation.cxx
    #from DerivationFrameworkTop.DerivationFrameworkTopConf import DerivationFramework__BoostedHadTopAndTopPairFilterTool
    #TOPQboostedtopfiltertool = DerivationFramework__BoostedHadTopAndTopPairFilterTool(
    #                             name = "TOPQBoostedHadTopAndTopPairFilterTool",
    #                             tHadPtCut  = 2000000.0, #cut on hadronic tops in MeV
    #                             tPairPtCut = 3500000.0) #cut on ttbar system in MeV
    #ToolSvc += TOPQboostedtopfiltertool

    #from DerivationFrameworkTop.DerivationFrameworkTopConf import DerivationFramework__BoostedHadTopAndTopPairFilterAugmentation
    #TOPQBoostedHadTopAndTopPairFilterAugmentation = DerivationFramework__BoostedHadTopAndTopPairFilterAugmentation(name = "TOPQBoostedHadTopAndTopPairFilterAugmentation")
    #TOPQBoostedHadTopAndTopPairFilterAugmentation.FilterTool = TOPQboostedtopfiltertool
    #ToolSvc += TOPQBoostedHadTopAndTopPairFilterAugmentation
    #augmentationTools.append(TOPQBoostedHadTopAndTopPairFilterAugmentation)
    #print "TOPQBoostedHadTopAndTopPairFilterAugmentationTool: ", TOPQBoostedHadTopAndTopPairFilterAugmentation

    #==============================================================================
    # HEAVY FLAVOR DECORATION
    #==============================================================================
    # /PhysicsAnalysis/DerivationFramework/DerivationFrameworkTop/trunk/src/TTbarPlusHeavyFlavorFilterTool.cxx
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkTop/trunk/src/TopHeavyFlavorFilterAugmentation.cxx
    from DerivationFrameworkTop.DerivationFrameworkTopConf import DerivationFramework__TTbarPlusHeavyFlavorFilterTool
    TOPQtthffiltertool = DerivationFramework__TTbarPlusHeavyFlavorFilterTool(
        "TOPQTTbarPlusHeavyFlavorFilterTool")
    ToolSvc += TOPQtthffiltertool

    from DerivationFrameworkTop.DerivationFrameworkTopConf import DerivationFramework__TopHeavyFlavorFilterAugmentation
    TOPQTopHFFilterAugmentation = DerivationFramework__TopHeavyFlavorFilterAugmentation(
        name="TOPQTopHFFilterAugmentation")
    TOPQTopHFFilterAugmentation.FilterTool = TOPQtthffiltertool
    ToolSvc += TOPQTopHFFilterAugmentation
    augmentationTools.append(TOPQTopHFFilterAugmentation)
    print "TOPQTopHFFilterAugmentationTool: ", TOPQTopHFFilterAugmentation

    #==============================================================================
    # HEAVY FLAVOR DECORATIONS (ttbar)
    #==============================================================================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/trunk/src/HadronOriginClassifier.cxx
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/trunk/src/HadronOriginDecorator.cxx
    # list of ttbar samples by mc_channel_number
    TOPQDSIDList = [
        410000,
        410001,
        410002,
        410003,
        410004,
        410007,
        410008,
        410009,
        301528,
        301529,
        301530,
        301531,
        301532,
        303722,
        303723,
        303724,
        303725,
        303726,
        407009,
        407010,
        407011,
        407012,
        410120,
        410121,
        426090,
        426091,
        426092,
        426093,
        426094,
        426095,
        426096,
        426097,
        429007,
    ]

    import PyUtils.AthFile as af
    from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
    f = af.fopen(athenaCommonFlags.PoolAODInput()[0])
    if len(f.mc_channel_number) > 0:
        if (int(f.mc_channel_number[0]) in TOPQDSIDList):
            from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__HadronOriginClassifier
            TOPQhadronorigintool = DerivationFramework__HadronOriginClassifier(
                "TOPQHadronOriginClassifier", DSID=int(f.mc_channel_number[0]))
            ToolSvc += TOPQhadronorigintool
            print "TOPQhadronorigintool: ", TOPQhadronorigintool
            from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__HadronOriginDecorator
            TOPQhadronorigindecorator = DerivationFramework__HadronOriginDecorator(
                name="TOPQHadronOriginDecorator")
            TOPQhadronorigindecorator.ToolName = TOPQhadronorigintool
            ToolSvc += TOPQhadronorigindecorator
            print "TOPQhadronorigindecorator: ", TOPQhadronorigindecorator
            augmentationTools.append(TOPQhadronorigindecorator)

    #==============================================================================
    # TAU TRUTH MATCHING
    #==============================================================================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/trunk/src/TauTruthMatchingWrapper.cxx
    # PhysicsAnalysis/TauID/TauAnalysisTools/trunk/Root/TauTruthMatchingTool.cxx
    from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauTruthMatchingWrapper
    from TauAnalysisTools.TauAnalysisToolsConf import TauAnalysisTools__TauTruthMatchingTool

    from RecExConfig.ObjKeyStore import objKeyStore
    if objKeyStore.isInInput("xAOD::TauJetContainer", "TauJets"):
        TOPQTauTruthMatchingTool = TauAnalysisTools__TauTruthMatchingTool(
            name="TOPQTauTruthMatchingTool")
        ToolSvc += TOPQTauTruthMatchingTool
        print "TOPQTauTruthMatchingTool: ", TOPQTauTruthMatchingTool
        TOPQTauTruthMatchingWrapper = DerivationFramework__TauTruthMatchingWrapper(
            name="TOPQTauTruthMatchingWrapper",
            TauTruthMatchingTool=TOPQTauTruthMatchingTool,
            TauContainerName="TauJets")
        ToolSvc += TOPQTauTruthMatchingWrapper
        augmentationTools.append(TOPQTauTruthMatchingWrapper)
        print "TOPQTauTruthMatchingWrapperTool: ", TOPQTauTruthMatchingWrapper

    #=============
    # RETURN TOOLS
    #=============
    return augmentationTools
    ToolSvc += DFCommonTauTruthClassifier

    # Build the truth taus
    from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthCollectionMakerTau
    DFCommonTruthTauTool = DerivationFramework__TruthCollectionMakerTau(
        name="DFCommonTruthTauTool",
        NewCollectionName="TruthTaus",
        MCTruthClassifier=DFCommonTauTruthClassifier)
    ToolSvc += DFCommonTruthTauTool
    DFCommonTauTruthWrapperTools.append(DFCommonTruthTauTool)

    # Matching
    # Only do if working with AOD
    from RecExConfig.ObjKeyStore import objKeyStore
    if objKeyStore.isInInput("xAOD::TauJetContainer", "TauJets"):
        DFCommonTauTruthMatchingTool = TauAnalysisTools__TauTruthMatchingTool(
            name="DFCommonTauTruthMatchingTool")
        ToolSvc += DFCommonTauTruthMatchingTool
        DFCommonTauTruthMatchingWrapper = DerivationFramework__TauTruthMatchingWrapper(
            name="DFCommonTauTruthMatchingWrapper",
            TauTruthMatchingTool=DFCommonTauTruthMatchingTool,
            TauContainerName="TauJets")
        ToolSvc += DFCommonTauTruthMatchingWrapper
        print DFCommonTauTruthMatchingWrapper
        DFCommonTauTruthWrapperTools.append(DFCommonTauTruthMatchingWrapper)

    #=======================================
    # CREATE THE DERIVATION KERNEL ALGORITHM
    #=======================================

    from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__CommonAugmentation
    DerivationFrameworkJob += CfgMgr.DerivationFramework__CommonAugmentation(
def setup(HIGG4DxName, ToolSvc):

    augmentationTools = []

    # DELTA R TOOL
    from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__DeltaRTool
    HIGG4DxTauJetsElectronsDeltaRTool = DerivationFramework__DeltaRTool(
        name="HIGG4DxTauJetsElectronsDeltaRTool",
        ContainerName="Electrons",
        SecondContainerName="TauJets",
        StoreGateEntryName="HIGG4DxTauJetsElectronsDeltaR")
    ToolSvc += HIGG4DxTauJetsElectronsDeltaRTool
    augmentationTools.append(HIGG4DxTauJetsElectronsDeltaRTool)

    # TAU SELECTOR TOOL
    from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauSelectionWrapper
    HIGG4DxJetBDTSigMediumSelectionWrapper = DerivationFramework__TauSelectionWrapper(
        name="HIGG4DxJetBDTSigMediumSelectionWrapper",
        #IsTauFlag              = IsTauFlag.JetBDTSigMedium,
        IsTauFlag=20,
        CollectionName="TauJets",
        StoreGateEntryName="HIGG4DxJetBDTSigMedium")
    ToolSvc += HIGG4DxJetBDTSigMediumSelectionWrapper
    augmentationTools.append(HIGG4DxJetBDTSigMediumSelectionWrapper)

    HIGG4DxJetBDTSigLooseSelectionWrapper = DerivationFramework__TauSelectionWrapper(
        name="HIGG4DxJetBDTSigLooseSelectionWrapper",
        IsTauFlag=19,
        CollectionName="TauJets",
        StoreGateEntryName="HIGG4DxJetBDTSigLoose")
    ToolSvc += HIGG4DxJetBDTSigLooseSelectionWrapper
    augmentationTools.append(HIGG4DxJetBDTSigLooseSelectionWrapper)

    # Tau primary vertex refit
    if HIGG4DxName == "HIGG4D3":
        from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauPVTrkSelectionTool
        HIGG4DxTauPVTrkSelectionTool = DerivationFramework__TauPVTrkSelectionTool(
            name="HIGG4DxTauPVTrkSelectionTool",
            #minPt = 15000,
            #m_maxDeltaR = 0.2,
            UseTrueTracks=DFisMC,
            TauContainerName="TauJets",
            TauPVTracksContainerName="TauPVTracks")
        ToolSvc += HIGG4DxTauPVTrkSelectionTool
        augmentationTools.append(HIGG4DxTauPVTrkSelectionTool)

        from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauPVRefitTool
        HIGG4DxTauPVRefittingTool = DerivationFramework__TauPVRefitTool(
            name="HIGG4DxTauPVRefittingTool",
            PVLinkName="PVLink",
            RefittedLinkName="TauRefittedPVLink",
            PVContainerName="PrimaryVertices",
            TauTrkContainerName="TauPVTracks",
            PVRefContainerName="TauRefittedPrimaryVertices")
        ToolSvc += HIGG4DxTauPVRefittingTool
        augmentationTools.append(HIGG4DxTauPVRefittingTool)

    if DFisMC:
        # Tau truth matching
        from TauAnalysisTools.TauAnalysisToolsConf import TauAnalysisTools__TauTruthMatchingTool
        HIGG4DxTauTruthMatchingTool = TauAnalysisTools__TauTruthMatchingTool(
            name="HIGG4DxTauTruthMatchingTool", WriteTruthTaus=True)

        ToolSvc += HIGG4DxTauTruthMatchingTool

        # Tau truth matching wrapper
        from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauTruthMatchingWrapper
        HIGG4DxTauTruthMatchingWrapper = DerivationFramework__TauTruthMatchingWrapper(
            name="HIGG4DxTauTruthMatchingWrapper",
            TauTruthMatchingTool=HIGG4DxTauTruthMatchingTool)

        ToolSvc += HIGG4DxTauTruthMatchingWrapper
        augmentationTools.append(HIGG4DxTauTruthMatchingWrapper)

    #Tau Overlapping Electron LLH Decorator
    from TauAnalysisTools.TauAnalysisToolsConf import TauAnalysisTools__TauOverlappingElectronLLHDecorator
    HIGG4DxTauOrlElLLHDec = TauAnalysisTools__TauOverlappingElectronLLHDecorator(
        name="HIGG4DxTauOrlElLLHDec", ElectronContainerName="Electrons")

    ToolSvc += HIGG4DxTauOrlElLLHDec

    #Tau Overlapping Electron LLH Decorator Wrapper
    from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauOverlappingElectronLLHDecoratorWrapper
    HIGG4DxTauOrlElLLHDecWrapper = DerivationFramework__TauOverlappingElectronLLHDecoratorWrapper(
        name="HIGG4DxTauOrlElLLHDecWrapper",
        TauOverlappingElectronLLHDecorator=HIGG4DxTauOrlElLLHDec,
        TauContainerName="TauJets")

    ToolSvc += HIGG4DxTauOrlElLLHDecWrapper
    augmentationTools.append(HIGG4DxTauOrlElLLHDecWrapper)

    #=============
    # return tools
    #=============
    return augmentationTools
示例#6
0
def setup(ToolSvc):

    augmentationTools = []

    #==============================================================================
    # Set up the MCTruthClassifier
    #==============================================================================
    from MCTruthClassifier.MCTruthClassifierConf import MCTruthClassifier
    TOPQClassifier = MCTruthClassifier(name="TOPQClassifier",
                                       ParticleCaloExtensionTool="")
    ToolSvc += TOPQClassifier
    print("TOPQClassifier: ", TOPQClassifier)

    #===============================================================================
    # Add Decoration Tool to Dress the Main Truth Collection with the Classification
    #===============================================================================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/trunk/src/TruthClassificationDecorator.cxx
    from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthClassificationDecorator
    TOPQClassificationDecorator = DerivationFramework__TruthClassificationDecorator(
        name="TOPQClassificationDecorator",
        ParticlesKey="TruthParticles",
        MCTruthClassifier=TOPQClassifier)
    ToolSvc += TOPQClassificationDecorator
    augmentationTools.append(TOPQClassificationDecorator)
    print("TOPQClassificationDecorator: ", TOPQClassificationDecorator)

    #==============================================================================
    # Schedule the tool for adding new truth collection
    #==============================================================================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/trunk/src/TruthCollectionMaker.cxx
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/trunk/src/TruthCollectionMakerTau.cxx
    from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthCollectionMaker
    from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthCollectionMakerTau

    #==========
    # TruthTaus
    #==========
    TOPQTauTool = DerivationFramework__TruthCollectionMakerTau(
        name="TOPQTauTool",
        NewCollectionName="TruthTaus",
        MCTruthClassifier=TOPQClassifier,
        RunClassifier=True)
    ToolSvc += TOPQTauTool
    augmentationTools.append(TOPQTauTool)
    print("TOPQTauTool: ", TOPQTauTool)

    #==============================================================================
    # BACKGROUND ELECTRON DECORATION TYPE/ORIGIN
    #==============================================================================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/trunk/src/BkgElectronClassification.cxx
    from MCTruthClassifier.MCTruthClassifierBase import MCTruthClassifier as BkgElectronMCTruthClassifier
    from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__BkgElectronClassification
    BkgElectronClassificationTool = DerivationFramework__BkgElectronClassification(
        name="BkgElectronClassificationTool",
        MCTruthClassifierTool=BkgElectronMCTruthClassifier)
    ToolSvc += BkgElectronClassificationTool
    augmentationTools.append(BkgElectronClassificationTool)
    print("BkgElectronClassificationTool: ", BkgElectronClassificationTool)

    #==============================================================================
    # BOOSTED TOP PAIR DECORATION
    #==============================================================================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkTop/trunk/src/BoostedHadTopAndTopPairFilterTool.cxx
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkTop/trunk/src/BoostedHadTopAndTopPairAugmentation.cxx
    from DerivationFrameworkTop.DerivationFrameworkTopConf import DerivationFramework__BoostedHadTopAndTopPairFilterTool
    TOPQboostedtopfiltertool = DerivationFramework__BoostedHadTopAndTopPairFilterTool(
        name="TOPQBoostedHadTopAndTopPairFilterTool")
    #tHadPtCut  = 500000.0, #cut on hadronic tops in MeV
    #tPairPtCut = 350000.0) #cut on ttbar system in MeV
    ToolSvc += TOPQboostedtopfiltertool

    from DerivationFrameworkTop.DerivationFrameworkTopConf import DerivationFramework__BoostedHadTopAndTopPairFilterAugmentation
    TOPQBoostedHadTopAndTopPairFilterAugmentation = DerivationFramework__BoostedHadTopAndTopPairFilterAugmentation(
        name="TOPQBoostedHadTopAndTopPairFilterAugmentation")
    TOPQBoostedHadTopAndTopPairFilterAugmentation.FilterTool_Low = TOPQboostedtopfiltertool
    TOPQBoostedHadTopAndTopPairFilterAugmentation.FilterTool_High = TOPQboostedtopfiltertool
    ToolSvc += TOPQBoostedHadTopAndTopPairFilterAugmentation
    augmentationTools.append(TOPQBoostedHadTopAndTopPairFilterAugmentation)
    print("TOPQBoostedHadTopAndTopPairFilterAugmentationTool: ",
          TOPQBoostedHadTopAndTopPairFilterAugmentation)

    #==============================================================================
    # HEAVY FLAVOR DECORATION
    #==============================================================================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkTop/trunk/src/TTbarPlusHeavyFlavorFilterTool.cxx
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkTop/trunk/src/TopHeavyFlavorFilterAugmentation.cxx
    from DerivationFrameworkTop.DerivationFrameworkTopConf import DerivationFramework__TTbarPlusHeavyFlavorFilterTool
    TOPQtthffiltertool = DerivationFramework__TTbarPlusHeavyFlavorFilterTool(
        "TOPQTTbarPlusHeavyFlavorFilterTool")
    ToolSvc += TOPQtthffiltertool

    from DerivationFrameworkTop.DerivationFrameworkTopConf import DerivationFramework__TopHeavyFlavorFilterAugmentation
    TOPQTopHFFilterAugmentation = DerivationFramework__TopHeavyFlavorFilterAugmentation(
        name="TOPQTopHFFilterAugmentation")
    TOPQTopHFFilterAugmentation.FilterTool = TOPQtthffiltertool
    ToolSvc += TOPQTopHFFilterAugmentation
    augmentationTools.append(TOPQTopHFFilterAugmentation)
    print("TOPQTopHFFilterAugmentationTool: ", TOPQTopHFFilterAugmentation)

    #==============================================================================
    # HEAVY FLAVOR DECORATIONS (ttbar)
    #==============================================================================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/trunk/src/HadronOriginClassifier.cxx
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkMCTruth/trunk/src/HadronOriginDecorator.cxx
    # list of ttbar samples by mc_channel_number

    TOPQDSIDList = list(DSIDList)

    import PyUtils.AthFile as af
    from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
    f = af.fopen(athenaCommonFlags.PoolAODInput()[0])
    if len(f.mc_channel_number) > 0:
        if (int(f.mc_channel_number[0]) in TOPQDSIDList):
            from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__HadronOriginClassifier
            TOPQhadronorigintool = DerivationFramework__HadronOriginClassifier(
                "TOPQHadronOriginClassifier", DSID=int(f.mc_channel_number[0]))
            ToolSvc += TOPQhadronorigintool
            print("TOPQhadronorigintool: ", TOPQhadronorigintool)
            from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__HadronOriginDecorator
            TOPQhadronorigindecorator = DerivationFramework__HadronOriginDecorator(
                name="TOPQHadronOriginDecorator")
            TOPQhadronorigindecorator.ToolName = TOPQhadronorigintool
            ToolSvc += TOPQhadronorigindecorator
            print("TOPQhadronorigindecorator: ", TOPQhadronorigindecorator)
            augmentationTools.append(TOPQhadronorigindecorator)

    #==============================================================================
    # TAU TRUTH MATCHING
    #==============================================================================
    # PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/trunk/src/TauTruthMatchingWrapper.cxx
    # PhysicsAnalysis/TauID/TauAnalysisTools/trunk/Root/TauTruthMatchingTool.cxx
    from DerivationFrameworkTau.DerivationFrameworkTauConf import DerivationFramework__TauTruthMatchingWrapper
    from TauAnalysisTools.TauAnalysisToolsConf import TauAnalysisTools__TauTruthMatchingTool

    from RecExConfig.ObjKeyStore import objKeyStore
    if objKeyStore.isInInput("xAOD::TauJetContainer", "TauJets"):
        TOPQTauTruthMatchingTool = TauAnalysisTools__TauTruthMatchingTool(
            name="TOPQTauTruthMatchingTool")
        ToolSvc += TOPQTauTruthMatchingTool
        print("TOPQTauTruthMatchingTool: ", TOPQTauTruthMatchingTool)
        TOPQTauTruthMatchingWrapper = DerivationFramework__TauTruthMatchingWrapper(
            name="TOPQTauTruthMatchingWrapper",
            TauTruthMatchingTool=TOPQTauTruthMatchingTool,
            TauContainerName="TauJets")
        ToolSvc += TOPQTauTruthMatchingWrapper
        augmentationTools.append(TOPQTauTruthMatchingWrapper)
        print("TOPQTauTruthMatchingWrapperTool: ", TOPQTauTruthMatchingWrapper)

    #=============
    # RETURN TOOLS
    #=============
    return augmentationTools