Esempio n. 1
0
    def createResidualsPlot(self, canvas, h1, h2):
        pad = makeResidualsPad(canvas.cd())
        pad.cd(1).SetLogy()
        pad.cd(2).SetLogy()
        pad.cd(1)
        setupAxes(h1)
        h1.SetStats(0)
        h1.DrawCopy()
        h2.DrawCopy('same')
        pad.cd(2)
        hDataClone = h2.Clone()
        setupAxes(hDataClone)
        hDataClone.SetStats(0)
        hDataClone.SetTitle(';E_{HO} / a.u.;Tight / Not Tight')
        hDataClone.Divide(h1)
        hDataClone.GetYaxis().SetTitleSize(0.07)
        hDataClone.GetYaxis().SetLabelSize(0.07)
        hDataClone.GetYaxis().SetTitleOffset(0.4)
        hDataClone.GetXaxis().SetTitleSize(0.07)
        hDataClone.GetXaxis().SetLabelSize(0.07)
        hDataClone.GetYaxis().CenterTitle()

        hDataClone.Draw('ep')
        return hDataClone
Esempio n. 2
0
	def createResidualsPlot(self,canvas, h1, h2):
		pad = makeResidualsPad(canvas.cd())
		pad.cd(1).SetLogy()
		pad.cd(2).SetLogy()
		pad.cd(1)
		setupAxes(h1)
		h1.SetStats(0)
		h1.DrawCopy()
		h2.DrawCopy('same')
		pad.cd(2)
		hDataClone = h2.Clone()
		setupAxes(hDataClone)
		hDataClone.SetStats(0)
		hDataClone.SetTitle(';E_{HO} / a.u.;Tight / Not Tight')
		hDataClone.Divide(h1)
		hDataClone.GetYaxis().SetTitleSize(0.07)
		hDataClone.GetYaxis().SetLabelSize(0.07)
		hDataClone.GetYaxis().SetTitleOffset(0.4)
		hDataClone.GetXaxis().SetTitleSize(0.07)
		hDataClone.GetXaxis().SetLabelSize(0.07)
		hDataClone.GetYaxis().CenterTitle()
		
		hDataClone.Draw('ep')
		return hDataClone
