Example #1
0
	def plotAverageEnergyAroundL1(self):
		canvas = TCanvas('canvasAverageEnergy','Average energy',900,800)
		canvas.cd().SetLogz()
		canvas.cd().SetRightMargin(.15)

		hSum = self.fileHandler.getHistogram('averageEnergy/averageEnergyAroundPoint' + self.key + '_SummedEnergy')
		hCounter = self.fileHandler.getHistogram('averageEnergy/averageEnergyAroundPoint' + self.key + '_Counter')
	
		for i in range(0,hSum.GetNbinsX()):
			for j in range(0,hSum.GetNbinsY()):
				if hCounter.GetBinContent(hCounter.GetBin(i,j)) != 0:
					hSum.SetBinContent(hSum.GetBin(i,j),hSum.GetBinContent(hSum.GetBin(i,j))/hCounter.GetBinContent(hCounter.GetBin(i,j)))
					pass
		hSum.GetXaxis().SetRangeUser(-0.6,0.6)
		hSum.GetYaxis().SetRangeUser(-0.6,0.6)
		hSum.GetZaxis().SetTitle('Reconstructed Energy / GeV')
		hSum.SetTitle(';#Delta#eta;#Delta#phi;Reconstructed Energy / GeV')#'Average Energy in HO tiles around L1 direction
		hSum.Draw('colz')
						
		canvas.Update()
		
		#Setup plot style
		setupAxes(hSum)	
		setStatBoxOptions(hSum,1100)
		setStatBoxPosition(hSum,x1=.65,x2=.85)
		setupPalette(hSum,x2ndc=.87)
	
		canvas.Update()
		self.storeCanvas(canvas,'averageEnergy',marginRight=.15)
		return canvas,hSum,hCounter,drawHoBoxes(canvas)
Example #2
0
	def plotAverageEnergyAroundL1(self):
		canvas = TCanvas('canvasAverageEnergy','Average energy',900,900)
		canvas.cd().SetLogz()
		
		hSum = self.fileHandler.getHistogram('averageEnergy/averageEnergyAroundPoint' + self.key + '_SummedEnergy')
		hCounter = self.fileHandler.getHistogram('averageEnergy/averageEnergyAroundPoint' + self.key + '_Counter')
	
		for i in range(0,hSum.GetNbinsX()):
			for j in range(0,hSum.GetNbinsY()):
				if hCounter.GetBinContent(hCounter.GetBin(i,j)) != 0:
					hSum.SetBinContent(hSum.GetBin(i,j),hSum.GetBinContent(hSum.GetBin(i,j))/hCounter.GetBinContent(hCounter.GetBin(i,j)))
					pass
		hSum.GetXaxis().SetRangeUser(-0.6,0.6)
		hSum.GetYaxis().SetRangeUser(-0.6,0.6)
	#	hSum.SetStats(0)
	#	hSum.GetXaxis().SetTitle('#Delta#eta')
	#	hSum.GetYaxis().SetTitle('#Delta#phi')
		hSum.GetZaxis().SetTitle('Reconstructed Energy / GeV')
		hSum.SetTitle('Average Energy in HO tiles around L1 direction;#Delta#eta;#Delta#phi;Reconstructed Energy / GeV')
		hSum.Draw('colz')
	#	hCounter.Draw('same,text')
		
		label = self.drawLabel()
		
		canvas.Update()
		
		#Setup plot style
		setupAxes(hSum)	
		setStatBoxOptions(hSum,1100)
		setStatBoxPosition(hSum)
		setupPalette(hSum)
	
		canvas.Update()
		self.storeCanvas(canvas,'averageEnergy')
		return canvas,hSum,label,hCounter,drawHoBoxes(canvas)
