Exemplo n.º 1
0
	def effPlots(self,org,plotter,denName,numName,sel,flavor):
		nlist,dlist,names=[],[],[]
		names2=[]
		for step in org.steps:
			if step.name==denName: 
				for plotName in sorted(step.keys()): 
					if plotName.endswith(flavor): dlist.append(step[plotName]);names.append(plotName)
			if step.name==numName: 
				for plotName in sorted(step.keys()): 
					if plotName.startswith(sel) and plotName.endswith(flavor) and '+' not in plotName: nlist.append(step[plotName]); names2.append(plotName)	
		print names
		print names2

		for n in nlist: removeLowStats(n,relErrMax=1.)

		effs = []
		for num,denom in zip(nlist,dlist):
			print num[0],denom[0]
			print num[0].GetNbinsX(),denom[0].GetNbinsX()
			eff = [r.TGraphAsymmErrors(n,d,"cl=0.683 n") for n,d in zip(num,denom)]
			effs.append(tuple(eff))

		#effs=[ tuple([r.TGraphAsymmErrors(n,d,"cl=0.683 n") for n,d in zip(num,denom) ]) for num,denom in zip(nlist,dlist) ]
		plotter.individualPlots(simulation=True, plotSpecs = [
											  {"plotName":"HPt"+flavor,
                                              "histos":effs[names.index("HPt"+flavor)],
                                              "newTitle":"; H^{0} p_{T} [GeV] ; efficiency",
                                              "legendCoords": (0.55, 0.75, 0.9, 0.9),
                                              "stampCoords": (0.37, 0.85),},
											  {"plotName":"XPt"+flavor,
                                              "histos":effs[names.index("XPt"+flavor)],
                                              "newTitle":"; best X^{0} p_{T} [GeV] ; efficiency",
                                              "legendCoords": (0.55, 0.75, 0.9, 0.9),
                                              "stampCoords": (0.37, 0.85),},
											  {"plotName":"Lxy"+flavor,
                                              "histos":effs[names.index("Lxy"+flavor)],
                                              "newTitle":"; best X^{0} L_{xy} [cm] ; efficiency",
                                              "legendCoords": (0.55, 0.75, 0.9, 0.9),
                                              "stampCoords": (0.37, 0.85),},
											  {"plotName":"SmallLxy"+flavor,
                                              "histos":effs[names.index("SmallLxy"+flavor)],
                                              "newTitle":"; best X^{0} L_{xy} [cm] ; efficiency",
                                              "legendCoords": (0.55, 0.75, 0.9, 0.9),
                                              "stampCoords": (0.37, 0.85),},
											  {"plotName":"IP2dMin"+flavor,
                                              "histos":effs[names.index("IP2dMin"+flavor)],
                                              "newTitle":"; best X^{0} min(IP^{xy}(q),IP^{xy}(#bar{q})) [cm] ; efficiency",
                                              "legendCoords": (0.55, 0.75, 0.9, 0.9),
                                              "stampCoords": (0.37, 0.85),},
											  {"plotName":"IP2dMax"+flavor,
                                              "histos":effs[names.index("IP2dMax"+flavor)],
                                              "newTitle":"; best X^{0} max(IP^{xy}(q),IP^{xy}(#bar{q})) [cm] ; efficiency",
                                              "legendCoords": (0.55, 0.75, 0.9, 0.9),
                                              "stampCoords": (0.37, 0.85),},
                                            ],
                               )
