Beispiel #1
0
def addTruthJetsAOD(kernel=None, decorationDressing=None):
    # Ensure that we are adding it to something
    if kernel is None:
        from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob
        kernel = DerivationFrameworkJob
    # In this case, we simply use the helpers from ExtendedJetCommon
    from DerivationFrameworkJetEtMiss.ExtendedJetCommon import addAntiKt4TruthJets, addAntiKt4TruthWZJets, addAntiKt10TruthJets
    addAntiKt4TruthJets(kernel, "TRUTH")  # Ignore the output list
    addAntiKt4TruthWZJets(kernel, "TRUTH")
    #if decorationDressing is not None:
    #    from DerivationFrameworkJetEtMiss.ExtendedJetCommon import addAntiKt4TruthDressedWZJets
    #    addAntiKt4TruthDressedWZJets(kernel,'TRUTH')
    if not objKeyStore.isInInput("xAOD::JetContainer",
                                 "AntiKt10TruthTrimmedPtFrac5SmallR20Jets"):
        #Large R jets
        from DerivationFrameworkJetEtMiss.JetCommon import addTrimmedJets
        #addTrimmedJets('AntiKt', 1.0, 'Truth', rclus=0.2, ptfrac=0.05, mods="truth_groomed",
        #               algseq=kernel, outputGroup="Trimmed", writeUngroomed=False)
    elif not objKeyStore.isInInput("xAOD::JetContainer", "AntiKt10TruthJets"):
        addAntiKt10TruthJets(kernel, "TRUTH")
Beispiel #2
0
    def configure(self):
        from AthenaCommon.Logging import logging
        mlog = logging.getLogger('CollisionDecision::configure:')
        mlog.info('entering')

        import traceback
        try:
            from AthenaCommon.AppMgr import ToolSvc

            from PrimaryDPDMaker.PrimaryDPDMakerConf import MBTSTimeFilterTool
            ToolSvc += MBTSTimeFilterTool \
                       (ChargeThreshold   = 60.0/222.0,
                        MinHitsPerSide    = 2,
                        MaxTimeDifference = 10.0)

            from EventBookkeeperTools.BookkeepingInfoWriter \
                 import SkimDecisionsWriter
            skimmer = SkimDecisionsWriter('D3PDSkimDecisionWriter')
            skimmer.SkimDecisionsContainerName = 'DESD_COLLCAND_SkimDecisionsContainer'

            from PrimaryDPDMaker.PrimaryDPDMakerConf import CollisionFilterAlg
            from RecExConfig.ObjKeyStore import objKeyStore
            if objKeyStore.isInInput('CaloCellContainer', 'AllCalo'):
                self.seq += CollisionFilterAlg(
                    'CaloTimeFilterInCollisionStream',
                    DoCaloTimeFilter=True,
                    DoMBTSTimeFilter=False)
                skimmer.addAcceptAlg('CaloTimeFilterInCollisionStream')

            self.seq += CollisionFilterAlg('MBTSTimeFilterInCollisionStream',
                                           DoCaloTimeFilter=False,
                                           DoMBTSTimeFilter=True)
            skimmer.addAcceptAlg('MBTSTimeFilterInCollisionStream')

            from PrimaryDPDMaker.TriggerFilter import TriggerFilter
            self.seq += TriggerFilter('TriggerFilterInCollissionStream',
                                      trigger='L1_MBTS_1_1')
            skimmer.addAcceptAlg('TriggerFilterInCollissionStream')

            self.seq += skimmer

            # register output in objKeyStore
            objKeyStore.addTransient(self.outputType(), self.outputKey())

            self._handle = skimmer

        except:
            mlog.error("Error configuring LArCollisionTimeAlg.")
            traceback.print_exc()

        return True
Beispiel #3
0
def addTruthMET(kernel=None):
    # Ensure that we are adding it to something
    if kernel is None:
        from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob
        kernel = DerivationFrameworkJob
    # Only do this if the truth MET is not present
    # This should handle EVNT correctly without an explicit check
    from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob
    if not objKeyStore.isInInput(
            "xAOD::MissingETContainer", "MET_Truth") and not hasattr(
                DerivationFrameworkJob, "METReconstruction"):
        import METReconstruction.METConfig_Truth
        from METReconstruction.METRecoConfig import getMETRecoAlg
        metAlg = getMETRecoAlg('METReconstruction')
        kernel += metAlg