Esempio n. 3
0
	def buildTripleCanvasWithResiduals(self,hSimHo, hSimPuHo, hDataHo,canvasName = 'cTripleCanvas',legendPostix = 'HO Only',ylabel = '# entries'):
		canvas = TCanvas(canvasName,canvasName,1800,1000)
		canvas.Divide(3,1)
		##
		#	Sim No PU and Data
		##
		hSimHo.SetLineColor(colorRwthDarkBlue)
		hSimHo.SetStats(0)
		hSimHo.SetTitle('No PU and Data compared;E_{HO} / a.u.;' + ylabel)
		
		hDataHo.SetLineColor(colorRwthMagenta)
		hSimPuHo.SetLineColor(colorRwthTuerkis)
		
		pad1 = makeResidualsPad(canvas.cd(1))
		pad1.cd(1).SetLogy()
		pad1.cd(2).SetLogy()
		pad1.cd(1)
		hSimHo.Draw()
		hDataHo.DrawCopy('same')
		
		label = drawLabelCmsPrivateData()

		legend = getLegend(x1=.5,y1 = 0.75,y2=.9)
		legend.AddEntry(hSimHo,'Sim No PU, ' + legendPostix,'l')
		legend.AddEntry(hDataHo,'Data, ' + legendPostix,'l')
		legend.Draw()
		
		setupAxes(hSimHo)

		##
		#	Sim PU52 and Data
		##		
		pad2 = makeResidualsPad(canvas.cd(2))
		pad2.cd(1).SetLogy()
		pad2.cd(2).SetLogy()
		pad2.cd(1)
		setupAxes(hSimPuHo)
		hSimPuHo.SetStats(0)
		hSimPuHo.SetTitle('PU52 and Data compared;E_{HO} / a.u.;' + ylabel)
		hSimPuHo.DrawCopy('')
		hDataHo.DrawCopy('same')
		
		label2 = drawLabelCmsPrivateData()

		legend2 = getLegend(x1=.5,y1 = 0.75,y2=.9)
		legend2.AddEntry(hSimPuHo,'Sim PU52, ' + legendPostix,'l')
		legend2.AddEntry(hDataHo,'Data, ' + legendPostix,'l')
		legend2.Draw()
		
		##
		#	Sim No PU and Sim PU 52
		##
		pad3 = makeResidualsPad(canvas.cd(3))
		pad3.cd(1).SetLogy()
		pad3.cd(2).SetLogy()
		pad3.cd(1)
		hSimPuHo.SetStats(0)
		setupAxes(hSimPuHo)
		hSimPuHo.SetTitle('PU52 and No PU Simulation compared;E_{HO} / a.u.;' + ylabel)
		hSimPuHo.Draw('')
		hSimHo.DrawCopy('same')
		
		label3 = drawLabelCmsPrivateData()

		legend3 = getLegend(x1=.5,y1 = 0.75,y2=.9)
		legend3.AddEntry(hSimPuHo,'Sim PU52, ' + legendPostix,'l')
		legend3.AddEntry(hSimHo,'Sim No PU, ' + legendPostix,'l')
		legend3.Draw()
				
		#Do the ratio
		pad1.cd(2)
		cloneData = hSimHo.Clone('cloneData')
		cloneData.SetTitle(';E_{HO} / a.u.;Sim/Data')
		cloneData.Sumw2()
		setupAxes(cloneData)
		cloneData.GetYaxis().SetTitleSize(0.05)
		cloneData.GetYaxis().SetLabelSize(0.05)
		cloneData.GetXaxis().SetTitleSize(0.05)
		cloneData.GetXaxis().SetLabelSize(0.05)
		cloneData.GetYaxis().CenterTitle()
		cloneData.Divide(hDataHo)
		cloneData.SetLineWidth(1)
		cloneData.SetMarkerStyle(6)
		cloneData.SetMarkerColor(colorRwthMagenta)
		cloneData.SetLineColor(colorRwthMagenta)
		cloneData.Draw('ep')
		
		pad2.cd(2)
		clonePuAndData = hSimPuHo.Clone('clonePuAndData')
		setupAxes(clonePuAndData)
		clonePuAndData.GetYaxis().SetTitleSize(0.05)
		clonePuAndData.GetYaxis().SetLabelSize(0.05)
		clonePuAndData.GetXaxis().SetTitleSize(0.05)
		clonePuAndData.GetXaxis().SetLabelSize(0.05)
		clonePuAndData.GetYaxis().CenterTitle()
		clonePuAndData.SetTitle(';E_{HO} / a.u.;Sim/Data')
		clonePuAndData.Sumw2()
		clonePuAndData.Divide(hDataHo)
		clonePuAndData.SetLineWidth(1)
		clonePuAndData.SetMarkerStyle(6)
		clonePuAndData.SetMarkerColor(colorRwthTuerkis)
		clonePuAndData.SetLineColor(colorRwthTuerkis)
		clonePuAndData.Draw('ep')
		
		pad3.cd(2)
		clonePuAndNoPu = hSimHo.Clone('clonePuAndNoPu')
		setupAxes(clonePuAndNoPu)
		clonePuAndNoPu.GetYaxis().SetTitleSize(0.05)
		clonePuAndNoPu.GetYaxis().SetLabelSize(0.05)
		clonePuAndNoPu.GetXaxis().SetTitleSize(0.05)
		clonePuAndNoPu.GetXaxis().SetLabelSize(0.05)
		clonePuAndNoPu.GetYaxis().CenterTitle()
		clonePuAndNoPu.SetTitle(';E_{HO} / a.u.;Sim No PU/Sim PU52')
		clonePuAndNoPu.Sumw2()
		clonePuAndNoPu.Divide(hSimPuHo)
		clonePuAndNoPu.SetLineWidth(1)
		clonePuAndNoPu.SetMarkerStyle(6)
		clonePuAndNoPu.SetMarkerColor(colorRwthDarkBlue)
		clonePuAndNoPu.SetLineColor(colorRwthDarkBlue)
		clonePuAndNoPu.Draw('ep')
		return canvas, hSimHo,hDataHo,hSimPuHo,cloneData,clonePuAndData,clonePuAndNoPu, legend,legend2,legend3, label2, label3 ,label
