Example #1
0
def get_plots(f, process=None, var=None, cut=None):
	tf_in = TFile.Open(f)
	SetOwnership(tf_in, 0)
	th1s = analysis.get_tobjects(tf_in, kind="th1f")
	
	th1_dict = {}
	for th1 in th1s:
		pieces = th1.GetName().split("_")
		p = "_".join(pieces[0:-2])		# Process
		if not p:
			p = pieces[0]
		v = pieces[-2]		# Variable
		c = pieces[-1]		# Cut
		cn = int(pieces[2][3:])		# Cut number
#		print c,v,p
		
		if (not process or p in process) and (not var or v in var) and (not cut or c in cut):
			if c not in th1_dict:
				th1_dict[c] = {}
			if v not in th1_dict[c]:
				th1_dict[c][v] = {}
			if p not in th1_dict[c][v]:
				th1_dict[c][v][p] = {}
		
			th1_dict[c][v][p] = {
				"th1": th1,
				"process": p,
				"var": v,
				"cut": c,
				"ncut": cn,
			}
	
	return th1_dict
def get_plots(f, process=None, var=None, cut=None):
	tf_in = TFile.Open(f)
	SetOwnership(tf_in, 0)
	th2s = analysis.get_tobjects(tf_in, kind="th2f")
	
	th2_dict = {}
	for th2 in th2s:
		pieces = th2.GetName().split("_")
		p = "_".join(pieces[0:-3])		# Process
		if not p:
			p = pieces[0]
		vs = (pieces[-3], pieces[-2])		# Variables
		c = pieces[-1]		# Cut
		cn = int(c[3:])		# Cut number
#		print c,v,p
		
		if (not process or p in process) and (not var or vs in var) and (not cut or c in cut):
			if c not in th2_dict:
				th2_dict[c] = {}
			if vs not in th2_dict[c]:
				th2_dict[c][vs] = {}
			if p not in th2_dict[c][vs]:
				th2_dict[c][vs][p] = {}
		
			th2_dict[c][vs][p] = {
				"th2": th2,
				"process": p,
				"vars": vs,
				"cut": c,
				"ncut": cn,
			}
	
	return th2_dict