Пример #1
0
def egammaTruthParticleConfig \
        (seq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName()),
         sgkey = 'egammaTruth',
         prefix = '',
         doPileup     = D3PDMakerFlags.TruthDoPileup(),
         **kwargs):
    
    if not rec.doTruth():
        return

    # Is the container already in SG?
    if cfgKeyStore.isInInput ('DataVector<xAOD::TruthParticle_v1>', sgkey):
        return

    algname = prefix + sgkey + 'Builder'
    if not hasattr (seq, algname):
        import AthenaCommon.CfgMgr as CfgMgr
        from egammaRec.Factories import ToolFactory
        exten = ToolFactory (CfgMgr.Trk__ParticleCaloExtensionTool,
                             name="GSFParticleCaloExtensionTool",
                             StartFromPerigee = True)()

        seq += egammaD3PDAnalysis.egammaTruthAlg (
            algname,
            InputKey = D3PDMakerFlags.TruthSGKey(),
            OutputKey = sgkey,
            ParticleCaloExtensionTool = exten,
            AuxPrefix = D3PDMakerFlags.EgammaUserDataPrefix())
            
        cfgKeyStore.addTransient ('DataVector<xAOD::TruthParticle_v1>', sgkey)

    return
Пример #2
0
def _jetTwoTrackVertexTagAlgHook(
        c,
        prefix,
        sgkey,
        jetCollections,
        InfoName=JetTagD3PDFlags.JetFitterVertexFinderObjects(),
        **kw):

    preseq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName())

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

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

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

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

    return
Пример #3
0
def convert_trackparticles(seq,
                           xaod_key,
                           key,
                           truth_key,
                           trackmap_key=None,
                           base_xaod_key=None,
                           base_key=None):
    from xAODTrackingCnv.xAODTrackingCnvConf import xAODMaker__TrackParticleCnvAlg
    have_truth = cfgKeyStore.isInInput('TrackParticleTruthCollection',
                                       truth_key)
    alg = xAODMaker__TrackParticleCnvAlg \
          (xaod_key + 'Cnv',
           AODContainerName = key,
           xAODContainerName = xaod_key,
           AODTruthContainerName = truth_key,
           AddTruthLink = have_truth)
    seq += alg

    if trackmap_key != None:
        from xAODEgammaCnv.xAODEgammaCnvConf import xAODMaker__GSFTrackParticleMapCnvAlg
        alg = xAODMaker__GSFTrackParticleMapCnvAlg\
              (xaod_key + 'ParticleMapCnv',
               AODContainerName = base_key,
               AODContainerNameGSF = key,
               xAODContainerName = base_xaod_key,
               xAODContainerNameGSF = xaod_key,
               TrackMapName = trackmap_key)
        seq += alg

    return
def _jetFilterAlgHook(c, prefix, sgkey, JetContainer, **kw):

    preseq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName())

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

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

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

    del filterargs['name']

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

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

    return
Пример #5
0
def resolveSGKey(type, keystr):
    """Pick proper SG key out of a list from ObjKeyStore.
    
KEYSTR is a comma-separated list of StoreGate keys.
Return the first one from that list that exists in ObjKeyStore for TYPE.
Raise an exception if none of them exist.
"""

    _initKeyStore()

    log = logging.getLogger('D3PD')
    kl = keystr.split(',')
    for k in kl:
        if cfgKeyStore.isInInput(type, k):
            log.verbose("Using SG key %s for type %s." % (k, type))
            return k
    if len(kl) == 1:
        # Just one, hope for the best.
        return k

    from RecExConfig.InputFilePeeker import inputFileSummary
    if inputFileSummary['nentries'] == 0:
        # No input events, can't autoconfig.  Just return the first key...
        log.warning("No input events, can't autoconfigure. "
                    "Using SG key %s for type %s." % (kl[0], type))
        return kl[0]

    raise Exception("No keys among `%s' for type `%s' in ObjKeyStore." %
                    (keystr, type))
def simpleParticleConfig(seq=AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName()),
                         sgkey='SimpleTruthCollection',
                         prefix='',
                         pdg_id=11,
                         min_pt=-1. * GeV):

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

    # Is the algorithm already registered?
    algname = prefix + sgkey + 'Builder'
    if hasattr(seq, algname): return

    filtname = prefix + sgkey + 'Filter'

    seq += createMcAodBuilder\
           (algname,
            inMcEvtCollection = D3PDMakerFlags.TruthSGKey(),
            outMcEvtCollection = sgkey + '_GEN_D3PD',
            outTruthParticles = sgkey,
            filterTool = TruthD3PDAnalysis.SimpleTruthParticleFilterTool
              (filtname,
               PDG_ID = pdg_id,
               MinPt  = min_pt),
            cnvTool = CfgMgr.TruthParticleCnvTool('D3PDTruthParticleCnvTool'),
            )

    cfgKeyStore.addTransient('TruthParticleContainer', sgkey)
    return
Пример #7
0
def convert_tracks(seq, xaod_key, key, truth_key):
    from xAODTrackingCnv.xAODTrackingCnvConf import xAODMaker__TrackParticleCnvAlg
    have_truth = cfgKeyStore.isInInput('TrackTruthCollection', truth_key)
    alg = xAODMaker__TrackParticleCnvAlg \
          (xaod_key + 'Cnv',
           AddTruthLink = have_truth,
           TrackContainerName = key,
           xAODTrackParticlesFromTracksContainerName = xaod_key,
           ConvertTracks = True,
           ConvertTrackParticles = False)

    seq += alg
    return
Пример #8
0
def testSGKey(type, keystr):
    """Test to see if SG keys are in ObjKeyStore.
    
KEYSTR is a comma-separated list of StoreGate keys.
Return true if any key from that list exists in ObjKeyStore for TYPE.
"""

    _initKeyStore()

    kl = keystr.split(',')
    for k in kl:
        if cfgKeyStore.isInInput(type, k):
            return True
    return False
Пример #9
0
def addPFlowJets(inputtype="EM", rsize=0.4, algseq=None, outputGroup="PFlow"):
    from JetRec.JetRecStandard import jtm
    jtm.modifiersMap["mods"] = ["jetfilter", jtm.nsubjettiness, jtm.pull]

    pflowName = "AntiKt" + str(int(
        rsize * 10)) + inputtype + "Pflow"  # input : EM, EMC, LC
    algname = "jetalg" + pflowName
    OutputJets.setdefault(outputGroup, []).append(pflowName)

    # return if the alg is already scheduled here :
    if algseq is None:
        print "No algsequence passed! Will not schedule", algname
        return
    elif cfgKeyStore.isInInput("xAOD::JetContainer", pflowName):
        print "Collection ", algname, "is already in input AOD!"
        return
    elif algname in DFJetAlgs:
        if hasattr(algseq, algname):
            print "   Algsequence", algseq, "already has an instance of", algname
        else:
            print "   Added", algname, "to sequence", algseq
            algseq += DFJetAlgs[algname]
        return DFJetAlgs[algname]

    if inputtype == "EM":
        inputName = "empflow"
    elif inputtype == "EMC":
        inputName = "emcpflow"
    elif inputtype == "LC":
        inputName = "lcpflow"

    if pflowName in jtm.tools:
        pflowjet = jtm.tools[pflowName]
    else:
        pflowjet = jtm.addJetFinder(pflowName + "Jets",
                                    "AntiKt",
                                    rsize,
                                    inputName,
                                    "mods",
                                    ghostArea=0.01,
                                    ptmin=2000,
                                    ptminFilter=7000)

    from JetRec.JetRecConf import JetAlgorithm
    print "Adding PFlow jets : ", pflowName
    alg = JetAlgorithm(algname, Tools=[pflowjet])
    print "   Added", algname, "to sequence", algseq
    algseq += alg
    DFJetAlgs[algname] = alg
    return alg
Пример #10
0
def buildGenericGroomAlg(jetalg,
                         rsize,
                         inputtype,
                         groomedName,
                         jetToolBuilder,
                         includePreTools=False,
                         algseq=None,
                         outputGroup="CustomJets"):
    algname = "jetalg" + groomedName

    # add these groomed jets to the output (use setdefault() to constuct the list if not existing yet)
    OutputJets.setdefault(outputGroup, []).append(groomedName + "Jets")

    # return if the alg is already scheduled here :
    if algseq is None:
        print "No algsequence passed! Will not schedule", algname
        return
    elif cfgKeyStore.isInInput("xAOD::JetContainer", groomedName):
        print "Collection ", algname, "is already in input AOD!"
        return
    elif algname in DFJetAlgs:
        if hasattr(algseq, algname):
            print "   Algsequence", algseq, "already has an instance of", algname
        else:
            print "   Added", algname, "to sequence", algseq
            algseq += DFJetAlgs[algname]
        return DFJetAlgs[algname]

    from JetRec.JetRecUtils import buildJetContName
    ungroomedname = buildJetContName(jetalg, rsize, inputtype)

    # 1. make sure we have pseudo-jet in our original container
    # this returns a list of the needed tools to do so.
    jetalgTools = reCreatePseudoJets(jetalg, rsize, inputtype)

    # 2nd step run the trimming alg. We can re-use the original largeR jet since we reassociated the PseudoJet already.
    fatjet_trim = jetToolBuilder(groomedName + "Jets", ungroomedname)

    from JetRec.JetRecConf import JetAlgorithm
    if includePreTools:
        # enable track ghost association and JVF
        jetalgTools = [jtm.tracksel, jtm.tvassoc] + jetalgTools

    alg = JetAlgorithm(algname, Tools=jetalgTools + [fatjet_trim])
    DFJetAlgs[algname] = alg

    print "   Added", algname, "to sequence", algseq
    algseq += alg
    return alg
