Ejemplo n.º 1
0
def draw(h_init, y_name, hlists, name, text):
    #Plot style
    setMarkerStyle(hlists[0], 1, 32)
    setMarkerStyle(hlists[1], 1, 22)
    setMarkerStyle(hlists[2], 3, 32)
    setMarkerStyle(hlists[3], 3, 22)
    setMarkerStyle(hlists[4], 4, 32)
    setMarkerStyle(hlists[5], 4, 22)
    setMarkerStyle(hlists[6], 6, 32)
    setMarkerStyle(hlists[7], 6, 22)

    #Set canvas
    #canv = makeCanvas(plotvar+name, False)
    #setMargins(canv, False)
    canv = ROOT.TCanvas()
    #canv.SetGrid()
    h_init.GetYaxis().SetTitle(y_name)
    h_init.Draw()
    drawSampleName(text)

    #Legend and drawing
    leg = ROOT.TLegend(0.17, 0.16, 0.61, 0.462)
    #leg = ROOT.TLegend(0.55,0.16,0.9,0.45)
    for h in hlists:
        h.Draw("e1same")
        leg.AddEntry(h, h.GetTitle(), "pl")
    hlists[0].Draw("e1same")
    leg.SetTextFont(62)
    leg.SetTextSize(0.025)
    leg.SetBorderSize(0)
    #leg.SetFillStyle(0)
    leg.Draw()

    #CMS_lumi setting
    iPos = 0
    iPeriod = 0
    if (iPos == 0): CMS_lumi.relPosX = 0.12
    CMS_lumi.extraText = "Preliminary"
    CMS_lumi.lumi_sqrtS = ""
    CMS_lumi.CMS_lumi(canv, iPeriod, iPos)

    #canv.SetLogx()
    canv.Modified()
    canv.Update()
    canv.SaveAs("eff_%s.png" % (name))
    canv.SaveAs("eff_%s.pdf" % (name))
Ejemplo n.º 2
0
def draw(h_init, y_name, hlists, name, text):
    #Plot style
    setMarkerStyle(hlists[0], 4, 20)  #blue, circle
    setMarkerStyle(hlists[1], 2, 34)  #black, cross
    setMarkerStyle(hlists[2], 3, 21)  #red, square
    #setMarkerStyle(hlists[3], 6, 24) #red, square
    #setMarkerStyle(hlists[3], 3, 31) #green, patrol

    #Set canvas
    #canv = makeCanvas(plotvar+name, False)
    #setMargins(canv, False)
    canv = ROOT.TCanvas()
    canv.SetGrid()
    h_init.GetYaxis().SetTitle(y_name)
    #h_init.GetYaxis().SetMinimum(0)
    h_init.Draw()
    drawSampleName(text)

    #Legend and drawing
    leg = ROOT.TLegend(0.25, 0.72, 0.45, 0.86)
    for h in hlists:
        h.Draw("e1same")
        leg.AddEntry(h, h.GetTitle(), "p")
    hlists[0].Draw("e1same")
    leg.SetTextFont(62)
    leg.SetTextSize(0.03)
    leg.SetBorderSize(0)
    leg.SetFillStyle(0)
    leg.Draw()

    #CMS_lumi setting
    iPos = 0
    iPeriod = 0
    if (iPos == 0): CMS_lumi.relPosX = 0.12
    CMS_lumi.extraText = "Simulation Preliminary"
    CMS_lumi.lumi_sqrtS = "14 TeV"
    CMS_lumi.CMS_lumi(canv, iPeriod, iPos)

    canv.Modified()
    canv.Update()
    canv.SaveAs("%s_%s.png" % (plotvar, name))
Ejemplo n.º 3
0
def draw(h_init, y_name, hlists, name, text):
    #Plot style
    setMarkerStyle(hlists[0], 4, 20)  #blue, circle
    setMarkerStyle(hlists[1], 1, 34)  #black, cross
    setMarkerStyle(hlists[2], 2, 21)  #red, square

    #Set canvas
    canv = makeCanvas(plotvar + name, False)
    setMargins(canv, False)
    h_init.GetYaxis().SetTitle(y_name)
    h_init.Draw()
    drawSampleName(text)

    #Legend and drawing
    legTop = ROOT.TLegend(0.6, 0.6, 0.8, 0.75)
    legBot = ROOT.TLegend(0.6, 0.2, 0.8, 0.35)
    if "Rate" in y_name: leg = legTop
    else: leg = legBot
    for h in hlists:
        h.Draw("e1same")
        leg.AddEntry(h, h.GetTitle(), "p")
    leg.SetTextFont(61)
    leg.SetTextSize(0.04)
    leg.SetBorderSize(0)
    leg.SetFillStyle(0)
    leg.Draw()

    #CMS_lumi setting
    iPos = 0
    iPeriod = 0
    if (iPos == 0): CMS_lumi.relPosX = 0.12
    CMS_lumi.extraText = "Simulation"
    CMS_lumi.lumi_sqrtS = "14 TeV"
    CMS_lumi.CMS_lumi(canv, iPeriod, iPos)

    canv.Modified()
    canv.Update()
    canv.SaveAs("%s_%s_%s.png" % (plotvar, id, name))
Ejemplo n.º 4
0
    #Set canvas
    canv = makeCanvas(name, False)
    setMargins(canv, False)
    h_init.Draw()
    drawSampleName("Z/#gamma^{*}#rightarrow#font[12]{#mu#mu}, p_{T} > 5 GeV")

    #Legend and drawing
    legTop = ROOT.TLegend(0.6, 0.7, 0.85, 0.85)
    legBot = ROOT.TLegend(0.6, 0.2, 0.85, 0.35)
    if "genMuon" in plotvar: leg = legBot
    if "recoMuon" in plotvar: leg = legTop
    for h in hlist:
        h.Draw("e1same")
        leg.AddEntry(h, h.GetTitle(), "p")
    leg.SetTextFont(61)
    leg.SetTextSize(0.04)
    leg.SetBorderSize(0)
    leg.Draw()

    #CMS_lumi setting
    iPos = 0
    iPeriod = 0
    if (iPos == 0): CMS_lumi.relPosX = 0.12
    CMS_lumi.extraText = "Simulation"
    CMS_lumi.lumi_sqrtS = "14 TeV"
    CMS_lumi.CMS_lumi(canv, iPeriod, iPos)

    canv.Modified()
    canv.Update()
    canv.SaveAs(name + ".png")