コード例 #1
0
ファイル: TimeWindow.py プロジェクト: ashrafkasem/MCHAMMER
	def plotTruthL1Together(self):
		c = TCanvas('cTimeWindowTruthL1',"Time Window Truth L1")
		effL1Muon3x3 = self.fileHandler.getHistogram('efficiency/L1MuonTruth3x3_Efficiency')
		effL1Muon3x3TW = self.fileHandler.getHistogram('efficiency/L1MuonTruthTimeWindow3x3_Efficiency')

		effL1Muon3x3.SetMarkerStyle(22)
		effL1Muon3x3.SetMarkerColor(colorRwthDarkBlue)
		effL1Muon3x3.SetLineColor(colorRwthDarkBlue)
		effL1Muon3x3.SetTitle('Efficiency Truth in 3x3 grid;p_{T} / GeV;rel. fraction')
		effL1Muon3x3.Draw()
		c.Update()
		effL1Muon3x3.GetPaintedGraph().GetXaxis().SetRangeUser(0,40)
		#effL1Muon3x3.GetPaintedGraph().GetYaxis().SetRangeUser(0.996,1.001)
		effL1Muon3x3TW.SetMarkerStyle(23)
		effL1Muon3x3TW.SetMarkerColor(colorRwthMagenta)
		effL1Muon3x3TW.SetLineColor(colorRwthMagenta)
		effL1Muon3x3TW.Draw('same')
		
		setupAxes(effL1Muon3x3)
		
		legend = TLegend(0.55,0.1,0.9,0.3)
		legend.AddEntry(effL1Muon3x3,'Matches to L1 Truth in 3x3 grid','ep')
		legend.AddEntry(effL1Muon3x3TW,'Matches to L1 Truth in 3x3 grid and time window','ep')
		legend.Draw()
		
		label = None
		if self.data:
			label = drawLabelCmsPrivateData()
		else:
			label = drawLabelCmsPrivateSimulation()
					
		c.Update()
		return c, label, effL1Muon3x3, effL1Muon3x3TW, legend
コード例 #2
0
ファイル: TimeWindow.py プロジェクト: dkgithub/HoMuonTrigger
	def plotTruthL1Together(self):
		c = TCanvas('cTimeWindowTruthL1',"Time Window Truth L1")
		effL1Muon3x3 = self.fileHandler.getHistogram('hoMuonAnalyzer/efficiency/L1MuonTruth3x3_Efficiency')
		effL1Muon3x3TW = self.fileHandler.getHistogram('hoMuonAnalyzer/efficiency/L1MuonTruthTimeWindow3x3_Efficiency')

		effL1Muon3x3.SetMarkerStyle(22)
		effL1Muon3x3.SetMarkerColor(colorRwthDarkBlue)
		effL1Muon3x3.SetLineColor(colorRwthDarkBlue)
		effL1Muon3x3.SetTitle('Efficiency Truth in 3x3 grid;p_{T} / GeV;rel. fraction')
		effL1Muon3x3.Draw()
		c.Update()
		effL1Muon3x3.GetPaintedGraph().GetXaxis().SetRangeUser(0,40)
		#effL1Muon3x3.GetPaintedGraph().GetYaxis().SetRangeUser(0.996,1.001)
		effL1Muon3x3TW.SetMarkerStyle(23)
		effL1Muon3x3TW.SetMarkerColor(colorRwthMagenta)
		effL1Muon3x3TW.SetLineColor(colorRwthMagenta)
		effL1Muon3x3TW.Draw('same')
		
		setupAxes(effL1Muon3x3)
		
		legend = TLegend(0.55,0.1,0.9,0.3)
		legend.AddEntry(effL1Muon3x3,'Matches to L1 Truth in 3x3 grid','ep')
		legend.AddEntry(effL1Muon3x3TW,'Matches to L1 Truth in 3x3 grid and time window','ep')
		legend.Draw()
		
		label = None
		if self.data:
			label = drawLabelCmsPrivateData()
		else:
			label = drawLabelCmsPrivateSimulation()
					
		c.Update()
		return c, label, effL1Muon3x3, effL1Muon3x3TW, legend
コード例 #3
0
	def plotL13x3AndL1Tight3x3L1Coordinates(self):
		effL1Muon3x3 = self.fileHandler.getHistogram('hoMuonAnalyzer/efficiency/gridMatching_L1pT_loose3x3_Efficiency')
		effL1TightMuon3x3 = self.fileHandler.getHistogram('hoMuonAnalyzer/efficiency/gridMatching_L1pT_tight3x3_Efficiency')
		c = TCanvas("tight and normal 3x3 L1 pT","3x3 All and Tight",1200,1200)
			
		effL1Muon3x3.SetMarkerColor(colorRwthDarkBlue)
		effL1Muon3x3.SetLineColor(colorRwthDarkBlue)
		effL1Muon3x3.SetMarkerStyle(20)
		effL1Muon3x3.SetTitle('Efficiency for Matching HO to L1 and L1 Tight;p_{T,L1} / GeV;Efficiency')

		effL1TightMuon3x3.SetMarkerColor(colorRwthMagenta)
		effL1TightMuon3x3.SetLineColor(colorRwthMagenta)
		effL1TightMuon3x3.SetMarkerStyle(21)
		
		effL1Muon3x3.Draw('')
		effL1TightMuon3x3.Draw('same')

		c.Update()
		
		effL1Muon3x3.GetPaintedGraph().GetXaxis().SetRangeUser(0,20)
		effL1Muon3x3.GetPaintedGraph().GetYaxis().SetRangeUser(0,1)
		
		setupAxes(effL1Muon3x3)
		setupAxes(effL1TightMuon3x3)
		
		legend = TLegend(0.55,0.1,0.9,0.3)
		legend.AddEntry(effL1Muon3x3,'Matches in 3x3 grid','ep')
		legend.AddEntry(effL1TightMuon3x3,'Matches from tight in 3x3 grid','ep')
		legend.Draw()

		label = self.drawLabel()

		c.Update()
		self.storeCanvas(c,'efficiencyNormalAndTightVsPtL1')
		return c, legend, effL1Muon3x3, effL1TightMuon3x3,label
コード例 #4
0
ファイル: EvsEtaPhi.py プロジェクト: Kuenni/HoMuonTrigger
	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)
コード例 #5
0
ファイル: EvsEtaPhi.py プロジェクト: Kuenni/HoMuonTrigger
	def plot1DEnergyAroundL1(self):	
		'''
			eta[P,M][2,1,0]phi[P,M][2,1,0]_averageEnergyAroundPoint
			Central tile is central
		'''
		histList = []
		fitList = []
		labelList = []
		canvas = TCanvas('canvas1DEnergy','1D energy',1200,1200)
		for p in reversed(range(-2,3)):
			for e in range(-2,3):
				if e == 0 and p == 0:
					histList.append(self.fileHandler.getHistogram('etaPhi/energy1D/central_averageEnergyAroundPoint' + self.key))
				else:
					histName = ('etaPhi/energy1D/eta%s%dPhi%s%d_averageEnergyAroundPoint' + self.key) % ('P' if e >= 0 else 'M',abs(e),'P' if p >= 0 else 'M',abs(p))
					histList.append(self.fileHandler.getHistogram(histName))
		canvas.Divide(5,5)
		for i,hist in enumerate(histList):
			canvas.cd(i+1).SetLogy()
			hist.GetXaxis().SetRangeUser(-0.5,4)
			hist.SetLineWidth(3)
			setupAxes(hist)
			hist.Draw()
			fit = TF1('fit%d' % (i),'landau',0.5,2)
			hist.Fit(fit,'RQ')
			label = TPaveText(0.6,0.7,0.9,0.9,"NDC")
			label.AddText('MPV: %5.2f' % (fit.GetParameter(1)))
			label.Draw()
			labelList.append(label)
			fitList.append(fit)
		canvas.Update()
		self.storeCanvas(canvas, '1DPlots')
		return histList,canvas,fitList,labelList
コード例 #6
0
ファイル: ControlPlots.py プロジェクト: Kuenni/HoMuonTrigger
	def plotL1PerPt(self):
		ptValues = [0.,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,6.0,7.0,8.0,10.0,12.0,14.0,16.0,18.0,20.0,25.0,30.0,35.0,40.0,45.0,50.0,60.0,70.0,80.0,90.0,100.0,120.0,140.0]
		ptBins = [0]
		for i in range(len(ptValues)-1):
			ptBins.append( (ptValues[i]+ptValues[i+1])/2. )
		ptBins.append(200)
		canvas = TCanvas('cL1PerPt')
		hist = TH1D('hist','# L1 per p_{T}',len(ptBins)-1,array('d',ptBins))
		chain = self.fileHandler.getTChain()
		eventCounter = 0
		liste = []
		nEvents = chain.GetEntries()
		for event in chain:
			eventCounter += 1
			for l1 in event.l1MuonData:
				if not l1.pt in liste:
					liste.append(l1.pt)
				hist.Fill(l1.pt)
			if not eventCounter%10000:
				printProgress(eventCounter,nEvents)
			if eventCounter == 50000:
				break
		print
		setupAxes(hist)
		hist.SetStats(0)
		hist.Scale(1,"width")
		hist.Draw()
		
		label = drawLabelCmsPrivateSimulation()
		
		canvas.Update()
		
	#	print liste
		return hist, canvas, label
コード例 #7
0
ファイル: Utils.py プロジェクト: ashrafkasem/MCHAMMER
def setupEAvplot(histE,
                 histC=None,
                 xmin=-0.4,
                 xmax=0.4,
                 ymin=-0.4,
                 ymax=0.4,
                 same=False,
                 limitForAll=None):
    if histC != None:
        histE = average2DHistogramBinwise(histE, histC)
    if same:
        if limitForAll == None:
            commandLine.warning(
                'WARNING: Requested same histogram borders for all ranges but '
                'did not give limitForAll parameter. Using default values instead!'
            )
        else:
            xmin = ymin = -limitForAll
            xmax = ymax = limitForAll
    histE.GetXaxis().SetRangeUser(xmin, xmax)
    histE.GetYaxis().SetRangeUser(ymin, ymax)
    histE.SetStats(0)
    histE.GetXaxis().SetTitle('#Delta#eta')
    histE.GetYaxis().SetTitle('#Delta#phi')
    histE.GetZaxis().SetTitle('Reconstructed Energy / GeV')
    setupAxes(histE)
    return histE