Пример #11
0
def buildGenericGroomAlg(
    jetalg, rsize, inputtype, groomedName, jetToolBuilder, includePreTools=False, algseq=None, outputGroup="CustomJets"
):
    algname = "jetalg" + groomedName

    # add these groomed jets to the output (use setdefault() to constuct the list if not existing yet)
    OutputJets.setdefault(outputGroup, []).append(groomedName + "Jets")

    # return if the alg is already scheduled here :
    if algseq is None:
        print "No algsequence passed! Will not schedule", algname
        return
    elif cfgKeyStore.isInInput("xAOD::JetContainer", groomedName):
        print "Collection ", algname, "is already in input AOD!"
        return
    elif algname in DFJetAlgs:
        if hasattr(algseq, algname):
            print "   Algsequence", algseq, "already has an instance of", algname
        else:
            print "   Added", algname, "to sequence", algseq
            algseq += DFJetAlgs[algname]
        return DFJetAlgs[algname]

    from JetRec.JetRecUtils import buildJetContName

    ungroomedname = buildJetContName(jetalg, rsize, inputtype)

    # 1. make sure we have pseudo-jet in our original container
    # this returns a list of the needed tools to do so.
    jetalgTools = reCreatePseudoJets(jetalg, rsize, inputtype)

    # 2nd step run the trimming alg. We can re-use the original largeR jet since we reassociated the PseudoJet already.
    fatjet_trim = jetToolBuilder(groomedName + "Jets", ungroomedname)

    from JetRec.JetRecConf import JetAlgorithm

    if includePreTools:
        # enable track ghost association and JVF
        jetalgTools = [jtm.tracksel, jtm.tvassoc] + jetalgTools

    alg = JetAlgorithm(algname, Tools=jetalgTools + [fatjet_trim])
    DFJetAlgs[algname] = alg

    print "   Added", algname, "to sequence", algseq
    algseq += alg
    return alg
Пример #12
0
def addPFlowJets(inputtype="EM", rsize=0.4, algseq=None, outputGroup="PFlow"):
    from JetRec.JetRecStandard import jtm

    jtm.modifiersMap["mods"] = ["jetfilter", jtm.nsubjettiness, jtm.pull]

    pflowName = "AntiKt" + str(int(rsize * 10)) + inputtype + "Pflow"  # input : EM, EMC, LC
    algname = "jetalg" + pflowName
    OutputJets.setdefault(outputGroup, []).append(pflowName)

    # return if the alg is already scheduled here :
    if algseq is None:
        print "No algsequence passed! Will not schedule", algname
        return
    elif cfgKeyStore.isInInput("xAOD::JetContainer", pflowName):
        print "Collection ", algname, "is already in input AOD!"
        return
    elif algname in DFJetAlgs:
        if hasattr(algseq, algname):
            print "   Algsequence", algseq, "already has an instance of", algname
        else:
            print "   Added", algname, "to sequence", algseq
            algseq += DFJetAlgs[algname]
        return DFJetAlgs[algname]

    if inputtype == "EM":
        inputName = "empflow"
    elif inputtype == "EMC":
        inputName = "emcpflow"
    elif inputtype == "LC":
        inputName = "lcpflow"

    if pflowName in jtm.tools:
        pflowjet = jtm.tools[pflowName]
    else:
        pflowjet = jtm.addJetFinder(
            pflowName + "Jets", "AntiKt", rsize, inputName, "mods", ghostArea=0.01, ptmin=2000, ptminFilter=7000
        )

    from JetRec.JetRecConf import JetAlgorithm

    print "Adding PFlow jets : ", pflowName
    alg = JetAlgorithm(algname, Tools=[pflowjet])
    print "   Added", algname, "to sequence", algseq
    algseq += alg
    DFJetAlgs[algname] = alg
    return alg
def TruthJetFilterConfig(seq,
                         sgkey='Filtered' +
                         D3PDMakerFlags.TruthParticlesSGKey(),
                         prefix='',
                         excludeWZdecays=True,
                         photonCone=-1.,
                         doPileup=D3PDMakerFlags.TruthDoPileup(),
                         writePartons=D3PDMakerFlags.TruthWritePartons(),
                         writeHadrons=D3PDMakerFlags.TruthWriteHadrons(),
                         writeGeant=D3PDMakerFlags.TruthWriteGeant(),
                         excludeLeptonsFromTau=False):

    if not rec.doTruth():
        return

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

    algname = prefix + sgkey + 'Builder'
    if hasattr(seq, algname):
        return

    filtname = prefix + sgkey + 'Filter'

    seq += createMcAodBuilder\
           (algname,
            inMcEvtCollection = D3PDMakerFlags.TruthSGKey(),
            outMcEvtCollection = sgkey + '_GEN_D3PD',
            outTruthParticles = sgkey,
            filterTool = D3PD__TruthJetFilterTool
              (filtname,
               DoPileup     = doPileup,
               WritePartons = writePartons,
               WriteHadrons = writeHadrons,
               WriteGeant   = writeGeant,
               ExcludeWZdecays = excludeWZdecays,
               PhotonCone   = photonCone,
               ExcludeLeptonsFromTau = excludeLeptonsFromTau,
               ),
            cnvTool = CfgMgr.TruthParticleCnvTool('D3PDTruthJetCnvTool'),
            )

    cfgKeyStore.addTransient('TruthParticleContainer', sgkey)
    return
Пример #14
0
def PartonJetConfig (finder    = 'AntiKt',
                     size      = 0.4,
                     doPythia  = False,
                     doHerwig  = False,
                     minJetPt  = 7.*GeV,
                     absEtaMax = 10.,
                     suffix    = '',
                     inputCollections = None):

    if not rec.doTruth():
        return

    # Is the container already in SG?
    import JetRec.JetAlgConfiguration                                                        
    nameBuilder = JetRec.JetAlgConfiguration.nameBuilder                                     
    editParm    = JetRec.JetAlgConfiguration.editParm 
    sgkey = nameBuilder(finder,editParm(size),'','Truth','Parton'+suffix,'',)+'Jets'
    if cfgKeyStore.isInInput ('JetCollection', sgkey):
        return

    # Configure parton selector tool
    from AthenaCommon.AppMgr import ToolSvc
    jetPartonSelectorTool = JetPartonSelectorTool("JetPartonSelectorTool")
    jetPartonSelectorTool.DoPythia = doPythia
    jetPartonSelectorTool.DoHerwig = doHerwig
    jetPartonSelectorTool.max_absEta = absEtaMax
    #jetPartonSelectorTool.OutputLevel = INFO
    ToolSvc += jetPartonSelectorTool

    # Configure jets builder
    if inputCollections != None:
        partonJetAlg = make_StandardJetGetter(finder,size,'Truth',inputSuff='Parton'+suffix,
                                              inputCollectionNames=inputCollections,
                                              inputTools=[jetPartonSelectorTool]).jetAlgorithmHandle()
        partonJetAlg.AlgTools['JetPartonSelectorTool'].InputCollectionKeys = []
        partonJetAlg.AlgTools['JetPartonSelectorTool'].InputCollectionKeys.append(inputCollections[0])
    else:
        partonJetAlg = make_StandardJetGetter(finder,size,'Truth',inputSuff='Parton'+suffix).jetAlgorithmHandle()
    partonJetAlg.AlgTools['JetFinalPtCut'].MinimumSignal = minJetPt
    #partonJetAlg.AlgTools['InputToJet'].InputSelector = jetPartonSelectorTool
    #partonJetAlg.OutputLevel = INFO

    return
def _truthMuonAlgHook(c, prefix, sgkey, TruthContainer='TruthParticles', **kw):
    preseq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName())

    # Is the container already in SG?
    if cfgKeyStore.isInInput('DataVector<xAOD::TruthParticle_v1>', sgkey):
        return

    # Is the algorithm already in the sequence?
    algname = prefix + 'TruthMuonsToSG'
    if hasattr(preseq, algname):
        return

    from TruthD3PDMaker.MCTruthClassifierConfig \
         import D3PDMCTruthClassifier
    preseq += MuonD3PDMaker.TruthMuonsToSG \
              (algname,
               TruthMuonContainer = sgkey,
               TruthContainer = TruthContainer,
               Classifier = D3PDMCTruthClassifier)
    return