Example #3
0
	def compareHistogramMethods(self):
		canvas = TCanvas('cComparison','Comparison btween histograms')
		
	#	canvas.Divide(2,1)
		
		histNormal = self.fileHandler.getHistogram('averageEnergy/averageEnergyAroundPoint' + self.key + '_SummedEnergy')
		histNormalCounter = self.fileHandler.getHistogram('averageEnergy/averageEnergyAroundPoint' + self.key + '_Counter')
		
		histNormal = setupEAvplot(histNormal, histNormalCounter,same=True,limitForAll=0.6)
		
	#	histNew = self.fileHandler.getHistogram('deltaEtaDeltaPhiEnergy/averageEnergyAroundPoint_2dSummedWeightsIEtaIPhi')
	#	histNewCounter = self.fileHandler.getHistogram('deltaEtaDeltaPhiEnergy/averageEnergyAroundPoint_2dCounterIEtaIPhi')
		
		canvas.cd(1).SetLogz()
		
		histNormal.SetTitle('Average Energy in HO tiles around L1 direction, i#eta by binning')
		histNormal.SetStats(1)
		histNormal.Draw('colz')
		
		label = getLabelCmsPrivateSimulation()
		label.Draw()
		
	#	canvas.cd(2).SetLogz()
		
	#	histNew = average2DHistogramBinwise(histNew, histNewCounter)
	#	histNew.GetXaxis().SetRangeUser(-8,8)
	#	histNew.GetYaxis().SetRangeUser(-8,8)
	#	histNew.GetXaxis().SetTitle('#Delta#eta')
	#	histNew.GetYaxis().SetTitle('#Delta#phi')
	#	histNew.GetZaxis().SetTitle('Reconstructed Energy / GeV')
	#	histNew.SetTitle('Mean Energy in HO tiles around L1 direction, i#eta by binning')
	#	histNew.Draw('colz')
			
	#	label2 = getLabelCmsPrivateSimulation()
	#	label2.Draw()
		
		canvas.Update()
		
		#Setup plot style
		setStatBoxOptions(histNormal,1100)
		setStatBoxPosition(histNormal)
		setupPalette(histNormal)
		
	#	setupAxes(histNew)	
	#	setStatBoxOptions(histNew,1100)
	#	setStatBoxPosition(histNew)
	#	setupPalette(histNew)
	
		canvas.Update()
		
		#TODO: Print the bin contents subtracted
		
		return canvas, histNormal,label#,histNew,label2
Example #4
0
	def compareHistogramMethods(self):
		canvas = TCanvas('cComparison','Comparison btween histograms')
		
	#	canvas.Divide(2,1)
		
		histNormal = self.fileHandler.getHistogram('averageEnergy/averageEnergyAroundPoint' + self.key + '_SummedEnergy')
		histNormalCounter = self.fileHandler.getHistogram('averageEnergy/averageEnergyAroundPoint' + self.key + '_Counter')
		
		histNormal = setupEAvplot(histNormal, histNormalCounter,same=True,limitForAll=0.6)
		
	#	histNew = self.fileHandler.getHistogram('deltaEtaDeltaPhiEnergy/averageEnergyAroundPoint_2dSummedWeightsIEtaIPhi')
	#	histNewCounter = self.fileHandler.getHistogram('deltaEtaDeltaPhiEnergy/averageEnergyAroundPoint_2dCounterIEtaIPhi')
		
		canvas.cd(1).SetLogz()
		
		histNormal.SetTitle('Average Energy in HO tiles around L1 direction, i#eta by binning')
		histNormal.SetStats(1)
		histNormal.Draw('colz')
		
		label = getLabelCmsPrivateSimulation()
		label.Draw()
		
	#	canvas.cd(2).SetLogz()
		
	#	histNew = average2DHistogramBinwise(histNew, histNewCounter)
	#	histNew.GetXaxis().SetRangeUser(-8,8)
	#	histNew.GetYaxis().SetRangeUser(-8,8)
	#	histNew.GetXaxis().SetTitle('#Delta#eta')
	#	histNew.GetYaxis().SetTitle('#Delta#phi')
	#	histNew.GetZaxis().SetTitle('Reconstructed Energy / GeV')
	#	histNew.SetTitle('Mean Energy in HO tiles around L1 direction, i#eta by binning')
	#	histNew.Draw('colz')
			
	#	label2 = getLabelCmsPrivateSimulation()
	#	label2.Draw()
		
		canvas.Update()
		
		#Setup plot style
		setStatBoxOptions(histNormal,1100)
		setStatBoxPosition(histNormal)
		setupPalette(histNormal)
		
	#	setupAxes(histNew)	
	#	setStatBoxOptions(histNew,1100)
	#	setStatBoxPosition(histNew)
	#	setupPalette(histNew)
	
		canvas.Update()
		
		#TODO: Print the bin contents subtracted
		
		return canvas, histNormal,label#,histNew,label2