Beispiel #4
0
    def checkExistingOutput(self):

        # check wether output is already in objKeyStore.
        # If yes, unless ignore explicitly, return true
        # If multiple output, all type/key should be present

        from RecExConfig.ObjKeyStore import objKeyStore

        mlog = logging.getLogger('Configured::existingOutput:%s:' %
                                 self.__class__.__name__.replace(".", '_'))
        oneMatch = False
        oneUnmatch = False
        for atype in self.output().keys():
            allkeys = self.output()[atype]
            if type(allkeys) != type([]): allkeys = [allkeys]
            for akey in allkeys:
                if objKeyStore.isInInput(atype, akey):
                    oneMatch = True
                else:
                    mlog.info('one object not in output %s:%s' % (atype, akey))
                    oneUnmatch = True

        if oneMatch and not oneUnmatch:
            if self.ignoreExistingDataObject():
                mlog.info(
                    "Output objects already available. Continue nevertheless")
            else:
                mlog.info("Output objects already available. Do nothing")
                self._existingOutput = True
                return True

        elif oneMatch and oneUnmatch:
            mlog.info(
                "Some, not all, output objects already available. Continue nevertheless"
            )
            # mlog.info("Some, not all, output objects already available. Do nothing")
            # self._existingOutput=True
            # return True

        else:
            mlog.info("No output objects already available. Continue.")
        self._existingOutput = False
        return False
Beispiel #5
0
def addTruthJetsEVNT(kernel=None, decorationDressing=None):
    # Ensure that we are running on something
    if kernel is None:
        from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob
        kernel = DerivationFrameworkJob
    # Add jet algorithms if they aren't there
    from JetRec.JetRecStandard import jtm
    from JetRec.JetRecConf import JetAlgorithm
    truth_modifiers = [
        jtm.truthpartondr, jtm.partontruthlabel, jtm.jetdrlabeler,
        jtm.trackjetdrlabeler
    ]
    if not objKeyStore.isInInput("xAOD::JetContainer",
                                 "AntiKt4TruthJets") and not hasattr(
                                     kernel, 'jetalgAntiKt4Truth'):
        # Standard truth jets
        # To remove jet constituents add the modifier jtm.removeconstit
        from DerivationFrameworkJetEtMiss.JetCommon import addStandardJets
        addStandardJets("AntiKt",
                        0.4,
                        "Truth",
                        15000,
                        mods=truth_modifiers,
                        algseq=kernel,
                        outputGroup="DFCommonMCTruthJets")
    if not objKeyStore.isInInput("xAOD::JetContainer",
                                 "AntiKt4TruthWZJets") and not hasattr(
                                     kernel, 'jetalgAntiKt4TruthWZ'):
        # WZ Truth Jets - handle non-dressed case
        from DerivationFrameworkJetEtMiss.JetCommon import addStandardJets
        addStandardJets("AntiKt",
                        0.4,
                        "TruthWZ",
                        15000,
                        mods=truth_modifiers,
                        algseq=kernel,
                        outputGroup="DFCommonMCTruthJets")
    if not objKeyStore.isInInput(
            "xAOD::JetContainer",
            "AntiKt4TruthDressedWZJets") and decorationDressing is not None:
        # WZ Dressed Truth Jets - handle dressed case
        from DerivationFrameworkJetEtMiss.JetCommon import addStandardJets
        addStandardJets("AntiKt",
                        0.4,
                        "TruthDressedWZ",
                        ptmin=15000,
                        mods="truth_ungroomed",
                        algseq=kernel,
                        outputGroup="DFCommonMCTruthJets")

    if not objKeyStore.isInInput("xAOD::JetContainer",
                                 "AntiKt2TruthChargedJets"):
        # R=0.2 truth charged jets
        from DerivationFrameworkJetEtMiss.JetCommon import addStandardJets
        addStandardJets("AntiKt",
                        0.2,
                        "TruthCharged",
                        5000,
                        mods=truth_modifiers,
                        algseq=kernel,
                        outputGroup="DFCommonMCTruthJets")

    if not objKeyStore.isInInput("xAOD::JetContainer",
                                 "AntiKt10TruthJets") and not hasattr(
                                     kernel, 'jetalgAntiKt10Truth'):
        # AntiKt2 truth charged jets ghost association
        from JetRec.JetRecConf import PseudoJetGetter
        if not 'gakt2truthchargedget' in jtm.tools:
            jtm += PseudoJetGetter(
                "gakt2truthchargedget",  # give a unique name
                InputContainer="AntiKt2TruthChargedJets",  # SG key
                Label=
                "GhostAntiKt2TruthChargedJets",  # this is the name you'll use to retrieve associated ghosts
                OutputContainer="PseudoJetGhostAntiKt2TruthChargedJet",
                SkipNegativeEnergy=True,
                GhostScale=
                1.e-20,  # This makes the PseudoJet Ghosts, and thus the reco flow will treat them as so.
            )
        trackjetgetters = []
        trackjetgetters += [jtm.gakt2truthchargedget]
        truthgetters = [jtm.truthget]
        truthgetters += trackjetgetters
        flavorgetters = []
        for ptype in jetFlags.truthFlavorTags():
            flavorgetters += [getattr(jtm, "gtruthget_" + ptype)]
        truthgetters += flavorgetters
        jtm.gettersMap["truth"] = list(truthgetters)

        # NB! This line works together with the next block. Some care is required here!
        # If we build groomed jets, the jet code will automatically build ungroomed jets, so no need to add them separately
        #Large R ungroomed jets
        if objKeyStore.isInInput("xAOD::JetContainer",
                                 "AntiKt10TruthTrimmedPtFrac5SmallR20Jets"):
            from DerivationFrameworkJetEtMiss.JetCommon import addStandardJets
            addStandardJets('AntiKt',
                            1.0,
                            'Truth',
                            ptmin=50000,
                            mods=truth_modifiers,
                            algseq=kernel,
                            outputGroup="DFCommonMCTruthJets")

    if not objKeyStore.isInInput(
            "xAOD::JetContainer",
            "AntiKt10TruthTrimmedPtFrac5SmallR20Jets") and not hasattr(
                kernel, 'jetalgAntiKt10TruthTrimmedPtFrac5SmallR20'):
        #Large R jets
        from DerivationFrameworkJetEtMiss.JetCommon import addTrimmedJets