Пример #16
0
    def configure(self):
        mlog = logging.getLogger(
            'ThinNegativeEnergyNeutralPFOs.py::configure:')
        mlog.info('entering')
        try:
            from ThinningUtils.ThinningUtilsConf import ThinNegativeEnergyNeutralPFOsAlg
            theNegativeEnergyNeutralPFOsThinner = ThinNegativeEnergyNeutralPFOsAlg(
                "ThinNegativeEnergyNeutralPFOsAlg",
                ThinNegativeEnergyNeutralPFOs=True,
                StreamName='StreamAOD')
            print(theNegativeEnergyNeutralPFOsThinner)

            CHSnPFOsThinAlg = None

            from RecExConfig.ObjKeyStore import cfgKeyStore

            from JetRec.JetRecFlags import jetFlags
            if (jetFlags.useTracks or cfgKeyStore.isInInput(
                    'xAOD::PFOContainer', 'CHSNeutralParticleFlowObjects')):
                CHSnPFOsThinAlg = ThinNegativeEnergyNeutralPFOsAlg(
                    "ThinNegativeEnergyCHSNeutralPFOsAlg",
                    NeutralPFOsKey="CHSNeutralParticleFlowObjects",
                    ThinNegativeEnergyNeutralPFOs=True,
                    StreamName='StreamAOD')
                print(CHSnPFOsThinAlg)

        except Exception:
            mlog.error(
                "could not get handle to ThinNegativeEnergyNeutralPFOsAlg")
            import traceback
            traceback.print_exc()
            return False
        mlog.info("now adding to topSequence")
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += theNegativeEnergyNeutralPFOsThinner
        if CHSnPFOsThinAlg:
            topSequence += CHSnPFOsThinAlg
        return True
Пример #17
0
    def configure(self):

        mlog = logging.getLogger('TrkTrackPostExecStream.py::configure:')
        mlog.info('entering')

        try:
            from RecExConfig.ObjKeyStore import cfgKeyStore
            from ThinningUtils.ThinningUtilsConf import ThinTrkTrackAlg
            theTrkTrackThinner = ThinTrkTrackAlg(
                "ThinTrkTrackAlg",
                doElectrons=True,
                doPhotons=True,
                doMuons=cfgKeyStore.isInInput('TrackCollection',
                                              'CombinedMuonTracks'),
                MuonsKey="Muons",
                ElectronsKey="Electrons",
                PhotonsKey="Photons",
                CombinedMuonsTrackKey="CombinedMuonTracks",
                GSFTrackKey="GSFTracks",
                StreamName='StreamAOD')

            from AthenaCommon.Constants import VERBOSE, DEBUG, INFO, ERROR
            #theTrkTrackThinner.OutputLevel=DEBUG
            print(theTrkTrackThinner)

        except Exception:
            import traceback
            mlog.error("could not get handle to ThinTrkTrackAlg")
            traceback.print_exc()
            return False

        mlog.info("now adding to topSequence")
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += theTrkTrackThinner
        mlog.info("Done adding to topSequence")

        return True
Пример #18
0
def hideInput(typ, key):
    sgkey = key
    dpos = sgkey.find('.')
    if dpos >= 0 and dpos < len(sgkey) - 1:
        sgkey = sgkey[:dpos]
    if cfgKeyStore.isInInput(typ, sgkey):
        if key.endswith('.'):
            newkey = key[:-1] + '_old.'
        else:
            newkey = key + '_old'
        addInputRename(typ, key, newkey)

        # Check for an xAOD type.
        if typ.startswith('xAOD::') and key.find('.') < 0:
            if typ.endswith('Container'):
                auxtyp = typ[:-9] + 'AuxContainer'
            else:
                auxtyp = typ + 'AuxInfo'

            auxkey = key + 'Aux.'
            auxnewkey = key + 'Aux_old.'
            addInputRename(auxtyp, auxkey, auxnewkey)
    return
Пример #19
0
def buildTOPQCA15jets(algseq):
    if not cfgKeyStore.isInInput("xAOD::JetContainer", "CamKt15LCTopoJets"):
        from JetRec.JetRecConf import JetAlgorithm
        jtm.modifiersMap["lctopoCA15"] = list(jtm.modifiersMap["lctopo"])
        if globalflags.DataSource() == 'geant4':
            jtm.modifiersMap["lctopoCA15"].remove('truthassoc')
        if hasattr(jtm, "CamKt15LCTopoJets"):
            TOPQCA15LC = getattr(jtm, "CamKt15LCTopoJets")
        else:
            TOPQCA15LC = jtm.addJetFinder("CamKt15LCTopoJets",
                                          "CamKt",
                                          1.5,
                                          "lctopo",
                                          "lctopoCA15",
                                          ghostArea=0.01,
                                          ptmin=2000,
                                          ptminFilter=100000,
                                          calibOpt="aro")
        if not hasattr(algseq, "jetalgCamKt15LCTopo"):
            TOPQCA15LCalg = JetAlgorithm("jetalgCamKt15LCTopo",
                                         Tools=[TOPQCA15LC])
            algseq += TOPQCA15LCalg
            print("Running jet finding algorithm for CamKt15LCTopoJets")
Пример #20
0
def makexAOD(seq, xaod_type, xaod_key, key=None, **kw):
    testfn = cfgKeyStore.isInInput
    if xaod_type in ['xAOD::TrigDecision']:
        testfn = cfgKeyStore.isInInputFile
    if testfn(xaod_type, xaod_key):
        return

    if key == None:
        key = xaod_key

    tinfo_list = types[xaod_type]
    if type(tinfo_list) != type([]):
        tinfo_list = [tinfo_list]

    for tinfo in tinfo_list:
        if cfgKeyStore.isInInput(tinfo[0], key):
            if seq == None:
                seq = AlgSequence()

            tinfo[1](seq, xaod_key, key, **kw)
            cfgKeyStore.addTransient(xaod_type, xaod_key)
            break
    return
Пример #21
0
def createxAOD(seq):
    from D3PDMakerConfig.makexAOD import makexAOD, setVxLinks
    makexAOD(seq,
             'xAOD::TruthParticleContainer',
             'TruthParticles',
             'GEN_AOD',
             xaod_truth_event_key='TruthEvents',
             xaod_truth_vertex_key='TruthVertices',
             xaod_truth_links_key='xAODTruthLinks')
    makexAOD(seq, 'xAOD::CaloClusterContainer', 'CaloCalTopoCluster')
    makexAOD(seq, 'xAOD::CaloClusterContainer', 'egClusterCollection')
    makexAOD(seq, 'xAOD::CaloClusterContainer', 'LArClusterEMFrwd')
    makexAOD(seq, 'xAOD::CaloClusterContainer', 'LArClusterEMSofte')
    makexAOD(seq, 'xAOD::CaloClusterContainer', 'EMTopoSW35')
    makexAOD(seq, 'xAOD::CaloClusterContainer', 'HLT')
    makexAOD(seq, 'xAOD::CaloClusterContainer', 'HLT_TrigCaloClusterMaker')
    makexAOD(seq, 'xAOD::CaloClusterContainer', 'HLT_TrigCaloClusterMaker_slw')
    makexAOD(seq, 'xAOD::CaloClusterContainer', 'MuonClusterCollection')
    makexAOD(seq, 'xAOD::CaloClusterContainer', 'Tau1P3PCellCluster')
    makexAOD(seq, 'xAOD::CaloClusterContainer', 'Tau1P3PEM012ClusterContainer')
    makexAOD(seq, 'xAOD::CaloClusterContainer', 'Tai1P3PPi0ClusterContainer')
    makexAOD(seq, 'xAOD::JetContainer', 'AntiKt4TopoEMJets')
    makexAOD(seq, 'xAOD::JetContainer', 'AntiKt4TruthJets')

    #makexAOD (seq, 'xAOD::TrackParticleContainer',
    #          'InDetTrackParticles', 'Tracks',
    #          truth_key = 'TrackTruthCollection')
    makexAOD(seq,
             'xAOD::TrackParticleContainer',
             'GSFInDetTrackParticles',
             'GSFTracks',
             truth_key='GSFTrackTruthCollection')

    makexAOD(seq,
             'xAOD::TrackParticleContainer',
             'InDetTrackParticles',
             'TrackParticleCandidate',
             truth_key='TrackParticleTruthCollection')
    makexAOD(seq,
             'xAOD::TrackParticleContainer',
             'GSFTrackParticles',
             'GSFTrackParticleCandidate',
             truth_key='GSFTrackParticleTruthCollection',
             trackmap_key='GSFTrackAssociation',
             base_xaod_key='InDetTrackParticles',
             base_key='TrackParticleCandidate')

    makexAOD(seq,
             'xAOD::TrackParticleContainer',
             'MuonboyTrackParticles',
             truth_key='TrackParticleTruthCollection')
    makexAOD(seq,
             'xAOD::TrackParticleContainer',
             'StacoTrackParticles',
             truth_key='TrackParticleTruthCollection')
    makexAOD(seq,
             'xAOD::TrackParticleContainer',
             'MuidExtrTrackParticles',
             truth_key='TrackParticleTruthCollection')
    makexAOD(seq,
             'xAOD::TrackParticleContainer',
             'MuidCombTrackParticles',
             truth_key='TrackParticleTruthCollection')
    makexAOD(seq,
             'xAOD::TrackParticleContainer',
             'ExtrapolatedMuonSpectrometerParticles',
             truth_key='TrackParticleTruthCollection')
    makexAOD(seq,
             'xAOD::TrackParticleContainer',
             'CombinedfitMuonparticles',
             truth_key='TrackParticleTruthCollection')
    makexAOD(seq,
             'xAOD::TrackParticleContainer',
             'HLT_InDetTrigParticleCreation_Electron_EFID',
             truth_key='')
    makexAOD(seq,
             'xAOD::TrackParticleContainer',
             'HLT_InDetTrigParticleCreationTRTOnly_Electron_EFID',
             truth_key='')

    makexAOD(seq,
             'xAOD::TrackParticleContainer',
             'HLT_InDetTrigParticleCreation_Muon_EFID',
             truth_key='')
    makexAOD(seq,
             'xAOD::TrackParticleContainer',
             'HLT_InDetTrigParticleCreation_FullScan_EFID',
             truth_key='')
    makexAOD(seq,
             'xAOD::TrackParticleContainer',
             'HLT_InDetTrigParticleCreation_Bphysics_EFID',
             truth_key='')
    makexAOD(seq,
             'xAOD::TrackParticleContainer',
             'HLT_InDetTrigParticleCreationTRTOnly_Muon_EFID',
             truth_key='')
    makexAOD(seq,
             'xAOD::TrackParticleContainer',
             'HLT_InDetTrigParticleCreationTRTOnly_FullScan_EFID',
             truth_key='')

    makexAOD(seq,
             'xAOD::VertexContainer',
             'AllPhotonsVxCandidates',
             TPContainerName='GSFTrackParticles')
    makexAOD(seq,
             'xAOD::VertexContainer',
             'VxPrimaryCandidate',
             key='PrimaryVertices',
             TPContainerName='InDetTrackParticles')

    makexAOD(seq,
             'xAOD::ElectronContainer',
             'Electrons',
             'ElectronAODCollection',
             xAODContainerFrwdName='ForwardElectrons')
    makexAOD(seq,
             'xAOD::ElectronContainer',
             'HLT_egamma_Electrons',
             'HLT_egamma_Electrons',
             xAODContainerFrwdName='HLT_egamma_Electrons_fwd',
             forTrigger=True)
    makexAOD(seq,
             'xAOD::PhotonContainer',
             'Photons',
             'PhotonAODCollection',
             topo_cluster_xaod_key='EMTopoSW35',
             vertex_xaod_key='AllPhotonsVxCandidates')
    makexAOD(seq,
             'xAOD::PhotonContainer',
             'HLT_egamma_Photons',
             'HLT_egamma_Photons',
             topo_cluster_xaod_key='',
             vertex_xaod_key='',
             forTrigger=True)

    makexAOD(seq,
             'xAOD::MuonContainer',
             'StacoMuonCollection',
             xaod_tp_key='InDetTrackParticles',
             xaod_sa_key='MuonboyTrackParticles',
             xaod_cb_key='StacoTrackParticles')
    makexAOD(seq,
             'xAOD::MuonContainer',
             'MuidMuonCollection',
             xaod_tp_key='InDetTrackParticles',
             xaod_sa_key='MuidExtrTrackParticles',
             xaod_cb_key='MuidCombTrackParticles')
    makexAOD(seq,
             'xAOD::MuonContainer',
             'CaloMuonCollection',
             xaod_tp_key='InDetTrackParticles',
             xaod_sa_key='',
             xaod_cb_key='')
    makexAOD(seq, 'xAOD::MuonContainer', 'HLT_MuonEFInfo')
    #makexAOD (seq, 'xAOD::MuonContainer',
    #          'HLT_eMuonEFInfo')
    #makexAOD (seq, 'xAOD::MuonContainer',
    #          'Muons',
    #          xaod_tp_key = 'InDetTrackParticles',
    #          xaod_sa_key = 'ExtrapolatedMuonSpectrometerParticles',
    #          xaod_cb_key = 'CombinedfitMuonparticles')
    makexAOD(seq, 'xAOD::TrigEMClusterContainer', 'HLT_TrigT2CaloEgamma')

    #setVxLinks (seq, 'InDetTrackParticles', 'VxPrimaryCandidate')
    #setVxLinks (seq, 'GSFTrackParticles', 'VxPrimaryCandidate')

    makexAOD(seq, 'xAOD::MissingETContainer', 'MET_Core_AntiKt4EMTopo',
             'MET_RefFinal')

    makexAOD(seq, 'xAOD::TrigDecision', 'xTrigDecision', 'TrigDecision')

    from xAODTriggerCnv.xAODRoICreator import xAODRoICreator
    if cfgKeyStore.isInInput('LVL1_ROI', 'LVL1_ROI'):
        xAODRoICreator(seq)
    return