Example #5
0
    def plotGenEtaPhi(self):
        c = TCanvas('cGenEta', 'Gen eta phi', 1200, 1600)
        c.Divide(2, 1)
        gen = self.fileHandler.getGraph('graphs/gen')

        histEta = TH1D('hEtaGen', "#eta GEN;#eta;#", 288, -math.pi, math.pi)
        histPhi = TH1D('hPhiGen', "#phi GEN;#phi;#", 288, -math.pi, math.pi)

        x = Double(0)
        y = Double(0)

        for i in range(0, gen.GetN()):
            gen.GetPoint(i, x, y)
            histPhi.Fill(y)
            histEta.Fill(x)

        setupAxes(histEta)
        setupAxes(histPhi)

        histEta.GetXaxis().SetRangeUser(-1, 1)

        c.cd(1)
        histEta.Draw()
        label1 = drawLabelCmsPrivateSimulation()
        c.cd(2)

        histPhi.Draw()
        label2 = drawLabelCmsPrivateSimulation()

        c.Update()

        setStatBoxOptions(histEta, 10)
        setStatBoxPosition(histEta, y1=0.85)
        setStatBoxOptions(histPhi, 10)
        setStatBoxPosition(histPhi, y1=0.85)

        c.Update()
        self.storeCanvas(c, "genEtaPhi")
        return c, gen, histEta, histPhi, label1, label2
Example #6
0
	def plotGenEtaPhi(self):
		c = TCanvas('cGenEta','Gen eta phi',1200,1600)
		c.Divide(2,1)
		gen = self.fileHandler.getGraph('graphs/gen')
		
		histEta = TH1D('hEtaGen',"#eta GEN;#eta;#",288, -math.pi,math.pi)
		histPhi = TH1D('hPhiGen',"#phi GEN;#phi;#",288, -math.pi,math.pi)
		
		x = Double(0)
		y = Double(0)
		
		for i in range(0,gen.GetN()):
			gen.GetPoint(i,x,y)
			histPhi.Fill(y)
			histEta.Fill(x)
		
		setupAxes(histEta)
		setupAxes(histPhi)
	
		histEta.GetXaxis().SetRangeUser(-1,1)
	
		c.cd(1)
		histEta.Draw()
		label1 = drawLabelCmsPrivateSimulation()
		c.cd(2)
	
		histPhi.Draw()
		label2 = drawLabelCmsPrivateSimulation()
		
		c.Update()
		
		setStatBoxOptions(histEta,10)
		setStatBoxPosition(histEta,y1=0.85)
		setStatBoxOptions(histPhi,10)
		setStatBoxPosition(histPhi,y1=0.85)
		
		c.Update()
		self.storeCanvas(c,"genEtaPhi")
		return c,gen,histEta,histPhi,label1,label2
Example #7
0
	def plotAverageEnergyAroundL1(self):
		canvas = TCanvas('canvasAverageEnergy','Average energy',1200,1200)
		canvas.cd().SetLogz()
		
		hSum = self.fileHandler.getHistogram('hoMuonAnalyzer/averageEnergy/averageEnergyAroundPoint' + self.key + '_SummedEnergy')
		hCounter = self.fileHandler.getHistogram('hoMuonAnalyzer/averageEnergy/averageEnergyAroundPoint' + self.key + '_Counter')
	
		for i in range(0,hSum.GetNbinsX()):
			for j in range(0,hSum.GetNbinsY()):
				if hCounter.GetBinContent(hCounter.GetBin(i,j)) != 0:
					hSum.SetBinContent(hSum.GetBin(i,j),hSum.GetBinContent(hSum.GetBin(i,j))/hCounter.GetBinContent(hCounter.GetBin(i,j)))
					pass
		hSum.GetXaxis().SetRangeUser(-0.6,0.6)
		hSum.GetYaxis().SetRangeUser(-0.6,0.6)
	#	hSum.SetStats(0)
		hSum.GetXaxis().SetTitle('#Delta#eta')
		hSum.GetYaxis().SetTitle('#Delta#phi')
		hSum.GetZaxis().SetTitle('Reconstructed Energy / GeV')
		hSum.SetTitle('Average Energy in HO tiles around L1 direction')
		hSum.Draw('colz')
	#	hCounter.Draw('same,text')
		
		label = getLabelCmsPrivateSimulation()
		label.Draw()
		
		canvas.Update()
		
		#Setup plot style
		setupAxes(hSum)	
		setStatBoxOptions(hSum,1100)
		setStatBoxPosition(hSum)
		setupPalette(hSum)
	
		canvas.Update()
		self.storeCanvas(canvas,'averageEnergy')
		return canvas,hSum,label,hCounter