def plotEtaPhiOfWrongBxId(self): canvasEtaPhiBxWrong = TCanvas("canvasEtaPhiBxWrong","canvasEtaPhiBxWrong",1200,1200) hWrong = self.fileHandler.getHistogram('hoMuonAnalyzer/BxWrongGen_Pt') hRight = self.fileHandler.getHistogram('hoMuonAnalyzer/BxRightGen_Pt') nRight = hRight.Integral() nWrong = hWrong.Integral() nEventsWithL1 = self.fileHandler.getHistogram('hoMuonAnalyzer/count/L1MuonPresent_Count').GetBinContent(2) etaPhiBxWrongNC = self.fileHandler.getGraph("hoMuonAnalyzer/graphs/BxWrongGen") etaPhiBxWrong = convertToHcalCoords(etaPhiBxWrongNC) etaPhiBxWrong.GetXaxis().SetTitle("i#eta / a.u.") etaPhiBxWrong.GetYaxis().SetTitle("i#phi / a.u.") etaPhiBxWrong.SetMarkerStyle(6) etaPhiBxWrong.SetMarkerColor(colorRwthDarkBlue) etaPhiBxWrong.SetTitle("#eta #phi plot of events with BX ID wrong") etaPhiBxWrong.Draw("AP") pText = TPaveText(0.7,0.85,0.9,0.9,'NDC') pText.AddText('Events with L1 objects: %d' % (nEventsWithL1)) pText.AddText('Events in Plot: %d' % (etaPhiBxWrong.GetN())) pText.SetBorderSize(1) pText.Draw() chimney1Converted = convertToHcalCoords(chimney1) chimney2Converted = convertToHcalCoords(chimney2) chimney1Converted.SetLineColor(colorRwthMagenta) chimney2Converted.SetLineColor(colorRwthMagenta) chimney1Converted.Draw("same,l") chimney2Converted.Draw("same,l") labelCmsPrivateSimulation = getLabelCmsPrivateSimulation() labelCmsPrivateSimulation.Draw() legend = TLegend(0.1,0.87,0.3,0.9) legend.AddEntry(chimney2Converted,"chimney","l") legend.Draw() canvasEtaPhiBxWrong.Update() self.storeCanvas(canvasEtaPhiBxWrong,"bxWrongEtaPhi")
def plotEtaPhiOfWrongBxId(self): canvasEtaPhiBxWrong = TCanvas("canvasEtaPhiBxWrong","canvasEtaPhiBxWrong",1200,1200) nEventsWithL1 = self.fileHandler.getHistogram('count/L1MuonPresent_Count').GetBinContent(2) etaPhiBxWrongNC = self.fileHandler.getGraph("graphs/BxWrongGen") etaPhiBxWrong = convertToHcalCoords(etaPhiBxWrongNC) etaPhiBxWrong.GetXaxis().SetTitle("i#eta / a.u.") etaPhiBxWrong.GetYaxis().SetTitle("i#phi / a.u.") etaPhiBxWrong.SetMarkerStyle(6) etaPhiBxWrong.SetMarkerColor(colorRwthDarkBlue) etaPhiBxWrong.SetTitle("#eta #phi plot of events with BX ID wrong") etaPhiBxWrong.Draw("AP") pText = TPaveText(0.7,0.85,0.9,0.9,'NDC') pText.AddText('Events with L1 objects: %d' % (nEventsWithL1)) pText.AddText('Events in Plot: %d' % (etaPhiBxWrong.GetN())) pText.SetBorderSize(1) pText.Draw() chimney1Converted = convertToHcalCoords(chimney1) chimney2Converted = convertToHcalCoords(chimney2) chimney1Converted.SetLineColor(colorRwthMagenta) chimney2Converted.SetLineColor(colorRwthMagenta) chimney1Converted.Draw("same,l") chimney2Converted.Draw("same,l") labelCmsPrivateSimulation = getLabelCmsPrivateSimulation() labelCmsPrivateSimulation.Draw() legend = TLegend(0.1,0.87,0.3,0.9) legend.AddEntry(chimney2Converted,"chimney","l") legend.Draw() canvasEtaPhiBxWrong.Update() self.storeCanvas(canvasEtaPhiBxWrong,"bxWrongEtaPhi")
def plotEtaOfWrongBxId(self): #Make eta histogram of the graph before etaPhiBxWrongNC = self.fileHandler.getGraph("graphs/BxWrongGen") etaPhiBxWrong = convertToHcalCoords(etaPhiBxWrongNC) canvasEtaBxWrong = TCanvas("canvasEtaBxWrong","canvasEtaBxWrong",1200,1200) histEtaBxWrong = TH1D("histEtaBxWrong","histEtaBxWrong;#eta Gen;# Events",20,-0.8,0.8) x = Double(0) y = Double(0) for i in range(0,etaPhiBxWrong.GetN()): etaPhiBxWrongNC.GetPoint(i,x,y) histEtaBxWrong.Fill(x) histEtaBxWrong.Draw() canvasEtaBxWrong.Update() self.storeCanvas(canvasEtaBxWrong,"bxWrongEta") # # Create a binwise normalized histogram of eta # canvasEtaBxTotal = TCanvas("canvasEtaBxTotal","canvasEtaBxtotal",1200,1200) etaPhiTotalNC = self.fileHandler.getGraph("graphs/L1ToGen") histEtaBxTotal= TH1D("histEtaBxTotal","histEtaBxTotal;#eta Gen;entries / 0.08 #eta",20,-0.8,0.8) x = Double(0) y = Double(0) for i in range(0,etaPhiTotalNC.GetN()): etaPhiTotalNC.GetPoint(i,x,y) histEtaBxTotal.Fill(x) histEtaBxTotal.Draw() self.storeCanvas(canvasEtaBxTotal,"bxEtaTotal") canvasEtaBxWrongNorm = TCanvas("canvasEtaBxWrongNorm","canvasEtaBxWrongNorm",1200,1200) histEtaBxWrongNorm = TH1D("histEtaBxWrongNorm","Fraction of L1 with BX ID Wrong;#eta Gen;fraction / 0.08 #eta (%)",20,-0.8,0.8) histEtaBxWrongNorm.SetStats(0) histEtaBxWrongNorm.SetLineColor(colorRwthDarkBlue) #fill the histogram bins for i in range(1,21): w = histEtaBxWrong.GetBinContent(i) t = histEtaBxTotal.GetBinContent(i) error = sqrt(w/float(t**2) + w**2/float(t**3))*100 print '%5d / %d = %.2f +/- %.2f' % (w,t,w/t*100,error) histEtaBxWrongNorm.SetBinContent(i,w/t*100) histEtaBxWrongNorm.SetBinError(i,error) histEtaBxWrongNorm.Draw("ehist") canvasEtaBxWrongNorm.Update() self.storeCanvas(canvasEtaBxWrongNorm,"bxWrongEtaNorm")