Example #1
0
	def makeCoordinatePlot(self,source):
		c  = TCanvas(source,source,1200,1200)
		graphDt = self.fileHandler.getGraph('graphs/L1MuonPresent_' + source)
		histAll = TH2D('hEtaPhi' + source,";#eta_{L1};#phi_{L1};#",30,-15*L1_ETA_BIN,15*L1_ETA_BIN,
			144, -math.pi,math.pi)
		fillGraphIn2DHist(graphDt, histAll)
		
		###
		'''
		Temporary stuff to check the eta coordinates in the graphs
		'''
		x = Double(0)
		y = Double(0)
		listeDt = []
		for i in range(0,graphDt.GetN()):
			graphDt.GetPoint(i,x,y)
			listeDt.append(float(x))

		histAll.SetStats(0)
		histAll.Draw('colz')
		c.Update()
		setupAxes(histAll)
		label = self.drawLabel()
		c.Update()
		return c,histAll,label
Example #2
0
	def makeL1EtaVsPatEtaPlot(self,source, title=""):
		canvas = TCanvas(source,source)
		graph = self.fileHandler.getGraph('graphs/' + source)
		hist = TH2D(source,title if title else source + ";#eta_{RECO};#eta_{L1};#",200,-1.0,1.0,20,-1.0,1.0)
		fillGraphIn2DHist(graph, hist)
		hist.Draw('colz')
		return canvas,hist
Example #3
0
	def plotL1EtaVsPatEta(self):
		c, hist = self.plotL1EtaVsPatEtaFine()
		graph = self.fileHandler.getGraph('graphs/l1EtaVsPatEtaNotFine')
		fillGraphIn2DHist(graph, hist)
		hist.SetTitle('L1Muon #eta vs. pat #eta')
		c.Update()		
		setupAxes(hist)
		setupPalette(hist)
		hist.SetStats(0)
		hist.GetXaxis().SetRangeUser(-.8,.8)
		hist.GetYaxis().SetRangeUser(-.8,.8)
		c.Update()
		return c,hist
Example #4
0
	def makeL1TimeVsEtaPlot(self,source):
		canvas = TCanvas(source,source)
		canvas.SetLogz()
		hist = TH2D(source,source + ";#eta_{L1};BXID;#",20,-1,1,
				7,-3.5,3.5)
		graph = self.fileHandler.getGraph('graphs/timingSupport_' + source)
		fillGraphIn2DHist(graph, hist)
		hist.SetStats(0)
		hist.Draw('colz')
		canvas.Update()
		setupAxes(hist)
		label = self.drawLabel()
		canvas.Update()
		return canvas,label,hist
Example #5
0
	def plotTightL1EtaPhiRatio(self):
		gL1Tight = self.fileHandler.getGraph('graphs/patTightToL1Muons')
		gL1Tight3x3 = self.fileHandler.getGraph('graphs/patTightToL1Muons3x3')
		
		halfPhiBinwidth = L1_PHI_BIN/2.
		
		hL1Tight = TH2D('hL1Tight','L1Tight',30,-15*L1_ETA_BIN	,15*L1_ETA_BIN,
					144, -math.pi,math.pi)
	
		hL1Tight3x3 = TH2D('hL1Tight3x3','L1Tight3x3',30,-15*L1_ETA_BIN	,15*L1_ETA_BIN,
					144, -math.pi,math.pi)

		hL1Tight = fillGraphIn2DHist(gL1Tight,hL1Tight)
		hL1Tight3x3 = fillGraphIn2DHist(gL1Tight3x3,hL1Tight3x3)
		
		c1 = TCanvas("available tight L1 for matching")
		hClone = hL1Tight.Clone('hClone')
		hClone.Draw('colz')
		
		hRatio = hL1Tight3x3.Clone('asdfasdf')
		hRatio.Divide(hL1Tight)
		
		c = TCanvas('2dMap',"",1200,900)
		#Local Efficiency per tight L1 coordinate (3x3 Matching)
		hRatio.SetTitle(';#eta_{L1};#phi_{L1} / rad;#epsilon')
		hRatio.GetXaxis().SetRangeUser(-0.8,.8)
		hRatio.Draw('colz')
		hRatio.SetStats(0)
		c.Update()
		setupAxes(hRatio)
		setupPalette(hRatio)
		c.Update()
		hRatio.GetYaxis().SetTitleOffset(.7)
		hRatio.GetZaxis().SetTitleOffset(.5)
		self.storeCanvas(c, 'localTightL1Efficiency')

		c2 = TCanvas('projections')
		c2.Divide(2,1)
		c2.cd(1)
		hEta = hRatio.ProjectionX()
		hEta.Scale(1/float(144))#72 phi bins
		hEta.Draw()
		
		c2.cd(2)
		hPhi = hRatio.ProjectionY()
		hPhi.Scale(1/float(16))#16 eta bins, cutoff due to |eta| < 0.8
		hPhi.Draw()
		
		return c,hRatio,c2,hEta,hPhi,c1,hClone
