Exemplo n.º 1
0

#        print "Got: 3: %s, 4p: %s, 3p: %s"%(res3, res4p, res3p)
    return (estimate.uniqueKey(r, channel, setup3p), res3p)

if "all" in channels: channels = ["e", "mu", "all"]
jobs = []
for channel in channels:
    for (i, r) in enumerate(allPhotonRegions):
        #        if args.selectRegion != i: continue
        jobs.append((r, channel, setup3p, None, setup3, setup4p))
        if not estimate.isData and not args.noSystematics:
            if "TTG" in args.selectEstimator:
                addJobs = estimate.getSigSysJobs(r, channel, setup3p)
            else:
                addJobs = estimate.getBkgSysJobs(r, channel, setup3p)
            for j in addJobs:
                jobs.append(tuple(list(j) + [setup3, setup4p]))

print "Running %i jobs in total." % len(jobs)

if args.nJobs != 1:
    jobs = splitList(jobs, args.nJobs)[args.job]

if args.cores == 1:
    results = map(wrapper, jobs)
else:
    from multiprocessing import Pool
    pool = Pool(processes=args.cores)
    results = pool.map(wrapper, jobs)
    pool.close()
Exemplo n.º 2
0
estimateTo = copy.deepcopy(estimateFrom)
estimateFrom.initCache(fromDir)
estimateTo.initCache(setup.defaultCacheDir())

if "all" in channels: channels = ["e", "mu"]
jobs = []
for channel in channels:
    for (i, r) in enumerate(allPhotonRegions):
        #        if args.selectRegion != i: continue
        jobs.append((r, channel, setup, None))
        if not estimateFrom.isData and not args.noSystematics:
            if "TTG" in args.selectEstimator:
                jobs.extend(estimateFrom.getSigSysJobs(r, channel, setup))
            else:
                jobs.extend(estimateFrom.getBkgSysJobs(r, channel, setup))

print "Running %i jobs in total." % len(jobs)
#jobs = splitList( jobs, 32)[1]
if args.nJobs != 1:
    jobs = splitList(jobs, args.nJobs)[args.job]

if args.cores == 1:
    results = map(wrapper, jobs)
else:
    from multiprocessing import Pool
    pool = Pool(processes=args.cores)
    results = pool.map(wrapper, jobs)
    pool.close()
    pool.join()