Пример #22
0
def backgroundD3PD(alg=None,
                   level=10,
                   file='background.root',
                   tuplename='background',
                   flags=BackgroundD3PDMakerFlags,
                   **kw):

    preseq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName())
    if (not hasattr(topSequence, 'BeamBackgroundFiller')
            and not hasattr(preseq, 'BeamBackgroundFiller')):
        if cfgKeyStore.isInInput("Trk::SegmentCollection",
                                 "ConvertedMBoySegments"):
            from RecBackgroundAlgs import RecBackgroundAlgsConf
            preseq += RecBackgroundAlgsConf.BeamBackgroundFiller()

    if (not hasattr(topSequence, 'BeamBackgroundFillerMoore')
            and not hasattr(preseq, 'BeamBackgroundFillerMoore')):
        if cfgKeyStore.isInInput("Trk::SegmentCollection", "MooreSegments"):
            from RecBackgroundAlgs.RecBackgroundAlgsConf import BeamBackgroundFiller
            BeamBackgroundFillerMoore = BeamBackgroundFiller(
                'BeamBackgroundFillerMoore',
                muonSegmentContainerKey='MooreSegments',
                BeamBackgroundKey='BeamBackgroundDataMoore')
            preseq += BeamBackgroundFillerMoore

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

    #Event level info
    alg += EventInfoD3PDObject(**_args(1, 'EventInfo', kw))
    if globalflags.DataSource == "data":
        alg += LBLengthD3PDObject(**_args(0, 'LBLength', kw))

    if rec.doTruth():
        from TruthD3PDMaker.GenEventD3PDObject import GenEventD3PDObject
        alg += GenEventD3PDObject(**_args(0, 'GenEvent', kw))

    if rec.doTrigger():
        alg += TrigDecisionD3PDObject(**_args(2, 'TrigDecision', kw))
        addTrigConfMetadata(alg)

        bcToolType = ""
        if globalflags.DataSource == "data":
            bcToolType = "LHC"
        addBunchStructureMetadata(alg, bcToolType)

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

        if flags.AddTriggerBits():
            alg += getBkgdTriggerBitsD3PDObject([])

    alg += BackgroundWordD3PDObject(**_args(0, 'BkgWord', kw))
    if flags.doLUCID():
        alg += Lucid_RawDataD3PDObject(**_args(0, 'Lucid', kw))
    alg += RawInfoSummaryForTagD3PDObject(**_args(0, 'SumForTag', kw))

    alg += MBTSD3PDObject(**_args(0, 'MBTS', kw))
    alg += LArCollisionTimeD3PDObject(**_args(0, 'LArTimeDiff', kw))

    if flags.doMet():
        alg += MissingETD3PDObject(**_args(1,
                                           'MET_RefFinal',
                                           kw,
                                           sgkey='MET_RefFinal',
                                           prefix='MET_RefFinal',
                                           allowMissing=True))

    alg += MuonD3PDObject(
        **_args(0,
                'Muon',
                kw,
                sgkey='MuonCollection',
                prefix='mu_',
                include=[
                    "Isolation", "Quality", "MuonTimingFillerTool",
                    "MuonTileTimeTool", "ChamberT0"
                ],
                allowMissing=True))
    alg += MuonD3PDObject(
        **_args(0,
                'MuidMuon',
                kw,
                sgkey='MuidMuonCollection',
                prefix='mu_muid_',
                include=[
                    "Isolation", "Quality", "MuonTimingFillerTool",
                    "MuonTileTimeTool", "ChamberT0"
                ],
                allowMissing=True))
    alg += MuonD3PDObject(
        **_args(0,
                'StacoMuon',
                kw,
                sgkey='StacoMuonCollection',
                prefix='mu_staco_',
                include=[
                    "Isolation", "Quality", "MuonTimingFillerTool",
                    "MuonTileTimeTool", "ChamberT0"
                ],
                allowMissing=True))
    if flags.doCaloMuon():
        alg += MuonD3PDObject(
            **_args(0,
                    'CaloMuon',
                    kw,
                    sgkey='CaloMuonCollection',
                    prefix='mu_calo_',
                    include=[
                        "Isolation", "Quality", "MuonTimingFillerTool",
                        "MuonTileTimeTool", "ChamberT0"
                    ],
                    allowMissing=True))

    alg += MuonSegmentD3PDObject(**_args(
        1,
        'MuonSeg',
        kw,
        sgkey='MuonSegments',
        prefix='museg_',
        # MooreSegmentT0 takes the default time
        # MuonboySegmentT0 recalculates time (see MuonSegmentD3PDObject.py and MuonSegmentT0FillerTool.cxx)
        include=['MooreSegmentT0'],
        exclude=['MuonboySegmentT0'],
        allowMissing=True))
    alg += MuonSegmentD3PDObject(**_args(1,
                                         'MooreSeg',
                                         kw,
                                         sgkey='MooreSegments',
                                         prefix='mooreseg_',
                                         include=['MooreSegmentT0'],
                                         exclude=['MuonboySegmentT0'],
                                         allowMissing=True))
    alg += MuonSegmentD3PDObject(**_args(1,
                                         'MboySeg',
                                         kw,
                                         sgkey='ConvertedMBoySegments',
                                         prefix='mboyseg_',
                                         include=['MuonboySegmentT0'],
                                         exclude=['MooreSegmentT0'],
                                         allowMissing=True))
    if flags.doMuGirlSeg():
        alg += MuonSegmentD3PDObject(**_args(1,
                                             'MuGirlSeg',
                                             kw,
                                             sgkey='MuGirlSegments',
                                             prefix='mgseg_',
                                             include=['MooreSegmentT0'],
                                             exclude=['MuonboySegmentT0'],
                                             allowMissing=True))

    if flags.doTrk():
        alg += xAODTrackParticleD3PDObject(
            **_args(0, 'TrackParticle', kw, prefix='trk_'))

    if flags.doMuonHits():
        alg += MdtPrepDataD3PDObject(0)
        alg += RpcPrepDataD3PDObject(0)
        alg += CscPrepDataD3PDObject(0)
        alg += TgcPrepDataD3PDObject(0)

        alg += TgcPrepDataD3PDObject(**_args(0,
                                             'TGC_MeasurementsPriorBC',
                                             kw,
                                             sgkey='TGC_MeasurementsPriorBC',
                                             prefix='tgcPriorBC_',
                                             label='TgcPrepDataPriorBC'))
        alg += TgcPrepDataD3PDObject(**_args(0,
                                             'TGC_MeasurementsNextBC',
                                             kw,
                                             sgkey='TGC_MeasurementsNextBC',
                                             prefix='tgcNextBC_',
                                             label='TgcPrepDataNextBC'))

    if flags.doCaloJet():
        #alg += JetD3PDObject (**_args(4,'AntiKt4TopoEMJets', kw,  sgkey='AntiKt4TopoEMJets',   prefix='AntiKt4TopoEM_', include='BeamBackground' ))
        if cfgKeyStore.isInInput("Trk::SegmentCollection",
                                 "ConvertedMBoySegments"):
            alg += JetD3PDObject(
                **_args(4,
                        'AntiKt4TopoEMJets',
                        kw,
                        sgkey='AntiKt4TopoEMJets',
                        prefix='AntiKt4TopoEM_',
                        include=['BeamBackground'],
                        exclude=[
                            'JetVertexFraction', 'JVtx', 'ActiveArea',
                            'TruthMF', 'TracksMoments'
                        ],
                        BeamBackground_BeamBackgroundKey='BeamBackgroundData'))
        else:
            alg += JetD3PDObject(
                **_args(4,
                        'AntiKt4TopoEMJets',
                        kw,
                        sgkey='AntiKt4TopoEMJets',
                        prefix='AntiKt4TopoEM_',
                        exclude=[
                            'JetVertexFraction', 'JVtx', 'ActiveArea',
                            'TruthMF', 'TracksMoments'
                        ]))
    else:
        alg += JetD3PDObject(
            **_args(4,
                    'AntiKt4TrackJets',
                    kw,
                    sgkey='AntiKt4TrackJets',
                    prefix='AntiKt4Track_',
                    exclude=[
                        'JetVertexFraction', 'JVtx', 'ActiveArea', 'TruthMF',
                        'TracksMoments'
                    ]))

    alg += PrimaryxAODVertexD3PDObject(0)

    if flags.doBeamBkgd():
        #alg += BeamBackgroundD3PDObject(1)
        if cfgKeyStore.isInInput("Trk::SegmentCollection",
                                 "ConvertedMBoySegments"):
            alg += BeamBackgroundD3PDObject(
                **_args(1,
                        'BeamBackgroundData',
                        kw,
                        sgkey='BeamBackgroundData',
                        prefix='bb_',
                        bbJetIndex_Target='AntiKt4TopoEM_',
                        bbClusterIndex_Target='cl_'))
        if cfgKeyStore.isInInput("Trk::SegmentCollection", "MooreSegments"):
            alg += BeamBackgroundD3PDObject(
                **_args(1,
                        'BeamBackgroundData',
                        kw,
                        sgkey='BeamBackgroundDataMoore',
                        prefix='bbMoore_',
                        bbJetIndex_Target='AntiKt4TopoEM_',
                        bbClusterIndex_Target='cl_'))

    if flags.doBCM():
        alg += BcmRdoFlatD3PDObject(**_args(0, 'BCMRdo', kw))

    if flags.doZDC():
        if globalflags.DataSource == "data": alg += ZdcD3PDObject(10)

    if flags.doPixelClus():
        from InDetD3PDMaker.PixelClusterD3PDObject import PixelClusterD3PDObject
        alg += PixelClusterD3PDObject(0)

    if flags.doCaloClus():
        from CaloSysD3PDMaker.ClusterD3PDObject import ClusterD3PDObject
        alg += ClusterD3PDObject(1)

    return alg