Example #6
0
	def plotL1EtaVsPatEtaTight(self):
		c, hist = self.plotL1EtaVsPatEtaFineTight()
		graph = self.fileHandler.getGraph('graphs/l1EtaVsPatEtaNotFineTight')
		fillGraphIn2DHist(graph, hist)
		hist.SetTitle('')#tight L1Muon #eta vs. pat #eta')
		c.Update()		
		setupAxes(hist)
		setupPalette(hist,shiftBy=.05)
		hist.SetStats(0)
		hist.GetXaxis().SetRangeUser(-.8,.8)
		hist.GetYaxis().SetRangeUser(-.8,.8)
		hist.GetZaxis().SetTitle('Entries')
		c.Update()
		self.storeCanvas(c,'l1EtaVsPatEtaTight',marginRight=.15)
		return c,hist
Example #7
0
	def makeNHitsVsPtPlot(self,source):
		canvas = TCanvas('cNHoHitsVsPt' + source,'cNHoHitsVsPt' + source)
		graph = self.fileHandler.getGraph('graphs/' + source )
		variableBinArray = sorted([0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,6,7,8,9,10,12,14,16,18,20,25,30,35,40,45,50,60,70,80,100,120,140,180])
		runArray = array('d',variableBinArray)
		hist = TH2D(source,source,50,-.5,49.5,len(runArray) -1, runArray)
		#hist = TH2D(source,source,50,-.5,49.5,201,-.5,200.5)
		fillGraphIn2DHist(graph, hist)
		normalizeTH2DAlongXAxis(hist)
		#hist.Scale(1/hist.Integral(),'width')
		#hist.SetMinimum(1e-7)
		hist.GetXaxis().SetRangeUser(0,50)
		canvas.SetLogz()
		#hist.SetLineWidth(3)
		#hist.SetLineColor(colorRwthDarkBlue)
		setupAxes(hist)
		#hist.SetTitle(source + 'HORecHits per L1;# possible Hits per L1Muon;#')
		hist.Draw('colz')
		return hist,canvas
Example #8
0
	def plotTightL1EtaPhiRatio(self):
		gL1Tight = self.fileHandler.getGraph('hoMuonAnalyzer/graphs/L1TightMuons')
		gL1Tight3x3 = self.fileHandler.getGraph('hoMuonAnalyzer/graphs/L1TightMuons3x3')
		
		halfPhiBinwidth = L1_PHI_BIN/2.
		
		hL1Tight = TH2D('hL1Tight','L1Tight',30,-15*L1_ETA_BIN	,15*L1_ETA_BIN,
					144, -math.pi,math.pi)
	
		hL1Tight3x3 = TH2D('hL1Tight3x3','L1Tight3x3',30,-15*L1_ETA_BIN	,15*L1_ETA_BIN,
					144, -math.pi,math.pi)

		hL1Tight = fillGraphIn2DHist(gL1Tight,hL1Tight)
		hL1Tight3x3 = fillGraphIn2DHist(gL1Tight3x3,hL1Tight3x3)
		
		hRatio = hL1Tight3x3.Clone('asdfasdf')
		hRatio.Divide(hL1Tight)
		
		c = TCanvas('2dMap')
		hRatio.SetTitle('Local Efficiency per tight L1 coordinate (3x3 Matching);#eta_{L1};#phi_{L1};#epsilon')
		hRatio.GetXaxis().SetRangeUser(-0.8,.8)
		hRatio.Draw('colz')
		hRatio.SetStats(0)
		c.Update()
		setupAxes(hRatio)
		setupPalette(hRatio)
		label = self.drawLabel()
		c.Update()
		self.storeCanvas(c, 'localTightL1Efficiency')

		c2 = TCanvas('projections')
		c2.Divide(2,1)
		c2.cd(1)
		hEta = hRatio.ProjectionX()
		hEta.Scale(1/float(144))#72 phi bins
		hEta.Draw()
		
		c2.cd(2)
		hPhi = hRatio.ProjectionY()
		hPhi.Scale(1/float(16))#16 eta bins, cutoff due to |eta| < 0.8
		hPhi.Draw()
		
		return c,hRatio,label,c2,hEta,hPhi
	def makeDtOnlyPlot(self,sourceDt,sourceDtHo):
		c  = TCanvas(sourceDt,sourceDt,1200,1200)
		
		graphDt = self.fileHandler.getGraph('graphs/timingSupport' + self.ptCut + '_' + sourceDt)
		histAll = TH2D('hEtaPhi' + sourceDt,";#eta_{L1};#phi_{L1};#",30,-15*L1_ETA_BIN,15*L1_ETA_BIN,
			144, -math.pi,math.pi)
		fillGraphIn2DHist(graphDt, histAll)
				
		if(sourceDtHo != ''):
			graphDtHo = self.fileHandler.getGraph('graphs/timingSupport' + self.ptCut + '_' + sourceDtHo)
			if not graphDtHo:
				fillGraphIn2DHist(graphDtHo, histAll)

		histAll.SetStats(0)
		histAll.Draw('colz')
		c.Update()
		setupAxes(histAll)
		label = self.drawLabel()
		c.Update()
		return c,histAll,label
