Ejemplo n.º 1
0
	nominalfolders = filter(lambda x: len(glob.glob(x+"/cluster_*")) != 0, nominalfolders)
	# -- And get the name of the signal
	signal = os.path.split(nominalfolders[0])[1][:2]
	# -- need to do the fakes-nt3 for the FRSYS
	#if sysdefined.has_key("FR"):
	#	for d in sysdefined["FR"]:
	#		nt3call(d,signal)

	syscommondict = {}
	# For each systematics evaluate the difference with respect the nominal
	for sysname,sysfoldertuple in sysdefined.iteritems():
		print "\033[34mresumesys INFO\033[m Evaluating '%s' systematic" % (sysname)
		fup   = filter(lambda x: x.find("_UP") != -1,sysfoldertuple)[0]
		fdown = filter(lambda x: x.find("_DOWN") != -1,sysfoldertuple)[0]
		# -- Extract the datasamples names present in the systematic folders
		datasamples = getsamplenames(fup)
		# -- Updating if there are metasamples defined
		usingmetasamples = {}
		# Substitute real samples by metasamples
		for metaname,realnames in join.iteritems():
			usingmetasamples[metaname] = realnames
			dum = []
			for realname in realnames:
				try:
					datasamples.remove(realname)
				except ValueError:
					dum = usingmetasamples.pop(metaname)
					break
			if len(dum) == 0:
				datasamples.append(metaname)
		print "\033[34mresumesys INFO\033[m ---+ Datasamples afected:",
Ejemplo n.º 2
0
    # -- And get the name of the signal
    signal = os.path.split(nominalfolders[0])[1][:2]
    # -- need to do the fakes-nt3 for the FRSYS
    if sysdefined.has_key("FR"):
        for d in sysdefined["FR"]:
            nt3call(d, signal)

    syscommondict = {}
    # For each systematics evaluate the difference with respect the nominal
    for sysname, sysfoldertuple in sysdefined.iteritems():
        print "\033[34mresumesys INFO\033[m Evaluating '%s' systematic" % (
            sysname)
        fup = filter(lambda x: x.find("_UP") != -1, sysfoldertuple)[0]
        fdown = filter(lambda x: x.find("_DOWN") != -1, sysfoldertuple)[0]
        # -- Extract the datasamples names present in the systematic folders
        datasamples = getsamplenames(fup)
        print "\033[34mresumesys INFO\033[m ---+ Datasamples afected:",
        for name in datasamples:
            print name,
            # Create the dictionaries ... EXPLICALO XXX
            sysdictname = "SYS" + name
            if not syscommondict.has_key(sysdictname):
                syscommondict[sysdictname] = {sysname: {}}
            elif not syscommondict[sysdictname].has_key(sysname):
                syscommondict[sysdictname][sysname] = {}

        print ""
        # -- Do the calculation: (Nominal-Sys)/Nominal per channel
        print "\033[34mresumesys INFO\033[m ---+ Extracting DOWN variation",
        sysdict_d = getdifferences(datasamples, nominalfolders, fdown)
        print "\033[34mresumesys INFO\033[m ---+ Extracting UP variation",
Ejemplo n.º 3
0
		for listofsamples in opt.subtract.split(","):
			refsample = listofsamples.split('@')[0]
			try:
				sampleslist = listofsamples.split('@')[1].split(":")
			except IndexError:
				message = '\033[1;31mplothisto ERROR\033[1;m Invalid syntax for the'
				message += ' -S option. Option catched as \'%s\'' % opt.subtract
				raise SyntaxError(message)
			subtract[refsample] = [ x for x in sampleslist ] 
	# -- and keeping those samples the user want to
	forcekeep = []
	if opt.force and len(subtract) == 0:
		message = '\033[1;33mplothisto WARNING\033[1;m Ignoring --force option, it should'
		message += ' be called with -S option...' 
	elif opt.force:
		available = getsamplenames(os.getcwd())
		forcekeep = opt.force.split(",")
		for sname in forcekeep:
			if sname not in available:
				message = '\033[1;31mplothisto ERROR\033[1;m Force keep sample "%s"' % sname
				message += ' with --force option. But it is not available'
				raise RuntimeError(message)

	# -- Extracting the samples available
	samples = map(lambda x: x.replace("cluster_",""),glob.glob("cluster_*"))
	# -- If we are dealing with WH, be sure not using another Higgs mass sample as background
	if signal.find("ToWW") != -1:
		samples = filter(lambda x: x.find("ToWW") == -1 or (x.find("ToWW") != -1 and x == signal), samples)
	# --- Some manipulations needed for the samples to be merged. DY and ZJets
	# --- Some names depending the run period
	if opt.runperiod == "2011":