示例#1
0
def plot_pt2():

    #pT^2 with coherent incoherent and gamma-gamma components

    ptbin = 0.002
    ptmin = 0.
    ptmax = 0.2  # 0.3

    mmin = 2.8
    mmax = 3.2
    #mmin = 1.5
    #mmax = 2.6

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

    can = ut.box_canvas()

    hPt = ut.prepare_TH1D("hPt", ptbin, ptmin, ptmax)
    hPtCoh = ut.prepare_TH1D("hPtCoh", ptbin / 3., ptmin, ptmax)
    hPtIncoh = ut.prepare_TH1D("hPtIncoh", ptbin, ptmin, ptmax)
    hPtGG = ut.prepare_TH1D("hPtGG", ptbin, ptmin, ptmax)

    ut.put_yx_tit(hPt, "Events / ({0:.3f}".format(ptbin) + " GeV^{2})",
                  "#it{p}_{T}^{2} (GeV^{2})")

    ut.set_margin_lbtr(gPad, 0.11, 0.09, 0.01, 0.02)

    draw = "jRecPt*jRecPt"

    tree.Draw(draw + " >> hPt", strsel)
    tree_coh.Draw(draw + " >> hPtCoh", strsel)
    tree_incoh.Draw(draw + " >> hPtIncoh", strsel)
    tree_gg.Draw(draw + " >> hPtGG", strsel)

    ut.norm_to_data(hPtCoh, hPt, rt.kBlue, 0., 0.015)
    ut.norm_to_data(hPtIncoh, hPt, rt.kRed, 0.05, 0.16)  # 0.3
    ut.norm_to_data(hPtGG, hPt, rt.kGreen, 0., 0.001)

    hPt.Draw()
    hPtCoh.Draw("same")
    hPtIncoh.Draw("same")
    hPtGG.Draw("same")

    leg = ut.prepare_leg(0.67, 0.78, 0.14, 0.18, 0.03)
    ut.add_leg_mass(leg, mmin, mmax)
    leg.AddEntry(hPt, "Data")
    leg.AddEntry(hPtCoh, "Coherent MC", "l")
    leg.AddEntry(hPtIncoh, "Incoherent MC", "l")
    leg.AddEntry(hPtGG, "#gamma#gamma#rightarrow e^{+}e^{-} MC", "l")
    leg.Draw("same")

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

    gPad.SetLogy()

    ut.invert_col(rt.gPad)
    can.SaveAs("01fig.pdf")
示例#2
0
def plot_jpsi_logPt2():

    # log_10(pT^2)

    ptbin = 0.12
    ptmin = -5.
    ptmax = 1.

    mmin = 2.8
    mmax = 3.2

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

    can = ut.box_canvas()

    hPt = ut.prepare_TH1D("hPt", ptbin, ptmin, ptmax)
    hPtCoh = ut.prepare_TH1D("hPtCoh", ptbin / 3., ptmin, ptmax)
    hPtIncoh = ut.prepare_TH1D("hPtIncoh", ptbin / 3., ptmin, ptmax)
    hPtGG = ut.prepare_TH1D("hPtGG", ptbin, ptmin, ptmax)

    ut.put_yx_tit(hPt, "Events / ({0:.3f}".format(ptbin) + " GeV^{2})",
                  "log_{10}( #it{p}_{T}^{2} ) (GeV^{2})")

    ut.set_margin_lbtr(gPad, 0.11, 0.09, 0.01, 0.01)

    draw = "TMath::Log10(jRecPt*jRecPt)"

    tree.Draw(draw + " >> hPt", strsel)
    tree_coh.Draw(draw + " >> hPtCoh", strsel)
    tree_incoh.Draw(draw + " >> hPtIncoh", strsel)
    tree_gg.Draw(draw + " >> hPtGG", strsel)
    ut.norm_to_data(hPtCoh, hPt, rt.kBlue, -5., -1.8)  # norm for coh
    ut.norm_to_data(hPtIncoh, hPt, rt.kRed, -1.1, 1.)  # for incoh
    ut.norm_to_data(hPtGG, hPt, rt.kGreen, -5., -2.9)  # for ggel

    hPt.Draw()
    hPtCoh.Draw("same")
    hPtIncoh.Draw("same")
    hPtGG.Draw("same")

    leg = ut.prepare_leg(0.67, 0.79, 0.14, 0.17, 0.03)
    ut.add_leg_mass(leg, mmin, mmax)
    leg.AddEntry(hPt, "Data")
    leg.AddEntry(hPtCoh, "Coherent MC", "l")
    leg.AddEntry(hPtIncoh, "Incoherent MC", "l")
    leg.AddEntry(hPtGG, "#gamma#gamma#rightarrow e^{+}e^{-} MC", "l")
    leg.Draw("same")

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

    #gPad.SetLogy()

    ut.invert_col(rt.gPad)
    can.SaveAs("01fig.pdf")
示例#3
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")
示例#4
0
def subtract_pt2_incoh():

    #subtract functional shape from pT^2 incoherent MC

    ptbin = 0.008
    ptmin = 0.
    ptmax = 1.

    mmin = 2.8
    mmax = 3.2

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

    can = ut.box_canvas()

    hPt = ut.prepare_TH1D("hPt", ptbin, ptmin, ptmax)

    ut.put_yx_tit(hPt, "Events / ({0:.3f}".format(ptbin) + " GeV^{2})",
                  "#it{p}_{T}^{2} (GeV^{2})")

    tree_incoh.Draw("jRecPt*jRecPt >> hPt", strsel)

    #incoherent functional shape
    func_incoh_pt2 = TF1("func_incoh", "[0]*exp(-[1]*x)", 0., 10.)
    func_incoh_pt2.SetParName(0, "A")
    func_incoh_pt2.SetParName(1, "b")
    func_incoh_pt2.SetNpx(1000)
    func_incoh_pt2.SetLineColor(rt.kRed)

    #values from pdf fit to log(Pt2)
    #func_incoh_pt2.SetParameters(266.3, 3.28)
    func_incoh_pt2.SetParameters(101953.970, 4.810)

    #histogram created from functional values
    hPtFunc = ut.prepare_TH1D("hPtFunc", ptbin, ptmin, ptmax)
    for ibin in xrange(1, hPtFunc.GetNbinsX() + 1):
        edge = hPtFunc.GetBinLowEdge(ibin)
        w = hPtFunc.GetBinWidth(ibin)
        hPtFunc.SetBinContent(ibin, func_incoh_pt2.Integral(edge, edge + w))
        hPtFunc.SetBinError(ibin, 0.)

    ut.set_margin_lbtr(gPad, 0.11, 0.09, 0.01, 0.01)

    hPt.Draw()
    hPtFunc.Draw("same")

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

    ut.invert_col(rt.gPad)
    can.SaveAs("01fig.pdf")
示例#5
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")
示例#6
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")
示例#7
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")
示例#8
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")
示例#9
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")
示例#10
0
def plot_jpsi_logPt2():

    #J/psi log_10(pT^2)

    ptbin = 0.12
    ptmin = -5.
    ptmax = 1.

    mmin = 2.8
    mmax = 3.2

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

    can = ut.box_canvas()

    hPt = ut.prepare_TH1D("hPt", ptbin, ptmin, ptmax)
    hPtMC = ut.prepare_TH1D("hPtMC", ptbin / 3., ptmin, ptmax)

    ut.put_yx_tit(hPt, "Events / ({0:.3f}".format(ptbin) + " GeV^{2})",
                  "#it{p}_{T}^{2} (GeV^{2})")

    ut.set_margin_lbtr(gPad, 0.11, 0.09, 0.01, 0.01)

    draw = "TMath::Log10(jRecPt*jRecPt)"

    tree.Draw(draw + " >> hPt", strsel)
    mctree.Draw(draw + " >> hPtMC", strsel)
    ut.norm_to_data(hPtMC, hPt, rt.kBlue, -5., -1.8)  # norm for coh
    #ut.norm_to_data(hPtMC, hPt, rt.kBlue, -1.1, 1.) # for incoh
    #ut.norm_to_data(hPtMC, hPt, rt.kBlue, -5., -2.4) # for ggel

    hPt.Draw()
    hPtMC.Draw("same")

    leg = ut.prepare_leg(0.67, 0.8, 0.14, 0.16, 0.03)
    ut.add_leg_mass(leg, mmin, mmax)
    leg.AddEntry(hPt, "Data")
    leg.AddEntry(hPtMC, "Coherent MC", "l")
    leg.Draw("same")

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

    ut.invert_col(rt.gPad)
    can.SaveAs("01fig.pdf")
示例#11
0
def plot_jpsi_pt2():

    #J/psi pT^2

    ptbin = 0.002
    ptmin = 0.
    ptmax = 0.15

    mmin = 2.8
    mmax = 3.2

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

    can = ut.box_canvas()

    hPt = ut.prepare_TH1D("hPt", ptbin, ptmin, ptmax)
    hPtMC = ut.prepare_TH1D("hPtMC", ptbin / 3., ptmin, ptmax)

    ut.put_yx_tit(hPt, "Events / ({0:.3f}".format(ptbin) + " GeV^{2})",
                  "#it{p}_{T}^{2} (GeV^{2})")

    ut.set_margin_lbtr(gPad, 0.11, 0.09, 0.01, 0.02)

    draw = "jRecPt*jRecPt"

    tree.Draw(draw + " >> hPt", strsel)
    mctree.Draw(draw + " >> hPtMC", strsel)
    ut.norm_to_data(hPtMC, hPt, rt.kBlue, 0., 0.015)

    hPt.Draw()
    hPtMC.Draw("same")

    leg = ut.prepare_leg(0.67, 0.8, 0.14, 0.16, 0.03)
    ut.add_leg_mass(leg, mmin, mmax)
    leg.AddEntry(hPt, "Data")
    leg.AddEntry(hPtMC, "Coherent MC", "l")
    leg.Draw("same")

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

    gPad.SetLogy()

    ut.invert_col(rt.gPad)
    can.SaveAs("01fig.pdf")
示例#12
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")
示例#13
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")
示例#14
0
def fit_pt_incoh():

    #fit to incoherent MC pT

    ptbin = 0.015
    #ptbin = math.sqrt(0.005)
    ptmin = 0.
    ptmax = 1.4

    mmin = 2.8
    mmax = 3.2

    fitran = [0.4, 1.]

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

    can = ut.box_canvas()

    hPtIncoh = ut.prepare_TH1D("hPtIncoh", ptbin, ptmin, ptmax)
    ut.put_yx_tit(hPtIncoh, "Events / ({0:.3f}".format(ptbin) + " GeV)",
                  "#it{p}_{T} (GeV)")

    tree_incoh.Draw("jRecPt >> hPtIncoh", strsel)

    print "Input events:", hPtIncoh.GetEntries()
    print "Histogram integral:", hPtIncoh.Integral()
    print "Histogram integral (w):", hPtIncoh.Integral("width")

    #hPtIncoh.Sumw2()
    #hPtIncoh.Scale(1./hPtIncoh.Integral("width"))

    ut.set_margin_lbtr(gPad, 0.11, 0.09, 0.01, 0.02)

    func_incoh = TF1("func_incoh", "2*[0]*x*exp(-[1]*x*x)", 0., 10.)
    func_incoh.SetParName(0, "A")
    func_incoh.SetParName(1, "b")
    func_incoh.SetNpx(1000)
    func_incoh.SetLineColor(rt.kRed)

    func_incoh.SetParameters(3000., 5.)

    r1 = (hPtIncoh.Fit(func_incoh, "RS", "", fitran[0], fitran[1])).Get()

    print "Fit integral:", func_incoh.Integral(0., 10.)

    hPtIncoh.Draw()
    func_incoh.Draw("same")

    #normalize fit function to number of events
    pdf_incoh = TF1("pdf_incoh", "2*[0]*x*exp(-[1]*x*x)", 0., 10.)
    pdf_incoh.SetParName(0, "A")
    pdf_incoh.SetParName(1, "b")
    #    tree_incoh.Draw("jRecPt >> hPtIncoh", strsel)
    #strsel = "jRecM>{0:.3f} && jRecM<{1:.3f}".format(mmin, mmax)
    nevt = tree_incoh.Draw(
        "", strsel +
        " && jRecPt>{0:.3f} && jRecPt<{1:.3f}".format(fitran[0], fitran[1]))
    k_norm = nevt / func_incoh.Integral(fitran[0], fitran[1])
    pdf_incoh.SetParameter(0, k_norm * func_incoh.GetParameter(0))
    pdf_incoh.SetParameter(1, func_incoh.GetParameter(1))
    #verify the normalization:
    print "Function integral after norm:", pdf_incoh.Integral(0., 10.)

    #create pdf for pT^2 and verify normalization
    pdf_pt2 = TF1("pdf_pt2", "[0]*exp(-[1]*x)", 0., 10.)
    pdf_pt2.SetParameter(0, pdf_incoh.GetParameter(0))
    pdf_pt2.SetParameter(1, pdf_incoh.GetParameter(1))
    print "PDF for pT^2 integral:", pdf_pt2.Integral(0., 10.)

    leg = ut.prepare_leg(0.67, 0.84, 0.14, 0.12, 0.03)
    ut.add_leg_mass(leg, mmin, mmax)
    leg.AddEntry(hPtIncoh, "Incoherent MC")
    leg.AddEntry(func_incoh, "2#it{A}*#it{p}_{T}exp(-#it{b}*#it{p}_{T}^{2})",
                 "l")
    leg.Draw("same")

    desc = pdesc(hPtIncoh, 0.72, 0.84, 0.057)
    desc.set_text_size(0.03)
    desc.itemD("#chi^{2}/ndf", r1.Chi2() / r1.Ndf(), -1, rt.kRed)
    desc.prec = 2
    desc.itemRes("#it{A}", r1, 0, rt.kRed)
    desc.itemD("#it{A}", pdf_incoh.GetParameter(0), -1, rt.kRed)
    desc.prec = 3
    desc.itemRes("#it{b}", r1, 1, rt.kRed)
    desc.draw()

    l0 = ut.cut_line(fitran[0], 0.9, hPtIncoh)
    l1 = ut.cut_line(fitran[1], 0.9, hPtIncoh)
    l0.Draw()
    l1.Draw()

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

    ut.invert_col(rt.gPad)
    can.SaveAs("01fig.pdf")
示例#15
0
def fit_logPt2_incoh():

    #fit to incoherent log_10(pT^2)

    ptbin = 0.12
    ptmin = -5.
    ptmax = 1.

    mmin = 2.8
    mmax = 3.2

    fitran = [-1., -0.1]

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

    can = ut.box_canvas()

    hPtIncoh = ut.prepare_TH1D("hPtIncoh", ptbin / 3., ptmin, ptmax)

    ut.put_yx_tit(hPtIncoh, "Events / ({0:.3f}".format(ptbin) + " GeV^{2})",
                  "log_{10}( #it{p}_{T}^{2} ) (GeV^{2})")

    ut.set_margin_lbtr(gPad, 0.11, 0.09, 0.01, 0.01)

    draw = "TMath::Log10(jRecPt*jRecPt)"
    tree_incoh.Draw(draw + " >> hPtIncoh", strsel)

    #hPtIncoh.Sumw2()
    #hPtIncoh.Scale(1./hPtIncoh.Integral("width"))

    func_incoh_logPt2 = TF1("func_incoh_logPt2",
                            "[0]*log(10.)*pow(10.,x)*exp(-[1]*pow(10.,x))",
                            -10., 10.)
    func_incoh_logPt2.SetParName(0, "A")
    func_incoh_logPt2.SetParName(1, "b")
    func_incoh_logPt2.SetNpx(1000)
    func_incoh_logPt2.SetLineColor(rt.kRed)

    func_incoh_logPt2.SetParameters(3000., 5.)

    r1 = (hPtIncoh.Fit(func_incoh_logPt2, "RS", "", fitran[0],
                       fitran[1])).Get()

    #create pdf normalized to number of events
    pdf_logPt2 = TF1("pdf_logPt2",
                     "[0]*log(10.)*pow(10.,x)*exp(-[1]*pow(10.,x))", -10., 10.)
    nevt = tree_incoh.Draw(
        "", strsel + " && " + draw + ">{0:.3f}".format(fitran[0]) + " && " +
        draw + "<{1:.3f}".format(fitran[0], fitran[1]))
    k_norm = nevt / func_incoh_logPt2.Integral(fitran[0], fitran[1])
    pdf_logPt2.SetParameter(0, k_norm * func_incoh_logPt2.GetParameter(0))
    pdf_logPt2.SetParameter(1, func_incoh_logPt2.GetParameter(1))
    #verify the normalization:
    print "PDF integral", pdf_logPt2.Integral(-10., 10.)

    hPtIncoh.Draw()
    func_incoh_logPt2.Draw("same")

    leg = ut.prepare_leg(0.18, 0.78, 0.14, 0.15, 0.03)
    ut.add_leg_mass(leg, mmin, mmax)
    leg.AddEntry(hPtIncoh, "Incoherent MC")
    leg.AddEntry(
        func_incoh_logPt2,
        "ln(10)*#it{A}*10^{log_{10}#it{p}_{T}^{2}}exp(-#it{b}10^{log_{10}#it{p}_{T}^{2}})",
        "l")
    leg.Draw("same")

    desc = pdesc(hPtIncoh, 0.18, 0.78, 0.057)
    desc.set_text_size(0.03)
    desc.itemD("#chi^{2}/ndf", r1.Chi2() / r1.Ndf(), -1, rt.kRed)
    desc.itemRes("#it{A}", r1, 0, rt.kRed)
    desc.itemD("#it{A}", pdf_logPt2.GetParameter(0), -1, rt.kRed)
    desc.itemRes("#it{b}", r1, 1, rt.kRed)
    desc.draw()

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

    l0 = ut.cut_line(fitran[0], 0.9, hPtIncoh)
    l1 = ut.cut_line(fitran[1], 0.9, hPtIncoh)
    l0.Draw()
    l1.Draw()

    ut.invert_col(rt.gPad)
    can.SaveAs("01fig.pdf")
示例#16
0
def plot_pt2_real():

    #pT^2 with realistic normalization for incoherent and gamma-gamma components

    ptbin = 0.002
    ptmin = 0.
    ptmax = 0.2  # 0.3

    mmin = 2.8
    mmax = 3.2

    ngg = 131  # number of gamma-gamma from mass fit

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

    can = ut.box_canvas()

    hPt = ut.prepare_TH1D("hPt", ptbin, ptmin, ptmax)
    hPtCoh = ut.prepare_TH1D("hPtCoh", ptbin, ptmin, ptmax)
    hPtIncoh = ut.prepare_TH1D("hPtIncoh", ptbin, ptmin, ptmax)
    hPtGG = ut.prepare_TH1D("hPtGG", ptbin, ptmin, ptmax)

    ut.put_yx_tit(hPt, "Events / ({0:.3f}".format(ptbin) + " GeV^{2})",
                  "#it{p}_{T}^{2} (GeV^{2})")

    ut.set_margin_lbtr(gPad, 0.11, 0.09, 0.01, 0.02)

    draw = "jRecPt*jRecPt"

    tree.Draw(draw + " >> hPt", strsel)
    tree_coh.Draw(draw + " >> hPtCoh", strsel)
    tree_gg.Draw(draw + " >> hPtGG", strsel)

    #incoherent functional shape
    func_incoh_pt2 = TF1("func_incoh", "[0]*exp(-[1]*x)", 0., 10.)
    func_incoh_pt2.SetParameters(873.04, 3.28)

    #fill incoherent histogram from functional shape
    ut.fill_h1_tf(hPtIncoh, func_incoh_pt2, rt.kRed)

    ut.norm_to_data(hPtCoh, hPt, rt.kBlue, 0., 0.015)
    ut.norm_to_num(hPtGG, ngg, rt.kGreen)

    hPt.Draw()
    hPtCoh.Draw("same")
    hPtIncoh.Draw("same")
    hPtGG.Draw("same")

    leg = ut.prepare_leg(0.6, 0.78, 0.14, 0.18, 0.03)
    ut.add_leg_mass(leg, mmin, mmax)
    leg.AddEntry(hPt, "Data")
    leg.AddEntry(hPtCoh, "Coherent MC, Sartre", "l")
    leg.AddEntry(hPtIncoh, "Incoherent parametrization", "l")
    leg.AddEntry(hPtGG, "#gamma#gamma#rightarrow e^{+}e^{-} MC", "l")
    leg.Draw("same")

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

    gPad.SetLogy()

    #ut.invert_col(rt.gPad)
    can.SaveAs("01fig.pdf")
示例#17
0
def plot_rec_gen_track_phi():

    #track azimuthal angle phi resolution as ( phi_track_rec - phi_track_gen )/phi_track_gen

    phibin = 0.0001
    phimin = -0.02
    phimax = 0.02

    #ptlo = 0.
    #pthi = 0.9

    fitran = [-0.01, 0.01]

    mmin = 2.8
    mmax = 3.2

    cbw = rt.kBlue

    #output log file
    out = open("out.txt", "w")
    #log fit parameters
    loglist1 = [(x, eval(x))
                for x in ["infile_mc", "phibin", "phimin", "phimax"]]
    loglist2 = [(x, eval(x)) for x in ["fitran", "mmin", "mmax"]]
    strlog = ut.make_log_string(loglist1, loglist2)
    ut.log_results(out, strlog + "\n")

    strsel = "jRecM>{0:.3f} && jRecM<{1:.3f}".format(mmin, mmax)
    #strsel += " && jGenPt>{0:.3f}".format(ptlo)
    #strsel += " && jGenPt<{0:.3f}".format(pthi)

    nbins, phimax = ut.get_nbins(phibin, phimin, phimax)
    hPhiRel = ut.prepare_TH1D_n("hPhiRel", nbins, phimin, phimax)

    ytit = "Events / ({0:.4f})".format(phibin)
    xtit = "(#phi_{rec} - #phi_{gen})/#phi_{gen}"

    mctree.Draw("(jT0phi-jGenP0phi)/jGenP0phi >> hPhiRel",
                strsel)  # positive charge
    mctree.Draw("(jT1phi-jGenP1phi)/jGenP1phi >>+hPhiRel",
                strsel)  # add negative charge

    x = RooRealVar("x", "x", phimin, phimax)
    x.setRange("fitran", fitran[0], fitran[1])
    rfPhiRel = RooDataHist("rfPhiRel", "rfPhiRel", RooArgList(x), hPhiRel)

    #Breit-Wigner pdf
    mean = RooRealVar("mean", "mean", 0., -0.1, 0.1)
    sigma = RooRealVar("sigma", "sigma", 0.01, 0., 0.9)
    bwpdf = RooBreitWigner("bwpdf", "bwpdf", x, mean, sigma)

    res = bwpdf.fitTo(rfPhiRel, rf.Range("fitran"), rf.Save())

    #log fit results
    ut.log_results(out, ut.log_fit_result(res))

    can = ut.box_canvas()
    ut.set_margin_lbtr(gPad, 0.12, 0.1, 0.05, 0.03)

    frame = x.frame(rf.Bins(nbins), rf.Title(""))
    ut.put_frame_yx_tit(frame, ytit, xtit)

    rfPhiRel.plotOn(frame, rf.Name("data"))

    bwpdf.plotOn(frame, rf.Precision(1e-6), rf.Name("bwpdf"))

    frame.Draw()

    desc = pdesc(frame, 0.12, 0.93, 0.057)
    #x, y, sep
    desc.set_text_size(0.03)
    desc.itemD("#chi^{2}/ndf", frame.chiSquare("bwpdf", "data", 2), -1, cbw)
    desc.prec = 2
    desc.fmt = "e"
    desc.itemR("mean", mean, cbw)
    desc.itemR("#sigma", sigma, cbw)

    desc.draw()

    leg = ut.make_uo_leg(hPhiRel, 0.5, 0.8, 0.2, 0.2)
    #leg.Draw("same")

    #print "Entries: ", hPhiRel.GetEntries()

    #ut.invert_col(rt.gPad)
    can.SaveAs("01fig.pdf")
示例#18
0
def plot_pt():

    #pT with coherent incoherent and gamma-gamma components

    ptbin = 0.02
    ptmin = 0.
    ptmax = 1.1

    mmin = 2.8
    mmax = 3.2
    #mmin = 3.4
    #mmax = 5.

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

    can = ut.box_canvas()

    hPt = ut.prepare_TH1D("hPt", ptbin, ptmin, ptmax)
    hPtCoh = ut.prepare_TH1D("hPtCoh", ptbin, ptmin, ptmax)
    hPtIncoh = ut.prepare_TH1D("hPtIncoh", ptbin, ptmin, ptmax)
    hPtGG = ut.prepare_TH1D("hPtGG", ptbin, ptmin, ptmax)

    #ut.put_yx_tit(hPt, "Events / ({0:.3f}".format(ptbin)+" GeV)", "#it{p}_{T} (GeV})")
    ut.put_yx_tit(hPt,
                  "J/#psi candidates / ({0:.3f}".format(ptbin) + " GeV/c)",
                  "Dielectron #it{p}_{T} (GeV/c)", 1.5, 1.2)

    ut.set_margin_lbtr(gPad, 0.11, 0.09, 0.01, 0.02)

    draw = "jRecPt"

    tree.Draw(draw + " >> hPt", strsel)
    tree_coh.Draw(draw + " >> hPtCoh", strsel)
    tree_incoh.Draw(draw + " >> hPtIncoh", strsel)
    tree_gg.Draw(draw + " >> hPtGG", strsel)

    ut.norm_to_data(hPtCoh, hPt, rt.kBlue, 0., 0.08)
    ut.norm_to_data(hPtIncoh, hPt, rt.kRed, 0.28, 1.)
    #ut.norm_to_data(hPtGG, hPt, rt.kGreen, 0., 0.03)
    ut.norm_to_num(hPtGG, 131, rt.kGreen + 1)

    #sum of all contributions
    hSum = ut.prepare_TH1D("hSum", ptbin, ptmin, ptmax)
    hSum.SetLineWidth(3)
    #add ggel to the sum
    hSum.Add(hPtGG)
    #add incoherent contribution
    hSum.Add(hPtIncoh)
    #add coherent contribution
    hSum.Add(hPtCoh)
    #set to draw as a lines
    ut.line_h1(hSum, rt.kBlack)

    hPt.Draw()
    hSum.Draw("same")
    hPtCoh.Draw("same")
    hPtIncoh.Draw("same")
    hPtGG.Draw("same")

    leg = ut.prepare_leg(0.64, 0.65, 0.14, 0.3, 0.03)
    leg.AddEntry(None, "#bf{|#kern[0.3]{#it{y}}| < 1}", "")
    ut.add_leg_mass(leg, mmin, mmax)
    leg.AddEntry(hPt, "Data", "p")
    leg.AddEntry(hSum, "Sum", "l")
    leg.AddEntry(hPtCoh, "Coherent J/#psi", "l")
    leg.AddEntry(hPtIncoh, "Incoherent J/#psi", "l")
    leg.AddEntry(hPtGG, "#gamma#gamma#rightarrow e^{+}e^{-}", "l")
    leg.Draw("same")

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

    pleg = ut.prepare_leg(0.33, 0.8, 0.01, 0.14, 0.035)
    pleg.AddEntry(None, "STAR Preliminary", "")
    pleg.AddEntry(None, "AuAu@200 GeV", "")
    pleg.AddEntry(None, "UPC sample", "")
    pleg.Draw("same")

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