Ejemplo n.º 1
0
def produceFamilyPlot(family, surname):

    canvas = TCanvas(surname, "", 2400, 800)

    legend = TLegend(0.1, 0.5, 0.4, 0.87)
    legend.SetBorderSize(0)
    legend.SetFillStyle(0)

    counter = 0
    markers = []
    for person in family:
        if len(person) < 2:
            print "error"
            continue
        name = person[0]
        sex = person[1]

        if len(person) >= 3:
            birth = person[2]
        else:
            birth = 0

        plot = makePlot(name, sex)
        normalizePlot(plot)

        plot.SetTitle("")
        plot.GetYaxis().SetLabelSize(0)
        plot.GetXaxis().SetLabelSize(0.07)
        plot.GetYaxis().SetTickSize(0)
        plot.GetYaxis().SetTitle("normalized popularity")
        plot.GetYaxis().SetTitleSize(0.07)
        plot.GetYaxis().SetTitleOffset(0.22)

        plot.SetLineColor(colors[counter])
        legend.AddEntry(plot, name, "L")
        plot.Draw("same C")
        if birth > 0:
            marker = TMarker(birth+0.5,
                             plot.GetBinContent(plot.FindBin(birth)), 20)
            marker.SetMarkerColor(colors[counter])
            marker.SetMarkerSize(5)
            markers.append(marker)
            markers[counter].Draw("same")

        counter += 1
    legend.Draw()

    canvas.SaveAs(surname + ".pdf")
Ejemplo n.º 2
0
def draw_potential():
    markers = []
    c1 = TCanvas("c1", "Prova")
    h2 = TH2F("h2", "h2", 1000, -100, 1200, 1000, 0, 1000)

    m = re.compile("(\d+)\s(\d+)\s([\-0-9\.]+)\s([\-0-9]+)")
    file = open("mappa_piazza.dat")
    while 1:
        line = file.readline()
        if (not line):
            break
        n = m.match(line)
        if (n):
            po = TMarker(float(n.group(1)), float(n.group(2)), 6)
            po.SetMarkerColor(abs(int(n.group(4))) + 1)
            markers.append(po)

    h2.Draw()
    for i in markers:
        i.Draw("SAME")
    c1.SaveAs("potenziale_piazza.png")
    sys.exit(1)
Ejemplo n.º 3
0
def myMarkerTextSmall2(x, y, lcolor, lstyle, mcolor, mstyle, msize, size,
                       text):

    l = TLatex()
    l.SetTextAlign(12)
    l.SetTextSize(size / 2.5)
    l.SetNDC()
    l.DrawLatex(x, y, text)

    yb1 = y - 0.15 * size
    yb2 = y + 0.15 * size
    xb1 = x - 0.28 * size - 0.45 * size
    xb2 = x + 0.28 * size - 0.45 * size

    print "box  = ", xb1, yb1, xb2, yb2

    #print "line = ",xl1,yl1,xl2,yl2
    mline1 = TLine(xb1, yb1, xb2, yb2)
    mline1.SetLineColor(lcolor)
    mline1.SetLineStyle(lstyle)
    mline1.SetLineWidth(2)
    y_new = (yb1 + yb2) / 2.
    mline1.DrawLineNDC(xb1, y_new, xb2, y_new)

    mline2 = TLine(xb1, yb1, xb2, yb2)
    mline2.SetLineColor(lcolor)
    mline2.SetLineStyle(lstyle)
    mline2.SetLineWidth(2)
    x_new = (xb1 + xb2) / 2.
    mline2.DrawLineNDC(x_new, yb1, x_new, yb2)

    marker = TMarker((xb1 + xb2) / 2.0, y, mstyle)
    marker.SetNDC()
    marker.SetMarkerColor(mcolor)
    marker.SetMarkerStyle(mstyle)
    marker.SetMarkerSize(msize)
    marker.Draw()

    return marker
