Exemple #1
0
def customiseEarlyDelete(process):
    # Mapping label -> [branches]
    # for the producers whose products are to be deleted early
    products = collections.defaultdict(list)

    products = customiseEarlyDeleteForSeeding(process, products)

    products = customiseEarlyDeleteForCandIsoDeposits(process, products)

    # Set process.options.canDeleteEarly
    if not hasattr(process.options, "canDeleteEarly"):
        process.options.canDeleteEarly = cms.untracked.vstring()

    branchSet = set()
    for branches in products.itervalues():
        for branch in branches:
            branchSet.add(branch)
    process.options.canDeleteEarly.extend(list(branchSet))

    # Find the consumers
    for moduleType in [process.producers_(), process.filters_(), process.analyzers_()]:
        for name, module in moduleType.iteritems():
            for producer, branches in products.iteritems():
                if _hasInputTagModuleLabel(process, module, producer):
                    #print "Module %s mightGet %s" % (name, str(branches))
                    if hasattr(module, "mightGet"):
                        module.mightGet.extend(branches)
                    else:
                        module.mightGet = cms.untracked.vstring(branches)
    return process
def customiseEarlyDelete(process):
    # Mapping label -> [branches]
    # for the producers whose products are to be deleted early
    products = collections.defaultdict(list)

    products = customiseEarlyDeleteForSeeding(process, products)
    products = customiseEarlyDeleteForMkFit(process, products)
    products = customiseEarlyDeleteForCKF(process, products)

    products = customiseEarlyDeleteForCandIsoDeposits(process, products)

    # Set process.options.canDeleteEarly
    if not hasattr(process.options, "canDeleteEarly"):
        process.options.canDeleteEarly = cms.untracked.vstring()

    branchSet = set()
    for branches in products.values():
        for branch in branches:
            branchSet.add(branch)
    branchList = sorted(branchSet)
    process.options.canDeleteEarly.extend(branchList)

    # LogErrorHarvester should not wait for deleted items
    for prod in process.producers_().values():
        if prod.type_() == "LogErrorHarvester":
            if not hasattr(prod, 'excludeModules'):
                prod.excludeModules = cms.untracked.vstring()
            t = prod.excludeModules.value()
            t.extend([b.split('_')[1] for b in branchList])
            prod.excludeModules = t

    # Find the consumers
    producers = []
    branchesList = []
    for producer, branches in products.items():
        producers.append(producer)
        branchesList.append(branches)

    for moduleType in [
            process.producers_(),
            process.filters_(),
            process.analyzers_()
    ]:
        for name, module in moduleType.items():
            result = []
            for producer in producers:
                result.append(False)

            _hasInputTagModuleLabel(process, module, name, producers, result)
            for i in range(len(result)):
                if result[i]:
                    #if it exists it might be optional or empty, both evaluate to False
                    if hasattr(module, "mightGet") and module.mightGet:
                        module.mightGet.extend(branchesList[i])
                    else:
                        module.mightGet = cms.untracked.vstring(
                            branchesList[i])
    return process
def customiseEarlyDelete(process):
    # Mapping label -> [branches]
    # for the producers whose products are to be deleted early
    products = collections.defaultdict(list)

    products = customiseEarlyDeleteForSeeding(process, products)

    products = customiseEarlyDeleteForCandIsoDeposits(process, products)

    # Set process.options.canDeleteEarly
    if not hasattr(process.options, "canDeleteEarly"):
        process.options.canDeleteEarly = cms.untracked.vstring()

    branchSet = set()
    for branches in six.itervalues(products):
        for branch in branches:
            branchSet.add(branch)
    process.options.canDeleteEarly.extend(list(branchSet))

    # LogErrorHarvester should not wait for deleted items
    for prod in six.itervalues(process.producers_()):
        if prod.type_() == "LogErrorHarvester":
            if not hasattr(prod,'excludeModules'):
                prod.excludeModules = cms.untracked.vstring()
            t = prod.excludeModules.value()
            t.extend([b.split('_')[1] for b in branchSet])
            prod.excludeModules = t

    # Find the consumers
    producers=[]
    branchesList=[]
    for producer, branches in six.iteritems(products):
        producers.append(producer)
        branchesList.append(branches)

    for moduleType in [process.producers_(), process.filters_(), process.analyzers_()]:
        for name, module in six.iteritems(moduleType):
            result=[]
            for producer in producers:
                result.append(False)

            _hasInputTagModuleLabel(process, module, producers,result)
            for i in range(len(result)):
                if result[i]:
                    if hasattr(module, "mightGet"):
                        module.mightGet.extend(branchesList[i])
                    else:
                        module.mightGet = cms.untracked.vstring(branchesList[i])
    return process