Пример #23
0
    def configure(self,keys=None):
        super(MuonStandalone,self).configure(keys)
        if not self.isEnabled(): return

        from AthenaCommon.BeamFlags import jobproperties
        beamFlags = jobproperties.Beam 
        SegmentLocation = "MuonSegments"
        if muonStandaloneFlags.segmentOrigin == 'TruthTracking':
            SegmentLocation = "ThirdChainSegments"

        # do the following in case of (at least one) NSW
        if (MuonGeometryFlags.hasSTGC() and MuonGeometryFlags.hasMM()):
            getPublicTool("MuonLayerHoughTool")
            self.addAlg( CfgMgr.MuonLayerHoughAlg( "MuonLayerHoughAlg", 
                PrintSummary = muonStandaloneFlags.printSummary(),
                CscPrepDataContainer = ("CSC_Clusters" if MuonGeometryFlags.hasCSC() else ""),
                sTgcPrepDataContainer = ("STGC_Measurements" if MuonGeometryFlags.hasSTGC() else ""),
                MMPrepDataContainer = ("MM_Measurements" if MuonGeometryFlags.hasMM() else "")  ) )
            if not muonStandaloneFlags.patternsOnly():
                SegmentFinder = getPublicTool("MuonClusterSegmentFinderTool")
                Cleaner = getPublicToolClone("MuonTrackCleaner_seg","MuonTrackCleaner")
                Cleaner.Extrapolator = getPublicTool("MuonStraightLineExtrapolator")
                Cleaner.Fitter = getPublicTool("MCTBSLFitterMaterialFromTrack")
                Cleaner.PullCut = 3
                Cleaner.PullCutPhi = 3
                Cleaner.UseSLFit = True
                SegmentFinder.TrackCleaner = Cleaner
            # for test purposes allow parallel running of truth segment finding and new segment finder
                MuonSegmentFinderAlg = CfgMgr.MuonSegmentFinderAlg( "MuonSegmentMaker",SegmentCollectionName=SegmentLocation, 
                                                                    MuonPatternCalibration = getPublicTool("MuonPatternCalibration"),
                                                                    MuonPatternSegmentMaker = getPublicTool("MuonPatternSegmentMaker"),
                                                                    MuonTruthSummaryTool = None,
                                                                    PrintSummary = muonStandaloneFlags.printSummary() )
                # we check whether the layout contains any CSC chamber and if yes, we check that the user also wants to use the CSCs in reconstruction
                if MuonGeometryFlags.hasCSC() and muonRecFlags.doCSCs():
                    getPublicTool("CscSegmentUtilTool")
                    getPublicTool("Csc2dSegmentMaker")
                    getPublicTool("Csc4dSegmentMaker")
                else:
                    MuonSegmentFinderAlg.Csc2dSegmentMaker = ""
                    MuonSegmentFinderAlg.Csc4dSegmentMaker = ""
                self.addAlg( MuonSegmentFinderAlg )
        else:
            getPublicTool("MuonLayerHoughTool")
            self.addAlg(MooSegmentFinderAlg("MuonSegmentMaker"))

            self.addAlg(MooSegmentFinderNCBAlg("MuonSegmentMaker_NCB"))

            if (not cfgKeyStore.isInInput ('xAOD::MuonSegmentContainer', 'MuonSegments_NCB')):
                self.addAlg( CfgMgr.xAODMaker__MuonSegmentCnvAlg("MuonSegmentCnvAlg_NCB",SegmentContainerName="NCB_MuonSegments",xAODContainerName="NCB_MuonSegments") )

        if (not cfgKeyStore.isInInput ('xAOD::MuonSegmentContainer', 'MuonSegments')):
            self.addAlg( CfgMgr.xAODMaker__MuonSegmentCnvAlg("MuonSegmentCnvAlg") )
        
        if muonStandaloneFlags.doSegmentsOnly():
            return	                    
        # Tracks builder
        #
        # add the algorithm (which uses the MuonTrackSteering)
        # 
        TrackBuilder = CfgMgr.MuPatTrackBuilder("MuPatTrackBuilder", TrackSteering = getPublicTool("MuonTrackSteering") )
        self.addAlg( TrackBuilder )
        
        self.registerOutputKey("MuonSpectrometerTracks",   self.MuPatTrackBuilder, "SpectrometerTrackOutputLocation")
        self.registerInputKey ("MuonSegments", self.MuPatTrackBuilder, "MuonSegmentCollection"   )

        
        if muonStandaloneFlags.createTrackParticles():
            xAODTrackParticleCnvAlg = MuonStandaloneTrackParticleCnvAlg("MuonStandaloneTrackParticleCnvAlg")
            self.addAlg( xAODTrackParticleCnvAlg )