Beispiel #6
0
def addTruthJets(kernel=None, decorationDressing=None):
    # In case it's requested, set up the use of photon decorations from dressing code
    from JetRec.JetRecStandardToolManager import jtm
    if decorationDressing is not None and not hasattr(jtm,
                                                      'truthpartdressedwz'):
        # Ensure that we are adding it to something, and that we haven't run it already
        if kernel is None:
            from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob
            kernel = DerivationFrameworkJob
        # make sure if we are using EVNT that we don't try to check sim metadata
        barCodeFromMetadata = 2
        if objKeyStore.isInInput("McEventCollection", "GEN_EVENT"):
            barCodeFromMetadata = 0
        from JetRec.JetRecStandardToolManager import jtm
        from ParticleJetTools.ParticleJetToolsConf import CopyTruthJetParticles
        if not 'truthpartdressedwz' in jtm.tools:
            jtm += CopyTruthJetParticles(
                "truthpartdressedwz",
                OutputName="JetInputTruthParticlesDressedWZ",
                MCTruthClassifier=jtm.JetMCTruthClassifier,
                #IncludePromptLeptons=False,#IncludePromptPhotons=False,
                #IncludeMuons=True,IncludeNeutrinos=True,BarCodeFromMetadata=barCodeFromMetadata,
                #FSRPhotonCone=-1. #, DressingDecorationName=decorationDressing
            )
        # Add a jet tool runner for this thing
        from JetRec.JetRecConf import JetToolRunner, JetAlgorithm, PseudoJetGetter
        jtm += JetToolRunner("jetdressedwzrun",
                             EventShapeTools=[],
                             Tools=[jtm.truthpartdressedwz],
                             Timer=jetFlags.timeJetToolRunner())
        # And an algorithm to run in
        kernel += JetAlgorithm("jetdressedwzalg")
        jetdressedwzalg = kernel.jetdressedwzalg
        jetdressedwzalg.Tools = [jtm.jetdressedwzrun]
        if not 'truthdressedwzget' in jtm.tools:
            jtm += PseudoJetGetter(
                "truthdressedwzget",
                Label="TruthDressedWZ",
                InputContainer=jtm.truthpartdressedwz.OutputName,
                OutputContainer="PseudoJetTruthDressedWZ",
                GhostScale=0.0,
                SkipNegativeEnergy=True)
        jtm.gettersMap['truthdressedwz'] = list(jtm.gettersMap['truth'])
        jtm.gettersMap['truthdressedwz'][0] = jtm.truthdressedwzget
    if not hasattr(jtm, 'truthpartcharged'):
        # Ensure that we are adding it to something, and that we haven't run it already
        if kernel is None:
            from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob
            kernel = DerivationFrameworkJob
        # make sure if we are using EVNT that we don't try to check sim metadata
        barCodeFromMetadata = 2
        if objKeyStore.isInInput("McEventCollection", "GEN_EVENT"):
            barCodeFromMetadata = 0
        from JetRec.JetRecStandardToolManager import jtm
        from ParticleJetTools.ParticleJetToolsConf import CopyTruthJetParticles
        if not 'truthpartcharged' in jtm.tools:
            jtm += CopyTruthJetParticles(
                "truthpartcharged",
                OutputName="JetInputTruthParticlesCharged",
                MCTruthClassifier=jtm.JetMCTruthClassifier,
                #ChargedParticlesOnly=True,
                #BarCodeFromMetadata=barCodeFromMetadata
            )
        # Add a jet tool runner for this thing
        from JetRec.JetRecConf import JetToolRunner, JetAlgorithm, PseudoJetGetter
        jtm += JetToolRunner("jetchargedrun",
                             EventShapeTools=[],
                             Tools=[jtm.truthpartcharged],
                             Timer=jetFlags.timeJetToolRunner())
        # And an algorithm to run in
        kernel += JetAlgorithm("jetchargedalg")
        jetchargedalg = kernel.jetchargedalg
        jetchargedalg.Tools = [jtm.jetchargedrun]
        if not 'truthchargedget' in jtm.tools:
            jtm += PseudoJetGetter(
                "truthchargedget",
                Label="TruthCharged",
                InputContainer=jtm.truthpartcharged.OutputName,
                OutputContainer="PseudoJetTruthCharged",
                GhostScale=0.0,
                SkipNegativeEnergy=True)
        jtm.gettersMap['truthcharged'] = [jtm.truthchargedget]
    # Propagate that downward
    if dfInputIsEVNT:
        addTruthJetsEVNT(kernel, decorationDressing)
    else:
        addTruthJetsAOD(kernel, decorationDressing)