Example #10
0
	def makeTimeVsPhiPlot(self,source,iEta,title = ""):
		canvas = TCanvas(source + str(iEta),str(iEta))
		if title == "":
			title = source
		hist = TH2D(source + str(iEta),title + str(iEta) + ";i#phi;Time / ns;#",72,.5,72.5,
				201,-100.5,100.5)
		graph = self.fileHandler.getGraph('graphs/iEta/timingSupport_' + source + 'Ieta' + str(iEta))
		if not graph: return
		fillGraphIn2DHist(graph, hist)
		hist.SetStats(0)
		hist.Draw('colz')
		hist.GetYaxis().SetRangeUser(-60,60)
		canvas.Update()
		setupAxes(hist)
		canvas.Update()

		self.storeCanvas(canvas, 'timeVsPhi/' +  source + '/iEta' + str(iEta),
						labelPosition={'x1ndc' : .6, 'y1ndc' : 0.92, 'x2ndc' : .9, 'y2ndc' : 0.95} )

		return canvas,hist,graph
Example #11
0
	def makeTimeVsEtaPlot(self,source,title = ""):
		canvas = TCanvas(source)
		canvas.SetRightMargin(.15)
		if title == "":
			title = source
		hist = TH2D(source,";i#eta;Time / ns;Entries",33,-16.5,16.5,
				201,-100.5,100.5)
		graph = self.fileHandler.getGraph('graphs/timingSupport_' + source)
		fillGraphIn2DHist(graph, hist)
		hist.SetStats(0)
		hist.GetXaxis().SetRangeUser(-11,11)
		hist.GetYaxis().SetRangeUser(-60,60)
		hist.Draw('colz')
		canvas.Update()
		setupAxes(hist)
		setupPalette(hist,shiftBy=.05)
		canvas.Update()
		fractionGraph,counterDict = self.printFractionsPerIEta(graph)
		self.debug('Integral of plot %20s: %d' % (source,hist.Integral()))
		medianTofZero = (counterDict[9]['median'] + counterDict[11]['median'])/2.
		tofFunction = TF1('f','4*sqrt(1+ 1/(tan(2*atan(exp(-x*0.087/2.)))**2))/300000000.*1e9 - 13.3 + [0]',-10,10)
		tofFunction.SetParameter(0,medianTofZero)
		tofFunction.Draw('same')

		###
		# Draw Boxes for the Intervals
		###
		intervalBoxes = []
		for index,item in enumerate(counterDict):
			iEta = index - 10
			# Skip iEta 0
			if iEta == 0:
				continue
			box = TBox(iEta - 0.5, item['median'] - 12.5, iEta + 0.5, item['median'] + 12.5)
			box.SetFillStyle(0)
			box.SetLineColor(colorRwthMagenta)
			box.SetLineWidth(2)
			box.Draw()
			intervalBoxes.append(box)

		return canvas,hist,fractionGraph,intervalBoxes,tofFunction
Example #12
0
	def plotL1PhiVsHoIPhi(self):
		canvas = TCanvas('cL1PhiVsHoIPhi','L1PhiVsHoIPhi',1200,1200)
		canvas.Divide(1,2)
		canvas.cd(1)
		graph = self.fileHandler.getGraph('correlation/l1PhiVsHoIPhi')
		graph.SetTitle('L1 #phi vs. HO i#phi;HO i#phi;L1 #phi')
		graph.SetMarkerStyle(2)
		setupAxes(graph)
		graph.Draw('AP')
		canvas.Update()
		
		canvas.cd(2)
		
		halfbinwidth = L1_PHI_BIN/2.
		
		hist = TH2D('hL1PhiVsHoIPhi','L1 Phi vs. iPhi',73,0.5,72.5,289, -math.pi - halfbinwidth,math.pi + halfbinwidth)
		hist = fillGraphIn2DHist(graph, hist)
		hist.Draw('colz')
		
		canvas.Update()
		
		return canvas,graph,hist