Пример #24
0
def addStandardJets(
    jetalg,
    rsize,
    inputtype,
    ptmin=2000,
    ptminFilter=5000,
    mods="calib",
    calibOpt="none",
    ghostArea=0.01,
    algseq=None,
    outputGroup="CustomJets",
    exclusiveSubjetBuilderList=[],
    **extraOptions
):
    ###############################################
    # supported options in extraOptions:
    # jetnamebase
    # variableRMinRadius
    # variableRMassScale
    ###############################################

    # "jetnamebase" can be configured through extraOptions
    if "jetnamebase" not in extraOptions.keys():
        jetnamebase = "{0}{1}{2}".format(jetalg, int(rsize * 10), inputtype)
    else:
        jetnamebase = extraOptions["jetnamebase"]
    jetname = jetnamebase + "Jets"
    algname = "jetalg" + jetnamebase
    OutputJets.setdefault(outputGroup, []).append(jetname)

    # exclusive kt subjet builder list
    if type(mods) is str:
        mods = jtm.modifiersMap[mods]
    for exclusiveSubjetBuilder in exclusiveSubjetBuilderList:
        (subjetfinder, SubjetContainerName) = exclusiveSubjetBuilder(jetname)
        mods += [subjetfinder]
        # add subjet container to the output
        OutputJets.setdefault(outputGroup, []).append(SubjetContainerName)

    # return if the alg is already scheduled here :
    if algseq is None:
        print "No algsequence passed! Will not schedule", algname
        return
    elif cfgKeyStore.isInInput("xAOD::JetContainer", jetname):
        print "Collection ", algname, "is already in input AOD!"
        return
    elif algname in DFJetAlgs:
        if hasattr(algseq, algname):
            print "   Algsequence", algseq, "already has an instance of", algname
        else:
            print "   Added", algname, "to sequence", algseq
            algseq += DFJetAlgs[algname]
        return DFJetAlgs[algname]

    if not jetname in jtm.tools:
        # Set default for the arguments to be passd to addJetFinder
        finderArgs = dict(modifiersin=[], consumers=[])
        finderArgs["ptmin"] = ptmin
        finderArgs["ptminFilter"] = ptminFilter
        finderArgs["ghostArea"] = ghostArea
        # configs for variable-R
        if ("variableRMinRadius" in extraOptions.keys()) and ("variableRMassScale" in extraOptions.keys()):
            print "INFO: You are running varaible-R jets!"
            finderArgs["variableRMinRadius"] = extraOptions["variableRMinRadius"]
            finderArgs["variableRMassScale"] = extraOptions["variableRMassScale"]
        # no container exist. simply build a new one.
        if inputtype == "LCTopo":
            finderArgs["modifiersin"] = mods
            finderArgs["calibOpt"] = "none"
        else:
            # be careful here -- when inputtype is not "LCTopo", many modifers in "calib" will not work
            # therefore, it is highly recommended to set mods=[], or something that you know that will work with non-calo type jet
            print "Warning! Make sure you know what you are doing!"
            print "Running addStandardJets for", jetname
            print "Here is a list of modifiers:", mods
            finderArgs["modifiersin"] = mods
        # finderArgs.pop('modifiersin') # leave the default modifiers.

        # map the input to the jtm code for PseudoJetGetter
        getterMap = dict(LCTopo="lctopo", Truth="truth", TruthWZ="truthwz", PV0Track="pv0track")
        # create the finder for the temporary collection.
        finderTool = jtm.addJetFinder(
            jetname, jetalg, rsize, getterMap[inputtype], **finderArgs  # pass the prepared arguments
        )

        from JetRec.JetRecConf import JetAlgorithm

        alg = JetAlgorithm(algname, Tools=[finderTool])
        print "   Added", algname, "to sequence", algseq
        algseq += alg
        DFJetAlgs[algname] = alg
Пример #25
0
def addStandardJets(jetalg,
                    rsize,
                    inputtype,
                    ptmin=2000,
                    ptminFilter=5000,
                    mods="calib",
                    calibOpt="none",
                    ghostArea=0.01,
                    algseq=None,
                    outputGroup="CustomJets",
                    exclusiveSubjetBuilderList=[],
                    **extraOptions):
    ###############################################
    # supported options in extraOptions:
    # jetnamebase
    # variableRMinRadius
    # variableRMassScale
    ###############################################

    # "jetnamebase" can be configured through extraOptions
    if 'jetnamebase' not in extraOptions.keys():
        jetnamebase = "{0}{1}{2}".format(jetalg, int(rsize * 10), inputtype)
    else:
        jetnamebase = extraOptions['jetnamebase']
    jetname = jetnamebase + "Jets"
    algname = "jetalg" + jetnamebase
    OutputJets.setdefault(outputGroup, []).append(jetname)

    # exclusive kt subjet builder list
    if type(mods) is str:
        mods = jtm.modifiersMap[mods]
    for exclusiveSubjetBuilder in exclusiveSubjetBuilderList:
        (subjetfinder, SubjetContainerName) = exclusiveSubjetBuilder(jetname)
        mods += [subjetfinder]
        # add subjet container to the output
        OutputJets.setdefault(outputGroup, []).append(SubjetContainerName)

    # return if the alg is already scheduled here :
    if algseq is None:
        print "No algsequence passed! Will not schedule", algname
        return
    elif cfgKeyStore.isInInput("xAOD::JetContainer", jetname):
        print "Collection ", algname, "is already in input AOD!"
        return
    elif algname in DFJetAlgs:
        if hasattr(algseq, algname):
            print "   Algsequence", algseq, "already has an instance of", algname
        else:
            print "   Added", algname, "to sequence", algseq
            algseq += DFJetAlgs[algname]
        return DFJetAlgs[algname]

    if not jetname in jtm.tools:
        # Set default for the arguments to be passd to addJetFinder
        finderArgs = dict(modifiersin=[], consumers=[])
        finderArgs['ptmin'] = ptmin
        finderArgs['ptminFilter'] = ptminFilter
        finderArgs['ghostArea'] = ghostArea
        # configs for variable-R
        if ("variableRMinRadius"
                in extraOptions.keys()) and ("variableRMassScale"
                                             in extraOptions.keys()):
            print 'INFO: You are running varaible-R jets!'
            finderArgs['variableRMinRadius'] = extraOptions[
                'variableRMinRadius']
            finderArgs['variableRMassScale'] = extraOptions[
                'variableRMassScale']
        # no container exist. simply build a new one.
        if inputtype == "LCTopo":
            finderArgs['modifiersin'] = mods
            finderArgs['calibOpt'] = "none"
        else:
            # be careful here -- when inputtype is not "LCTopo", many modifers in "calib" will not work
            # therefore, it is highly recommended to set mods=[], or something that you know that will work with non-calo type jet
            print 'Warning! Make sure you know what you are doing!'
            print 'Running addStandardJets for', jetname
            print 'Here is a list of modifiers:', mods
            finderArgs['modifiersin'] = mods
        #finderArgs.pop('modifiersin') # leave the default modifiers.

        # map the input to the jtm code for PseudoJetGetter
        getterMap = dict(LCTopo='lctopo',
                         Truth='truth',
                         TruthWZ='truthwz',
                         PV0Track='pv0track')
        # create the finder for the temporary collection.
        finderTool = jtm.addJetFinder(
            jetname,
            jetalg,
            rsize,
            getterMap[inputtype],
            **finderArgs  # pass the prepared arguments
        )

        from JetRec.JetRecConf import JetAlgorithm
        alg = JetAlgorithm(algname, Tools=[finderTool])
        print "   Added", algname, "to sequence", algseq
        algseq += alg
        DFJetAlgs[algname] = alg
Пример #26
0
# Schedules all tools needed for jet/MET analyses and writes the
# results into SG. These may then be accessed along the train
#********************************************************************

from DerivationFrameworkCore.DerivationFrameworkMaster import *
from JetRec.JetRecFlags import jetFlags
from AthenaCommon.GlobalFlags import globalflags

##################################################################
#       Schedule common content for all jet-using derivations
##################################################################

jetFlags.eventShapeTools = []
from JetRec.JetRecStandard import jtm
from RecExConfig.ObjKeyStore import cfgKeyStore
if not cfgKeyStore.isInInput("xAOD::JetContainer", "AntiKt2PV0TrackJets"):
    jtm.addJetFinder("AntiKt2PV0TrackJets",
                     "AntiKt",
                     0.2,
                     "pv0track",
                     ptmin=2000)
from JetRec.JetAlgorithm import addJetRecoToAlgSequence
addJetRecoToAlgSequence(DerivationFrameworkJob, eventShapeTools=None)

DFJetAlgs = {}

##################################################################
#                  Definitions of helper functions
##################################################################

Пример #27
0
# $Id: Lucid_RawDataD3PDObject.py 352093 2011-03-16 13:03:57Z mtibbett $
#
# @file BackgroundD3PDMaker/python/Lucid_RawDataD3PDObject.py
# @author Mark Tibbets <*****@*****.**>
# @date Feb, 2011
# @brief D3PD object for LUCID_RawData.
#

import D3PDMakerCoreComps    
import BackgroundD3PDMaker
from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
from D3PDMakerCoreComps.D3PDObject import make_SG_D3PDObject

from RecExConfig.ObjKeyStore import cfgKeyStore
if cfgKeyStore.isInInput( "LUCID_RawDataContainer", "Lucid_RawData" ):
    _haveLucid = True
else:
    _haveLucid = False
    from AthenaCommon.Logging import logging
    _mlog = logging.getLogger( "Lucid_RawDataD3PDObject" )
    _mlog.warning( "No LUCID_RawDataContainer object in input; skipping." )

Lucid_RawDataD3PDObject = \
    make_SG_D3PDObject ('LUCID_RawDataContainer',
                        'Lucid_RawData',
                        'lucid_', 'Lucid_RawDataD3PDObject',
                        default_allowMissing = not _haveLucid )