Esempio n. 4
0
    def buildTripleCanvasWithResiduals(self,
                                       hSimHo,
                                       hSimPuHo,
                                       hDataHo,
                                       canvasName='cTripleCanvas',
                                       legendPostix='HO Only',
                                       ylabel='# entries'):
        canvas = TCanvas(canvasName, canvasName, 1800, 1000)
        canvas.Divide(3, 1)
        ##
        #	Sim No PU and Data
        ##
        hSimHo.SetLineColor(colorRwthDarkBlue)
        hSimHo.SetStats(0)
        hSimHo.SetTitle('No PU and Data compared;E_{HO} / a.u.;' + ylabel)

        hDataHo.SetLineColor(colorRwthMagenta)
        hSimPuHo.SetLineColor(colorRwthTuerkis)

        pad1 = makeResidualsPad(canvas.cd(1))
        pad1.cd(1).SetLogy()
        pad1.cd(2).SetLogy()
        pad1.cd(1)
        hSimHo.Draw()
        hDataHo.DrawCopy('same')

        label = drawLabelCmsPrivateData()

        legend = getLegend(x1=.5, y1=0.75, y2=.9)
        legend.AddEntry(hSimHo, 'Sim No PU, ' + legendPostix, 'l')
        legend.AddEntry(hDataHo, 'Data, ' + legendPostix, 'l')
        legend.Draw()

        setupAxes(hSimHo)

        ##
        #	Sim PU52 and Data
        ##
        pad2 = makeResidualsPad(canvas.cd(2))
        pad2.cd(1).SetLogy()
        pad2.cd(2).SetLogy()
        pad2.cd(1)
        setupAxes(hSimPuHo)
        hSimPuHo.SetStats(0)
        hSimPuHo.SetTitle('PU52 and Data compared;E_{HO} / a.u.;' + ylabel)
        hSimPuHo.DrawCopy('')
        hDataHo.DrawCopy('same')

        label2 = drawLabelCmsPrivateData()

        legend2 = getLegend(x1=.5, y1=0.75, y2=.9)
        legend2.AddEntry(hSimPuHo, 'Sim PU52, ' + legendPostix, 'l')
        legend2.AddEntry(hDataHo, 'Data, ' + legendPostix, 'l')
        legend2.Draw()

        ##
        #	Sim No PU and Sim PU 52
        ##
        pad3 = makeResidualsPad(canvas.cd(3))
        pad3.cd(1).SetLogy()
        pad3.cd(2).SetLogy()
        pad3.cd(1)
        hSimPuHo.SetStats(0)
        setupAxes(hSimPuHo)
        hSimPuHo.SetTitle('PU52 and No PU Simulation compared;E_{HO} / a.u.;' +
                          ylabel)
        hSimPuHo.Draw('')
        hSimHo.DrawCopy('same')

        label3 = drawLabelCmsPrivateData()

        legend3 = getLegend(x1=.5, y1=0.75, y2=.9)
        legend3.AddEntry(hSimPuHo, 'Sim PU52, ' + legendPostix, 'l')
        legend3.AddEntry(hSimHo, 'Sim No PU, ' + legendPostix, 'l')
        legend3.Draw()

        #Do the ratio
        pad1.cd(2)
        cloneData = hSimHo.Clone('cloneData')
        cloneData.SetTitle(';E_{HO} / a.u.;Sim/Data')
        cloneData.Sumw2()
        setupAxes(cloneData)
        cloneData.GetYaxis().SetTitleSize(0.05)
        cloneData.GetYaxis().SetLabelSize(0.05)
        cloneData.GetXaxis().SetTitleSize(0.05)
        cloneData.GetXaxis().SetLabelSize(0.05)
        cloneData.GetYaxis().CenterTitle()
        cloneData.Divide(hDataHo)
        cloneData.SetLineWidth(1)
        cloneData.SetMarkerStyle(6)
        cloneData.SetMarkerColor(colorRwthMagenta)
        cloneData.SetLineColor(colorRwthMagenta)
        cloneData.Draw('ep')

        pad2.cd(2)
        clonePuAndData = hSimPuHo.Clone('clonePuAndData')
        setupAxes(clonePuAndData)
        clonePuAndData.GetYaxis().SetTitleSize(0.05)
        clonePuAndData.GetYaxis().SetLabelSize(0.05)
        clonePuAndData.GetXaxis().SetTitleSize(0.05)
        clonePuAndData.GetXaxis().SetLabelSize(0.05)
        clonePuAndData.GetYaxis().CenterTitle()
        clonePuAndData.SetTitle(';E_{HO} / a.u.;Sim/Data')
        clonePuAndData.Sumw2()
        clonePuAndData.Divide(hDataHo)
        clonePuAndData.SetLineWidth(1)
        clonePuAndData.SetMarkerStyle(6)
        clonePuAndData.SetMarkerColor(colorRwthTuerkis)
        clonePuAndData.SetLineColor(colorRwthTuerkis)
        clonePuAndData.Draw('ep')

        pad3.cd(2)
        clonePuAndNoPu = hSimHo.Clone('clonePuAndNoPu')
        setupAxes(clonePuAndNoPu)
        clonePuAndNoPu.GetYaxis().SetTitleSize(0.05)
        clonePuAndNoPu.GetYaxis().SetLabelSize(0.05)
        clonePuAndNoPu.GetXaxis().SetTitleSize(0.05)
        clonePuAndNoPu.GetXaxis().SetLabelSize(0.05)
        clonePuAndNoPu.GetYaxis().CenterTitle()
        clonePuAndNoPu.SetTitle(';E_{HO} / a.u.;Sim No PU/Sim PU52')
        clonePuAndNoPu.Sumw2()
        clonePuAndNoPu.Divide(hSimPuHo)
        clonePuAndNoPu.SetLineWidth(1)
        clonePuAndNoPu.SetMarkerStyle(6)
        clonePuAndNoPu.SetMarkerColor(colorRwthDarkBlue)
        clonePuAndNoPu.SetLineColor(colorRwthDarkBlue)
        clonePuAndNoPu.Draw('ep')
        return canvas, hSimHo, hDataHo, hSimPuHo, cloneData, clonePuAndData, clonePuAndNoPu, legend, legend2, legend3, label2, label3, label