Exemplo n.º 2
0
	def effPlots(self,org,plotter,denName,numName,sel,flavor):
		flavorMap={'ud':'q#bar{q}','qmu':'q#mu/#bar{q}#mu','':''}
		nlist,dlist,names=[],[],[]
		names2=[]
		for step in org.steps:
			if step.name==denName: 
				for plotName in sorted(step.keys()):
					if plotName.endswith(flavor) : dlist.append(step[plotName]);names.append(plotName)
			if step.name==numName: 
				for plotName in sorted(step.keys()): 
					if plotName.startswith(sel) and plotName.endswith(flavor) and '+' not in plotName: nlist.append(step[plotName]);names2.append(plotName)
		print names
		print names2
		'''
		num,denom=nlist[names2.index(sel+'XDR'+flavor)][0],dlist[names.index('XDR'+flavor)][0]
		print num,denom
		for i in range(0,num.GetNbinsX()):
			n,d = num.GetBinContent(i),denom.GetBinContent(i)
			print n,d
		'''

		for n in nlist: print n[0].GetName();removeLowStats(n,relErrMax=0.7)

		effs=[ tuple([r.TGraphAsymmErrors(n,d,"cl=0.683 n") for n,d in zip(num,denom) ]) for num,denom in zip(nlist,dlist) ]
		plotter.individualPlots(simulation=True, plotSpecs = [
											  {"plotName":"HPt"+flavor,
                                              "histos":effs[names.index("HPt"+flavor)],
                                              "newTitle":"; H^{0} p_{T} [GeV] ; efficiency %s."%flavorMap[flavor],
                                              "legendCoords": (0.55, 0.7, 0.9, 0.92),
                                              "stampCoords": (0.37, 0.85),},
											  {"plotName":"XPt"+flavor,
                                              "histos":effs[names.index("XPt"+flavor)],
                                              "newTitle":"; best #tilde{#chi}^{0}_{1} p_{T} [GeV] ; efficiency %s"%flavorMap[flavor],
                                              "legendCoords": (0.55, 0.7, 0.9, 0.92),
                                              "stampCoords": (0.37, 0.85),},
											  {"plotName":"Lxy"+flavor,
                                              "histos":effs[names.index("Lxy"+flavor)],
                                              "newTitle":"; best #tilde{#chi}^{0}_{1} L_{xy} [cm] ; efficiency %s"%flavorMap[flavor],
                                              "legendCoords": (0.55, 0.7, 0.9, 0.92),
                                              "stampCoords": (0.37, 0.85),},
											  {"plotName":"SmallLxy"+flavor,
                                              "histos":effs[names.index("SmallLxy"+flavor)],
                                              "newTitle":"; best #tilde{#chi}^{0}_{1} L_{xy} [cm] ; efficiency %s"%flavorMap[flavor],
                                              "legendCoords": (0.55, 0.7, 0.9, 0.92),
                                              "stampCoords": (0.37, 0.85),},
											  {"plotName":"IP2dMin"+flavor,
                                              "histos":effs[names.index("IP2dMin"+flavor)],
                                              "newTitle":"; best #tilde{#chi}^{0}_{1} min(IP^{xy}(q),IP^{xy}(#bar{q})) [cm] ; efficiency %s%s"%(flavorMap[flavor],flavorMap[flavor]),
                                              "legendCoords": (0.55, 0.7, 0.9, 0.92),
                                              "stampCoords": (0.37, 0.85),},
											  {"plotName":"IP2dMax"+flavor,
                                              "histos":effs[names.index("IP2dMax"+flavor)],
                                              "newTitle":"; best #tilde{#chi}^{0}_{1} max(IP^{xy}(q),IP^{xy}(#bar{q})) [cm] ; efficiency %s%s"%(flavorMap[flavor],flavorMap[flavor]),
                                              "legendCoords": (0.55, 0.7, 0.9, 0.92),
                                              "stampCoords": (0.37, 0.85),},
											  {"plotName":"XDR"+flavor,
                                              "histos":effs[names.index("XDR"+flavor)],
                                              "newTitle":"; best #tilde{#chi}^{0}_{1} #Delta R (q#bar{q},#tilde{#chi}^{0}_{1}) ; efficiency %s%s"%(flavorMap[flavor],flavorMap[flavor]),
                                              "legendCoords": (0.55, 0.7, 0.9, 0.92),
                                              "stampCoords": (0.37, 0.85),},
                                            ],
                               )