if _haveLucid:
    Lucid_RawDataD3PDObject.defineBlock (0, 'LucidPMTHits',
Пример #28
0
## because some of the following functions would add it with a lower
## detail level.
##
if triggerAvailable:
    from TriggerD3PDMaker.TrigDecisionD3PDObject import TrigDecisionD3PDObject
    d3pdalg += TrigDecisionD3PDObject(10)
    pass

##
## Offline e/gamma information:
##
oflEgammaIncludes = ['ClusterKin']
from egammaD3PDMaker.ElectronD3PDObject import ElectronD3PDObject
added = False
for sgkey in D3PDMakerFlags.ElectronSGKey().split(","):
    if cfgKeyStore.isInInput("ElectronContainer", sgkey):
        d3pdalg += ElectronD3PDObject(1, include=oflEgammaIncludes)
        added = True
        break
    pass
if not added:
    TriggerD3PDStream_msg.warning("Offline electrons not found in input")
    pass
from egammaD3PDMaker.PhotonD3PDObject import PhotonD3PDObject
added = False
for sgkey in D3PDMakerFlags.PhotonSGKey().split(","):
    if cfgKeyStore.isInInput("PhotonContainer", sgkey):
        d3pdalg += PhotonD3PDObject(1,
                                    include=oflEgammaIncludes + ['Samplings'],
                                    Samplings_Samplings=[2],
                                    Samplings_WriteEnergy=False,
Пример #29
0
def egammaD3PD(alg=None,
               trigalg=None,
               level=10,
               file='egamma.root',
               tuplename='egamma',
               **kw):

    preseq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName())
    createxAOD(preseq)

    if not cfgKeyStore.isInInput('xAOD::ElectronContainer', 'AllElectrons'):
        preseq += MergeElectrons()

    # Core algorithm
    # By default the user of this function should have created an algorithm already.
    # But for backwards compatibility let the function create its own algorithm if
    # needed...
    if not alg:
        from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
        alg = MSMgr.NewRootStream(tuplename, file)

    alg += EventInfoD3PDObject(**_args(level, 'EventInfo', kw))

    # Segregate trigger decision flags in a separate tree.
    if not trigalg:
        from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
        trigalg = MSMgr.NewRootStream(tuplename + ':' + tuplename + 'TrigDec',
                                      FileName=file,
                                      TreeName=tuplename + 'TrigDec')

    trigalg += EventInfoD3PDObject(0)
    alg.Stream.trigDecisionTree = trigalg

    # Add bunch structure metadata.
    from TriggerD3PDMaker.BunchStructureMetadata \
         import addBunchStructureMetadata
    addBunchStructureMetadata(alg)

    alg += LArCollisionTimeD3PDObject(**_args(level, 'LArCollisionTime', kw))
    alg += ElectronD3PDObject(**_args(
        level, 'Electron', kw, EgammaJetSignedIPAndPTRel_target='jet_'))
    alg += PhotonD3PDObject(**_args(level, 'Photon', kw))

    # # Additional muon variables for Zg skims.
    # if not MuonD3PDObject.allBlocknames().has_key("MuonScatteringAngleSignificance"):
    #     from AthenaCommon.AppMgr import ToolSvc
    #     muonScatteringSigTool=None
    #     if hasattr(ToolSvc, "MuonScatteringSigTool"):
    #         muonScatteringSigTool=ToolSvc.MuonScatteringSigTool
    #     from JetTagD3PDMaker import MuonScatteringAngleSignificanceFillerTool
    #     MuonD3PDObject.defineBlock (100, "MuonScatteringAngleSignificance",
    #                                 MuonScatteringAngleSignificanceFillerTool,
    #                                 ScatteringSigTool=muonScatteringSigTool)
    alg += MuonD3PDObject(**_args(
        10,
        'Muons',
        kw,
        sgkey='StacoMuonCollection,Muons',
        prefix='mu_',
        include=[
            "EFCBInfoIndex", "EFMGInfoIndex", "EFMEInfoIndex", "L2CBInfoIndex",
            "L1InfoIndex", "MuonScatteringAngleSignificance"
        ],
        exclude=["EFCBInfo", "EFMGInfo", "EFMEInfo", "L2CBInfo", "L1Info"],
        allowMissing=True))

    alg += JetD3PDObject(
        **_args(0, 'Jet', kw, include=['JetQual', 'DQMoments']))
    alg += MBTSD3PDObject(**_args(level, 'MBTS', kw))
    alg += MBTSTimeD3PDObject(**_args(level, 'MBTSTime', kw))
    # alg += MBTSTriggerBitsD3PDObject  (**_args (level, 'MBTSTriggerBits', kw))
    # alg += ZDCTriggerBitsD3PDObject   (**_args (level, 'ZDCTriggerBits', kw))
    alg += CollisionDecisionD3PDObject(**_args(level, 'CollisionDecision', kw))
    alg += MissingETD3PDObject(**_args(level,
                                       'MissingET',
                                       kw,
                                       sgkey='MET_Core_AntiKt4EMTopo',
                                       prefix='MET_RefFinal_'))
    if D3PDMakerFlags.DoTrigger():
        from TriggerD3PDMaker.TrigDecisionD3PDObject \
             import TrigDecisionD3PDObject
        alg += TrigDecisionD3PDObject(**_args(2, 'TrigDecision', kw))
        #TrigEgammaD3PDObjects (alg, **_args (1, 'TrigEgamma', kw,
        #                                     TrigEMCluster_level = 2))

    #     from TriggerD3PDMaker.EnergySumROID3PDObject import EnergySumROID3PDObject
    #     from TrigMissingETD3PDMaker.TrigMETD3PDObject import TrigMETD3PDObject

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

    #     # The LVL2 information:
    #     alg += TrigMETD3PDObject(**_args( level, 'TrigMETL2', kw,
    #                                       prefix = "trig_L2_met_",
    #                                       sgkey = "HLT_T2MissingET" ))
    #     if cfgKeyStore.isInInputFile( "TrigMissingETContainer", "HLT_L2MissingET_FEB" ):
    #         alg += TrigMETD3PDObject(**_args( level, 'TrigMETL2_FEB', kw,
    #                                           prefix = "trig_L2_feb_met_",
    #                                           sgkey = "HLT_L2MissingET_FEB" ))

    #     # The EF information:
    #     alg += TrigMETD3PDObject(**_args ( level, 'TrigMETEF', kw,
    #                                        prefix = "trig_EF_met_",
    #                                        sgkey = "HLT_TrigEFMissingET" ))

    #     from TriggerD3PDMaker.BGCodeD3PDObject import BGCodeD3PDObject
    #     alg += BGCodeD3PDObject (**_args (2, 'BGCode', kw))

    # May be missing in single-beam data.
    alg += PrimaryxAODVertexD3PDObject(**_args(
        1,
        'PrimaryVertex',
        kw,
        #allowMissing = True,
        sgkey=D3PDMakerFlags.VertexSGKey(),
        prefix='vxp_',
        storeVertexTrackIndexAssociation=False,
        storeVertexTrackAssociation=True,
        storeDiagonalCovarianceAsErrors=True))

    if rec.doTruth():
        from MuonD3PDMaker.TruthMuonD3PDObject import TruthMuonD3PDObject
        alg += TruthMuonD3PDObject(**_args(level, 'TruthMuon', kw))
        alg += TruthEventD3PDObject(**_args(1, 'TruthEvent', kw))
        alg += TruthParticleD3PDObject(**_args(level, 'TruthParticle', kw))

    # alg.MetadataTools += [LBMetadataConfig()]

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

    return alg
Пример #30
0
                                                                                UnassociatedHitsGetter = unassociatedHitsGetterTool,
                                                                                ContainerName = "EventInfo",
                                                                                DecorationPrefix = prefixName,
                                                                                OutputLevel =INFO)
    ToolSvc += unassociatedHitsDecorator
    augmentationTools+=[unassociatedHitsDecorator]
    if (printIdTrkDxAODConf):
        print unassociatedHitsDecorator
        print unassociatedHitsDecorator.properties()

# Add LArCollisionTime augmentation tool
if dumpLArCollisionTime:
    from LArCellRec.LArCollisionTimeGetter import LArCollisionTimeGetter
    from RecExConfig.ObjKeyStore           import cfgKeyStore
    # We can only do this if we have the cell container.
    if cfgKeyStore.isInInput ('CaloCellContainer', 'AllCalo'):
        LArCollisionTimeGetter (topSequence)

        from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__LArCollisionTimeDecorator
        lArCollisionTimeDecorator = DerivationFramework__LArCollisionTimeDecorator (name ='lArCollisionTimeDecorator',
                                                                                    ContainerName = "EventInfo",
                                                                                    DecorationPrefix = prefixName+"LArCollTime_",
                                                                                    OutputLevel =INFO)
        ToolSvc += lArCollisionTimeDecorator
        augmentationTools+=[lArCollisionTimeDecorator]
        if (printIdTrkDxAODConf):
            print lArCollisionTimeDecorator
            print lArCollisionTimeDecorator.properties()


# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration

# $Id: TrigOperationalInfoD3PDObject.py 338058 2010-12-20 13:20:43Z krasznaa $
#
# D3PD object capable of saving the names of the chains which caused an event to
# end up in the express stream. Should only be useful for producing first trigger
# efficiency plots out of express stream data.
#