コード例 #8
0
ファイル: DeltaPhi.py プロジェクト: Kuenni/HoMuonTrigger
	def plotDeltaPhiVsL1Phi(self):
		canvas = TCanvas('cDeltaPhiVsL1Phi','DeltaPhiVsL1Phi',1200,1200)
		hist = self.fileHandler.getHistogram('correlation/shiftCheckDeltaPhiVsPhi')
		hist.GetYaxis().SetRangeUser(-1,1)
		hist.GetXaxis().SetRangeUser(-.5,.5)
		hist.GetXaxis().SetTitle('L1 #phi')
		hist.GetZaxis().SetTitle('#')
		hist.SetStats(0)
		hist.SetTitle('#Delta#phi vs. L1#phi')
		setupAxes(hist)
	
		hist.Draw('colz')
		phiBorderLines = []
		
		HO_BIN = math.pi/36.
		
		for i in range(-31,32):
			line = TLine(HO_BIN*i - HO_BIN/2.,-.6, HO_BIN*i - HO_BIN/2.,.6)
			line.SetLineWidth(2)
		#	line.Draw()
			phiBorderLines.append(line)
			
		legend = TLegend(0.6,0.8,0.9,0.85)
		legend.AddEntry(phiBorderLines[0],"HO Tile center","e")
		#legend.Draw()
		
		label = self.drawLabel()
		canvas.Update()
		
		setupPalette(hist)
		
		canvas.Update()
		canvas.SaveAs('plots/deltaPhiVsL1Phi.pdf')
		
		return canvas,hist,label,phiBorderLines,legend
コード例 #9
0
ファイル: Timing.py プロジェクト: Kuenni/HoMuonTrigger
	def plotPtAndPhiOfWrongBxId(self):
		#Prepare canvas
		canvas = TCanvas("canvasPtPhiBxWrong","PtPhiBxWrong",1200,1200)
		canvas.cd().Draw()
		#prepare histogram
		hist = self.fileHandler.getHistogram("etaPhi/3D/BxWrongGen_EtaPhiPt")
	
		stack = THStack(hist,"zy","2dStack","",-1,-1,-1,-1,"zy","")
	
		#Create new histogram and add the histograms from the stack
		histNew = TH2D("histPtPhiBxWrong","p_{T} vs. #phi distribution for wrong BX ID;#phi;p_{T} / 5 GeV;#",80,-3.2,3.2,40,0,200)
		histNew.GetYaxis().SetTitleOffset(1.2)
		for i in stack.GetHists():
			histNew.Add(i)
	
		gStyle.SetPalette(1)
		histNew.SetStats(0)
		setupAxes(histNew)
		histNew.Draw('COLZ')
		canvas.Update()
	
		palette = histNew.FindObject("palette")
		palette.SetX1NDC(0.9)
		palette.SetX2NDC(0.92)
		#add label
		label = getLabelCmsPrivateSimulation()
		label.Draw()
		
		canvas.Update()
		self.storeCanvas(canvas,"bxWrongPtPhi")
		return canvas,hist,stack,histNew,label
コード例 #10
0
ファイル: ControlPlots.py プロジェクト: ashrafkasem/MCHAMMER
    def plotHoDigiMatchesPerDetId(self):
        canvas = TCanvas('canvasDigiMatchesMultiplicity')
        digiMatches = self.fileHandler.getHistogram(
            'hoDigiMatchesPerDetId_Multiplicity')
        setupAxes(digiMatches)
        digiMatches.SetTitle(
            'Number of matches between RecHit and Digi for a given DetId')
        digiMatches.GetXaxis().SetRangeUser(0, 5)
        digiMatches.GetXaxis().SetTitle('Number of matches per DetId')
        digiMatches.GetYaxis().SetTitle('#')
        canvas.cd().SetLogy()
        digiMatches.SetLineWidth(3)
        digiMatches.SetLineColor(colorRwthDarkBlue)
        digiMatches.Draw()

        label = drawLabelCmsPrivateSimulation()

        canvas.Update()

        stats = digiMatches.GetListOfFunctions().FindObject("stats")
        stats.SetX1NDC(.7)
        stats.SetX2NDC(.9)
        stats.SetY1NDC(.75)
        stats.SetY2NDC(.9)

        canvas.Update()
        self.storeCanvas(canvas, "digiMatchesPerDetId")
        return canvas, digiMatches, label
コード例 #11
0
def plotRecHitVsDigiTime():
    canvas = TCanvas("canvasRecHitVsDigi", "RecHitTime Vs Simple Digi", 1200,
                     1200)

    hoDigiTime = fileHandler.getGraph(
        'hoDigiAnalyzer/correlation/hoTimeRecHitVsDigi')
    setupAxes(hoDigiTime)

    hoDigiTime.GetXaxis().SetTitle('digi time / ns')
    hoDigiTime.GetYaxis().SetTitle('rec hit time / ns')
    hoDigiTime.GetYaxis().SetTitleOffset(1.2)
    hoDigiTime.SetMarkerStyle(6)
    hoDigiTime.SetMarkerColor(colorRwthDarkBlue)
    hoDigiTime.SetTitle('HORecHit time vs. simple digi time estimation')
    hoDigiTime.Draw('ap')

    #Label for CMS private
    label = getLabelCmsPrivateSimulation()
    label.Draw()

    canvas.Update()

    canvas.SaveAs('plots/timing/digiTimeVsRecHitTime.png')

    return canvas, label, hoDigiTime
コード例 #12
0
ファイル: EvsEtaPhi.py プロジェクト: ashrafkasem/MCHAMMER
	def makeEmaxPlot(self,source, title = ""):
		if title == "":
			title = '# of E_{Max} in HO tiles around L1 direction ' + source
			
		canvas = TCanvas('canvasEmaxcounts' + source,'E max counts' + source,900,900)
		canvas.cd().SetLogz()
		
		hCounter = self.fileHandler.getHistogram('deltaEtaDeltaPhiEnergy/averageEMaxAroundPoint' + source + '_2dCounter')
		hCounter.GetXaxis().SetRangeUser(-.6,.6)
		hCounter.GetYaxis().SetRangeUser(-.6,.6)
		hCounter.SetTitle(title + ';#Delta#eta;#Delta#phi;# Entries')
		hCounter.SetStats(0)
		hCounter.Draw('colz')
		canvas.Update()		
		setupAxes(hCounter)
		setupPalette(hCounter)
		canvas.Update()
		label = self.drawLabel()
		#boxes = drawHoBoxes(canvas)
		self.storeCanvas(canvas,'eMaxCounts' + source)

		#Output fractions in grid		
		self.debug('Emax fraction for ' + source)
		self.outputFractionsInTileGrid(hCounter)
		return canvas,label,hCounter
コード例 #13
0
ファイル: DtRpc.py プロジェクト: Kuenni/HoMuonTrigger
	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
コード例 #14
0
ファイル: Energy.py プロジェクト: ashrafkasem/MCHAMMER
	def plotMatchedAndNotMatchedPerWheel(self):
		resHo = self.plotEnergyPerWheel('horeco')
		resHoMatched = self.plotEnergyPerWheel('L1MuonWithHoMatchAboveThr')
		
		cTogether = TCanvas('cTogether','Matched and not Matched',1800,500)
		cTogether.Divide(4,1)
		
		plotTitles = [
					'Wheel -1',
					'Wheel 0 (-)',
					'Wheel 0 (+)',
					'Wheel +1',
					]
		
		for i in range(0,4):
			cTogether.cd(i+1).SetLogy()
			resHo[i].SetTitle(plotTitles[i] + ';E_{Rec} / GeV;fraction of MIP peak')
			#resHo[i].GetXaxis().SetRangeUser(-1,6)
			maxBin = resHoMatched[i].GetMaximumBin()#resHo[i].FindBin()
			resHo[i].Scale(1/resHo[i].GetBinContent(maxBin))
			resHo[i].SetStats(0)
			resHo[i].Draw()
			setupAxes(resHo[i])
			#resHo[i].GetYaxis().SetRangeUser(4e-3,2)
			resHoMatched[i].Scale(1/resHoMatched[i].GetBinContent(maxBin))
			resHoMatched[i].Draw('same')
		cTogether.Update()
		cTogether.SaveAs('plots/energyPerWheelTogether.root')

		return cTogether,resHo, resHoMatched
コード例 #15
0
ファイル: ControlPlots.py プロジェクト: Kuenni/HoMuonTrigger
	def plotHoDigiMatchesPerDetId(self):
		canvas = TCanvas('canvasDigiMatchesMultiplicity')
		digiMatches = self.fileHandler.getHistogram('hoDigiMatchesPerDetId_Multiplicity')
		setupAxes(digiMatches)
		digiMatches.SetTitle('Number of matches between RecHit and Digi for a given DetId')
		digiMatches.GetXaxis().SetRangeUser(0,5)
		digiMatches.GetXaxis().SetTitle('Number of matches per DetId')
		digiMatches.GetYaxis().SetTitle('#')
		canvas.cd().SetLogy()
		digiMatches.SetLineWidth(3)
		digiMatches.SetLineColor(colorRwthDarkBlue)
		digiMatches.Draw()
		
		label = drawLabelCmsPrivateSimulation()
		
		canvas.Update()
		
		stats = digiMatches.GetListOfFunctions().FindObject("stats")
		stats.SetX1NDC(.7)
		stats.SetX2NDC(.9)
		stats.SetY1NDC(.75)
		stats.SetY2NDC(.9)
		
		canvas.Update()
		self.storeCanvas(canvas,"digiMatchesPerDetId")
		return canvas,digiMatches,label
コード例 #16
0
	def plotPtAndPhiOfWrongBxId(self):
		#Prepare canvas
		canvas = TCanvas("canvasPtPhiBxWrong","PtPhiBxWrong",1200,1200)
		canvas.cd().Draw()
		#prepare histogram
		hist = self.fileHandler.getHistogram("etaPhi/3D/BxWrongGen_EtaPhiPt")
	
		stack = THStack(hist,"zy","2dStack","",-1,-1,-1,-1,"zy","")
	
		#Create new histogram and add the histograms from the stack
		histNew = TH2D("histPtPhiBxWrong","p_{T} vs. #phi distribution for wrong BX ID;#phi;p_{T} / 5 GeV;#",80,-3.2,3.2,40,0,200)
		histNew.GetYaxis().SetTitleOffset(1.2)
		for i in stack.GetHists():
			histNew.Add(i)
	
		gStyle.SetPalette(1)
		histNew.SetStats(0)
		setupAxes(histNew)
		histNew.Draw('COLZ')
		canvas.Update()
	
		palette = histNew.FindObject("palette")
		palette.SetX1NDC(0.9)
		palette.SetX2NDC(0.92)
		#add label
		label = getLabelCmsPrivateSimulation()
		label.Draw()
		
		canvas.Update()
		self.storeCanvas(canvas,"bxWrongPtPhi")
		return canvas,hist,stack,histNew,label