Beispiel #7
0
    pass

# make sure we have Configurable-aware jobO
# ie: hack that we'll remove someday... FIXME
from AthenaCommon.AlgSequence import AlgSequence
job = AlgSequence()

from McParticleAlgs.JobOptCfg import McAodBuilder, createMcAodBuilder, PileUpClassification

# If we're reprocessing, we may have TruthEvents but not xAODTruthLinks.
# Remake the links here if needed.
#   JM: In the future, this would not work. If TrutheEvents exists, it should
#       be renamed out of the way. Force rerun is effectivly always true.
# This needs to come before the McAodBuilder below; otherwise,
# xAODTruthCnvAlg will also try to rebuild TruthEvents.
if (objKeyStore.isInInput("xAOD::TruthEventContainer", "TruthEvents")
        and not objKeyStore.isInInput("xAODTruthParticleLinkVector",
                                      "xAODTruthLinks")):
    from xAODTruthCnv.xAODTruthCnvConf import xAODMaker__RedoTruthLinksAlg
    job += xAODMaker__RedoTruthLinksAlg("GEN_AOD2xAOD_links")

if (objKeyStore.isInInput("McEventCollection", "TruthEvent")
        and not objKeyStore.isInInput("McEventCollection", "GEN_AOD")):
    job += McAodBuilder()
    pass


