Пример #1
0
	import glob
	import os
	from functionspool_mod import getsamplenames,parsermetasamples
	from math import sqrt
	
	#Opciones de entrada
	usage  ="usage: resumesys sysfolder"
	usage +="\nThe sysfolder must contain one or more folders named TYPESYS_VAR,\n"
	usage +="where TYPE could be 'LEPTON' 'FR' 'MS' 'MET' or 'PU'. For each\n"
	usage +="systematic it must be two folders where VAR is sustituted by\n"
	usage +="UP and DOWN (1sigma and -1sigma variation)."
	usage +="\nThe ouput is [....]"

	parser = OptionParser(usage=usage)
	parser.add_option( '-m', action='store', dest='join', metavar="MS|MS1,MS2,...|MS1@S1,..,SN::MS2@S2_1,...,S2_2::...", \
			help=parsermetasamples())	
	(opt,args) = parser.parse_args()

	if len(args) < 1:
		message= "\033[31mresumesys ERROR\033[m It is needed the systematic path"
		raise RuntimeError(message)

	try:
		syspathrel = glob.glob(args[0])[0]
	except IndexError:
		message= "\033[31mresumesys ERROR\033[m Invalid given path '%s'"% args[0]
		raise RuntimeError(message)

	syspath = os.path.abspath(syspathrel)
	# Check the directory
	if not os.path.isdir(syspath):
Пример #2
0
	usage+="\n"
        parser = OptionParser(usage=usage)
        parser.set_defaults(mode='FU',update=False)
	parser.add_option( '-f', '--folder', action='store',dest='folders',metavar='FOLDER1[,...]',\
			help='Folder (or list of folders) where to find the "cluster_*/Results/*.root"'\
			' files. Incompatible option with "-s"')
	parser.add_option( '-s', '--signal', action='store',dest='signal',\
			help='This option assumes that inside the current directory is going'\
			' to find the channel folder structure with the cluster_*/Results/*.root' \
			' files, where each channel folder begins with SIGNAL')
	parser.add_option( '-m', '--mode', action='store',dest='mode',metavar='FU|PU',\
			help='Set the sytematic mode: FU (Fully Uncorrelated) consideres each lepton and'\
			' each scale factor independently. PU (Partial Uncorrelated), only consider'\
			' as independent the scale factor, all the leptons with the same flavour are variated'\
			' at the same direction simultaneously (Default:FU)')
	parser.add_option( '--merge', action='store',dest='merge',help=parsermetasamples())
	parser.add_option( '-u', '--update', action='store_true', dest='updatemod', help='Update'\
			', the systematic_mod.py file, previously created with the "resumesys" utility,'\
			' with the values for the LEPTON key')
	parser.add_option( '-v', '--verbose', action='count', dest='verbose', help='Verbose mode'\
			', get also the number of raw events (not weighted) at each cut')

        ( opt, args ) = parser.parse_args()

	folders = []
	if opt.signal and opt.folders:
		message = '\033[1;31mgetddweights ERROR\033[1;m Incompatible options "-s" and "-f"'
		raise RuntimeError(message)

	# Assumes full folder content
	if opt.signal: