Exemplo n.º 1
0
def plot_dphi_bemc():

    #tracks opening angle at BEMC
    phibin = 0.01
    phimin = 2.4
    phimax = 3.1

    mmin = 1.5
    mmax = 5
    #mmin = 2.8
    #mmax = 3.2

    ptmax = 0.17

    strsel = "jRecM>{0:.3f} && jRecM<{1:.3f} && jRecPt<{2:.3f}".format(
        mmin, mmax, ptmax)

    can = ut.box_canvas()

    hDphi = ut.prepare_TH1D("hDphi", phibin, phimin, phimax)
    hDphiMC = ut.prepare_TH1D("hDphiMC", phibin, phimin, phimax)

    ut.put_yx_tit(hDphi, "Events / {0:.2f}".format(phibin),
                  "Tracks #Delta#phi at BEMC")
    ut.put_yx_tit(hDphiMC, "Events / {0:.2f}".format(phibin),
                  "Tracks #Delta#phi at BEMC")

    ut.set_margin_lbtr(gPad, 0.1, 0.08, 0.014, 0.01)

    tree.Draw("jDeltaPhiBemc >> hDphi", strsel)
    mctree.Draw("jDeltaPhiBemc >> hDphiMC", strsel)
    ut.norm_to_data(hDphiMC, hDphi, rt.kBlue)

    hDphiMC.Draw()
    hDphi.Draw("e1same")
    #hDphi.Draw()
    hDphiMC.Draw("same")

    lin = ut.cut_line(2.618, 0.5, hDphi)
    lin.Draw("same")

    leg = ut.prepare_leg(0.14, 0.71, 0.14, 0.21, 0.03)
    ut.add_leg_pt_mass(leg, ptmax, mmin, mmax)
    leg.AddEntry(hDphi, "Data")
    leg.AddEntry(hDphiMC, "MC", "l")
    leg.AddEntry(lin, "Cut at 2.618", "l")
    leg.Draw("same")

    uoleg = ut.make_uo_leg(hDphi, 0.14, 0.9, 0.01, 0.1)
    uoleg.Draw("same")

    ut.invert_col(rt.gPad)
    can.SaveAs("01fig.pdf")
Exemplo n.º 2
0
def plot_tracks_chi2():

    #tracks reduced chi2
    cbin = 0.05
    cmin = 0.
    cmax = 4.

    mmin = 2.8
    mmax = 3.2

    ptmax = 0.17

    strsel = "jRecM>{0:.3f} && jRecM<{1:.3f} && jRecPt<{2:.3f}".format(
        mmin, mmax, ptmax)

    can = ut.box_canvas()

    hChi2 = ut.prepare_TH1D("hChi2", cbin, cmin, cmax)
    hChi2MC = ut.prepare_TH1D("hChi2MC", cbin / 3., cmin, cmax)

    ut.put_yx_tit(hChi2MC, "Events / {0:.2f}".format(cbin),
                  "Tracks reduced #chi^{2}")

    ut.set_margin_lbtr(gPad, 0.1, 0.08, 0.01, 0.01)

    tree.Draw("jT0chi2 >> hChi2", strsel)
    tree.Draw("jT1chi2 >>+hChi2", strsel)
    mctree.Draw("jT0chi2 >> hChi2MC", strsel)
    mctree.Draw("jT1chi2 >>+hChi2MC", strsel)
    ut.norm_to_data(hChi2MC, hChi2, rt.kBlue)

    hChi2MC.Draw()
    hChi2.Draw("e1same")
    hChi2MC.Draw("same")

    leg = ut.prepare_leg(0.64, 0.8, 0.14, 0.16, 0.03)
    ut.add_leg_pt_mass(leg, ptmax, mmin, mmax)
    leg.AddEntry(hChi2, "Data")
    leg.AddEntry(hChi2MC, "MC", "l")
    leg.Draw("same")

    uoleg = ut.make_uo_leg(hChi2, 0.3, 0.9, 0.01, 0.1)
    uoleg.Draw("same")

    #ut.invert_col(rt.gPad)
    can.SaveAs("01fig.pdf")
Exemplo n.º 3
0
def plot_tracks_nhits():

    #tracks number of hits
    nhbin = 1
    nhmin = 10.
    nhmax = 49.

    mmin = 1.5
    mmax = 5.

    ptmax = 0.17

    strsel = "jRecM>{0:.3f} && jRecM<{1:.3f} && jRecPt<{2:.3f}".format(
        mmin, mmax, ptmax)

    can = ut.box_canvas()

    hNh = ut.prepare_TH1D("hNh", nhbin, nhmin, nhmax)
    hNhMC = ut.prepare_TH1D("hNhMC", nhbin, nhmin, nhmax)

    ut.put_yx_tit(hNhMC, "Events / ({0:.0f} hit)".format(nhbin),
                  "Tracks number of hits", 1.7)

    ut.set_margin_lbtr(gPad, 0.12, 0.08, 0.01, 0.01)

    tree.Draw("jT0nHits >> hNh", strsel)
    tree.Draw("jT1nHits >>+hNh", strsel)
    mctree.Draw("jT0nHits >> hNhMC", strsel)
    mctree.Draw("jT1nHits >>+hNhMC", strsel)
    ut.norm_to_data(hNhMC, hNh, rt.kBlue)

    hNhMC.Draw()
    hNh.Draw("e1same")
    hNhMC.Draw("same")

    leg = ut.prepare_leg(0.57, 0.8, 0.14, 0.16, 0.03)
    ut.add_leg_pt_mass(leg, ptmax, mmin, mmax)
    leg.AddEntry(hNh, "Data")
    leg.AddEntry(hNhMC, "MC", "l")
    leg.Draw("same")

    uoleg = ut.make_uo_leg(hNh, 0.14, 0.9, 0.01, 0.1)
    uoleg.Draw("same")

    #ut.invert_col(rt.gPad)
    can.SaveAs("01fig.pdf")
Exemplo n.º 4
0
def plot_tracks_eta():

    #tracks pseudorapidity
    etabin = 0.09
    etamax = 1.1

    mmin = 2.8
    mmax = 3.2

    ptmax = 0.18

    strsel = "jRecM>{0:.3f} && jRecM<{1:.3f} && jRecPt<{2:.3f}".format(
        mmin, mmax, ptmax)

    can = ut.box_canvas()

    hEta = ut.prepare_TH1D("hEta", etabin, -etamax, etamax)
    hEtaMC = ut.prepare_TH1D("hEtaMC", etabin / 2., -etamax, etamax)

    ut.put_yx_tit(hEta, "Events / {0:.2f}".format(etabin),
                  "Tracks pseudorapidity")

    ut.set_margin_lbtr(gPad, 0.1, 0.08, 0.014, 0.01)

    hEta.SetMaximum(100)  # 220

    tree.Draw("jT0eta >> hEta", strsel)
    tree.Draw("jT1eta >>+hEta", strsel)
    mctree.Draw("jT0eta >> hEtaMC", strsel)
    mctree.Draw("jT1eta >>+hEtaMC", strsel)
    ut.norm_to_data(hEtaMC, hEta, rt.kBlue)

    hEta.Draw()
    hEtaMC.Draw("same")

    leg = ut.prepare_leg(0.64, 0.8, 0.14, 0.16, 0.03)
    ut.add_leg_pt_mass(leg, ptmax, mmin, mmax)
    leg.AddEntry(hEta, "Data")
    leg.AddEntry(hEtaMC, "MC", "l")
    leg.Draw("same")

    uoleg = ut.make_uo_leg(hEta, 0.14, 0.9, 0.01, 0.1)
    uoleg.Draw("same")

    #ut.invert_col(rt.gPad)
    can.SaveAs("01fig.pdf")
Exemplo n.º 5
0
def plot_tracks_phi():

    #tracks pseudorapidity
    phibin = 0.8
    phimax = 4.

    mmin = 1.5
    mmax = 5.

    ptmax = 0.17

    strsel = "jRecM>{0:.3f} && jRecM<{1:.3f} && jRecPt<{2:.3f}".format(
        mmin, mmax, ptmax)

    can = ut.box_canvas()

    hPhi = ut.prepare_TH1D("hPhi", phibin, -phimax, phimax)
    hPhiMC = ut.prepare_TH1D("hPhiMC", phibin / 3., -phimax, phimax)

    ut.put_yx_tit(hPhi, "Events / {0:.1f}".format(phibin),
                  "Tracks azimuthal angle")

    ut.set_margin_lbtr(gPad, 0.1, 0.08, 0.014, 0.01)

    hPhi.SetMaximum(520)

    tree.Draw("jT0phi >> hPhi", strsel)
    tree.Draw("jT1phi >>+hPhi", strsel)
    mctree.Draw("jT0phi >> hPhiMC", strsel)
    mctree.Draw("jT1phi >>+hPhiMC", strsel)
    ut.norm_to_data(hPhiMC, hPhi, rt.kBlue)

    hPhi.Draw()
    hPhiMC.Draw("same")

    leg = ut.prepare_leg(0.67, 0.8, 0.14, 0.16, 0.03)
    ut.add_leg_pt_mass(leg, ptmax, mmin, mmax)
    leg.AddEntry(hPhi, "Data")
    leg.AddEntry(hPhiMC, "MC", "l")
    leg.Draw("same")

    uoleg = ut.make_uo_leg(hPhi, 0.14, 0.9, 0.01, 0.1)
    uoleg.Draw("same")

    #ut.invert_col(rt.gPad)
    can.SaveAs("01fig.pdf")
Exemplo n.º 6
0
def plot_tracks_dca():

    #tracks dca to primary vertex along z
    dcabin = 0.02
    dcamin = -1.
    dcamax = 1.

    mmin = 1.5
    mmax = 5.

    ptmax = 0.17

    strsel = "jRecM>{0:.3f} && jRecM<{1:.3f} && jRecPt<{2:.3f}".format(
        mmin, mmax, ptmax)

    can = ut.box_canvas()

    hDca = ut.prepare_TH1D("hDca", dcabin, dcamin, dcamax)
    hDcaMC = ut.prepare_TH1D("hDcaMC", dcabin / 3, dcamin, dcamax)

    ut.put_yx_tit(hDcaMC, "Events / ({0:.2f} cm)".format(dcabin),
                  "Tracks dca in #it{z} to prim. vtx (cm)")

    ut.set_margin_lbtr(gPad, 0.1, 0.08, 0.01, 0.01)

    tree.Draw("jT0dcaZ >> hDca", strsel)
    tree.Draw("jT1dcaZ >>+hDca", strsel)
    mctree.Draw("jT0dcaZ >> hDcaMC", strsel)
    mctree.Draw("jT1dcaZ >>+hDcaMC", strsel)
    ut.norm_to_data(hDcaMC, hDca, rt.kBlue)

    hDcaMC.Draw()
    hDca.Draw("e1same")
    hDcaMC.Draw("same")

    leg = ut.prepare_leg(0.67, 0.8, 0.14, 0.16, 0.03)
    ut.add_leg_pt_mass(leg, ptmax, mmin, mmax)
    leg.AddEntry(hDca, "Data")
    leg.AddEntry(hDcaMC, "MC", "l")
    leg.Draw("same")

    uoleg = ut.make_uo_leg(hDca, 0.14, 0.9, 0.01, 0.1)
    uoleg.Draw("same")

    #ut.invert_col(rt.gPad)
    can.SaveAs("01fig.pdf")
Exemplo n.º 7
0
def plot_y():

    #reconstructed rapidity
    ybin = 0.1
    ymax = 1.3

    mmin = 1.5
    mmax = 5

    ptmax = 0.17

    strsel = "jRecM>{0:.3f} && jRecM<{1:.3f} && jRecPt<{2:.3f}".format(
        mmin, mmax, ptmax)

    can = ut.box_canvas()

    hY = ut.prepare_TH1D("hY", ybin, -ymax, ymax)
    hYMC = ut.prepare_TH1D("hYMC", ybin / 2., -ymax, ymax)

    ut.put_yx_tit(hY, "Events / {0:.1f}".format(ybin), "Dilepton rapidity")

    ut.set_margin_lbtr(gPad, 0.1, 0.08, 0.01, 0.01)

    tree.Draw("jRecY >> hY", strsel)
    mctree.Draw("jRecY >> hYMC", strsel)
    ut.norm_to_data(hYMC, hY, rt.kBlue)

    hY.Draw()
    hYMC.Draw("same")

    leg = ut.prepare_leg(0.67, 0.8, 0.14, 0.16, 0.03)
    ut.add_leg_pt_mass(leg, ptmax, mmin, mmax)
    leg.AddEntry(hY, "Data")
    leg.AddEntry(hYMC, "MC", "l")
    leg.Draw("same")

    uoleg = ut.make_uo_leg(hY, 0.14, 0.9, 0.01, 0.1)
    uoleg.Draw("same")

    #ut.invert_col(rt.gPad)
    can.SaveAs("01fig.pdf")
Exemplo n.º 8
0
def plot_dvtx_mc():

    #difference between reconstructed and generated vertex in MC
    vbin = 0.01
    vmin = -2.
    vmax = 2.

    mmin = 1.5
    mmax = 5.

    ptmax = 0.17

    strsel = "jRecM>{0:.3f} && jRecM<{1:.3f} && jRecPt<{2:.3f}".format(
        mmin, mmax, ptmax)

    can = ut.box_canvas()

    hDv = ut.prepare_TH1D("hDv", vbin, vmin, vmax)

    ut.put_yx_tit(hDv, "Events / ({0:.2f} cm)".format(vbin),
                  "Vtx_{#it{z},rec} - Vtx_{#it{z},gen} (cm)")

    ut.set_margin_lbtr(gPad, 0.12, 0.08, 0.01, 0.01)

    mctree.Draw("jVtxZ-jGenVtxZ >> hDv", strsel)

    hDv.Draw()

    leg = ut.prepare_leg(0.62, 0.8, 0.14, 0.16, 0.03)
    ut.add_leg_pt_mass(leg, ptmax, mmin, mmax)
    leg.AddEntry(None, "Reconstructed - generated", "")
    leg.AddEntry(None, "vertex position along #it{z}", "")
    leg.Draw("same")

    uoleg = ut.make_uo_leg(hDv, 0.14, 0.9, 0.01, 0.1)
    uoleg.Draw("same")

    #ut.invert_col(rt.gPad)
    can.SaveAs("01fig.pdf")
Exemplo n.º 9
0
def plot_proj_both(frame2, frame_east, frame_west, adc_bin, adc_min, adc_max,
                   ptmax, mmin, mmax):

    can = ut.box_canvas(800, 700)  #900, 700

    xp = Double(0)
    yp = Double(0)

    #east data on the left
    hEast = frame_east.getHist("data")
    plot_east = frame2.Clone("plot_east")
    plot_east.SetMarkerStyle(22)
    plot_east.SetMarkerSize(1.4)
    ut.set_H1D_col(plot_east, rt.kBlue)
    for ibin in xrange(hEast.GetN()):
        hEast.GetPoint(ibin, xp, yp)
        plot_east.SetBinContent(ibin + 1, yp)
        plot_east.SetBinError(ibin + 1, hEast.GetErrorY(ibin))

    frame2.SetMaximum(1.2 * plot_east.GetMaximum())  # 1.15

    #west data on the right
    hWest = frame_west.getHist("data")
    plot_west = frame2.Clone("plot_west")
    plot_west.SetMarkerStyle(21)
    ut.set_H1D_col(plot_west, rt.kRed)
    for i in xrange(hWest.GetN()):
        hWest.GetPoint(i, xp, yp)
        ibin = frame2.GetNbinsX() - i
        plot_west.SetBinContent(ibin, yp)
        plot_west.SetBinError(ibin, hWest.GetErrorY(i))

    #east fit
    cEast = frame_east.getCurve("model")
    gEast = TGraph(cEast.GetN() - 1)
    for i in xrange(cEast.GetN() - 1):
        cEast.GetPoint(i, xp, yp)
        gEast.SetPoint(i, xp, yp)

    gEast.SetLineColor(rt.kBlue)
    gEast.SetLineWidth(3)
    gEast.SetLineStyle(rt.kDashed)
    #gEast.SetLineStyle(rt.kDashDotted)

    #west fit on the left
    cWest = frame_west.getCurve("model")
    gWest = TGraph(cWest.GetN() - 1)
    xmax = frame2.GetBinCenter(
        frame2.GetNbinsX()) + frame2.GetBinWidth(frame2.GetNbinsX()) / 2.
    for i in xrange(cWest.GetN() - 1):
        cWest.GetPoint(i, xp, yp)
        xplot = xmax - xp
        gWest.SetPoint(i, xplot, yp)

    gWest.SetLineColor(rt.kRed)
    gWest.SetLineWidth(3)
    #gWest.SetLineStyle(rt.kDashDotted)
    #gWest.SetLineStyle(rt.kDashed)

    #horizontal axis
    frame2.SetMinimum(0)
    #frame2.SetMinimum(0.98)
    frame2.GetXaxis().SetNdivisions(0, rt.kFALSE)
    #east axis
    ypos = frame2.GetYaxis().GetXmin()
    axisE = TGaxis(adc_min, ypos, adc_max, ypos, adc_min, adc_max)
    ut.set_axis(axisE)
    axisE.SetWmin(axisE.GetWmin() * 0.01)
    axisE.SetWmax(axisE.GetWmax() * 0.01)
    axisE.SetTitle("ZDC East #times100")
    axisE.SetTitleOffset(1.1)
    #west axis
    xpos = frame2.GetXaxis().GetXmax()
    axisW = TGaxis(xpos, ypos, xpos - adc_max, ypos, adc_min, adc_max, 510,
                   "-")
    ut.set_axis(axisW)
    axisW.SetWmin(axisW.GetWmin() * 0.01)
    axisW.SetWmax(axisW.GetWmax() * 0.01)
    axisW.SetLabelOffset(-0.024)
    axisW.SetTitle("ZDC West #times100")
    axisW.SetTitleOffset(1.1)

    #vertical axis
    yvpos = 1. * frame2.GetMaximum()
    axisV = TGaxis(xpos, 0, xpos, yvpos, 0, yvpos, 510, "+L")
    #axisV = TGaxis(xpos, 0, xpos, yvpos, 0.98, yvpos, 510, "+G")
    ut.set_axis(axisV)

    frame2.SetYTitle("ZDC East / ({0:.0f} ADC units)".format(adc_bin))
    axisV.SetTitle("ZDC West / ({0:.0f} ADC units)".format(adc_bin))

    frame2.GetYaxis().SetTitleOffset(1.5)
    axisV.SetTitleOffset(1.5)

    gPad.SetTopMargin(0.05)  # 0.01
    gPad.SetRightMargin(0.1)
    gPad.SetBottomMargin(0.08)
    gPad.SetLeftMargin(0.1)

    frame2.Draw()
    plot_east.Draw("e1same")
    plot_west.Draw("e1same")
    gEast.Draw("lsame")
    gWest.Draw("lsame")

    axisE.Draw()
    axisW.Draw()
    axisV.Draw()

    #kinematics legend
    #kleg = ut.prepare_leg(0.16, 0.78, 0.32, 0.2, 0.035)
    kleg = ut.prepare_leg(0.16, 0.73, 0.32, 0.2, 0.035)
    kleg.AddEntry(None, "AuAu@200 GeV", "")
    kleg.AddEntry(None, "UPC sample", "")
    ut.add_leg_pt_mass(kleg, ptmax, mmin, mmax)
    kleg.Draw("same")

    #data legend
    dleg = ut.prepare_leg(0.6, 0.8, 0.15, 0.08, 0.03)
    dleg.AddEntry(plot_east, "ZDC East", "p")
    dleg.AddEntry(plot_west, "ZDC West", "p")
    #dleg.Draw("same")

    #projections legend
    #pleg = ut.prepare_leg(0.24, 0.56, 0.25, 0.2, 0.035)
    pleg = ut.prepare_leg(0.24, 0.51, 0.25, 0.2, 0.035)
    pleg.AddEntry(plot_east, "ZDC East", "p")
    pleg.AddEntry(plot_west, "ZDC West", "p")
    pleg.AddEntry(gEast, "Fit projection to east", "l")
    pleg.AddEntry(gWest, "Fit projection to west", "l")
    pleg.Draw("same")

    #gPad.SetLogy()
    #gPad.SetGrid()

    #ut.invert_col(gPad)
    can.SaveAs("01fig.pdf")