def getMcAODBuilder(putype):
    """ putype is expected to be a string ! """
    builder = createMcAodBuilder(
        name="McAodBuilder" + putype,
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
Beispiel #9
0
DFJetAlgs = {}

##################################################################
# Schedule the augmentation of a flag to label events with large
# EMEC-IW Noise based on the presence of many bad quality clusters
##################################################################

if hasattr(DerivationFrameworkJob, "BadBatmanAugmentation"):
    dfjetlog.warning(
        "BadBatmanAugmentation: BadBatmanAugmentation already scheduled on sequence "
        + DerivationFrameworkJob.name)
else:
    # Check if we have clusters.  If we don't then this cannot run
    from RecExConfig.ObjKeyStore import objKeyStore
    if objKeyStore.isInInput("xAOD::CaloClusterContainer",
                             "CaloCalTopoClusters"):
        # schedule it
        batmanaug = CfgMgr.DerivationFramework__CommonAugmentation(
            "BadBatmanAugmentation")
        DerivationFrameworkJob += batmanaug
        batmanaugtool = None
        from AthenaCommon.AppMgr import ToolSvc
        # create and add the tool to the alg if needed
        if hasattr(ToolSvc, "BadBatmanAugmentationTool"):
            batmanaugtool = getattr(ToolSvc, "BadBatmanAugmentationTool")
        else:
            batmanaugtool = CfgMgr.DerivationFramework__BadBatmanAugmentationTool(
                "BadBatmanAugmentationTool")
            ToolSvc += batmanaugtool
        if not batmanaugtool in batmanaug.AugmentationTools:
            batmanaug.AugmentationTools.append(batmanaugtool)
Beispiel #10
0
        treatException("EventCount_jobOptions.py" )

# functionality : read truth
if rec.doTruth():
    # this algorithm dump the content of the MC event: big output
    if rec.doDumpMC():
        # generator truth
        from TruthExamples.TruthExamplesConf import DumpMC
        topSequence+=DumpMC()

# If no xAOD::EventInfo is found in a POOL file, schedule conversion from old EventInfo
if globalflags.InputFormat.is_pool():
    from RecExConfig.ObjKeyStore import objKeyStore
    from PyUtils.MetaReaderPeeker import convert_itemList
    objKeyStore.addManyTypesInputFile(convert_itemList(layout='#join'))
    from AthenaCommon.AlgSequence import AthSequencer
    condSeq = AthSequencer("AthCondSeq")
    if ( not objKeyStore.isInInput("xAOD::EventInfo") ) and ( not hasattr(condSeq, "xAODMaker::EventInfoCnvAlg") ):
        from xAODEventInfoCnv.xAODEventInfoCnvAlgDefault import xAODEventInfoCnvAlgDefault
        xAODEventInfoCnvAlgDefault(sequence=condSeq)

if rec.doTrigger:
    try:
        from TriggerJobOpts.TriggerGetter import TriggerGetter
        triggerGetter = TriggerGetter()
    except Exception:
        treatException("Could not import TriggerJobOpts.TriggerGetter . Switched off !" )
        from RecExConfig.RecAlgsFlags import recAlgs
        recAlgs.doTrigger=False

Beispiel #11
0
# ====================================================================
# Check if we have Monte Carlo or real data, based on the inputFileSummary
# ====================================================================
from AthenaCommon.GlobalFlags import globalflags
if not globalflags.DataSource() == 'data':
    logAODSelect_setupOptions.debug(
        "Detected that the input file is a simulated dataset")
    AODSelectFlags.isSim = True
    pass

# Check for the presence of GEN_AOD, TruthEvent (ESD), GEN_EVENT, and SpclMC:
if AODSelectFlags.isSim():
    # Check which McEventCollection we have available
    from RecExConfig.ObjKeyStore import objKeyStore
    if objKeyStore.isInInput("McEventCollection", "GEN_AOD") \
           or objKeyStore['transient'].has_item("McEventCollection#GEN_AOD"):
        AODSelectFlags.mcEventCollection = "GEN_AOD"
        pass
    elif objKeyStore.isInInput("McEventCollection", "TruthEvent") \
             or objKeyStore['transient'].has_item("McEventCollection#TruthEvent"):
        AODSelectFlags.mcEventCollection = "TruthEvent"
        pass
    elif objKeyStore.isInInput("McEventCollection", "GEN_EVENT") \
             or objKeyStore['transient'].has_item("McEventCollection#GEN_EVENT"):
        AODSelectFlags.mcEventCollection = "GEN_EVENT"
        pass

    # Check which TruthParticleContainer we have available
    if objKeyStore.isInInput("TruthParticleContainer", "SpclMC") \
           or objKeyStore['transient'].has_item("TruthParticleContainer#SpclMC"):
Beispiel #12
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
Beispiel #13
0
# =============================================================================
# We need to schedule the kt5 jet finding for the egamma calorimeter isolation correction
# =============================================================================
if AODSelectFlags.doEGammaCaloIsolationFlagging():
    AODSelectFlags.doRunJetFinding = True
    pass

# =============================================================================
# Schedule special jet finding for calculating the ambient energy density
# =============================================================================
if AODSelectFlags.doRunJetFinding():
    # Let's first see if the Kt5Jets already exist
    from RecExConfig.ObjKeyStore import objKeyStore
    hasKt5TopoJets = False
    if objKeyStore.isInInput("JetCollection", "Kt5TopoJets") \
           or objKeyStore['transient'].has_item("JetCollection#Kt5TopoJets"):
        hasKt5TopoJets = True
        pass
    if AODSelectFlags.doRunJetFinding.forceRerunJetFinding == True:
        hasKt5TopoJets = False

    if not hasKt5TopoJets:
        # Groan ... LowPtJetFinder clobbers jetFlags.inputFileType to AOD.
        # This causes failures building Kt5Truth jets when reading ESDs.
        # Try to work around...
        from PhotonAnalysisUtils.PhotonAnalysisUtilsFlags import PAUflags
        from RecExConfig.RecFlags import rec
        from JetRec.JetRecFlags import jetFlags
        if rec.readESD(): jetFlags.inputFileType = "ESD"
Beispiel #14
0
def HSG2physicsD3PD (name,file,
                     tuplename = 'physics',
                     **kw):

    from AthenaCommon.AlgSequence import AlgSequence  # needed for attila's code
    from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags # needed for attila's code
    
    # define track and cluster filters
    filter1 = makeTrackFilterAlg(TracksName = D3PDMakerFlags.TrackSGKey(),
                                 OutputTracksName='GoodTracks'+name,
                                 ptCut=0.,nSCTPix=4)

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

    # now configure the D3PD 
    from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
    alg = MSMgr.NewRootStream( name, file, TreeName=tuplename)
    
    
    #alg = D3PDMakerCoreComps.MakerAlg(tuplename, seq,
    #                                  file = file,
    #                                  D3PDSvc = D3PDSvc,
    #                                  streamNameRoot = streamNameRoot)
    
    alg += EventInfoD3PDObject        (**_args (10, 'EventInfo', kw))
    alg += LArCollisionTimeD3PDObject (**_args (10, 'LArCollisionTime', kw))


    from D3PDMakerCoreComps.D3PDObject         import make_SG_D3PDObject

    import EventCommonD3PDMaker

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

    
    # Muon blocks
    alg += MuonD3PDObject             (**_args (10, 'MuidMuon', kw,
                                                sgkey='MuidMuonCollection', prefix='mu_muid_',
                                                include = ["EFCBInfoIndex","EFMGInfoIndex", "EFMEInfoIndex" ],
                                                exclude = ["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
                                                allowMissing = True
                                                ))
    alg += MuonD3PDObject             (**_args (10, 'StacoMuon', kw,
                                                sgkey='StacoMuonCollection', prefix='mu_staco_',
                                                include = ["EFCBInfoIndex","EFMGInfoIndex", "EFMEInfoIndex"],
                                                exclude = ["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
                                                allowMissing = True
                                                ))
    alg += MuonD3PDObject             (**_args (10, 'CaloMuon', kw,
                                                sgkey='CaloMuonCollection', prefix='mu_calo_',
                                                include = ["EFCBInfoIndex","EFMGInfoIndex", "EFMEInfoIndex"],
                                                exclude = ["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
                                                allowMissing = True
                                                ))
    
    alg += MuonD3PDObject             (**_args (10, 'Muons', kw,
                                                sgkey='Muons', prefix='mu_muon_',
                                                include = ["EFCBInfoIndex","EFMGInfoIndex", "EFMEInfoIndex"],
                                                exclude = ["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
                                                allowMissing = True
                                                ))
    # Quadruplet vertex block
    from AthenaCommon.AlgSequence import AlgSequence  
    from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags 
    from HSG2VertexCreation.HSG2VertexReconstruction import HSG2VertexReconstruction 
    HSG2VertexReconstruction( "HSG2VertexReconstruction", 
                              AlgSequence( D3PDMakerFlags.PreD3PDAlgSeqName() )) 
    
    from HiggsD3PDMaker.HSG2VertexReconstruction import addHSG2VertexReconstruction
    addHSG2VertexReconstruction( alg, electron_target = "el_",
                                 muid_target = "mu_muid_",
                                 staco_target = "mu_staco_",
                                 calo_target = "mu_calo_" ,
                                 muon_target = "mu_muon_" )
    
    # Tau block
    alg += TauD3PDObject              (**_args ( 1, 'Tau', kw)) 
    

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

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

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

    # For H->ZZ->llqq analysis
    # PhysicsAnalysis/D3PDMaker/PhysicsD3PDMaker/python/SMWZD3PD.py
    from MissingET.METRefGetter_plup import *
    METRefAlg_HSG5 = make_METRefAlg(_suffix='_HSG5')
    METRefAlg_HSG5.sequence                    = AlgSequence( D3PDMakerFlags.PreD3PDAlgSeqName() )
    METRefAlg_HSG5.jet_JetInputCollectionKey   = "AntiKt4TopoEMJets"+JetTagD3PD_CollectionPostfix
    METRefAlg_HSG5.jet_JetPtCut                = 20.0*GeV
    METRefAlg_HSG5.jet_ApplyJetScale           = "No"
    METRefAlg_HSG5.jet_UseJetMomentForScale    = True
    METRefAlg_HSG5.jet_JetMomentForScale       = "EMJES"
    METRefAlg_HSG5.jet_RunSoftJetsTool         = False
    METRefAlg_HSG5.jet_SoftJetsPtCut           = 7.0*GeV
    METRefAlg_HSG5.jet_SoftJetsMaxPtCut        = 20.0*GeV
    METRefAlg_HSG5.photon_doPhotonTool         = False
    METRefAlg_HSG5.tau_doTauTool               = False
    METRefAlg_HSG5.jet_SoftJetsCalibType       = "EmScale"
    METRefAlg_HSG5.jet_ApplySoftJetsScale      = "No"
    METRefAlg_HSG5.jet_calibType               = "ExclRefCalib"
    METRefAlg_HSG5.ele_calibType               = "RefCalib"
    METRefAlg_HSG5.gamma_calibType             = "EmScale"
    METRefAlg_HSG5.cellout_calibType           = "Eflow"
    METRefAlg_HSG5.tau_calibType               = "EmScale"
    METRefAlg_HSG5.cryo_ApplyCorrection        = "Off"
    METRefAlg_HSG5.muon_container              = "StacoMuonCollection"
    METRefAlg_HSG5.muon_algorithm              = "Staco"
    METRefAlg_HSG5.muon_isolationAlg           = "dRJet"
    #    METRefAlg_HSG5.jet_ApplyJetJVF             = "Yes"
    #    METRefAlg_HSG5.plupSuppCorr                ='STVF'
    #    METRefAlg_HSG5.celloutCorrection           ='STVF'
    print METRefAlg_HSG5
    METRefAlg_HSG5()

    customMETs = ['MET_RefFinal', 'MET_RefGamma', 'MET_RefEle', 'MET_RefTau', 'MET_RefJet',
                  'MET_CellOut', 'MET_Cryo', 'MET_SoftJets',
                  'MET_RefJet_JVF', 'MET_RefJet_JVFCut',
                  'MET_CellOut_Eflow_STVF', 'MET_CellOut_Eflow_JetArea',
                  'MET_RefFinal_STVF' ]
    for custom in customMETs:
        alg += MissingETD3PDObject (level=0, sgkey = custom+'_HSG5',prefix='MET_HSG5_'+custom[4:],
                                    exclude=['MET_Base', 'MET_Base0', 'MET_Truth_Int',
                                             'MET_RefFinal_Comps','MET_Calib_Comps','MET_CellOut_Comps',
                                             'MET_CorrTopo_Comps','MET_Cryo_Comps','MET_CryoCone_Comps',
                                             'MET_Final_Comps','MET_LocHadTopo_Comps',
                                             'MET_LocHadTopoObj_Comps','MET_Muid_Comps',
                                             'MET_Muid_Spectro_Comps','MET_Muid_Track_Comps',
                                             'MET_MuonBoy_Comps','MET_MuonBoy_Spectro_Comps',
                                             'MET_MuonBoy_Track_Comps','MET_MuonMuid_Comps',
                                             'MET_Muon_Comps','MET_Muon_Isol_Muid_Comps',
                                             'MET_Muon_Isol_Staco_Comps','MET_Muon_NonIsol_Muid_Comps',
                                             'MET_Muon_NonIsol_Staco_Comps','MET_Muon_Total_Muid_Comps',
                                             'MET_Muon_Total_Staco_Comps','MET_RefEle_Comps',
                                             'MET_RefEle_em_Comps','MET_RefGamma_Comps',
                                             'MET_RefGamma_em_Comps','MET_RefJet_Comps',
                                             'MET_RefJet_em_Comps','MET_RefMuon_Comps',
                                             'MET_RefMuon_Muid_Comps','MET_RefMuon_Staco_Comps',
                                             'MET_RefMuon_Track_Muid_Comps','MET_RefMuon_Track_Staco_Comps',
                                             'MET_RefMuon_Track_em_Comps','MET_RefMuon_Track_Comps',
                                             'MET_RefMuon_em_Comps','MET_RefTau_Comps',
                                             'MET_RefTau_em_Comps','MET_SoftJets_Comps',
                                             'MET_SoftJets_em_Comps','MET_Topo_Comps',
                                             'MET_TopoObj_Comps','MET_Track_Comps'],
                                    allowMissing=True)
    alg += MissingETCompositionD3PDObject ( level=4, sgkey = 'MET_RefComposition_HSG5', suffix='HSG5_', allowMissing =True,
                                            jetSGKey='AntiKt4TopoEMJets'+JetTagD3PD_CollectionPostfix, jetPrefix='jet_AntiKt4TopoEM_MET_')

    ### large-R jets
    ### Copied from D3PDMaker/QcdD3PDMaker/share/JetMetD3PD_prodJobOFragment.py
    from RecExConfig.ObjKeyStore import objKeyStore
    if objKeyStore.isInInput("CaloClusterContainer","CaloCalTopoCluster"):
        preseqLRJ = AlgSequence (D3PDMakerFlags.PreD3PDAlgSeqName())
        from QcdD3PDMaker.JSjets import createJSJets
        from QcdD3PDMaker.JSD3PD import JSD3PD
        from HSG2DPDUtils.GroomedJetsConfig import getGroomedJetsConfig
        dictsConfig = getGroomedJetsConfig()
        for dC in dictsConfig:
            xx = createJSJets(dC[0], dC[1], preseqLRJ)
            if xx[0] != None and xx[1] != None:
                JSD3PD(xx, alg)

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

    # ... high-pt tracks (nSCT>3; pt>5 GeV)
    from TrackD3PDMaker.TrackD3PDMakerFlags                import TrackD3PDFlags as highPtFlags
    highPtFlags.doTruth = True
    highPtFlags.storeDiagonalCovarianceAsErrors = True
    highPtFlags.storeHitTruthMatching = True
    highPtFlags.storePixelHitsOnTrack = False
    highPtFlags.storePixelHolesOnTrack = False
    highPtFlags.storePixelOutliersOnTrack = False
    highPtFlags.storeSCTHitsOnTrack = False
    highPtFlags.storeSCTHolesOnTrack = False
    highPtFlags.storeSCTOutliersOnTrack = False
    highPtFlags.storeTRTHitsOnTrack = False
    highPtFlags.storeTRTHolesOnTrack = False
    highPtFlags.storeTRTOutliersOnTrack = False
    highPtFlags.storeTrackFitQuality = True
    highPtFlags.storeTrackMomentum = True
    highPtFlags.storeTrackSummary = True
    highPtFlags.trackParametersAtBeamSpotLevelOfDetails = 0
    highPtFlags.trackParametersAtGlobalPerigeeLevelOfDetails = 2
    highPtFlags.trackParametersAtPrimaryVertexLevelOfDetails = 3
    
    alg += TrackParticleD3PDObject(**_args ( 3, 'Tracks2', kw,
                                             sgkey  = 'HighPtTracks'+name,
                                             label  = 'trkpt5',
                                             prefix = 'trkpt5_'))

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

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

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

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

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

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

    if not rec.doTruth():
        alg += BeamSpotD3PDObject(10)
    
    
    
    if D3PDMakerFlags.DoTrigger():
                
        # Trigger Decision + metadata
        alg += TrigDecisionD3PDObject  (**_args(10, 'TrigDecision', kw))
        addTrigConfMetadata(alg)

        
        from TrigMissingETD3PDMaker.TrigMETD3PD import TrigMETD3PDObjects
        TrigMETD3PDObjects( alg )

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


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

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

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

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

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

    return alg
Beispiel #15
0
    include("PartPropSvc/PartPropSvc.py")
    pass

if not "ToolSvc"         in theApp.ExtSvc and \
   not "ToolSvc/ToolSvc" in theApp.ExtSvc:
    theApp.ExtSvc += ["ToolSvc/ToolSvc"]
    pass

# make sure we have Configurable-aware jobO
# ie: hack that we'll remove someday... FIXME
from AthenaCommon.AlgSequence import AlgSequence
job = AlgSequence()

from McParticleAlgs.JobOptCfg import McAodBuilder, createMcAodBuilder, PileUpClassification

if (objKeyStore.isInInput("McEventCollection", "TruthEvent")
        and not objKeyStore.isInInput("McEventCollection", "GEN_AOD")):
    job += McAodBuilder()
    pass


def getMcAODBuilder(putype):
    """ putype is expected to be a string ! """
    builder = createMcAodBuilder(
        name="McAodBuilder" + putype,
        outMcEvtCollection="GEN_AOD",  # this is the input to the CnvTool
        outTruthParticles="SpclMC" + putype,
    )
    builder.CnvTool.SelectSignalType = PileUpClassification.fromString(
        putype)  # min bias only