from D3PDMakerCoreComps.D3PDObject import make_SG_D3PDObject
import TriggerD3PDMaker

# This object can only be used on express stream (D)ESD files. So let's check
# whether the source object is available, because most of the time it isn't.
from RecExConfig.ObjKeyStore import cfgKeyStore
if cfgKeyStore.isInInput( "TrigOperationalInfoCollection", "HLT_EXPRESS_OPI_EF" ):
    _haveOpInfo = True
else:
    _haveOpInfo = False
    from AthenaCommon.Logging import logging
    _mlog = logging.getLogger( "TrigOperationalInfoD3PDObject" )
    _mlog.warning( "No TrigOperationalInfoCollection object in input; skipping." )

TrigOperationalInfoD3PDObject = make_SG_D3PDObject( "TrigOperationalInfoCollection",
                                                    "HLT_EXPRESS_OPI_EF",
                                                    "trig_express_",
                                                    "TrigOperationalInfoD3PDObject",
                                                    default_allowMissing = not _haveOpInfo )

if _haveOpInfo:
    TrigOperationalInfoD3PDObject.defineBlock( 0, "ExpressChains",
Пример #32
0
        UnassociatedHitsGetter=unassociatedHitsGetterTool,
        ContainerName="EventInfo",
        DecorationPrefix=prefixName,
        OutputLevel=INFO)
    ToolSvc += unassociatedHitsDecorator
    augmentationTools += [unassociatedHitsDecorator]

    if (printIdTrkDxAODConf):
        print unassociatedHitsDecorator
        print unassociatedHitsDecorator.properties()

# Add LArCollisionTime augmentation tool
if dumpLArCollisionTime:
    from RecExConfig.ObjKeyStore import cfgKeyStore
    # We can only do this if we have the cell container.
    if cfgKeyStore.isInInput('CaloCellContainer', 'AllCalo'):

        from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__LArCollisionTimeDecorator
        lArCollisionTimeDecorator = DerivationFramework__LArCollisionTimeDecorator(
            name='NCBlArCollisionTimeDecorator',
            ContainerName="EventInfo",
            DecorationPrefix=prefixName + "LArCollTime_",
            OutputLevel=INFO)
        ToolSvc += lArCollisionTimeDecorator
        augmentationTools += [lArCollisionTimeDecorator]

        if (printIdTrkDxAODConf):
            print lArCollisionTimeDecorator
            print lArCollisionTimeDecorator.properties()

#====================================================================
Пример #33
0
def JetVarToolConfig(seq=AlgSequence):

    from RecExConfig.ObjKeyStore import cfgKeyStore
    if (cfgKeyStore.isInInput('CaloCellContainer', 'AllCalo')
            and cfgKeyStore.isInInput('CaloCellLinkContainer',
                                      'CaloCalTopoCluster_Link')):

        from JetRec.JetMomentGetter import make_JetMomentGetter
        from JetRec.JetRecFlags import jetFlags

        from CaloClusterCorrection.StandardCellWeightCalib import getCellWeightTool
        cellcalibtool = getCellWeightTool('Kt',
                                          0.4,
                                          'Topo',
                                          onlyCellWeight=True)

        jetFlags.doJVF = False  ##the following jet getter seems to fail if we don't deactivate the jet vertex finder.
        #make_StandardJetGetter('AntiKt',0.4,'Topo',disable=False, doCalib=True, calibName='H1NumInv', outputCollectionName='AntiKt4TopoJets',seq=seq)
        #make_StandardJetGetter('AntiKt',0.6,'Topo',disable=False, doCalib=True, calibName='H1NumInv', outputCollectionName='AntiKt6TopoJets',seq=seq)
        # MB: April 19, 2011, Suggested fix from SS
        make_StandardJetGetter('AntiKt',
                               0.4,
                               'Topo',
                               disable=False,
                               doCalib=True,
                               calibName='EM:H1NumInv',
                               outputCollectionName='AntiKt4TopoJets',
                               seq=seq)
        make_StandardJetGetter('AntiKt',
                               0.6,
                               'Topo',
                               disable=False,
                               doCalib=True,
                               calibName='EM:H1NumInv',
                               outputCollectionName='AntiKt6TopoJets',
                               seq=seq)

        # MB: April 7, 2011 : Suggested fix from SS
        from JetMomentTools.JetMomentToolsConf import \
             JetBadChanCorrTool, JetBadCellCorrTool, JetCaloQualityTool
        atool4 = JetBadChanCorrTool("JetBadChanCorrTool_anti04",
                                    ConeDr=0.4,
                                    UseCalibScale=False)
        atool4.CellCalibrator = cellcalibtool
        atool6 = JetBadChanCorrTool("JetBadChanCorrTool_anti06",
                                    ConeDr=0.6,
                                    UseCalibScale=False)
        atool6.CellCalibrator = cellcalibtool

        #atool4 = JetBadChanCorrTool("JetBadChanCorrTool_anti04",UpdateEvery=False,ConeDr=0.4,UseCalibScale=False)
        #atool4.CellCalibrator = cellcalibtool
        #atool6 = JetBadChanCorrTool("JetBadChanCorrTool_anti06",UpdateEvery=False,ConeDr=0.6,UseCalibScale=False)
        #atool6.CellCalibrator = cellcalibtool

        cqual_tool = JetCaloQualityTool("CaloQualTool")
        cqual_tool.doSamplingBasedVariables = True
        cqual_tool.doCellBasedVariables = True

        BadCellCorrT = JetBadCellCorrTool("JetBadCellCorrTool")

        BadCellCorrT.CellCalibrator = cellcalibtool
        ##print BadCellCorrT
        ##toolist += [BadCellCorrT]

        make_JetMomentGetter("AntiKt4TopoJets",
                             [atool4, cqual_tool, BadCellCorrT],
                             seq=seq)
        make_JetMomentGetter("AntiKt6TopoJets",
                             [atool6, cqual_tool, BadCellCorrT],
                             seq=seq)
    else:
        from AthenaCommon.Logging import logging
        log = logging.getLogger('MissingETGoodness')
        log.warning('No cells; not rebuilding jets.')

    ###############################################

    jet_collection_key = 'AntiKt4TopoJets'
    if cfgKeyStore.isInInput('JetCollection', 'AntiKt4TopoEMJets'):
        jet_collection_key = 'AntiKt4TopoEMJets'

    truth_jet_collection_key = 'Cone4TruthJets'
    if cfgKeyStore.isInInput('JetCollection', 'AntiKt4TruthJets'):
        truth_jet_collection_key = 'AntiKt4TruthJets'

    from MissingETGoodness.MissingETGoodnessConf import JetVarTool as ConfiguredJetVarTool
    JetVarTool = ConfiguredJetVarTool(
        JetCollectionKey=jet_collection_key,
        JetTruthCollectionKey=truth_jet_collection_key,
        TrackParticleContainerKey='TrackParticleCandidate',
    )
    from AthenaCommon.AppMgr import ToolSvc
    ToolSvc += JetVarTool
    print JetVarTool
Пример #34
0
#
# D3PD object saving the CTP_RDO information into the D3PD
# Note that this can only be used on ESD files (or if back-navigation
# is active...)
#

import D3PDMakerCoreComps
from D3PDMakerCoreComps.D3PDObject import D3PDObject
from D3PDMakerCoreComps.D3PDObject import make_SG_D3PDObject
import TriggerD3PDMaker

# This object can only be used on (D)ESD files, when the CTP_RDO object is
# available:
from RecExConfig.ObjKeyStore import cfgKeyStore
if cfgKeyStore.isInInput("CTP_RDO", "CTP_RDO"):
    _haveRDO = True
else:
    _haveRDO = False
    from AthenaCommon.Logging import logging
    _mlog = logging.getLogger("CTPD3PDObject")
    _mlog.warning("No CTP_RDO object in input; skipping.")

CTPD3PDObject = make_SG_D3PDObject("CTP_RDO",
                                   "CTP_RDO",
                                   "ctp_",
                                   "CTPD3PDObject",
                                   default_allowMissing=not _haveRDO)

if _haveRDO:
    CTPD3PDObject.defineBlock(0, "RDOInfo", TriggerD3PDMaker.CTP_RDOFillerTool)
Пример #35
0
# results into SG. These may then be accessed along the train
# ********************************************************************

from DerivationFrameworkCore.DerivationFrameworkMaster import *
from JetRec.JetRecFlags import jetFlags
from AthenaCommon.GlobalFlags import globalflags

##################################################################
#       Schedule common content for all jet-using derivations
##################################################################

jetFlags.eventShapeTools = []
from JetRec.JetRecStandard import jtm
from RecExConfig.ObjKeyStore import cfgKeyStore

if not cfgKeyStore.isInInput("xAOD::JetContainer", "AntiKt2PV0TrackJets"):
    jtm.addJetFinder("AntiKt2PV0TrackJets", "AntiKt", 0.2, "pv0track", ptmin=2000)
from JetRec.JetAlgorithm import addJetRecoToAlgSequence

addJetRecoToAlgSequence(DerivationFrameworkJob, eventShapeTools=None)

DFJetAlgs = {}

##################################################################
#                  Definitions of helper functions
##################################################################


def defineEDAlg(R=0.4, inputtype="LCTopo"):
    from EventShapeTools.EventDensityConfig import configEventDensityTool, EventDensityAlg
    from AthenaCommon.AppMgr import ToolSvc