Ejemplo n.º 1
0
for r in range(len(mm.regions)):
    mm.iterateRegion()

    mccs = mm.collectMCCs()
    macros = mm.collectMacros()
    flags = mm.collectFlags(["flagDumps"], False, True)
    scenario = mm.getScenario(True)

    procs = mm.getProcs()
    fmt = "'{run:1d} {lumi:9d} {evt:12d}\\t" + mm.getVariable(
        "fmt", "").replace("\\\\t", "\\t") + "'"

    for p in procs:

        output = mm.outdir + "/dump/" + scenario + "/" + sl + "fb"
        func.mkdir(output)

        tag = p.replace(".*.", "").replace(".*", "").replace("*.",
                                                             "").rstrip("_")

        mm.submit([
            mm.getVariable("mcafile", ""),
            mm.getVariable("cutfile", ""), fmt, mm.treedirs,
            mm.getVariable("treename", "treeProducerSusyMultilepton"), mccs,
            macros, friends, "-p " + p, flags, output, tag
        ], mm.region.name, False)

mm.runJobs()
mm.clearJobs()
Ejemplo n.º 2
0
base = "python prepareEventVariablesFriendTree.py {T} {O} --tree {TREENAME} --vector -T sf -d {SAMPLES} -m {MODULES} {FRIENDS} {ADDITIONAL}"
(options, args) = parser.parse_args()
options         = maker.splitLists(options)
options.modules = func.splitList(options.modules)
options.accept  = func.splitList(options.accept )
options.exclude = func.splitList(options.exclude)
mm              = maker.Maker("friendmaker", base, args, options)
mm.loadNEvtSample()


## loop on modules, submitting jobs
for module in mm.getFriendModules():

	mm.workdir = mm.cmssw +"/src/CMGTools/TTHAnalysis/macros"
	output     = mm.outdir +"/"+ module
	func.mkdir(output,False)
	func.mkdir(output +"/log",False)
	if options.bk: func.mkdir(output +"/ref",False)

	file     = getFriendFile(mm, module)
	requires = getFriendConn(mm, module)
	requires = filter(lambda x: x, requires)


	## loop on samples
	for d in os.listdir(mm.treedir):

		## only consider real samples
		if not os.path.isdir(mm.treedir +"/"+ d): continue
		if not os.path.exists(mm.treedir +"/"+ d +"/"+options.treename+"/tree.root") and \
           not os.path.exists(mm.treedir +"/"+ d +"/"+options.treename+"/tree.root.url"): continue
Ejemplo n.º 3
0
            theSc = scenario
            theBin = mm.getVariable("bins", "")

            ## change scenario if looping over all bins
            if options.perBin:
                min, max = func.getMinMax(b)
                theSc = scenario + "_" + min.replace(".", "p")
                theBin = b

            ## background first
            output = mm.outdir + "/scan/" + theSc + "/" + sl + "fb"
            bkgDir = output + "/bkg"
            if not options.redoBkg and os.path.exists(bkgDir +
                                                      "/common/SR.input.root"):
                continue
            func.mkdir(bkgDir)

            mm.submit([
                mm.getVariable("mcafile", ""),
                mm.getVariable("cutfile", ""),
                mm.getVariable("expr", ""), theBin,
                theSc.replace("/", "_"), mm.treedirs,
                mm.getVariable("treename", "treeProducerSusyMultilepton"),
                mccs, macros,
                mm.getVariable("lumi", "12.9"), bkgDir, friends, flags,
                func.getCut(options, mm.getVariable("firstCut", "alwaystrue"),
                            mm.getVariable("expr", ""), theBin)
            ],
                      theSc.replace("/", "_") + "_bkg", False)
    mm.runJobs()
    mm.clearJobs()
Ejemplo n.º 4
0
## skim main tree
friends = mm.collectFriends()
flags = " ".join(
    mm.options.flags
)  ## we do not want to have all flags, only the additional ones given here

for r in range(len(mm.regions)):
    mm.iterateRegion()
    mm.reloadBase(base)

    mccs = mm.collectMCCs()
    macros = mm.collectMacros()

    output = mm.outdir
    func.mkdir(output, False)
    json = options.json if options.json else ""
    mcas = makeDummyMCAs(mm)

    for mca in mcas:
        mm.submit([
            mca,
            mm.getVariable("cutfile", ""), output, mm.treedir,
            mm.getVariable("treename", "treeProducerSusyMultilepton"), mccs,
            macros, friends, json, flags
        ], "main_" + mca[mca.rfind("/") + 1:].rstrip(".txt"), False)

    mm.runJobs()
    mm.clearJobs()

    #### skim friend trees