コード例 #17
0
ファイル: DtRpc.py プロジェクト: ashrafkasem/MCHAMMER
    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
コード例 #18
0
ファイル: DeltaPhi.py プロジェクト: Kuenni/HoMuonTrigger
	def plotEtaPhiForDeltaPhiOne(self):
		canvas = TCanvas("cEtaPhiDeltaPhiOne","Eta Phi For DPhi 1",1200,1200)
		graph = self.fileHandler.getGraph('graphs/averageEnergyDeltaPhi1')
			
		halfbinwidth = L1_PHI_BIN/2.
		hist = TH2D('hEtaPhiDeltaPhi1',"#eta#phi of #Delta#phi=1 evts.",30,-15*L1_ETA_BIN	,15*L1_ETA_BIN,
				289, -math.pi - halfbinwidth,math.pi + halfbinwidth)
		
		x = Double(0)
		y = Double(0)
		
		for i in range(0,graph.GetN()):
			graph.GetPoint(i,x,y)
			hist.Fill(x,y)
		
		hist.SetStats(0)
		hist.GetXaxis().SetRangeUser(-1,1)
		hist.SetTitle(hist.GetTitle() + ';#eta;#phi;Entries')
		setupAxes(hist)
		hist.Draw('colz')
		canvas.Update()
		
		setupPalette(hist)
		
		label = self.drawLabel()
		
		canvas.Update()
		
		self.storeCanvas(canvas, 'etaPhiForDeltaPhiOne')
		canvas.SaveAs('plots/etaPhiForDeltaPhiOne.pdf')
		
		return canvas,hist,label
コード例 #19
0
def plotQualityCodesStacked(gridSize):
	gridString = gridSizeDict.get(gridSize)
	c = TCanvas('cQualityCodes' + gridString + 'Stacked','Stacked QC ' + gridString,600,0,800,600)
	c.SetLogy()
	c.cd().SetBottomMargin(0.15)
	c.cd().SetRightMargin(0.20)
	qualityCodes = fileHandler.getHistogram('hoMuonAnalyzer/multiplicity/L1MuonQualityCodes' + gridString + '_Multiplicity')
	qualityCodesFail = fileHandler.getHistogram('hoMuonAnalyzer/multiplicity/L1MuonQualityCodes' + gridString + 'Fail_Multiplicity')
	
	countQualityCodes = fileHandler.getHistogram('hoMuonAnalyzer/multiplicity/L1MuonAllQualityCodes_Multiplicity')
	countQualityCodesTruth = fileHandler.getHistogram('hoMuonAnalyzer/multiplicity/L1MuonTruthAllQualityCodes_Multiplicity')
	
	print
	cli.output('Sanity check for quality code counts')
	for i in range(1,8):
		nTotalHistogram = countQualityCodes.GetBinContent(countQualityCodes.FindBin(i))
		nFail = qualityCodesFail.GetBinContent(qualityCodesFail.FindBin(i))
		nPass = qualityCodes.GetBinContent(qualityCodes.FindBin(i))
		nSummed = nFail + nPass
		print
		cli.output('NTotal: %d\t\tNSummed: %d' % (nTotalHistogram,nSummed))
		cli.output('Sanity check: %s'% (CliColors.OKBLUE + 'OK' + CliColors.ENDC if nTotalHistogram == nSummed else CliColors.FAIL + 'FAIL' + CliColors.ENDC) )
		print
		if nTotalHistogram:
			qualityCodes.SetBinContent(qualityCodes.FindBin(i),nPass/float(nTotalHistogram))
			qualityCodesFail.SetBinContent(qualityCodesFail.FindBin(i),nFail/float(nTotalHistogram))
	
	stack = THStack("hstack","Quality Codes in matching to HO (" + gridString + ");;rel. fraction")
	
	qualityCodes.SetLineColor(colorRwthDarkBlue)
	qualityCodes.SetFillColor(colorRwthDarkBlue)
	qualityCodes.SetFillStyle(3002)

	qualityCodesFail.SetFillColor(colorRwthMagenta)
	qualityCodesFail.SetLineColor(colorRwthMagenta)
	qualityCodesFail.SetFillStyle(3002)

	stack.Add(qualityCodes)
	stack.Add(qualityCodesFail)
	
	stack.Draw()
	stack.GetXaxis().SetRangeUser(0,8)
		#Label the bins with the meaning of the quality code
	for i in range(1,8):
		stack.GetXaxis().SetBinLabel(stack.GetXaxis().FindBin(i),qualityCodeDict.get(i))
		
	legend = TLegend(0.82,0.75,0.99,0.9)
	legend.AddEntry(qualityCodes,"Passed","f")
	legend.AddEntry(qualityCodesFail,"Failed","f")
	legend.Draw()
	
	label = drawLabelCmsPrivateSimulation(x1ndc=0.5,y1ndc=0.9,x2ndc=0.8,y2ndc=0.93)
	
	setupAxes(stack)
		
	c.Update()
	
	c.SaveAs('plots/efficiency/qualityCodesStacked' + gridString + '.pdf')
	
	return stack,c,qualityCodes,qualityCodesFail,legend,label
コード例 #20
0
ファイル: GridMatching.py プロジェクト: Kuenni/HoMuonTrigger
	def get3x3MatchingPlot(self,hist3x3,hist3x3Tight,histTitle):
		eff3x3 = self.fileHandler.getHistogram(hist3x3)
		eff3x3Tight = self.fileHandler.getHistogram(hist3x3Tight)
		c = TCanvas(histTitle,histTitle,900,900)
		c.SetBottomMargin(.12)

		eff3x3.SetMarkerColor(colorRwthDarkBlue)
		eff3x3.SetLineColor(colorRwthDarkBlue)
		eff3x3.SetMarkerStyle(20)
		eff3x3.SetTitle(histTitle)

		eff3x3Tight.SetMarkerColor(colorRwthMagenta)
		eff3x3Tight.SetLineColor(colorRwthMagenta)
		eff3x3Tight.SetMarkerStyle(21)

		eff3x3.Draw('')
		eff3x3Tight.Draw('same')

		c.Update()
		
		setupAxes(eff3x3)
		setupAxes(eff3x3Tight)
		
		eff3x3.GetPaintedGraph().GetXaxis().SetTitleOffset(.8)
		eff3x3.GetPaintedGraph().GetYaxis().SetTitleOffset(.68)
		
		legend = TLegend(0.25,0.2,0.83,0.33)
		
		return c,eff3x3,eff3x3Tight,legend
コード例 #21
0
ファイル: EvsEtaPhi.py プロジェクト: ashrafkasem/MCHAMMER
	def plot1DEMaxAroundL1(self):	
		'''
			eta[P,M][2,1,0]phi[P,M][2,1,0]_averageEnergyAroundPoint
			Central tile is central
		'''
		histList = []
		fitList = []
		labelList = []
		canvas = TCanvas('canvas1DEMax','1D EMax',1200,1200)
		for p in reversed(range(-2,3)):
			for e in range(-2,3):
				if e == 0 and p == 0:
					histList.append(self.fileHandler.getHistogram('etaPhi/energy1D/central_averageEMaxAroundPoint' + self.key))
				else:
					histName = ('etaPhi/energy1D/eta%s%dPhi%s%d_averageEMaxAroundPoint' + self.key) % ('P' if e >= 0 else 'M',abs(e),'P' if p >= 0 else 'M',abs(p))
					histList.append(self.fileHandler.getHistogram(histName))
		canvas.Divide(5,5)
		for i,hist in enumerate(histList):
			canvas.cd(i+1).SetLogy()
			hist.GetXaxis().SetRangeUser(-0.5,4)
			hist.SetLineWidth(3)
			setupAxes(hist)
			hist.Draw()
			fit = TF1('fit%d' % (i),'landau',0.5,2)
			hist.Fit(fit,'RQ')
			label = TPaveText(0.6,0.7,0.9,0.9,"NDC")
			label.AddText('MPV: %5.2f' % (fit.GetParameter(1)))
			label.Draw()
			labelList.append(label)
			fitList.append(fit)
		canvas.Update()
		self.storeCanvas(canvas, '1DEMaxPlots')
		return histList,canvas,fitList,labelList
コード例 #22
0
    def plotEtaPhiForDeltaPhiOne(self):
        canvas = TCanvas("cEtaPhiDeltaPhiOne", "Eta Phi For DPhi 1", 1200,
                         1200)
        graph = self.fileHandler.getGraph('graphs/averageEnergyDeltaPhi1')

        halfbinwidth = L1_PHI_BIN / 2.
        hist = TH2D('hEtaPhiDeltaPhi1', "#eta#phi of #Delta#phi=1 evts.", 30,
                    -15 * L1_ETA_BIN, 15 * L1_ETA_BIN, 289,
                    -math.pi - halfbinwidth, math.pi + halfbinwidth)

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

        for i in range(0, graph.GetN()):
            graph.GetPoint(i, x, y)
            hist.Fill(x, y)

        hist.SetStats(0)
        hist.GetXaxis().SetRangeUser(-1, 1)
        hist.SetTitle(hist.GetTitle() + ';#eta;#phi;Entries')
        setupAxes(hist)
        hist.Draw('colz')
        canvas.Update()

        setupPalette(hist)

        label = self.drawLabel()

        canvas.Update()

        self.storeCanvas(canvas, 'etaPhiForDeltaPhiOne')
        canvas.SaveAs('plots/etaPhiForDeltaPhiOne.pdf')

        return canvas, hist, label
コード例 #23
0
ファイル: EvsEtaPhi.py プロジェクト: ashrafkasem/MCHAMMER
	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)