Ejemplo n.º 4
0
def plotFailedHoMatchesNoTrg():
	c = TCanvas("cFailedHoMatchesNoTrg","cFailedHoMatchesNoTrg",1200,1200)
	c.cd().SetRightMargin(0.25)
	c.cd().SetLeftMargin(0.08)
	
	#Graph for in events not in geometric acceptance
	grNotInGaNC = file.Get("hoMuonAnalyzer/graphs/NoTrgTdmiNotInGA")
	grNotInGa = PlotStyle.convertToHcalCoords(grNotInGaNC)
	grNotInGa.GetYaxis().SetTitle("i#phi / a.u.")
	grNotInGa.GetXaxis().SetTitle("i#eta / a.u.")
	grNotInGa.GetYaxis().SetTitleFont(62)
	grNotInGa.GetYaxis().SetLabelFont(62)
	grNotInGa.SetMarkerStyle(6)
	grNotInGa.SetMarkerColor(PlotStyle.colorRwthDarkBlue)
	grNotInGa.SetTitle("#eta #phi plot failed HO matches in no Single #mu Trg. events")
	grNotInGa.Draw("AP")
	
	#Graph of events with HO match below threshold
	grHoBelowThrNC = file.Get("hoMuonAnalyzer/graphs/NoTrgTdmiBelowThr")
	grHoBelowThr = PlotStyle.convertToHcalCoords(grHoBelowThrNC)
	grHoBelowThr.SetMarkerStyle(20)
	grHoBelowThr.SetMarkerSize(1.2)
	grHoBelowThr.SetMarkerColor( PlotStyle.colorRwthGruen )
	grHoBelowThr.Draw("samep")
	
	#Graph for events where HO matching failed
	grHoMatchFailNC = file.Get("hoMuonAnalyzer/graphs/NoTrgHoMatchFail")
	grHoMatchFail = PlotStyle.convertToHcalCoords(grHoMatchFailNC)
	grHoMatchFail.SetMarkerStyle(21)
	grHoMatchFail.SetMarkerSize(1)
	grHoMatchFail.SetMarkerColor( PlotStyle.colorRwthRot )
	grHoMatchFail.Draw("samep")
	
	#Draw chimneys
	chimney1Converted = PlotStyle.convertToHcalCoords(PlotStyle.chimney1)
	chimney2Converted = PlotStyle.convertToHcalCoords(PlotStyle.chimney2)
	chimney1Converted.SetLineColor(PlotStyle.colorRwthMagenta)
	chimney2Converted.SetLineColor(PlotStyle.colorRwthMagenta)
	chimney1Converted.Draw('same')
	chimney2Converted.Draw('same')
	
	#cms private label
	label = TPaveText(PlotStyle.getLabelCmsPrivateSimulation(x1ndc=0.5,x2ndc=0.75))
	label.Draw()
	
	#create extra marker for the legend
	marker = TMarker(1,1,2)
	marker.SetMarkerSize(3)
	marker.SetMarkerColor(PlotStyle.colorRwthDarkBlue)
	
	#legend
	legend = TLegend(0.75,0.8,0.99,0.9)
	legend.AddEntry(chimney2Converted,"chimney","l")
	legend.AddEntry(marker,'Not in GA','p')
	legend.AddEntry(grHoMatchFail,'HO match fail','p')
	legend.AddEntry(grHoBelowThr,'HO match < 0.2 GeV','p')
	legend.Draw()
	
	nNotMatching = grHoMatchFail.GetN()
	nNotInGa = grNotInGa.GetN()
	nBelowThr = grHoBelowThr.GetN()
	nTotal = nNotMatching + nNotInGa + nBelowThr
	
	print 80*'#'
	print 'Not Matching:\t%5d/%d\t=> %5.2f%% +- %f%%' % (nNotMatching,nTotal,nNotMatching/float(nTotal)*100,PlotStyle.calcSigma(nNotMatching,float(nTotal)))
	print 'Not in GA:\t%5d/%d\t=> %5.2f%% +- %f%%' % (nNotInGa,nTotal,nNotInGa/float(nTotal)*100,PlotStyle.calcSigma(nNotInGa,float(nTotal)))
	print 'Below Thr:\t%5d/%d\t=> %5.2f%% +- %f%%' % (nBelowThr,nTotal,nBelowThr/float(nTotal)*100,PlotStyle.calcSigma(nBelowThr,float(nTotal)))
	print 80*'#'
	
	c.Update()
	c.SaveAs('plots/graphsEtaPhi/gNoTrgHoMatchingFailed.png')
	c.SaveAs('plots/graphsEtaPhi/gNoTrgHoMatchingFailed.pdf')
	return c,grNotInGa,label,chimney1Converted,chimney2Converted,legend,grHoMatchFail,grHoBelowThr
Ejemplo n.º 5
0
ROCwmass.SetLineColor(2)
ROCwmass.SetLineWidth(2)
ROCwmass.SetTitle(";signal efficiency;background rejection")
c2 = TCanvas("c2")



ptlimstrs = [str(int(2000.0*ptlims[0])),str(int(2000.0*ptlims[1]))]
ROCwmass.Draw()
prelim.DrawLatex( 0.15, 0.85, ptlimstrs[0]+" GeV < p_{T} < "+ptlimstrs[1]+" GeV" )
if (cust=="w" or cust=="top") and Drawmarker:
	if cust=="w":
		prelim.DrawLatex( 0.44, 0.55, "N_{2}^{DDT}+msd" )
		TM = TMarker(0.4, 0.01, 23)
	if cust=="top":
		prelim.DrawLatex( 0.44, 0.60, "#tau_{32}+msd+subjetb" )
		TM = TMarker(0.4, 0.017, 23)
	TM.SetMarkerSize(2)
	TM.SetMarkerColor(4)
	TM.Draw()
c2.SetLogy()
c2.Write("rocwmass")
ROC.Draw()

c2.Write("roccomp")

dnnsig.Write()
dnnbkg.Write()
output.Write()
output.Close()
Ejemplo n.º 6
0
g_width.Draw('AC')
g_width.SetLineWidth(2)
g_width.SetTitle('hMSSM, m_{{A}} = {mass} GeV'.format(mass=int(mass)))

l_5percent.SetLineColor(2)
l_5percent.SetLineWidth(3)
l_10percent.SetLineColor(2)
l_10percent.SetLineWidth(3)
l_10percent.SetLineStyle(2)
l_25percent.SetLineColor(2)
l_25percent.SetLineStyle(3)
l_25percent.SetLineWidth(3)

p_5percent.SetMarkerStyle(20)
p_5percent.SetMarkerColor(2)
p_10percent.SetMarkerStyle(21)
p_10percent.SetMarkerColor(2)
p_25percent.SetMarkerStyle(22)
p_25percent.SetMarkerColor(2)

p_5percent.Draw()
l_5percent.Draw()
p_10percent.Draw()
l_10percent.Draw()
p_25percent.Draw()
l_25percent.Draw()

g_width.GetXaxis().SetTitle('1/tan(#beta)^{2}')  #  #prop coupling^{2}
g_width.GetYaxis().SetTitle('Width (GeV)')
g_width.GetYaxis().SetTitleSize(0.05)