def sigma_xy(): #beam sigma in x and y gen = make_gen() beam = gen.beam_par gx = TGraph(beam.hz.GetNbinsX() + 1) gy = TGraph(beam.hz.GetNbinsX() + 1) for ibin in range(beam.hz.GetNbinsX() + 1): zpos = beam.hz.GetBinCenter(ibin) sx = beam.gx[ibin].GetParameter(2) sy = beam.gy[ibin].GetParameter(2) gx.SetPoint(ibin, zpos, sx) gy.SetPoint(ibin, zpos, sy) ut.set_graph(gx, rt.kBlue) ut.set_graph(gy, rt.kRed) can = ut.box_canvas() frame = gPad.DrawFrame(-10e3, 0, 15.5e3, 3.3) gx.Draw("lsame") gy.Draw("lsame") gPad.SetGrid() ut.invert_col(gPad) can.SaveAs("01fig.pdf")
def acc_both(): #acceptance for quasi-real photoproduction and for Pythia #selection mode, 1 - s1, 2 - s2, 3 - s1 or s2, 4 - ecal, 5 - any #acc_qr = acc_quasi_real(False) acc_py_s1 = acc_pythia(False, 1) acc_py_s2 = acc_pythia(False, 2) #acc_py_s12 = acc_pythia(False, 3) acc_py_ecal = acc_pythia(False, 4) acc_py_all = acc_pythia(False, 5) #acc_py = acc_gap("../data/ir6_close/lmon_pythia_5M_beff2_close_5Mevt.root") #make the plot can = ut.box_canvas() #ut.set_graph(acc_qr, rt.kRed) #ut.set_graph(acc_py, rt.kBlue, rt.kFullTriangleUp) ut.set_graph(acc_py_s1, rt.kYellow+1) ut.set_graph(acc_py_s2, rt.kGreen+1) #ut.set_graph(acc_py_s12, rt.kBlack) ut.set_graph(acc_py_ecal, rt.kBlue) ut.set_graph(acc_py_all, rt.kBlack) frame = gPad.DrawFrame(-10, 0, 5, 1.1) # 0.3 frame.Draw() #ytit = "Acceptance / {0:.1f} %".format(prec*100) ut.put_yx_tit(frame, "Acceptance", "log_{10}(#it{Q}^{2})", 1.6, 1.2) frame.Draw() ut.set_margin_lbtr(gPad, 0.11, 0.1, 0.03, 0.02) gPad.SetGrid() #acc_py.Draw("psame") #acc_qr.Draw("psame") acc_py_s1.Draw("psame") acc_py_s2.Draw("psame") #acc_py_s12.Draw("psame") acc_py_all.Draw("psame") acc_py_ecal.Draw("psame") #leg = ut.prepare_leg(0.2, 0.82, 0.2, 0.12, 0.035) leg = ut.prepare_leg(0.15, 0.78, 0.2, 0.16, 0.035) #leg.AddEntry(acc_qr, "Quasi-real photoproduction", "lp") #leg.AddEntry(acc_py, "Pythia6", "lp") leg.AddEntry(acc_py_s1, "Tagger 1", "lp") leg.AddEntry(acc_py_s2, "Tagger 2", "lp") #leg.AddEntry(acc_py_s12, "Tagger 1 #bf{or} Tagger 2", "lp") leg.AddEntry(acc_py_ecal, "ecal", "lp") leg.AddEntry(acc_py_all, "Tagger 1 #bf{or} Tagger 2 #bf{or} ecal", "lp") leg.Draw("same") #ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def div_xy(): #beam divergence in x and y gen = make_gen() beam = gen.beam_par gx = TGraph(beam.hz.GetNbinsX() + 1) gy = TGraph(beam.hz.GetNbinsX() + 1) for ibin in range(beam.hz.GetNbinsX() + 1): zpos = beam.hz.GetBinCenter(ibin) dx = beam.divx[ibin].GetParameter(2) dy = beam.divy[ibin].GetParameter(2) gx.SetPoint(ibin, zpos, dx) gy.SetPoint(ibin, zpos, dy) ut.set_graph(gx, rt.kBlue) ut.set_graph(gy, rt.kRed) can = ut.box_canvas() frame = gPad.DrawFrame(-10e3, 0, 15.5e3, 600e-6) gx.Draw("lsame") gy.Draw("lsame") gPad.SetGrid() ut.invert_col(gPad) can.SaveAs("01fig.pdf")
def make_both(): lqmin = -11 lqmax = 5 ymax = 8.5 gQr = make_qr() gPy = make_py() gQr10x100 = make_qr_10x100() gQr5x41 = make_qr_5x41() can = ut.box_canvas() frame = gPad.DrawFrame(lqmin, 0, lqmax, ymax) frame.Draw() xtit = "log_{10}(#it{Q}^{2})" ytit = "#frac{d#it{#sigma}}{d(" + xtit + ")} (#mub/GeV^{2})" ut.put_yx_tit(frame, ytit, xtit, 1.6, 1.3) ut.set_margin_lbtr(gPad, 0.14, 0.1, 0.03, 0.02) gQr.Draw("lsame") gPy.Draw("lsame") gQr10x100.Draw("lsame") gQr5x41.Draw("lsame") leg = ut.prepare_leg(0.53, 0.83, 0.2, 0.1, 0.035) leg.AddEntry(gPy, "Pythia6", "l") leg.AddEntry(gQr, "Quasi-real photoproduction", "l") leg.AddEntry(gQr10x100, "Quasi-real 10x100", "l") leg.Draw("same") ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def drawrange(x, y, xtit="", ytit=""): if type(x) != type([]): if xtit == "": xtit = x.GetXaxis().GetTitle() x = [x.GetXaxis().GetBinLowEdge(1), x.GetXaxis().GetBinUpEdge(x.GetNbinsX())] ldrawn.append(gPad.DrawFrame(x[0], y[0], x[1], y[1], ";" + xtit + ";" + ytit)) ldrawn[-1].GetYaxis().CenterTitle()
def evt_Log10_Q2_ecal_compare(): #compare log_10(Q^2) from ecal for two separate inputs infile1 = "../data/ir6/lmon_pythia_5M_beff2_5Mevt_v2.root" #infile2 = "../data/ir6_close/lmon_pythia_5M_beff2_close_5Mevt.root" #infile2 = "../data/ir6/lmon_pythia_5M_beff2_1p5T_5Mevt.root" infile2 = "../data/ir6/lmon_pythia_5M_beff2_1p5T_5Mevt_v2.root" lqbin = 5e-2 lqmin = -2.5 lqmax = 2.5 inp1 = TFile.Open(infile1) inp2 = TFile.Open(infile2) tree1 = inp1.Get("DetectorTree") tree2 = inp2.Get("DetectorTree") hQ2ecal = ut.prepare_TH1D("hQ2ecal", lqbin, lqmin, lqmax) hQ2ecal_close = ut.prepare_TH1D("hQ2ecal_close", lqbin, lqmin, lqmax) tree1.Draw(gL10Q2 + " >> hQ2ecal", "ecal_IsHit==1") tree2.Draw(gL10Q2 + " >> hQ2ecal_close", "ecal_IsHit==1") print "All events:", hQ2ecal.GetEntries() #print "Selected :", hLog10Q2Tag.GetEntries() can = ut.box_canvas() frame = gPad.DrawFrame(lqmin, 10, lqmax, 1e5) frame.Draw() ytit = "Events / {0:.3f}".format(lqbin) ut.put_yx_tit(frame, ytit, "log_{10}(#it{Q}^{2})", 1.4, 1.2) ut.set_margin_lbtr(gPad, 0.1, 0.1, 0.03, 0.02) ut.line_h1(hQ2ecal, rt.kBlue, 3) ut.line_h1(hQ2ecal_close, rt.kRed, 3) #hQ2ecal.SetMinimum(10) gPad.SetLogy() gPad.SetGrid() hQ2ecal.Draw("e1same") hQ2ecal_close.Draw("e1same") #hLog10Q2.SetMaximum(2e5) # for qr leg = ut.prepare_leg(0.6, 0.83, 0.2, 0.1, 0.035) #leg.AddEntry(hLog10Q2, "All electrons from quasi-real photoproduction", "l") #leg.AddEntry(hLog10Q2, "All Pythia6 scattered electrons", "l") #leg.AddEntry(hLog10Q2Tag, "Electrons hitting the tagger", "l") leg.AddEntry(hQ2ecal, "Default geometry", "l") #leg.AddEntry(hQ2ecal_close, "Magnets in central det", "l") leg.AddEntry(hQ2ecal_close, "1.5T solenoid", "l") leg.Draw("same") #ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def eta(): #acceptance in electron polar angle as pi - theta in mrad i1 = "/home/jaroslav/sim/lmon/data/taggers/tag1a/hits_tag.root" i2 = "/home/jaroslav/sim/lmon/data/taggers/tag1ax1/hits_tag.root" #tag = ["s1_IsHit", "Tagger 1", 0.15] tag = ["s2_IsHit", "Tagger 2", 0.3] in1 = TFile.Open(i1) t1 = in1.Get("event") in2 = TFile.Open(i2) t2 = in2.Get("event") #eta xmin = -17 xmax = -3 a1 = rt.acc_Q2_kine(t1, "true_el_theta", tag[0]) a1.modif = 0 # eta from theta a1.prec = 0.01 a1.bmin = 0.1 #a1.nev = int(1e5) g1 = a1.get() a2 = rt.acc_Q2_kine(t2, "true_el_theta", tag[0]) a2.modif = 0 # eta from theta a2.prec = 0.01 a2.bmin = 0.1 #a2.nev = int(1e5) g2 = a2.get() can = ut.box_canvas() frame = gPad.DrawFrame(xmin, 0, xmax, tag[2]) ut.put_yx_tit(frame, "Tagger acceptance", "Electron pseudorapidity #it{#eta}", 1.6, 1.3) frame.Draw() ut.set_margin_lbtr(gPad, 0.11, 0.1, 0.03, 0.02) ut.set_graph(g1, rt.kRed) g1.Draw("psame") ut.set_graph(g2, rt.kBlue) g2.Draw("psame") gPad.SetGrid() leg = ut.prepare_leg(0.15, 0.8, 0.24, 0.14, 0.035) # x, y, dx, dy, tsiz leg.AddEntry("", tag[1], "") leg.AddEntry(g1, "Quasi-real photoproduction", "lp") leg.AddEntry(g2, "Pythia 6", "lp") leg.Draw("same") #ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def energy(): #acceptance in electron energy i1 = "/home/jaroslav/sim/lmon/data/taggers/tag1a/hits_tag.root" i2 = "/home/jaroslav/sim/lmon/data/taggers/tag1ax1/hits_tag.root" #tag = ["s1_IsHit", "Tagger 1", 2] tag = ["s2_IsHit", "Tagger 2", 11] in1 = TFile.Open(i1) t1 = in1.Get("event") in2 = TFile.Open(i2) t2 = in2.Get("event") #mrad xmin = tag[2] xmax = 19 amax = 0.9 a1 = rt.acc_Q2_kine(t1, "true_el_E", tag[0]) a1.prec = 0.05 a1.bmin = 0.1 #a1.nev = int(1e5) g1 = a1.get() a2 = rt.acc_Q2_kine(t2, "true_el_E", tag[0]) a2.prec = 0.05 a2.bmin = 0.1 #a2.nev = int(1e5) g2 = a2.get() can = ut.box_canvas() frame = gPad.DrawFrame(xmin, 0, xmax, amax) ut.put_yx_tit(frame, "Tagger acceptance", "Electron energy #it{E} (GeV)", 1.6, 1.3) frame.Draw() ut.set_margin_lbtr(gPad, 0.11, 0.1, 0.03, 0.02) ut.set_graph(g1, rt.kRed) g1.Draw("psame") ut.set_graph(g2, rt.kBlue) g2.Draw("psame") gPad.SetGrid() leg = ut.prepare_leg(0.15, 0.8, 0.24, 0.14, 0.035) # x, y, dx, dy, tsiz leg.AddEntry("", tag[1], "") leg.AddEntry(g1, "Quasi-real photoproduction", "lp") leg.AddEntry(g2, "Pythia 6", "lp") leg.Draw("same") #ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def acc_mlt_theta_s12(): #acceptance in electron polar angle as -log10(pi - theta) in mrad for tagger 1 and tagger 2 #inp = "/home/jaroslav/sim/lmon/data/taggers/tag1a/hits_tag.root" #inp = "/home/jaroslav/sim/lmon/data/taggers/tag1ax1/hits_tag.root" inp = "/home/jaroslav/sim/lmon/data/taggers/tag2a/hits_tag_10files.root" infile = TFile.Open(inp) tree = infile.Get("event") #mrad tmin = 1.5 tmax = 7.5 #amax = 0.3 amax = 1 as1 = rt.acc_Q2_kine(tree, "true_el_theta", "s1_IsHit") as1.modif = 3 # -log10(pi - theta) as1.prec = 0.05 as1.bmin = 0.1 #as1.nev = int(1e5) gs1 = as1.get() as2 = rt.acc_Q2_kine(tree, "true_el_theta", "s2_IsHit") as2.modif = 3 # -log10(pi - theta) as2.prec = 0.05 as2.bmin = 0.1 #as2.nev = int(1e5) gs2 = as2.get() can = ut.box_canvas() frame = gPad.DrawFrame(tmin, 0, tmax, amax) ut.put_yx_tit(frame, "Acceptance", "Electron -log_{10}(#pi - #it{#theta}_{e})", 1.6, 1.3) frame.Draw() ut.set_margin_lbtr(gPad, 0.11, 0.1, 0.03, 0.02) ut.set_graph(gs1, rt.kBlue) gs1.Draw("psame") ut.set_graph(gs2, rt.kRed) gs2.Draw("psame") gPad.SetGrid() #leg = ut.prepare_leg(0.15, 0.78, 0.24, 0.16, 0.035) # x, y, dx, dy, tsiz #leg.AddEntry(None, "Tagger 1", "") #leg.AddEntry(glQ2Py, "Pythia6", "l") #leg.AddEntry(glQ2Qr, "QR", "l") #leg.Draw("same") ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def acc_gap_both(): #acceptance in gap between taggers and ecal lqmin = -2.9 lqmax = -0.2 #lqmin = -8 #lqmax = 3 acc_py = acc_gap("../data/ir6/lmon_pythia_5M_beff2_5Mevt_v2.root", lqmin, lqmax) #acc_py = acc_gap("../data/ir6/lmon_pythia_5M_beff2_NoSol_5Mevt.root", lqmin, lqmax) #acc_py_close = acc_gap("../data/ir6_close/lmon_pythia_5M_beff2_close_5Mevt.root", -2.4, 0) #acc_py_close = acc_gap("../data/ir6/lmon_pythia_5M_beff2_1p5T_5Mevt.root", -2.9, -0.2) acc_py_close = acc_gap("../data/ir6/lmon_pythia_5M_beff2_1p5T_5Mevt_v2.root", lqmin, lqmax) #acc_py_close = acc_gap("../data/ir6/lmon_pythia_5M_beff2_5Mevt_v2.root", lqmin, lqmax) #acc_py_close = acc_gap("../data/ir6/lmon_pythia_5M_beff2_NoSol_5Mevt_v2.root", lqmin, lqmax) #acc_py_3 = acc_gap("../data/ir6/lmon_pythia_5M_beff2_NoSol_5Mevt.root", lqmin, lqmax) #make the plot can = ut.box_canvas() ut.set_graph(acc_py, rt.kBlue) ut.set_graph(acc_py_close, rt.kRed) #ut.set_graph(acc_py_3, rt.kGreen) #frame = gPad.DrawFrame(-3, 0, 0.1, 1.1) frame = gPad.DrawFrame(-3, 0.03, 0.1, 1.4) # for log scale #frame = gPad.DrawFrame(-10, 0, 4, 1.1) frame.Draw() #ytit = "Acceptance / {0:.1f} %".format(prec*100) ut.put_yx_tit(frame, "Acceptance", "log_{10}(#it{Q}^{2})", 1.6, 1.2) frame.Draw() ut.set_margin_lbtr(gPad, 0.11, 0.1, 0.03, 0.02) gPad.SetGrid() gPad.SetLogy() frame.GetYaxis().SetMoreLogLabels() acc_py.Draw("psame") acc_py_close.Draw("psame") #acc_py_3.Draw("psame") leg = ut.prepare_leg(0.2, 0.84, 0.2, 0.1, 0.035) #leg.AddEntry(acc_qr, "Quasi-real photoproduction", "lp") #leg.AddEntry(acc_py, "Pythia6", "lp") leg.AddEntry(acc_py, "Default geometry", "lp") #leg.AddEntry(acc_py_close, "Magnets in central det", "lp") leg.AddEntry(acc_py_close, "1.5T solenoid", "lp") #leg.AddEntry(acc_py_3, "No solenoid", "lp") leg.Draw("same") #ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def plot_dSigDe_all(): # dSigma / dEgamma over all energies, ZEUS parametrization parse = ConfigParser.RawConfigParser() parse.add_section("main") parse.set("main", "emin", "0.1") # GeV parse.set("main", "Ee", "18") parse.set("main", "Ep", "275") sig_top = gen_zeus(parse).dSigDe parse.set("main", "Ee", "10") parse.set("main", "Ep", "110") sig_mid = gen_zeus(parse).dSigDe parse.set("main", "Ee", "5") parse.set("main", "Ep", "41") sig_low = gen_zeus(parse).dSigDe gStyle.SetPadTickY(1) can = ut.box_canvas() frame = gPad.DrawFrame(0.1, 1, 19, 80) frame.Draw() ut.set_F1(sig_top) ut.set_F1(sig_mid, rt.kYellow + 1) ut.set_F1(sig_low, rt.kBlue) sig_top.Draw("same") sig_mid.Draw("same") sig_low.Draw("same") ytit = "d#sigma / d#it{E}_{#gamma} (mb/GeV)" xtit = "#it{E}_{#gamma} (GeV)" ut.put_yx_tit(frame, ytit, xtit, 1.6, 1.4) ut.set_margin_lbtr(gPad, 0.12, 0.1, 0.01, 0.01) frame.GetYaxis().SetMoreLogLabels() leg = ut.prepare_leg(0.65, 0.77, 0.24, 0.16, 0.035) # x, y, dx, dy, tsiz leg.AddEntry(sig_top, "18 #times 275 GeV", "l") leg.AddEntry(sig_mid, "10 #times 100 GeV", "l") leg.AddEntry(sig_low, "5 #times 41 GeV", "l") leg.Draw("same") gPad.SetLogy() gPad.SetGrid() ut.invert_col(gPad) can.SaveAs("01fig.pdf")
def acc_eta_s2(): #Tagger 2 pseudorapidity emin = -17 emax = -3 amax = 0.3 acc_qr = rt.acc_Q2_kine(tree_qr, "true_el_theta", "lowQ2s2_IsHit") acc_qr.modif = 0 # eta from theta acc_qr.prec = 0.01 acc_qr.bmin = 0.1 #acc_qr.nev = int(1e5) gEtaQr = acc_qr.get() #gprint(gPtQr) acc_py = rt.acc_Q2_kine(tree_py, "true_el_theta", "lowQ2s2_IsHit") acc_py.modif = 0 acc_py.prec = 0.01 acc_py.bmin = 0.1 #acc_py.nev = int(1e5) gEtaPy = acc_py.get() can = ut.box_canvas() frame = gPad.DrawFrame(emin, 0, emax, amax) #ytit = "Acceptance / {0:.1f} %".format(acc_qr.prec*100) ut.put_yx_tit(frame, "Acceptance", "Electron pseudorapidity #eta", 1.6, 1.3) frame.Draw() ut.set_margin_lbtr(gPad, 0.11, 0.1, 0.03, 0.02) ut.set_graph(gEtaQr, rt.kRed) gEtaQr.Draw("psame") ut.set_graph(gEtaPy, rt.kBlue) gEtaPy.Draw("psame") gPad.SetGrid() leg = ut.prepare_leg(0.15, 0.78, 0.24, 0.16, 0.035) # x, y, dx, dy, tsiz leg.AddEntry(None, "Tagger 2", "") leg.AddEntry(gEtaPy, "Pythia6", "l") leg.AddEntry(gEtaQr, "QR", "l") leg.Draw("same") #ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def acc_eta_s12(): #acceptance in electron pseudorapidity for tagger 1 and tagger 2 inp = "/home/jaroslav/sim/lmon/data/taggers/tag1a/hits_tag.root" infile = TFile.Open(inp) tree = infile.Get("event") emin = -17 emax = -3 amax = 0.3 as1 = rt.acc_Q2_kine(tree, "true_el_theta", "s1_IsHit") as1.modif = 0 # eta from theta as1.prec = 0.01 as1.bmin = 0.1 #as1.nev = int(1e5) gs1 = as1.get() as2 = rt.acc_Q2_kine(tree, "true_el_theta", "s2_IsHit") as2.modif = 0 # eta from theta as2.prec = 0.01 as2.bmin = 0.1 #as2.nev = int(1e5) gs2 = as2.get() can = ut.box_canvas() frame = gPad.DrawFrame(emin, 0, emax, amax) ut.put_yx_tit(frame, "Acceptance", "Electron pseudorapidity #eta", 1.6, 1.3) frame.Draw() ut.set_margin_lbtr(gPad, 0.11, 0.1, 0.03, 0.02) ut.set_graph(gs1, rt.kBlue) gs1.Draw("psame") ut.set_graph(gs2, rt.kRed) gs2.Draw("psame") gPad.SetGrid() #leg = ut.prepare_leg(0.15, 0.78, 0.24, 0.16, 0.035) # x, y, dx, dy, tsiz #leg.AddEntry(None, "Tagger 1", "") #leg.AddEntry(glQ2Py, "Pythia6", "l") #leg.AddEntry(glQ2Qr, "QR", "l") #leg.Draw("same") ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def el_eta_beff(): #electron pseudorapidity eta and angular divergence xbin = 0.1 xmin = -20 xmax = 10 qrpy = 0 if qrpy == 0: tree = tree_qr lab_data = "QR" col = rt.kBlue else: tree = tree_py lab_data = "Pythia6" col = rt.kRed can = ut.box_canvas() hE = ut.prepare_TH1D("hE", xbin, xmin, xmax) hB = ut.prepare_TH1D("hB", xbin, xmin, xmax) form = "-TMath::Log(TMath::Tan(true_el_theta/2.))" form2 = "-TMath::Log(TMath::Tan(el_theta/2.))" tree.Draw(form + " >> hE") tree.Draw(form2 + " >> hB") ut.line_h1(hE, col) ut.line_h1(hB, rt.kViolet) vmax = hB.GetMaximum() + 0.1 * hB.GetMaximum() frame = gPad.DrawFrame(xmin, 0.5, xmax, vmax) ut.put_yx_tit(frame, "Counts", "Electron #eta", 1.6, 1.3) frame.Draw() ut.set_margin_lbtr(gPad, 0.11, 0.1, 0.05, 0.02) gPad.SetGrid() #gPad.SetLogy() hB.Draw("same") hE.Draw("same") leg = ut.prepare_leg(0.56, 0.8, 0.24, 0.12, 0.035) # x, y, dx, dy, tsiz leg.AddEntry(hE, lab_data + ", no divergence", "l") leg.AddEntry(hB, "Divergence included", "l") leg.Draw("same") #ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def el_theta_beff(): #electron polar angle theta and effect of angular divergence xbin = 5e-5 #xmin = TMath.Pi() - 2.2e-2 xmin = 3.13 xmax = TMath.Pi() + 0.2e-2 qrpy = 0 if qrpy == 0: tree = tree_qr lab_data = "QR" col = rt.kBlue else: tree = tree_py lab_data = "Pythia6" col = rt.kRed can = ut.box_canvas() hT = ut.prepare_TH1D("hT", xbin, xmin, xmax) hB = ut.prepare_TH1D("hB", xbin, xmin, xmax) tree.Draw("true_el_theta >> hT") tree.Draw("el_theta >> hB") ut.line_h1(hT, col) ut.line_h1(hB, rt.kViolet) vmax = hT.GetMaximum() + 0.4 * hT.GetMaximum() frame = gPad.DrawFrame(xmin, 1e3, xmax, vmax) ut.put_yx_tit(frame, "Counts", "Electron #theta (rad)", 1.6, 1.3) frame.Draw() ut.set_margin_lbtr(gPad, 0.11, 0.1, 0.03, 0.02) gPad.SetGrid() gPad.SetLogy() hB.Draw("same") hT.Draw("same") leg = ut.prepare_leg(0.14, 0.8, 0.24, 0.12, 0.035) # x, y, dx, dy, tsiz leg.AddEntry(hT, lab_data + ", no divergence", "l") leg.AddEntry(hB, "Divergence included", "l") leg.Draw("same") #ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def acc_theta_s12(): #acceptance in electron polar angle for tagger 1 and tagger 2 inp = "/home/jaroslav/sim/lmon/data/taggers/tag1a/hits_tag.root" #inp = "/home/jaroslav/sim/lmon/data/taggers/tag1ax1/hits_tag.root" infile = TFile.Open(inp) tree = infile.Get("event") tmin = TMath.Pi() - 1.1e-2 tmax = TMath.Pi() + 1e-3 #amax = 0.25 amax = 0.4 as1 = rt.acc_Q2_kine(tree, "true_el_theta", "s1_IsHit") as1.prec = 0.1 as1.bmin = 2e-4 #as1.nev = int(1e5) gs1 = as1.get() as2 = rt.acc_Q2_kine(tree, "true_el_theta", "s2_IsHit") as2.prec = 0.1 as2.bmin = 2e-4 #as2.nev = int(1e5) gs2 = as2.get() can = ut.box_canvas() frame = gPad.DrawFrame(tmin, 0, tmax, amax) ut.put_yx_tit(frame, "Tagger acceptance", "Electron polar angle #it{#theta} (rad)", 1.6, 1.3) frame.Draw() ut.set_margin_lbtr(gPad, 0.11, 0.1, 0.03, 0.02) ut.set_graph(gs1, rt.kRed) gs1.Draw("psame") ut.set_graph(gs2, rt.kBlue) gs2.Draw("psame") gPad.SetGrid() leg = ut.prepare_leg(0.15, 0.82, 0.24, 0.12, 0.035) # x, y, dx, dy, tsiz leg.AddEntry(gs1, "Tagger 1", "lp") leg.AddEntry(gs2, "Tagger 2", "lp") leg.Draw("same") ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def acc_en_s1(): #Tagger 1 energy emin = 0 emax = 15 amax = 1 acc_qr = rt.acc_Q2_kine(tree_qr, "true_el_E", "lowQ2s1_IsHit") acc_qr.prec = 0.05 acc_qr.bmin = 0.1 #acc_qr.nev = int(1e5) gEnQr = acc_qr.get() #gprint(gPtQr) acc_py = rt.acc_Q2_kine(tree_py, "true_el_E", "lowQ2s1_IsHit") acc_py.prec = 0.05 acc_py.bmin = 0.1 #acc_py.nev = int(1e5) gEnPy = acc_py.get() can = ut.box_canvas() frame = gPad.DrawFrame(emin, 0, emax, amax) #ytit = "Acceptance / {0:.1f} %".format(acc_qr.prec*100) ut.put_yx_tit(frame, "Acceptance", "Electron energy #it{E} (GeV)", 1.6, 1.3) frame.Draw() ut.set_margin_lbtr(gPad, 0.11, 0.1, 0.03, 0.02) ut.set_graph(gEnQr, rt.kRed) gEnQr.Draw("psame") ut.set_graph(gEnPy, rt.kBlue) gEnPy.Draw("psame") gPad.SetGrid() leg = ut.prepare_leg(0.15, 0.78, 0.24, 0.16, 0.035) # x, y, dx, dy, tsiz leg.AddEntry(None, "Tagger 1", "") leg.AddEntry(gEnPy, "Pythia6", "l") leg.AddEntry(gEnQr, "QR", "l") leg.Draw("same") ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def el_phi_beff(): #electron azimuthal angle phi xbin = 3e-2 xmin = -TMath.Pi() - 0.3 xmax = TMath.Pi() + 0.3 qrpy = 0 if qrpy == 0: tree = tree_qr lab_data = "QR" col = rt.kBlue else: tree = tree_py lab_data = "Pythia6" col = rt.kRed can = ut.box_canvas() hP = ut.prepare_TH1D("hP", xbin, xmin, xmax) hB = ut.prepare_TH1D("hB", xbin, xmin, xmax) tree.Draw("true_el_phi >> hP") tree.Draw("el_phi >> hB") ut.line_h1(hP, col) ut.line_h1(hB, rt.kViolet) vmax = hP.GetMaximum() + 0.5 * hP.GetMaximum() frame = gPad.DrawFrame(xmin, 0.5, xmax, vmax) ut.put_yx_tit(frame, "Counts", "Electron #phi (rad)", 1.6, 1.3) frame.Draw() ut.set_margin_lbtr(gPad, 0.11, 0.1, 0.05, 0.02) gPad.SetGrid() #gPad.SetLogy() hB.Draw("same") hP.Draw("same") leg = ut.prepare_leg(0.55, 0.8, 0.24, 0.12, 0.035) # x, y, dx, dy, tsiz leg.AddEntry(hP, lab_data + ", no divergence", "l") leg.AddEntry(hB, "Divergence included", "l") leg.Draw("same") #ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def acc_phi_s2(): #Tagger 2 phi pmin = -TMath.Pi() - 0.3 pmax = TMath.Pi() + 0.3 amax = 0.3 acc_qr = rt.acc_Q2_kine(tree_qr, "true_el_phi", "lowQ2s2_IsHit") acc_qr.prec = 0.01 #acc_qr.bmin = 2e-4 #acc_qr.nev = int(1e5) gPhiQr = acc_qr.get() #gprint(gPtQr) acc_py = rt.acc_Q2_kine(tree_py, "true_el_phi", "lowQ2s2_IsHit") acc_py.prec = 0.01 #acc_py.bmin = 2e-4 #acc_py.nev = int(1e4) gPhiPy = acc_py.get() can = ut.box_canvas() frame = gPad.DrawFrame(pmin, 0, pmax, amax) #ytit = "Acceptance / {0:.1f} %".format(acc_qr.prec*100) ut.put_yx_tit(frame, "Acceptance", "Electron azimuthal angle #phi (rad)", 1.6, 1.3) frame.Draw() ut.set_margin_lbtr(gPad, 0.11, 0.1, 0.03, 0.02) ut.set_graph(gPhiQr, rt.kRed) gPhiQr.Draw("psame") ut.set_graph(gPhiPy, rt.kBlue) gPhiPy.Draw("psame") gPad.SetGrid() leg = ut.prepare_leg(0.72, 0.78, 0.24, 0.16, 0.035) # x, y, dx, dy, tsiz leg.AddEntry(None, "Tagger 2", "") leg.AddEntry(gPhiPy, "Pythia6", "l") leg.AddEntry(gPhiQr, "QR", "l") leg.Draw("same") #ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def conv_theta(): #conversion probablity as a function of polar angle theta tbin = 2e-4 tmin = 0 tmax = 2.5e-3 prec = 0.01 delt = 1e-6 gROOT.LoadMacro("get_ew_conv.C") #hEffV1 = rt.get_ew_conv(tree_v1, "phot_theta", "ew_conv", prec, delt, -1., TMath.Pi()) hEffV2 = rt.get_ew_conv(tree_v2, "phot_theta", "ew_conv", prec, delt, -1., TMath.Pi()) #hEffV1 = get_eff(tree_v1, "TMath::Pi()-phot_theta", "ew_conv", tbin, tmin, tmax) #hEffV2 = get_eff(tree_v2, "TMath::Pi()-phot_theta", "ew_conv", tbin, tmin, tmax) #ut.set_graph(hEffV1, rt.kBlue) #ut.set_graph(hEffV2, rt.kRed, rt.kFullTriangleUp) #hEffV2.SetMarkerSize(1.5) ut.set_graph(hEffV2) #plot the probability can = ut.box_canvas() frame = gPad.DrawFrame(tmin, 0.065, tmax, 0.095) frame.SetXTitle("Generated #vartheta (rad)") frame.SetYTitle("Conversion probability") frame.SetTitleOffset(2.1, "Y") frame.SetTitleOffset(1.5, "X") ut.set_margin_lbtr(gPad, 0.14, 0.11, 0.02, 0.01) frame.Draw() #hEffV1.Draw("psame") hEffV2.Draw("psame") leg = ut.prepare_leg(0.2, 0.84, 0.2, 0.1, 0.035) #leg.AddEntry(hEffV1, "Tilted plane", "lp") leg.AddEntry(hEffV2, "Half-cylinder", "lp") #leg.Draw("same") gPad.SetLogx() #ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def acc_theta_s1(): tmin = TMath.Pi() - 2.1e-2 tmax = TMath.Pi() + 0.5e-2 amax = 0.08 acc_qr = rt.acc_Q2_kine(tree_qr, "true_el_theta", "lowQ2s1_IsHit") acc_qr.prec = 0.05 acc_qr.bmin = 2e-4 #acc_qr.nev = int(1e5) gThetaQr = acc_qr.get() #gprint(gPtQr) acc_py = rt.acc_Q2_kine(tree_py, "true_el_theta", "lowQ2s1_IsHit") acc_py.prec = 0.05 acc_py.bmin = 2e-4 #acc_py.nev = int(1e4) gThetaPy = acc_py.get() can = ut.box_canvas() frame = gPad.DrawFrame(tmin, 0, tmax, amax) #ytit = "Acceptance / {0:.1f} %".format(acc_qr.prec*100) ut.put_yx_tit(frame, "Acceptance", "Electron polar angle #theta (rad)", 1.6, 1.3) frame.Draw() ut.set_margin_lbtr(gPad, 0.11, 0.1, 0.03, 0.02) ut.set_graph(gThetaQr, rt.kRed) gThetaQr.Draw("psame") ut.set_graph(gThetaPy, rt.kBlue) gThetaPy.Draw("psame") gPad.SetGrid() leg = ut.prepare_leg(0.15, 0.78, 0.24, 0.16, 0.035) # x, y, dx, dy, tsiz leg.AddEntry(None, "Tagger 1", "") leg.AddEntry(gThetaPy, "Pythia6", "l") leg.AddEntry(gThetaQr, "QR", "l") leg.Draw("same") ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def acc_lQ2_s2(): #Tagger 2 log_10(Q^2) lQ2min = -10 lQ2max = 0 amax = 0.3 acc_qr = rt.acc_Q2_kine(tree_qr, "true_Q2", "lowQ2s2_IsHit") acc_qr.modif = 1 # log_10(Q^2) from Q2 acc_qr.prec = 0.05 acc_qr.bmin = 0.1 #acc_qr.nev = int(1e5) glQ2Qr = acc_qr.get() acc_py = rt.acc_Q2_kine(tree_py, "true_Q2", "lowQ2s2_IsHit") acc_py.modif = 1 acc_py.prec = 0.05 acc_py.bmin = 0.1 #acc_py.nev = int(1e5) glQ2Py = acc_py.get() can = ut.box_canvas() frame = gPad.DrawFrame(lQ2min, 0, lQ2max, amax) ut.put_yx_tit(frame, "Acceptance", "Virtuality log_{10}(#it{Q}^{2}) (GeV)", 1.6, 1.3) frame.Draw() ut.set_margin_lbtr(gPad, 0.11, 0.1, 0.03, 0.02) ut.set_graph(glQ2Qr, rt.kRed) glQ2Qr.Draw("psame") ut.set_graph(glQ2Py, rt.kBlue) glQ2Py.Draw("psame") gPad.SetGrid() leg = ut.prepare_leg(0.15, 0.78, 0.24, 0.16, 0.035) # x, y, dx, dy, tsiz leg.AddEntry(None, "Tagger 2", "") leg.AddEntry(glQ2Py, "Pythia6", "l") leg.AddEntry(glQ2Qr, "QR", "l") leg.Draw("same") ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def conv_phi(): #conversion probablity as a function of azimuthal angle phi pbin = 0.4 pmin = -TMath.Pi() - 0.3 pmax = TMath.Pi() + 0.3 prec = 0.01 delt = 1e-6 gROOT.LoadMacro("get_ew_conv.C") #hEffV1 = rt.get_ew_conv(tree_v1, "phot_phi", "ew_conv", prec, delt) hEffV2 = rt.get_ew_conv(tree_v2, "phot_phi", "ew_conv", prec, delt) #hEffV1 = get_eff(tree_v1, "phot_phi", "ew_conv", pbin, pmin, pmax) #hEffV2 = get_eff(tree_v2, "phot_phi", "ew_conv", pbin, pmin, pmax) #ut.set_graph(hEffV1, rt.kBlue) #ut.set_graph(hEffV2, rt.kRed, rt.kFullTriangleUp) #hEffV2.SetMarkerSize(1.5) ut.set_graph(hEffV2) #plot the probability can = ut.box_canvas() #frame = gPad.DrawFrame(pmin, 0.075, pmax, 0.087) frame = gPad.DrawFrame(pmin, 0.065, pmax, 0.095) frame.SetXTitle("Generated #phi (rad)") frame.SetYTitle("Conversion probability") frame.SetTitleOffset(2.1, "Y") frame.SetTitleOffset(1.2, "X") ut.set_margin_lbtr(gPad, 0.14, 0.09, 0.02, 0.01) frame.Draw() #hEffV1.Draw("psame") hEffV2.Draw("psame") leg = ut.prepare_leg(0.2, 0.84, 0.2, 0.1, 0.035) #leg.AddEntry(hEffV1, "Tilted plane", "lp") leg.AddEntry(hEffV2, "Half-cylinder", "lp") #leg.Draw("same") #ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def sigma_en(): #cross section as a function of electron energy emin = 0 # GeV emax = 24 smin = 1e-4 smax = 1e3 # mb ebin = 0.2 basedir = "/home/jaroslav/sim/GETaLM_data" g1 = make_sigma(basedir+"/lumi/lumi_18x275_Lif_emin0p5_T3p3_10Mevt.root", "true_el_E", 0.1, emin, emax, 171.3) g2 = make_sigma(basedir+"/qr/qr_18x275_T3p3_5Mevt.root", "true_el_E", ebin, emin, emax, 0.053) g3 = make_sigma(basedir+"/py/pythia_ep_18x275_Q2all_beff2_5Mevt.root", "true_el_E", ebin, emin, emax, 0.055) can = ut.box_canvas() frame = gPad.DrawFrame(emin, smin, emax, smax) frame.Draw() xtit = "#it{E_{e}}' (GeV)" ytit = "#frac{d#it{#sigma}}{d#it{E_{e}}'} (mb/GeV)" ut.put_yx_tit(frame, ytit, xtit, 1.6, 1.3) ut.set_margin_lbtr(gPad, 0.14, 0.1, 0.02, 0.02) g1.SetLineColor(rt.kBlue) g2.SetLineColor(rt.kRed) g3.SetLineColor(rt.kGreen+1) g3.SetLineStyle(rt.kDashed) g1.Draw("lsame") g2.Draw("lsame") g3.Draw("lsame") gPad.SetLogy() gPad.SetGrid() leg = ut.prepare_leg(0.2, 0.75, 0.24, 0.15, 0.035) # x, y, dx, dy, tsiz leg.AddEntry(g1, "Bremsstrahlung", "l") leg.AddEntry(g2, "Quasi-real", "l") leg.AddEntry(g3, "Pythia6", "l") leg.Draw("same") #ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def plot_dSigDe(): # dSigma / dEgamma according to ZEUS parametrization parse = ConfigParser.RawConfigParser() parse.add_section("main") parse.set("main", "emin", "6") parse.set("main", "Ee", "18") parse.set("main", "Ep", "275") gen = gen_zeus(parse) sig = gen.dSigDe gStyle.SetPadTickY(1) can = ut.box_canvas() #frame = gPad.DrawFrame(6, 0, 29, 6) frame = gPad.DrawFrame(5, 0, 19, 7.2) sig.SetLineWidth(3) sig.SetNpx(1000) sig.SetTitle("") sig.Draw("same") frame.GetXaxis().SetTitle("#it{E}_{#gamma} (GeV)") frame.GetYaxis().SetTitle("d#sigma / d#it{E}_{#gamma} (mb/GeV)") frame.GetYaxis().SetTitleOffset(1.1) frame.GetXaxis().SetTitleOffset(1.3) frame.SetTickLength(0.015, "X") frame.SetTickLength(0.015, "Y") gPad.SetTopMargin(0.02) gPad.SetRightMargin(0.01) gPad.SetLeftMargin(0.09) leg = ut.prepare_leg(0.65, 0.73, 0.24, 0.2, 0.035) # x, y, dx, dy, tsiz leg.AddEntry(sig, "#frac{d#sigma}{d#it{E}_{#gamma}}", "l") leg.AddEntry(None, "", "") #leg.AddEntry(None, "#it{E}_{e} = 27.6 GeV", "") #leg.AddEntry(None, "#it{E}_{p} = 920 GeV", "") leg.AddEntry(None, "#it{E}_{e} = 18 GeV", "") leg.AddEntry(None, "#it{E}_{p} = 275 GeV", "") leg.Draw("same") ut.invert_col(gPad) can.SaveAs("01fig.pdf")
def sigma_pitheta(): #cross section as a function of electron scattering angle as pi - theta in mrad tmin = 0 # mrad tmax = 25 smin = 1e-4 smax = 2e3 # mb basedir = "/home/jaroslav/sim/GETaLM_data" form = "(TMath::Pi()-true_el_theta)*1e3" g1 = make_sigma_2(basedir+"/lumi/lumi_18x275_Lif_emin0p5_T3p3_10Mevt.root", form, 0.2, tmin, tmax, 171.3, 5, 1.2) g2 = make_sigma(basedir+"/qr/qr_18x275_T3p3_5Mevt.root", form, 0.2, tmin, tmax, 0.053) g3 = make_sigma(basedir+"/py/pythia_ep_18x275_Q2all_beff2_5Mevt.root", form, 0.2, tmin, tmax, 0.055) can = ut.box_canvas() frame = gPad.DrawFrame(tmin, smin, tmax, smax) frame.Draw() xtit = "#it{#pi - #theta_{e}}' (mrad)" ytit = "#frac{d#it{#sigma}}{d#it{#theta_{e}}'} (mb/mrad)" ut.put_yx_tit(frame, ytit, xtit, 1.6, 1.3) ut.set_margin_lbtr(gPad, 0.14, 0.1, 0.02, 0.02) g1.SetLineColor(rt.kBlue) g2.SetLineColor(rt.kRed) g3.SetLineColor(rt.kGreen+1) g3.SetLineStyle(rt.kDashed) g1.Draw("lsame") g2.Draw("lsame") g3.Draw("lsame") leg = ut.prepare_leg(0.6, 0.75, 0.24, 0.15, 0.035) # x, y, dx, dy, tsiz leg.AddEntry(g1, "Bremsstrahlung", "l") leg.AddEntry(g2, "Quasi-real", "l") leg.AddEntry(g3, "Pythia6", "l") leg.Draw("same") gPad.SetLogy() gPad.SetGrid() #ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def make_all_E(): lqmin = -11 lqmax = 5 smax = 7.5 basedir = "/home/jaroslav/sim/lgen/data" #sigma in micro barn #g18x275 = make_sigma(basedir+"/lgen_18x275_qr_Qe_beff2_5Mevt.root", 55.1) #g10x100 = make_sigma(basedir+"/lgen_10x100_qr_5Mevt.root", 44.8) #g5x41 = make_sigma(basedir+"/lgen_5x41_qr_5Mevt.root", 33.4) g18x275 = make_sigma(basedir+"/lgen_py_18x275_Q2all_5Mevt.root", 54.7) g10x100 = make_sigma(basedir+"/lgen_py_10x100_Q2all_5Mevt.root", 40.9) g5x41 = make_sigma(basedir+"/lgen_py_5x41_Q2all_5Mevt.root", 28.4) can = ut.box_canvas() frame = gPad.DrawFrame(lqmin, 0, lqmax, smax) frame.Draw() xtit = "log_{10}(#it{Q}^{2})" ytit = "#frac{d#it{#sigma}}{d("+xtit+")} (#mub/GeV^{2})" ut.put_yx_tit(frame, ytit, xtit, 1.6, 1.3) ut.set_margin_lbtr(gPad, 0.14, 0.1, 0.01, 0.01) g18x275.SetLineColor(rt.kRed) g10x100.SetLineColor(rt.kYellow+1) g5x41.SetLineColor(rt.kBlue) g18x275.Draw("lsame") g10x100.Draw("lsame") g5x41.Draw("lsame") leg = ut.prepare_leg(0.72, 0.8, 0.24, 0.16, 0.035) # x, y, dx, dy, tsiz leg.AddEntry(g18x275, "18 #times 275 GeV", "l") leg.AddEntry(g10x100, "10 #times 100 GeV", "l") leg.AddEntry(g5x41, "5 #times 41 GeV", "l") leg.Draw("same") gPad.SetGrid() ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def acc_pT_s2(): ptmin = 0 ptmax = 0.25 amax = 0.25 acc_qr = rt.acc_Q2_kine(tree_qr, "true_el_pT", "lowQ2s2_IsHit") acc_qr.prec = 0.05 acc_qr.bmin = 0.003 #acc_qr.nev = int(1e5) gPtQr = acc_qr.get() acc_py = rt.acc_Q2_kine(tree_py, "true_el_pT", "lowQ2s2_IsHit") acc_py.prec = 0.05 acc_py.bmin = 0.003 #acc_py.nev = int(1e4) gPtPy = acc_py.get() can = ut.box_canvas() frame = gPad.DrawFrame(ptmin, 0, ptmax, amax) #ytit = "Acceptance / {0:.1f} %".format(acc_qr.prec*100) ut.put_yx_tit(frame, "Acceptance", "Electron #it{p}_{T} (GeV)", 1.6, 1.3) frame.Draw() ut.set_margin_lbtr(gPad, 0.11, 0.1, 0.03, 0.05) ut.set_graph(gPtQr, rt.kRed) gPtQr.Draw("psame") ut.set_graph(gPtPy, rt.kBlue) gPtPy.Draw("psame") gPad.SetGrid() leg = ut.prepare_leg(0.72, 0.78, 0.24, 0.16, 0.035) # x, y, dx, dy, tsiz leg.AddEntry(None, "Tagger 2", "") leg.AddEntry(gPtPy, "Pythia6", "l") leg.AddEntry(gPtQr, "QR", "l") leg.Draw("same") #ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def conv_prob_en(): #conversion probability as a function of photon energy #plot range emin = 0 emax = 19 pmin = 0.05 pmax = 0.1 #pmax = 1 inp = TFile.Open("ew.root") tree = inp.Get("conv_tree") prec = 0.01 calc = rt.conv_calc(prec, 1e-6) calc.set_tree(tree) #calc.nev = 300000 conv = calc.get_conv() calc.release_tree() #calc.conv_in_all = True #calc.clean_in_sel = True #clean = calc.get_conv() can = ut.box_canvas() frame = gPad.DrawFrame(emin, pmin, emax, pmax) ut.put_yx_tit(frame, "Conversion probability", "#it{E}_{#gamma} (GeV)", 1.8) ut.set_margin_lbtr(gPad, 0.12, 0.09, 0.02, 0.01) frame.Draw() gPad.SetGrid() ut.set_graph(conv, rt.kBlue) conv.Draw("psame") #ut.set_graph(clean, rt.kRed) #clean.Draw("psame") ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def pressure_func(): gen = make_gen() #pressure function pf = gen.pressure_func ut.set_F1(pf, rt.kBlue) can = ut.box_canvas() frame = gPad.DrawFrame(-5.5e3, 0, 15.5e3, 7e-9) pf.Draw("same") gPad.SetGrid() ut.invert_col(gPad) can.SaveAs("01fig.pdf")