コード例 #24
0
ファイル: Energy.py プロジェクト: Kuenni/HoMuonTrigger
	def plotMatchedAndNotMatchedPerWheel(self):
		resHo = self.plotEnergyPerWheel('horeco')
		resHoMatched = self.plotEnergyPerWheel('L1MuonWithHoMatchAboveThr')
		
		cTogether = TCanvas('cTogether','Matched and not Matched',1800,500)
		cTogether.Divide(4,1)
		
		plotTitles = [
					'Wheel -1',
					'Wheel 0 (-)',
					'Wheel 0 (+)',
					'Wheel +1',
					]
		
		for i in range(0,4):
			cTogether.cd(i+1).SetLogy()
			resHo[i].SetTitle(plotTitles[i] + ';E_{Rec} / GeV;fraction of MIP peak')
			#resHo[i].GetXaxis().SetRangeUser(-1,6)
			maxBin = resHoMatched[i].GetMaximumBin()#resHo[i].FindBin()
			resHo[i].Scale(1/resHo[i].GetBinContent(maxBin))
			resHo[i].SetStats(0)
			resHo[i].Draw()
			setupAxes(resHo[i])
			#resHo[i].GetYaxis().SetRangeUser(4e-3,2)
			resHoMatched[i].Scale(1/resHoMatched[i].GetBinContent(maxBin))
			resHoMatched[i].Draw('same')
		cTogether.Update()
		cTogether.SaveAs('plots/energyPerWheelTogether.root')

		return cTogether,resHo, resHoMatched
コード例 #25
0
	def plotHoTime(self):
		c3 = TCanvas("c3","HO Time",1200,1200)
		skipNoisePlot = False
		if not skipNoisePlot:
			c3.Divide(1,2)
			c3.cd(1).SetLogy()
			label = getLabelCmsPrivateSimulation()
			label.Draw()
			hHoTime = self.fileHandler.getHistogram('hoRecHits_Time')
			
			hHoTime.SetStats(0)
			hHoTime.SetTitle("Time distribution for all HO Rec Hits")
			hHoTime.SetLineColor(colorRwthDarkBlue)
			hHoTime.SetLineWidth(3)
			hHoTime.Draw()
			label = getLabelCmsPrivateSimulation()
			label.Draw()
			
		hHoTimeAboveThr = self.fileHandler.getHistogram('hoRecHitsAboveThr_Time')
		c3.cd(2).SetLogy()
		hHoTimeAboveThr.SetStats(0)
		hHoTimeAboveThr.SetTitle("Time distribution for HO Rec Hits > 0.2 GeV")
		hHoTimeAboveThr.SetLineColor(colorRwthDarkBlue)
		hHoTimeAboveThr.SetLineWidth(3)
		setupAxes(hHoTimeAboveThr)
		hHoTimeAboveThr.Draw()
		
		label = getLabelCmsPrivateSimulation()
		label.Draw()
		
		self.debug(80*'#')
		self.debug( 'Integral of HO > 0.2 GeV time histogram:')
		self.debug( hHoTimeAboveThr.Integral())
		self.debug('')
		
		xLow = -5
		xHigh = 5
		histogramBetween = hHoTimeAboveThr.Integral(hHoTimeAboveThr.FindBin(xLow),hHoTimeAboveThr.FindBin(xHigh))
		histogramTotal = float(hHoTimeAboveThr.Integral())
		self.debug( 'Histogram integral between %.f ns and %.f ns' % (xLow,xHigh) )
		self.debug( '%d/%d => %.2f +/- %f' % (histogramBetween,histogramTotal
											,histogramBetween/histogramTotal,calcSigma(histogramBetween, histogramTotal))) 
		self.debug( 80*'#')
		
		fit = TF1("fit","gaus",-10,10)
		hHoTimeAboveThr.Fit(fit)
		
		pText = TPaveText(0.7,0.8,0.9,0.9,'NDC')
		pText.AddText('Mean: %.2f ns' % (fit.GetParameter(1)))
		pText.AddText('#sigma: %.2f ns' % (fit.GetParameter(2)))
		pText.SetBorderSize(1)
		pText.SetFillColor(0)
		pText.Draw()
		
		c3.Update()
		self.storeCanvas(c3,"hoTime")
		
		return c3,label,hHoTimeAboveThr,pText
コード例 #26
0
ファイル: QualityCode.py プロジェクト: Kuenni/HoMuonTrigger
	def plotQualityCodesStacked(self,gridSize):
		gridString = self.gridSizeDict.get(gridSize)
		c = TCanvas('cQualityCodes' + gridString + 'Stacked','Stacked QC ' + gridString,600,0,800,600)
		c.cd().SetBottomMargin(0.15)
		c.cd().SetRightMargin(0.20)
		qualityCodes = self.fileHandler.getHistogram('multiplicity/L1MuonQualityCodes' + gridString + '_Multiplicity')
		qualityCodesFail = self.fileHandler.getHistogram('multiplicity/L1MuonQualityCodes' + gridString + 'Fail_Multiplicity')
		
		countQualityCodes = self.fileHandler.getHistogram('multiplicity/L1MuonAllQualityCodes_Multiplicity')
		
		self.commandLine.output('Sanity check for quality code counts')
		for i in range(1,8):
			nTotalHistogram = countQualityCodes.GetBinContent(countQualityCodes.FindBin(i))
			nFail = qualityCodesFail.GetBinContent(qualityCodesFail.FindBin(i))
			nPass = qualityCodes.GetBinContent(qualityCodes.FindBin(i))
			nSummed = nFail + nPass
			print
			self.commandLine.output('NTotal: %d\t\tNSummed: %d' % (nTotalHistogram,nSummed))
			self.commandLine.output('Sanity check: %s'% (CliColors.OKBLUE + 'OK' + CliColors.ENDC if nTotalHistogram == nSummed else CliColors.FAIL + 'FAIL' + CliColors.ENDC) )
			print
			if nTotalHistogram:
				qualityCodes.SetBinContent(qualityCodes.FindBin(i),nPass/float(nTotalHistogram))
				qualityCodesFail.SetBinContent(qualityCodesFail.FindBin(i),nFail/float(nTotalHistogram))
		
		stack = THStack("hstack",";;rel. fraction")
		
		
		qualityCodes.SetLineColor(colorRwthDarkBlue)
		qualityCodes.SetFillColor(colorRwthDarkBlue)
		qualityCodes.SetFillStyle(3002)
	
		qualityCodesFail.SetFillColor(colorRwthMagenta)
		qualityCodesFail.SetLineColor(colorRwthMagenta)
		qualityCodesFail.SetFillStyle(3002)
	
		stack.Add(qualityCodes)
		stack.Add(qualityCodesFail)
		
		stack.Draw()
		stack.GetXaxis().SetRangeUser(0,8)

			#Label the bins with the meaning of the quality code
		for i in range(1,8):
			stack.GetXaxis().SetBinLabel(stack.GetXaxis().FindBin(i),self.qualityCodeDict.get(i))
			
		legend = TLegend(0.1,0.8,0.3,0.95)
		legend.AddEntry(qualityCodes,"Passed","f")
		legend.AddEntry(qualityCodesFail,"Failed","f")
		legend.Draw()
				
		setupAxes(stack)
		stack.SetMinimum(0.75)

		c.Update()
		
		self.storeCanvas(c, 'qualityCodesStacked' + gridString)
		
		return stack,c,qualityCodes,qualityCodesFail,legend
コード例 #27
0
ファイル: Timing.py プロジェクト: Kuenni/HoMuonTrigger
	def plotHoTime(self):
		c3 = TCanvas("c3","HO Time",1200,1200)
		skipNoisePlot = False
		if not skipNoisePlot:
			c3.Divide(1,2)
			c3.cd(1).SetLogy()
			label = getLabelCmsPrivateSimulation()
			label.Draw()
			hHoTime = self.fileHandler.getHistogram('hoRecHits_Time')
			
			hHoTime.SetStats(0)
			hHoTime.SetTitle("Time distribution for all HO Rec Hits")
			hHoTime.SetLineColor(colorRwthDarkBlue)
			hHoTime.SetLineWidth(3)
			hHoTime.Draw()
			label = getLabelCmsPrivateSimulation()
			label.Draw()
			
		hHoTimeAboveThr = self.fileHandler.getHistogram('hoRecHitsAboveThr_Time')
		c3.cd(2).SetLogy()
		hHoTimeAboveThr.SetStats(0)
		hHoTimeAboveThr.SetTitle("Time distribution for HO Rec Hits > 0.2 GeV")
		hHoTimeAboveThr.SetLineColor(colorRwthDarkBlue)
		hHoTimeAboveThr.SetLineWidth(3)
		setupAxes(hHoTimeAboveThr)
		hHoTimeAboveThr.Draw()
		
		label = getLabelCmsPrivateSimulation()
		label.Draw()
		
		self.debug(80*'#')
		self.debug( 'Integral of HO > 0.2 GeV time histogram:')
		self.debug( hHoTimeAboveThr.Integral())
		self.debug('')
		
		xLow = -5
		xHigh = 5
		histogramBetween = hHoTimeAboveThr.Integral(hHoTimeAboveThr.FindBin(xLow),hHoTimeAboveThr.FindBin(xHigh))
		histogramTotal = float(hHoTimeAboveThr.Integral())
		self.debug( 'Histogram integral between %.f ns and %.f ns' % (xLow,xHigh) )
		self.debug( '%d/%d => %.2f +/- %f' % (histogramBetween,histogramTotal
											,histogramBetween/histogramTotal,calcSigma(histogramBetween, histogramTotal))) 
		self.debug( 80*'#')
		
		fit = TF1("fit","gaus",-10,10)
		hHoTimeAboveThr.Fit(fit)
		
		pText = TPaveText(0.7,0.8,0.9,0.9,'NDC')
		pText.AddText('Mean: %.2f ns' % (fit.GetParameter(1)))
		pText.AddText('#sigma: %.2f ns' % (fit.GetParameter(2)))
		pText.SetBorderSize(1)
		pText.SetFillColor(0)
		pText.Draw()
		
		c3.Update()
		self.storeCanvas(c3,"hoTime")
		
		return c3,label,hHoTimeAboveThr,pText
コード例 #28
0
ファイル: PtResolution.py プロジェクト: Kuenni/HoMuonTrigger
	def makeQuantilePlot(self,dataSet):
		c = TCanvas(dataSet + 'quantiles')

		graphMean = getTGraphErrors(self.cached_data['x']['values'],
								self.cached_data[dataSet]['mean'],
								ey = self.cached_data[dataSet]['meanError'],
								ex=self.cached_data['x']['errors'])
		setupAxes(graphMean)
		graphMean.SetMarkerStyle(20)
		graphMean.SetMarkerColor(colorRwthDarkBlue)
		graphMean.SetLineColor(colorRwthDarkBlue)
		
		graphMedian = getTGraphErrors(self.cached_data['x']['values'],
								self.cached_data[dataSet]['median'])
		graphMedian.SetMarkerStyle(21)
		graphMedian.SetMarkerColor(colorRwthMagenta)
		graphMedian.SetLineColor(colorRwthMagenta)
		graphMedian.SetFillColor(colorRwthMagenta)
		
		graphQ50 = getTGraphErrors(self.cached_data['x']['values'],
								self.cached_data[dataSet]['q50'])
		graphQ50.SetMarkerStyle(22)
		graphQ50.SetMarkerColor(colorRwthLila)
		graphQ50.SetLineColor(colorRwthLila)
		
		graphShape68 = TGraph()
		graphShape68.SetName(dataSet)
		graphShape68.SetFillStyle(1001)
		graphShape68.SetFillColorAlpha(colorRwthGruen,.75)
		graphShape68.SetLineColorAlpha(colorRwthGruen,.75)

		for i in zip(self.cached_data['x']['values'],self.cached_data[dataSet]['q16']):
			graphShape68.SetPoint(graphShape68.GetN(),i[0],i[1])
		
		for i in zip(reversed(self.cached_data['x']['values']),reversed(self.cached_data[dataSet]['q84'])):
			graphShape68.SetPoint(graphShape68.GetN(),i[0],i[1])
		
		graphShape68.GetYaxis().SetRangeUser(0,200)
		graphShape68.SetTitle(";p_{T,Reco} / GeV;p_{T,L1} / GeV")#"Mean, Median, and Quantiles of " + dataSet + " p_{T};p_{T,Reco} / GeV;p_{T,L1} / GeV")
		setupAxes(graphShape68)

		graphShape68.Draw('a f')
		graphMean.Draw('same p')
		graphMedian.Draw('same,l')
		graphQ50.Draw('same,l')

		
		legend = getLegend(y1=.75,y2 = .95,x1=.1,x2=.5)
		legend.AddEntry(graphMean,dataSet + ' p_{T} Mean','ep')
		legend.AddEntry(graphMedian,dataSet + ' p_{T} Median','l')
		legend.AddEntry(graphShape68,dataSet + ' p_{T} Q_{25} - Q_{75}','f')
		legend.AddEntry(graphQ50,dataSet + ' p_{T} Q_{50}','l')
		legend.Draw()
				
		c.Update()
		self.storeCanvas(c,'quantiles_' + self.truthTag + '_' + dataSet.replace(' ','_').replace('!','Not'), marginRight = .02)
		return c,graphMean,legend,graphMedian,graphShape68,graphQ50
コード例 #29
0
ファイル: HoTimeVsEta.py プロジェクト: Kuenni/HoMuonTrigger
	def plotFractionsVsEta(self,graph,title,saveName):
		c2 = TCanvas(saveName + '_EtaFractions',"saveName",0,600,800,600)
		c2.cd().SetLeftMargin(.15)
		graph.SetTitle(';i#eta;rel. Fraction in [-12.5,12.5]ns')
		graph.Draw('ap')
		c2.Update()
		setupAxes(graph)
		self.storeCanvas(c2,saveName,marginLeft=.15,marginRight=.02)
		return c2,graph
コード例 #30
0
 def plotFractionsVsEta(self, graph, title, saveName):
     c2 = TCanvas(saveName + '_EtaFractions')
     graph.SetTitle(title + ';i#eta;rel. Fraction in [-12.5,12.5]ns')
     graph.Draw('ap')
     c2.Update()
     setupAxes(graph)
     label = self.drawLabel()
     self.storeCanvas(c2, saveName)
     return c2, graph, label
コード例 #31
0
    def compareL1Count(self):
        hSim = self.fileHandlerSimulation.getHistogram('L1MuonPresent_Pt')
        hSimPu = self.fileHandlerSimulationPu.getHistogram('L1MuonPresent_Pt')
        hData = self.fileHandler.getHistogram('L1MuonPresent_Pt')

        #	hSimPu.Sumw2()
        #	hSim.Sumw2()

        hSim.Scale(1 / hSim.Integral(), 'width')
        hSimPu.Scale(1 / hSimPu.Integral(), 'width')
        hData.Scale(1 / hData.Integral(), 'width')

        c = TCanvas('cNvsPt', 'Nvs pt')
        c.cd().SetLeftMargin(0.17)

        hSim.SetMarkerStyle(20)
        hSim.SetMarkerColor(colorRwthLila)
        hSim.SetLineColor(colorRwthLila)
        hSim.GetYaxis().SetRangeUser(0, 0.03)

        hSimPu.SetMarkerStyle(21)
        hSimPu.SetMarkerColor(colorRwthOrange)
        hSimPu.SetLineColor(colorRwthOrange)
        hSimPu.SetTitle(
            'Normalized distribution of p_{T};p_{T,L1};normalized fraction / binwidth'
        )
        hSimPu.SetStats(0)
        hSimPu.GetXaxis().SetRangeUser(0, 20)
        hSimPu.GetYaxis().SetTitle("Normalized fraction / #frac{1}{GeV}")
        hSimPu.Draw('lp')
        hSim.Draw('same,lp')
        setupAxes(hSimPu)

        hSimPu.GetYaxis().SetTitleOffset(1.35)

        hData.SetMarkerStyle(22)
        hData.SetMarkerColor(colorRwthTuerkis)
        #		hData.Draw('same,p')

        legend = getLegend(y1=0.65, y2=.9)
        legend.AddEntry(hSim, 'Sim', 'lp')
        legend.AddEntry(hSimPu, 'Sim, PU52', 'lp')
        #		legend.AddEntry(hData,'Data','ep')
        legend.Draw()

        label = self.drawLabel()

        c.Update()
        self.storeCanvas(c,
                         'l1CountComparison/l1CountNormalized',
                         markPosition={
                             'x1ndc': 0.16,
                             'y1ndc': 0.898,
                             'x2ndc': 0.319,
                             'y2ndc': 0.940
                         })
        return hSim, c, hSimPu, hData, legend, label
コード例 #32
0
ファイル: EvsEtaPhi.py プロジェクト: Kuenni/HoMuonTrigger
	def plotEtaPhiForTightL1(self):
		canvas = TCanvas("cEtaPhi","Eta Phi",1200,900)
		graphAll = self.fileHandler.getGraph('graphs/patTightToL1Muons')
		graphWithHo = self.fileHandler.getGraph('graphs/patTightToL1Muons3x3')
				
		halfPhiBinwidth = L1_PHI_BIN/2.
		l1BinOffset = L1_PHI_BIN*3/4.
		
		histAll = TH2D('hEtaPhiAll',"",30,-15*L1_ETA_BIN	,15*L1_ETA_BIN,
					144, -math.pi,math.pi)
		histWithHo = TH2D('hEtaPhiWithHO',"",30,-15*L1_ETA_BIN,15*L1_ETA_BIN,
					144, -math.pi,math.pi)
		
		x = Double(0)
		y = Double(0)
		
		for i in range(0,graphAll.GetN()):
			graphAll.GetPoint(i,x,y)
			histAll.Fill(x,y)
			
		for i in range(0,graphWithHo.GetN()):
			graphWithHo.GetPoint(i,x,y)
			histWithHo.Fill(x,y)
		
		canvas.cd().SetRightMargin(.15)
		histAll.SetStats(0)
		histAll.GetXaxis().SetRangeUser(-1,1)
		histAll.SetTitle(histAll.GetTitle() + ';#eta_{L1};#phi_{L1};Entries')
		histAll.Draw('colz')
		canvas.Update()
		setupAxes(histAll)
		setupPalette(histAll,x2ndc=.87)
		#label1 = self.drawLabel(x1ndc=.55,x2ndc=.85)
		histAll.GetZaxis().SetTitleOffset(1.)
		histAll.GetZaxis().SetRangeUser(0,1250)
		canvas.Update()
		
		canvas2 = TCanvas("cEtaPhiAndHo","Eta Phi And HO",1200,900)
		
		canvas2.cd().SetRightMargin(.15)
		histWithHo.SetStats(0)
		histWithHo.GetXaxis().SetRangeUser(-1,1)
		histWithHo.SetTitle(histWithHo.GetTitle() + ';#eta_{L1};#phi_{L1};Entries')
		histWithHo.Draw('colz')
		#label2 = self.drawLabel(x1ndc=.55,x2ndc=.85)
		histWithHo.GetZaxis().SetRangeUser(0,1250)
		
		canvas2.Update()
		setupAxes(histWithHo)
		setupPalette(histWithHo,x2ndc=.87)
		histWithHo.GetZaxis().SetTitleOffset(1.)
		
		canvas2.Update()
		
		self.storeCanvas(canvas, 'etaPhiForTightL1',marginRight=.15)
		self.storeCanvas(canvas2, 'etaPhiForTightL1AndHo',marginRight=.15)
		return canvas,histAll,histWithHo,canvas2
コード例 #33
0
ファイル: Timing.py プロジェクト: Kuenni/HoMuonTrigger
	def plotHoTimeLog(self):
		c3 = TCanvas("c3Log","HO Time Log",1200,1200)
		skipNoisePlot = True
		if not skipNoisePlot:
			c3.Divide(1,2)
			c3.cd(1).SetLogy()
			label = getLabelCmsPrivateSimulation()
			label.Draw()
			hHoTime = self.fileHandler.getHistogram('hoRecHits_Time')
			
			hHoTime.SetStats(0)
			hHoTime.SetTitle()
			hHoTime.SetLineColor(colorRwthDarkBlue)
			hHoTime.SetLineWidth(3)
			hHoTime.Draw()
			label = getLabelCmsPrivateSimulation()
			label.Draw()
			
		hHoTimeAboveThr = self.fileHandler.getHistogram('hoRecHitsAboveThr_Time')
		c3.cd(2).SetLogy()
		hHoTimeAboveThr.SetStats(0)
		hHoTimeAboveThr.SetTitle('')
		hHoTimeAboveThr.SetLineColor(colorRwthDarkBlue)
		hHoTimeAboveThr.SetLineWidth(3)
		hHoTimeAboveThr.GetXaxis().SetRangeUser(-50,50)
		setupAxes(hHoTimeAboveThr)
		hHoTimeAboveThr.Draw()
	
		fit = TF1("fit","gaus",-10,10)
		fit.SetParameter(1,0)
		fit.SetParameter(2,1)
		fit.SetLineWidth(3)
		hHoTimeAboveThr.Fit(fit,'','R',-12.5,7)
		
		self.debug(80*'#')
		self.debug('Chi^2: %5.2f' % fit.GetChisquare())
		self.debug('NDF: %d' % fit.GetNDF())
		self.debug(80*'#')
		
		legend = getLegend(x1=.1, y1=.85, x2=.415, y2=.95)
		legend.AddEntry(hHoTimeAboveThr,'HO (E_{Rec} > 0.2 GeV)','l')
		legend.AddEntry(fit,'Fit','l')
		legend.Draw()
		
		pText = TPaveText(0.78,0.85,0.97,0.95,'NDC')
		pText.AddText('Mean: %.2f ns' % (fit.GetParameter(1)))
		pText.AddText('#sigma: %.2f ns' % (fit.GetParameter(2)))
		pText.SetBorderSize(1)
		pText.SetFillColor(0)
		pText.Draw()
		
		c3.Update()
		self.storeCanvas(c3,"hoTimeLog",marginRight=.03)
		
		return c3,pText,hHoTimeAboveThr,legend
コード例 #34
0
ファイル: PtResolution.py プロジェクト: ashrafkasem/MCHAMMER
    def makeIntegralPlot(self, datasetName):
        cControlPlot = TCanvas('cControlPlots', 'control plot integral')
        xData = [
            self.cached_data['x']['values'], self.cached_data['x']['errors']
        ]
        dataAllL1, errorAllL1 = self.getHistogramIntegralsAsList(
            'l1PtResolution/' + datasetName)
        dataMatch, errorMatch = self.getHistogramIntegralsAsList(
            'l1PtResolution/' + datasetName + "HoMatch")
        dataNoMatch, errorNoMatch = self.getHistogramIntegralsAsList(
            'l1PtResolution/' + datasetName + "NotHoMatch")

        graphIntegralsAllL1 = getTGraphErrors(xData[0],
                                              dataAllL1,
                                              ex=xData[1],
                                              ey=errorAllL1)
        graphIntegralsMatch = getTGraphErrors(xData[0],
                                              dataMatch,
                                              ex=xData[1],
                                              ey=errorMatch)
        graphIntegralsNoMatch = getTGraphErrors(xData[0],
                                                dataNoMatch,
                                                ex=xData[1],
                                                ey=errorNoMatch)

        graphIntegralsAllL1.SetMarkerStyle(21)
        graphIntegralsAllL1.SetTitle('Integrals of ' + datasetName +
                                     ';p_{T} / GeV;# entries')
        graphIntegralsAllL1.SetMarkerColor(colorRwthDarkBlue)
        graphIntegralsAllL1.SetLineColor(colorRwthDarkBlue)

        graphIntegralsMatch.SetMarkerStyle(20)
        graphIntegralsMatch.SetMarkerColor(colorRwthMagenta)
        graphIntegralsMatch.SetLineColor(colorRwthMagenta)

        graphIntegralsNoMatch.SetMarkerStyle(34)
        graphIntegralsNoMatch.SetMarkerColor(colorRwthTuerkis)
        graphIntegralsNoMatch.SetLineColor(colorRwthTuerkis)

        graphIntegralsAllL1.Draw('ap')
        graphIntegralsMatch.Draw('samep')
        graphIntegralsNoMatch.Draw('samep')

        label = self.drawLabel()

        setupAxes(graphIntegralsAllL1)
        legend2 = getLegend(y2=.9)
        legend2.AddEntry(graphIntegralsAllL1, datasetName, 'ep')
        legend2.AddEntry(graphIntegralsMatch, datasetName + " And HO", 'ep')
        legend2.AddEntry(graphIntegralsNoMatch, datasetName + " !HO", 'ep')
        legend2.Draw()
        cControlPlot.Update()

        self.storeCanvas(cControlPlot, 'rmsVsPt_integrals' + datasetName)
        return label, legend2, graphIntegralsMatch, graphIntegralsNoMatch, cControlPlot, graphIntegralsAllL1
コード例 #35
0
    def plotEtaPhiForAllL1(self):
        canvas = TCanvas("cEtaPhi", "Eta Phi", 1200, 1200)
        canvas.Divide(2, 1)
        graphAll = self.fileHandler.getGraph('graphs/L1MuonPresent')
        graphWithHo = self.fileHandler.getGraph('graphs/L1Muon3x3')

        halfPhiBinwidth = L1_PHI_BIN / 2.
        halfEtaBinwidth = L1_ETA_BIN / 2.

        histAll = TH2D('hEtaPhiAll', "#eta#phi for all L1", 30,
                       -15 * L1_ETA_BIN, 15 * L1_ETA_BIN, 289,
                       -math.pi - halfPhiBinwidth, math.pi + halfPhiBinwidth)
        histWithHo = TH2D('hEtaPhiWithHO', "#eta#phi L1 + HO (3x3)", 30,
                          -15 * L1_ETA_BIN, 15 * L1_ETA_BIN, 289,
                          -math.pi - halfPhiBinwidth,
                          math.pi + halfPhiBinwidth)

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

        for i in range(0, graphAll.GetN()):
            graphAll.GetPoint(i, x, y)
            histAll.Fill(x, y)

        for i in range(0, graphWithHo.GetN()):
            graphWithHo.GetPoint(i, x, y)
            histWithHo.Fill(x, y)

        canvas.cd(1)
        histAll.SetStats(0)
        histAll.GetXaxis().SetRangeUser(-1, 1)
        histAll.SetTitle(histAll.GetTitle() + ';#eta;#phi;Entries')
        setupAxes(histAll)
        histAll.Draw('colz')
        label1 = self.drawLabel()
        canvas.Update()

        setupPalette(histAll)

        canvas.cd(2)
        histWithHo.SetStats(0)
        histWithHo.GetXaxis().SetRangeUser(-1, 1)
        histWithHo.SetTitle(histWithHo.GetTitle() + ';#eta;#phi;Entries')
        setupAxes(histWithHo)
        histWithHo.Draw('colz')
        label2 = self.drawLabel()

        canvas.Update()
        setupPalette(histWithHo)

        canvas.Update()

        canvas.SaveAs('plots/etaPhiForAllL1.pdf')

        return canvas, histAll, histWithHo, label1, label2
コード例 #36
0
ファイル: DeltaPhi.py プロジェクト: Kuenni/HoMuonTrigger
	def plotEtaPhiForAllL1(self):
		canvas = TCanvas("cEtaPhi","Eta Phi",1200,1200)
		canvas.Divide(2,1)
		graphAll = self.fileHandler.getGraph('graphs/L1MuonPresent')
		graphWithHo = self.fileHandler.getGraph('graphs/L1Muon3x3')
				
		halfPhiBinwidth = L1_PHI_BIN/2.
		halfEtaBinwidth = L1_ETA_BIN/2.
		
		histAll = TH2D('hEtaPhiAll',"#eta#phi for all L1",30,-15*L1_ETA_BIN	,15*L1_ETA_BIN,
					289, -math.pi - halfPhiBinwidth,math.pi + halfPhiBinwidth)
		histWithHo = TH2D('hEtaPhiWithHO',"#eta#phi L1 + HO (3x3)",30,-15*L1_ETA_BIN,15*L1_ETA_BIN,
					289, -math.pi - halfPhiBinwidth,math.pi + halfPhiBinwidth)
		
		x = Double(0)
		y = Double(0)
		
		for i in range(0,graphAll.GetN()):
			graphAll.GetPoint(i,x,y)
			histAll.Fill(x,y)
			
		for i in range(0,graphWithHo.GetN()):
			graphWithHo.GetPoint(i,x,y)
			histWithHo.Fill(x,y)
		
		canvas.cd(1)
		histAll.SetStats(0)
		histAll.GetXaxis().SetRangeUser(-1,1)
		histAll.SetTitle(histAll.GetTitle() + ';#eta;#phi;Entries')
		setupAxes(histAll)
		histAll.Draw('colz')
		label1 = self.drawLabel()
		canvas.Update()
		
		setupPalette(histAll)
		
		canvas.cd(2)
		histWithHo.SetStats(0)
		histWithHo.GetXaxis().SetRangeUser(-1,1)
		histWithHo.SetTitle(histWithHo.GetTitle() + ';#eta;#phi;Entries')
		setupAxes(histWithHo)
		histWithHo.Draw('colz')
		label2 = self.drawLabel()
		
		canvas.Update()
		setupPalette(histWithHo)
		
		canvas.Update()
		
		canvas.SaveAs('plots/etaPhiForAllL1.pdf')
		
		return canvas,histAll,histWithHo,label1,label2
	
		
コード例 #37
0
ファイル: ControlPlots.py プロジェクト: Kuenni/HoMuonTrigger
	def plotL1PresentMultiplicity(self):
		canvas = TCanvas('cL1Multiplicity')
		hist = self.fileHandler.getHistogram('multiplicity/L1MuonPresent_Multiplicity')
		hist.GetXaxis().SetRangeUser(0,20)
		canvas.SetLogy()
		hist.SetLineWidth(3)
		hist.SetLineColor(colorRwthDarkBlue)
		setupAxes(hist)
		hist.SetTitle('L1Muon Multiplicity;# L1 Objects per event;#')
		hist.Draw()
		return hist,canvas
コード例 #38
0
ファイル: DeltaPhi.py プロジェクト: Kuenni/HoMuonTrigger
	def plotHoPhiVsHoIPhi(self):
		canvas = TCanvas('cHoPhiVsHoIPhi','HoPhiVsHoIPhi',1200,1200)
		graph = self.fileHandler.getGraph('correlation/hoPhiVsHoIPhi')
		graph.SetTitle('HO #phi vs. HO i#phi;HO i#phi;HO #phi')
		graph.SetMarkerStyle(2)
		setupAxes(graph)
		graph.Draw('AP')
		
		canvas.Update()
		
		return canvas,graph
コード例 #39
0
ファイル: ControlPlots.py プロジェクト: Kuenni/HoMuonTrigger
	def makeNHitsPlot(self,source):
		canvas = TCanvas('cNHoHitsPerL1' + source,'cNHoHitsPerL1' + source)
		hist = self.fileHandler.getHistogram('multiplicity/' + source + '_Multiplicity')
		hist.GetXaxis().SetRangeUser(0,50)
		canvas.SetLogy()
		hist.SetLineWidth(3)
		hist.SetLineColor(colorRwthDarkBlue)
		setupAxes(hist)
		hist.SetTitle(source + 'HORecHits per L1;# possible Hits per L1Muon;#')
		hist.Draw()
		return hist,canvas
コード例 #40
0
    def plotHoPhiVsHoIPhi(self):
        canvas = TCanvas('cHoPhiVsHoIPhi', 'HoPhiVsHoIPhi', 1200, 1200)
        graph = self.fileHandler.getGraph('correlation/hoPhiVsHoIPhi')
        graph.SetTitle('HO #phi vs. HO i#phi;HO i#phi;HO #phi')
        graph.SetMarkerStyle(2)
        setupAxes(graph)
        graph.Draw('AP')

        canvas.Update()

        return canvas, graph
コード例 #41
0
ファイル: ControlPlots.py プロジェクト: ashrafkasem/MCHAMMER
 def makeNHitsPlot(self, source):
     canvas = TCanvas('cNHoHitsPerL1' + source, 'cNHoHitsPerL1' + source)
     hist = self.fileHandler.getHistogram('multiplicity/' + source +
                                          '_Multiplicity')
     hist.GetXaxis().SetRangeUser(0, 50)
     canvas.SetLogy()
     hist.SetLineWidth(3)
     hist.SetLineColor(colorRwthDarkBlue)
     setupAxes(hist)
     hist.SetTitle(source + 'HORecHits per L1;# possible Hits per L1Muon;#')
     hist.Draw()
     return hist, canvas
コード例 #42
0
ファイル: EvsEtaPhi.py プロジェクト: ashrafkasem/MCHAMMER
	def plotEtaPhiForTightL1(self):
		canvas = TCanvas("cEtaPhi","Eta Phi",1200,1200)
		canvas.Divide(2,1)
		graphAll = self.fileHandler.getGraph('graphs/patTightToL1Muons')
		graphWithHo = self.fileHandler.getGraph('graphs/patTightToL1Muons3x3')
				
		halfPhiBinwidth = L1_PHI_BIN/2.
		l1BinOffset = L1_PHI_BIN*3/4.
		
		histAll = TH2D('hEtaPhiAll',"#eta#phi for tight L1",30,-15*L1_ETA_BIN	,15*L1_ETA_BIN,
					144, -math.pi,math.pi)
		histWithHo = TH2D('hEtaPhiWithHO',"#eta#phi tight L1 + HO (3x3)",30,-15*L1_ETA_BIN,15*L1_ETA_BIN,
					144, -math.pi,math.pi)
		
		x = Double(0)
		y = Double(0)
		
		for i in range(0,graphAll.GetN()):
			graphAll.GetPoint(i,x,y)
			histAll.Fill(x,y)
			
		for i in range(0,graphWithHo.GetN()):
			graphWithHo.GetPoint(i,x,y)
			histWithHo.Fill(x,y)
		
		canvas.cd(1)
		histAll.SetStats(0)
		histAll.GetXaxis().SetRangeUser(-1,1)
		histAll.SetTitle(histAll.GetTitle() + ';#eta_{L1};#phi_{L1};Entries')
		histAll.Draw('colz')
		canvas.Update()
		setupAxes(histAll)
		setupPalette(histAll)
		label1 = self.drawLabel()
		canvas.Update()
		
		
		
		canvas.cd(2)
		histWithHo.SetStats(0)
		histWithHo.GetXaxis().SetRangeUser(-1,1)
		histWithHo.SetTitle(histWithHo.GetTitle() + ';#eta_{L1};#phi_{L1};Entries')
		histWithHo.Draw('colz')
		label2 = self.drawLabel()
		
		canvas.Update()
		setupAxes(histWithHo)
		setupPalette(histWithHo)
		
		canvas.Update()
		
		self.storeCanvas(canvas, 'etaPhiForTightL1')
		return canvas,histAll,histWithHo,label1,label2
コード例 #43
0
ファイル: ControlPlots.py プロジェクト: Kuenni/HoMuonTrigger
	def getIEtaIPhiPlot(self,key):
	#	canvas = TCanvas('cHoIEtaIPhi' + key,'HO iEta iPhi',0,50,600,500)
		hoEtaPhi = self.fileHandler.getHistogram('etaPhi/' + key + '_iEtaIPhi')
		hoEtaPhi.SetTitle('HO RecHits > 0.2GeV;i#eta;i#phi;# entries')
		hoEtaPhi.Draw('colz')
	#	canvas.Update()
		hoEtaPhi.SetStats(0)
		setupAxes(hoEtaPhi)
	#	setupPalette(hoEtaPhi)
	#	label = self.drawLabel()
	#	canvas.Update()
		return hoEtaPhi#,label,canvas
コード例 #44
0
ファイル: ControlPlots.py プロジェクト: ashrafkasem/MCHAMMER
 def getIEtaIPhiPlot(self, key):
     #	canvas = TCanvas('cHoIEtaIPhi' + key,'HO iEta iPhi',0,50,600,500)
     hoEtaPhi = self.fileHandler.getHistogram('etaPhi/' + key + '_iEtaIPhi')
     hoEtaPhi.SetTitle('HO RecHits > 0.2GeV;i#eta;i#phi;# entries')
     hoEtaPhi.Draw('colz')
     #	canvas.Update()
     hoEtaPhi.SetStats(0)
     setupAxes(hoEtaPhi)
     #	setupPalette(hoEtaPhi)
     #	label = self.drawLabel()
     #	canvas.Update()
     return hoEtaPhi  #,label,canvas
コード例 #45
0
ファイル: ControlPlots.py プロジェクト: ashrafkasem/MCHAMMER
 def plotL1PresentMultiplicity(self):
     canvas = TCanvas('cL1Multiplicity')
     hist = self.fileHandler.getHistogram(
         'multiplicity/L1MuonPresent_Multiplicity')
     hist.GetXaxis().SetRangeUser(0, 20)
     canvas.SetLogy()
     hist.SetLineWidth(3)
     hist.SetLineColor(colorRwthDarkBlue)
     setupAxes(hist)
     hist.SetTitle('L1Muon Multiplicity;# L1 Objects per event;#')
     hist.Draw()
     return hist, canvas
コード例 #46
0
ファイル: ControlPlots.py プロジェクト: ashrafkasem/MCHAMMER
 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
コード例 #47
0
ファイル: ControlPlots.py プロジェクト: Kuenni/HoMuonTrigger
	def plotHoIEtaIPhiMatchedToL1(self):
		canvas = TCanvas('cHoIEtaIPhiAndL1','HO iEta iPhi And L1',650,50,600,500)
		hoEtaPhi = self.fileHandler.getHistogram('etaPhi/L1Muon3x3_iEtaIPhi')
		hoEtaPhi.SetTitle('L1 matched to HO RecHits > 0.2GeV;i#eta;i#phi;# entries')
		hoEtaPhi.Draw('colz')
		canvas.Update()
		hoEtaPhi.SetStats(0)
		setupAxes(hoEtaPhi)
		setupPalette(hoEtaPhi)
		label = self.drawLabel()
		canvas.Update()
		self.storeCanvas(canvas,"l1MatchedToHoIEtaIPhi")
		return label,canvas,hoEtaPhi
コード例 #48
0
ファイル: ControlPlots.py プロジェクト: Kuenni/HoMuonTrigger
	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
コード例 #49
0
	def plotHoIEtaIPhi(self):
		canvas = TCanvas('cHoIEtaIPhi','HO iEta iPhi',0,50,600,500)
		hoEtaPhi = self.fileHandler.getHistogram('hoMuonAnalyzer/etaPhi/hoRecHitsAboveThr_iEtaIPhi')
		hoEtaPhi.SetTitle('HO RecHits > 0.2GeV;i#eta;i#phi;# entries')
		hoEtaPhi.Draw('colz')
		canvas.Update()
		hoEtaPhi.SetStats(0)
		setupAxes(hoEtaPhi)
		setupPalette(hoEtaPhi)
		label = self.drawLabel()
		canvas.Update()
		self.storeCanvas(canvas,"hoEtaPhi")
		return label,canvas,hoEtaPhi
コード例 #50
0
	def plotHoTimeLog(self):
		c3 = TCanvas("c3Log","HO Time Log",1200,1200)
		skipNoisePlot = True
		if not skipNoisePlot:
			c3.Divide(1,2)
			c3.cd(1).SetLogy()
			label = getLabelCmsPrivateSimulation()
			label.Draw()
			hHoTime = self.fileHandler.getHistogram('hoRecHits_Time')
			
			hHoTime.SetStats(0)
			hHoTime.SetTitle("Time distribution for all HO Rec Hits")
			hHoTime.SetLineColor(colorRwthDarkBlue)
			hHoTime.SetLineWidth(3)
			hHoTime.Draw()
			label = getLabelCmsPrivateSimulation()
			label.Draw()
			
		hHoTimeAboveThr = self.fileHandler.getHistogram('hoRecHitsAboveThr_Time')
		c3.cd(2).SetLogy()
		hHoTimeAboveThr.SetStats(0)
		hHoTimeAboveThr.SetTitle("Time distribution for HO Rec Hits > 0.2 GeV")
		hHoTimeAboveThr.SetLineColor(colorRwthDarkBlue)
		hHoTimeAboveThr.SetLineWidth(3)
		setupAxes(hHoTimeAboveThr)
		hHoTimeAboveThr.Draw()
		
		label = getLabelCmsPrivateSimulation()
		label.Draw()
	
		fit = TF1("fit","gaus",-10,10)
		fit.SetParameter(1,0)
		fit.SetParameter(2,1)
		hHoTimeAboveThr.Fit(fit,'','R',-12.5,12.5)
		
		self.debug(80*'#')
		self.debug('Chi^2: %5.2f' % fit.GetChisquare())
		self.debug('NDF: %d' % fit.GetNDF())
		self.debug(80*'#')
		
		pText = TPaveText(0.7,0.8,0.9,0.9,'NDC')
		pText.AddText('Mean: %.2f ns' % (fit.GetParameter(1)))
		pText.AddText('#sigma: %.2f ns' % (fit.GetParameter(2)))
		pText.SetBorderSize(1)
		pText.SetFillColor(0)
		pText.Draw()
		
		c3.Update()
		self.storeCanvas(c3,"hoTimeLog")
		
		return c3,pText,hHoTimeAboveThr
コード例 #51
0
ファイル: EvsEtaPhi.py プロジェクト: dkgithub/HoMuonTrigger
	def plotEtaPhiForTightL1(self):
		canvas = TCanvas("cEtaPhi","Eta Phi",1200,1200)
		canvas.Divide(2,1)
		graphAll = self.fileHandler.getGraph('hoMuonAnalyzer/graphs/L1TightMuons')
		graphWithHo = self.fileHandler.getGraph('hoMuonAnalyzer/graphs/L1TightMuons3x3')
				
		halfPhiBinwidth = L1_PHI_BIN/2.
		l1BinOffset = L1_PHI_BIN*3/4.
		
		histAll = TH2D('hEtaPhiAll',"#eta#phi for tight L1",30,-15*L1_ETA_BIN	,15*L1_ETA_BIN,
					144, -math.pi,math.pi)
		histWithHo = TH2D('hEtaPhiWithHO',"#eta#phi tight L1 + HO (3x3)",30,-15*L1_ETA_BIN,15*L1_ETA_BIN,
					144, -math.pi,math.pi)
		
		x = Double(0)
		y = Double(0)
		
		for i in range(0,graphAll.GetN()):
			graphAll.GetPoint(i,x,y)
			histAll.Fill(x,y)
			
		for i in range(0,graphWithHo.GetN()):
			graphWithHo.GetPoint(i,x,y)
			histWithHo.Fill(x,y)
		
		canvas.cd(1)
		histAll.SetStats(0)
		histAll.GetXaxis().SetRangeUser(-1,1)
		histAll.SetTitle(histAll.GetTitle() + ';#eta_{L1};#phi_{L1};Entries')
		setupAxes(histAll)
		histAll.Draw('colz')
		label1 = self.drawLabel()
		canvas.Update()
		
		setupPalette(histAll)
		
		canvas.cd(2)
		histWithHo.SetStats(0)
		histWithHo.GetXaxis().SetRangeUser(-1,1)
		histWithHo.SetTitle(histWithHo.GetTitle() + ';#eta_{L1};#phi_{L1};Entries')
		setupAxes(histWithHo)
		histWithHo.Draw('colz')
		label2 = self.drawLabel()
		
		canvas.Update()
		setupPalette(histWithHo)
		
		canvas.Update()
		
		self.storeCanvas(canvas, 'etaPhiForTightL1')
		return canvas,histAll,histWithHo,label1,label2
コード例 #52
0
ファイル: Timing.py プロジェクト: saxenapooja/HoMuonTrigger
	def plotHoTimeLog(self):
		c3 = TCanvas("c3Log","HO Time Log",1200,1200)
		skipNoisePlot = True
		if not skipNoisePlot:
			c3.Divide(1,2)
			c3.cd(1).SetLogy()
			label = getLabelCmsPrivateSimulation()
			label.Draw()
			hHoTime = self.fileHandler.getHistogram('hoMuonAnalyzer/hoRecHits_Time')
			
			hHoTime.SetStats(0)
			hHoTime.SetTitle("Time distribution for all HO Rec Hits")
			hHoTime.SetLineColor(colorRwthDarkBlue)
			hHoTime.SetLineWidth(3)
			hHoTime.Draw()
			label = getLabelCmsPrivateSimulation()
			label.Draw()
			
		hHoTimeAboveThr = self.fileHandler.getHistogram('hoMuonAnalyzer/hoRecHitsAboveThr_Time')
		c3.cd(2).SetLogy()
		hHoTimeAboveThr.SetStats(0)
		hHoTimeAboveThr.SetTitle("Time distribution for HO Rec Hits > 0.2 GeV")
		hHoTimeAboveThr.SetLineColor(colorRwthDarkBlue)
		hHoTimeAboveThr.SetLineWidth(3)
		setupAxes(hHoTimeAboveThr)
		hHoTimeAboveThr.Draw()
		
		label = getLabelCmsPrivateSimulation()
		label.Draw()
	
		fit = TF1("fit","gaus",-10,10)
		fit.SetParameter(1,0)
		fit.SetParameter(2,1)
		hHoTimeAboveThr.Fit(fit,'','R',-12.5,12.5)
		
		self.output(80*'#')
		self.output('Chi^2: %5.2f' % fit.GetChisquare())
		self.output('NDF: %d' % fit.GetNDF())
		self.output(80*'#')
		
		pText = TPaveText(0.7,0.8,0.9,0.9,'NDC')
		pText.AddText('Mean: %.2f ns' % (fit.GetParameter(1)))
		pText.AddText('#sigma: %.2f ns' % (fit.GetParameter(2)))
		pText.SetBorderSize(1)
		pText.SetFillColor(0)
		pText.Draw()
		
		c3.Update()
		self.storeCanvas(c3,"hoTimeLog")
		
		return c3,pText,hHoTimeAboveThr
コード例 #53
0
ファイル: DeltaPhi.py プロジェクト: Kuenni/HoMuonTrigger
	def plotDeltaPhiVsGenPt(self):
		canvas = TCanvas('cDeltaPhiVsGenPt','DeltaPhiVsGenPt',1200,1200)
		hist = self.fileHandler.getHistogram('correlation/shiftCheckDeltaPhiVsGenPt')
		hist.GetYaxis().SetRangeUser(-0.6,0.6)
		hist.Draw('colz')
		canvas.Update()
		
		setupPalette(hist)
		setupAxes(hist)
		
		label = self.drawLabel()
		canvas.Update()
		
		return canvas,hist,label
コード例 #54
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
コード例 #55
0
ファイル: Counters.py プロジェクト: ashrafkasem/MCHAMMER
    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')
        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, c1, hClone
コード例 #56
0
ファイル: QualityCodes.py プロジェクト: ashrafkasem/MCHAMMER
def plotQualityCodesVsPt():
    allPlots = []

    allPlots.append(createPlotPtVsQualityCode(1))
    allPlots.append(createPlotPtVsQualityCode(2))
    allPlots.append(createPlotPtVsQualityCode(3))

    canvas = TCanvas('allQCCodes', "All QC")
    canvas.SetLogy()
    canvas.cd().SetBottomMargin(0.15)

    histAllCodes = fileHandler.getHistogram(
        'multiplicity/L1MuonAllQualityCodes_Multiplicity')
    histAllCodesTruth = fileHandler.getHistogram(
        'multiplicity/L1MuonTruthAllQualityCodes_Multiplicity')

    setupAxes(histAllCodes)

    histAllCodes.SetLineWidth(3)
    histAllCodesTruth.SetLineWidth(3)
    histAllCodes.SetLineColor(colorRwthDarkBlue)
    histAllCodes.Scale(1 / histAllCodes.Integral())
    histAllCodes.GetXaxis().SetRangeUser(0, 8)
    histAllCodes.SetStats(0)
    histAllCodes.SetTitle('L1 muon quality codes;;rel. fraction')
    #Label the bins with the meaning of the quality code
    for i in range(1, 8):
        histAllCodes.GetXaxis().SetBinLabel(histAllCodes.GetXaxis().FindBin(i),
                                            qualityCodeDict.get(i))

    histAllCodes.Draw()

    histAllCodesTruth.Scale(1 / histAllCodesTruth.Integral())
    histAllCodesTruth.SetLineColor(colorRwthMagenta)
    histAllCodesTruth.Draw('Same')

    label = drawLabelCmsPrivateSimulation()

    legend = TLegend(0.1, 0.75, 0.3, 0.9)
    legend.AddEntry(histAllCodes, "All L1", "l")
    legend.AddEntry(histAllCodesTruth, "L1 Truth", "l")
    legend.Draw()

    canvas.Update()
    canvas.SaveAs('plots/efficiency/allQualityCodes.pdf')

    allPlots.append([histAllCodes, histAllCodesTruth, canvas, legend, label])

    return allPlots
コード例 #57
0
ファイル: ControlPlots.py プロジェクト: ashrafkasem/MCHAMMER
 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)
     hist.SetStats(0)
     hist.GetXaxis().SetRangeUser(-.8, .8)
     hist.GetYaxis().SetRangeUser(-.8, .8)
     label = self.drawLabel()
     c.Update()
     self.storeCanvas(c, 'l1EtaVsPatEtaTight')
     return c, hist, label
コード例 #58
0
ファイル: ControlPlots.py プロジェクト: ashrafkasem/MCHAMMER
 def plotHoIEtaIPhiMatchedToL1(self):
     canvas = TCanvas('cHoIEtaIPhiAndL1', 'HO iEta iPhi And L1', 650, 50,
                      600, 500)
     hoEtaPhi = self.fileHandler.getHistogram('etaPhi/L1Muon3x3_iEtaIPhi')
     hoEtaPhi.SetTitle(
         'L1 matched to HO RecHits > 0.2GeV;i#eta;i#phi;# entries')
     hoEtaPhi.Draw('colz')
     canvas.Update()
     hoEtaPhi.SetStats(0)
     setupAxes(hoEtaPhi)
     setupPalette(hoEtaPhi)
     label = self.drawLabel()
     canvas.Update()
     self.storeCanvas(canvas, "l1MatchedToHoIEtaIPhi")
     return label, canvas, hoEtaPhi
コード例 #59
0
ファイル: ControlPlots.py プロジェクト: ashrafkasem/MCHAMMER
 def plotHoIEtaIPhi(self):
     canvas = TCanvas('cHoIEtaIPhi', 'HO iEta iPhi', 0, 50, 600, 500)
     canvas.SetLogz()
     hoEtaPhi = self.fileHandler.getHistogram(
         'etaPhi/hoRecHitsAboveThr_iEtaIPhi')
     hoEtaPhi.SetTitle('HO RecHits > 0.2GeV;i#eta;i#phi;# entries')
     hoEtaPhi.Draw('colz')
     canvas.Update()
     hoEtaPhi.SetStats(0)
     setupAxes(hoEtaPhi)
     setupPalette(hoEtaPhi)
     label = self.drawLabel()
     canvas.Update()
     self.storeCanvas(canvas, "hoEtaPhi")
     return label, canvas, hoEtaPhi
コード例 #60
0
    def plotDeltaPhiVsGenPt(self):
        canvas = TCanvas('cDeltaPhiVsGenPt', 'DeltaPhiVsGenPt', 1200, 1200)
        hist = self.fileHandler.getHistogram(
            'correlation/shiftCheckDeltaPhiVsGenPt')
        hist.GetYaxis().SetRangeUser(-0.6, 0.6)
        hist.Draw('colz')
        canvas.Update()

        setupPalette(hist)
        setupAxes(hist)

        label = self.drawLabel()
        canvas.Update()

        return canvas, hist, label