def plot_zdc_2d(): #ZDC ADC counts east vs. west 2D zbin = 18 zmin = 10 zmax = 700 znam = ["jZDCUnAttEast", "jZDCUnAttWest"] xtit = ["FastZDC East ADC", "FastZDC West ADC"] can = ut.box_canvas() hZdc = ut.prepare_TH2D("hZdc", zbin, zmin, zmax, zbin, zmin, zmax) tree.Draw(znam[1] + ":" + znam[0] + " >> hZdc") ut.put_yx_tit(hZdc, xtit[1], xtit[0], 1.7, 1.2) ut.set_margin_lbtr(gPad, 0.12, 0.09, 0.02, 0.11) hZdc.SetMinimum(0.98) hZdc.SetContour(300) hZdc.Draw() gPad.SetGrid() gPad.SetLogz() ut.invert_col(gPad) can.SaveAs("01fig.pdf")
def gen_xy(): #distribution of x and y xbin = 2e-9 xmin = 8e-14 xmax = 2e-4 ybin = 1e-2 ymin = 0.06 ymax = 1.1 hXY = ut.prepare_TH2D("hXY", xbin, xmin, xmax, ybin, ymin, ymax) tree.Draw("gen_y:gen_x >> hXY") can = ut.box_canvas() ut.put_yx_tit(hXY, "#it{y}", "#it{x}", 1.4, 1.2) hXY.Draw() gPad.SetLogx() gPad.SetLogz() ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def gen_ys(): #CM energy s * generated y as input to gamma-p total cross section sqrt_s = 28.6 # GeV #ys range ysbin = 0.1 ysmin = 0 ysmax = 30 hYS = ut.prepare_TH1D("hYS", ysbin, ysmin, ysmax) tree.Draw("true_y*" + str(sqrt_s) + " >> hYS") can = ut.box_canvas() ut.put_yx_tit(hYS, "Events", "#ys (GeV^{2})", 1.4, 1.2) hYS.Draw() gPad.SetLogy() ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def gen_Q2_theta(): #Q^2 relative to theta qbin = 1e-3 #qmin = 1e-5 qmin = 0 qmax = 0.45 tbin = 5e-4 tmin = 0 tmax = 0.04 hQ2theta = ut.prepare_TH2D("hQ2theta", tbin, tmin, tmax, qbin, qmin, qmax) tree.Draw("true_Q2:gen_theta >> hQ2theta") can = ut.box_canvas() ut.put_yx_tit(hQ2theta, "#it{Q}^{2}", "#theta (rad)", 1.4, 1.2) hQ2theta.Draw() #gPad.SetLogx() gPad.SetLogz() ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def gen_Log10x_y(): #distribution of log_10(x) and y xbin = 0.01 xmin = -13.5 xmax = -3.5 ybin = 5e-5 #ymin = 0.06 ymin = 0 ymax = 1.1 hXY = ut.prepare_TH2D("hXY", xbin, xmin, xmax, ybin, ymin, ymax) can = ut.box_canvas() tree.Draw("gen_y:TMath::Log10(gen_x) >> hXY") #tree.Draw("gen_y:gen_u >> hXY") ytit = "#it{y}" + " / {0:.3f}".format(ybin) xtit = "log_{10}(x)" + " / {0:.3f}".format(xbin) ut.put_yx_tit(hXY, ytit, xtit, 1.4, 1.4) ut.set_margin_lbtr(gPad, 0.1, 0.11, 0.03, 0.12) hXY.Draw() gPad.SetLogy() gPad.SetLogz() ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def gen_E(): #electron energy ebin = 0.01 emin = 0 emax = 20 hE = ut.prepare_TH1D("hE", ebin, emin, emax) #tree.Draw("gen_E >> hE") tree.Draw("true_el_E >> hE") can = ut.box_canvas() ut.put_yx_tit(hE, "Events", "#it{E'}", 1.4, 1.2) hE.Draw() gPad.SetLogy() gPad.SetGrid() ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def gen_theta(): #electron polar angle theta #theta range, rad tbin = 1e-3 #tmin = 0 #tmax = 0.2 tmin = 2.9 tmax = 3.15 hTheta = ut.prepare_TH1D("hTheta", tbin, tmin, tmax) #tree.Draw("TMath::Pi()-true_el_theta >> hTheta") tree.Draw("true_el_theta >> hTheta") can = ut.box_canvas() ut.put_yx_tit(hTheta, "Events", "#theta (rad)", 1.4, 1.2) hTheta.Draw() gPad.SetLogy() gPad.SetGrid() ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def gen_mlt(): #electron mlt = -log_10(pi-true_el_theta) #mlt range tbin = 0.1 tmin = -2 tmax = 8 hT = ut.prepare_TH1D("hT", tbin, tmin, tmax) can = ut.box_canvas() form = "-TMath::Log10(TMath::Pi()-true_el_theta)" tree.Draw(form + " >> hT") ut.put_yx_tit(hT, "Events", "mlt", 1.4, 1.2) hT.Draw() gPad.SetLogy() gPad.SetGrid() ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def gen_Log10_Q2(): #plot the log_10(Q^2) lqbin = 0.02 lqmin = -11 lqmax = 6 hLog10Q2 = ut.prepare_TH1D("hLog10Q2", lqbin, lqmin, lqmax) tree.Draw("TMath::Log10(true_Q2) >> hLog10Q2") #tree.Draw("TMath::Log10(gen_el_Q2) >> hLog10Q2") can = ut.box_canvas() gPad.SetGrid() ut.put_yx_tit(hLog10Q2, "Events", "log_{10}(#it{Q}^{2})", 1.4, 1.2) gPad.SetLogy() hLog10Q2.Draw() ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def gen_y(): #rapidity from Starlight #rapidity range nbin = 200 ymin = -6 ymax = 6 hY = ut.prepare_TH1D_n("hY", nbin, ymin, ymax) hYsl = ut.prepare_TH1D_n("hYsl", nbin, ymin, ymax) can = ut.box_canvas() tree.Draw("rapidity >> hY", "", "", 100000) tree_sl.Draw("VMrapidity >> hYsl", "", "", 100000) ut.line_h1(hYsl) ut.put_yx_tit(hY, "Events", "y", 1.4, 1.2) hY.Draw() hYsl.Draw("same") gPad.SetGrid() ut.invert_col(rt.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 neut_eta(): #neutron pseudorapidity etabin = 0.05 etamin = -20 etamax = 20 hEta = ut.prepare_TH1D("hEta", etabin, etamin, etamax) can = ut.box_canvas() particles = TClonesArray("TParticle", 200) tree.SetBranchAddress("particles", particles) nev = tree.GetEntriesFast() #nev = 24 for iev in xrange(nev): tree.GetEntry(iev) for imc in xrange(particles.GetEntriesFast()): part = particles.At(imc) if part.GetPdgCode() != 2112: continue hEta.Fill(part.Eta()) ut.put_yx_tit(hEta, "Events", "#eta", 1.4, 1.2) hEta.Draw() gPad.SetGrid() gPad.SetLogy() ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def gen_ay(): #abs(y) nbin = 100 ymax = 6 hAY = ut.prepare_TH1D_n("hAY", nbin, 0, ymax) can = ut.box_canvas() tree.Draw("TMath::Abs(rapidity) >> hAY", "", "", 100000) ut.put_yx_tit(hAY, "Events", "|y|", 1.4, 1.2) hAY.Draw() #absolute rapidity directly from Starlight sl = TFile.Open("/home/jaroslav/sim/noon-master/SLoutput.root") hSLy = sl.Get("hAY") hSLy.Draw("same") gPad.SetGrid() ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def plot_east(): zmin = 0 zbin = 10 zmax = 400 can = ut.box_canvas() hZdc = ut.prepare_TH1D("hZdc", zbin, zmin, zmax) tree.Draw("jZDCUnAttEast >> hZdc") ut.set_margin_lbtr(gPad, 0.1, 0.08, 0.01, 0.04) ut.put_yx_tit(hZdc, "ZDC East", "ADC") #middle point from 1n and 2n positions, dl-202011.03 mid_1n2n = (164.996 + 75.671) / 2 print("mid_1n2n:", mid_1n2n) lin = ut.cut_line(mid_1n2n, 0.7, hZdc) gF = make_FastZDC("jZDCUnAttEast", hZdc) hZdc.Draw() gF.Draw("same") hZdc.Draw("e1same") lin.Draw("same") gPad.SetGrid() #gPad.SetLogy() ut.invert_col(gPad) can.SaveAs("01fig.pdf")
def gen_eta(): #electron pseudorapidity #eta range etabin = 0.3 etamin = -20 etamax = 10 hEta = ut.prepare_TH1D("hEta", etabin, etamin, etamax) can = ut.box_canvas() form = "-TMath::Log(TMath::Tan(true_el_theta/2.))" #form = "-TMath::Log(TMath::Tan(el_theta/2.))" tree.Draw(form + " >> hEta") ut.put_yx_tit(hEta, "Events", "#eta", 1.4, 1.2) hEta.Draw() gPad.SetLogy() gPad.SetGrid() ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def gamma_p_ys(): #distribution of total gamma-proton cross section over a given CM energy s and generated y sqrt_s = 28.6 # GeV #gamma-p range gpbin = 0.01 gpmin = 0 gpmax = 1 hGP = ut.prepare_TH1D("hGP", gpbin, gpmin, gpmax) scm = sqrt_s**2 form = "0.0677*TMath::Power((true_y*" + str(scm) + "), 0.0808)" form += "+0.129*TMath::Power((true_y*" + str(scm) + "), -0.4525)" #print form tree.Draw(form + " >> hGP") can = ut.box_canvas() ut.put_yx_tit(hGP, "Events", "#sigma(#gamma p) (mb)", 1.4, 1.2) hGP.Draw() gPad.SetLogy() ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
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 evt_log10_Q2_theta(): #log_10(Q^2) and theta lqbin = 0.01 lqmin = -8 lqmax = -1 tbin = 1e-4 tmin = 0 tmax = 0.011 hlQ2thetaTag = ut.prepare_TH2D("hlQ2thetaTag", tbin, tmin, tmax, lqbin, lqmin, lqmax) tree.Draw(gL10Q2 + ":TMath::Pi()-el_theta >> hlQ2thetaTag", gQ2sel) ytit = "log_{10}(Q^{2}) / " + "{0:.3f}".format(lqbin) xtit = "Polar angle #theta (rad) / {0:.2f} mrad".format(tbin * 1e3) ut.put_yx_tit(hlQ2thetaTag, ytit, xtit, 1.6, 1.4) can = ut.box_canvas() ut.set_margin_lbtr(gPad, 0.12, 0.1, 0.03, 0.12) #gPad.SetLogx() gPad.SetLogz() hlQ2thetaTag.Draw() #ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def neut_en_pn(): #neutron energy and positive and negative rapidity #plot range ebin = 18 emin = 10 emax = 700 sel = "" #sel = "npos==1 && nneg == 1" #sel = "npos==2 && nneg == 2" #sel = "npos>1 || nneg>1" hE = ut.prepare_TH2D("hE", ebin, emin, emax, ebin, emin, emax) can = ut.box_canvas() tree.Draw("epos:eneg >> hE", sel) #y:x ut.put_yx_tit(hE, "#it{E}_{#it{n}} (GeV), #it{#eta} > 0", "#it{E}_{#it{n}} (GeV), #it{#eta} < 0", 1.7, 1.2) ut.set_margin_lbtr(gPad, 0.12, 0.09, 0.02, 0.11) hE.SetMinimum(0.98) hE.SetContour(300) hE.Draw() gPad.SetGrid() gPad.SetLogz() ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def evt_Log10_Q2_y(): #log_10(Q^2) and y lqbin = 5e-2 #lqmin = -5 lqmin = -10 lqmax = -1.5 ybin = 1e-2 #ymin = 0.06 ymin = 0 ymax = 0.8 yform = "(18.-el_gen)/18." hLog10Q2yTag = ut.prepare_TH2D("hLog10Q2yTag", ybin, ymin, ymax, lqbin, lqmin, lqmax) can = ut.box_canvas() tree.Draw(gL10Q2 + ":" + yform + " >> hLog10Q2yTag", gQ2sel) ut.put_yx_tit(hLog10Q2yTag, "log_{10}(#it{Q}^{2})", "y", 1.6, 1.4) gPad.SetLogx() hLog10Q2yTag.Draw() ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def evt_Q2_theta(): #Q^2 and theta qbin = 5e-6 qmin = 1e-10 qmax = 1e-1 tbin = 1e-4 tmin = 0 tmax = 0.011 qform = "2.*18.*el_gen*(1.-TMath::Cos(TMath::Pi()-el_theta))" hQ2thetaTag = ut.prepare_TH2D("hQ2thetaTag", tbin, tmin, tmax, qbin, qmin, qmax) tree.Draw(qform + ":TMath::Pi()-el_theta >> hQ2thetaTag", gQ2sel) ytit = "Q^{2} / 5x10^{-6} GeV^{2}" xtit = "Polar angle #theta (rad) / {0:.2f} mrad".format(tbin * 1e3) ut.put_yx_tit(hQ2thetaTag, ytit, xtit, 1.6, 1.4) can = ut.box_canvas() ut.set_margin_lbtr(gPad, 0.11, 0.1, 0.03, 0.11) gPad.SetLogy() gPad.SetLogz() hQ2thetaTag.Draw() ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def hit_z(): #hit z position #detector = "up" #detector = "down" detector = "phot" #plot range zbin = 1e-3 zmin = -0.1 zmax = 0.1 inp_lmon = TFile.Open("lmon.root") tree = inp_lmon.Get(detector) can = ut.box_canvas() hZ = ut.prepare_TH1D("hZ", zbin, zmin, zmax) tree.Draw("z >> hZ") print("Entries:", hZ.GetEntries()) ut.set_H1D_col(hZ, rt.kBlue) ut.put_yx_tit(hZ, "Counts", "Hit #it{z} (mm)", 1.5, 1.4) ut.set_margin_lbtr(gPad, 0.11, 0.11, 0.02, 0.03) gPad.SetGrid() gPad.SetLogy() ut.invert_col(rt.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 phot_en_conv(): #photon energy with conversions or clean conversions #plot range emin = 0 emax = 19 ebin = 0.1 inp = TFile.Open("ew.root") tree = inp.Get("conv_tree") can = ut.box_canvas() hE = ut.prepare_TH1D("hE", ebin, emin, emax) nev = tree.Draw("gen_en >> hE") #nev = tree.Draw("gen_en >> hE", "conv==1") #nev = tree.Draw("gen_en >> hE", "clean==1") print(nev) ut.line_h1(hE) ut.put_yx_tit(hE, "Counts", "#it{E} (GeV)") ut.set_margin_lbtr(gPad, 0.11, 0.09, 0.02, 0.01) gPad.SetGrid() gPad.SetLogy() 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 evt_true_lQ2_ly_separate(): #generator true log_10(Q^2) and y, separate for each detector lqbin = 0.2 lqmin = -10 lqmax = 3 ybin = 0.1 ymin = -5 ymax = 0 lQ2form = "TMath::Log10(true_Q2)" lyform = "TMath::Log10(true_y)" hLQ2yAll = ut.prepare_TH2D("hLQ2yAll", ybin * 0.2, ymin, ymax, lqbin * 0.2, lqmin, lqmax) #hLQ2yAll = ut.prepare_TH2D("hLQ2yAll", ybin, ymin, ymax, lqbin, lqmin, lqmax) hLQ2yS1 = ut.prepare_TH2D("hLQ2yS1", ybin, ymin, ymax, lqbin, lqmin, lqmax) hLQ2yS2 = ut.prepare_TH2D("hLQ2yS2", ybin, ymin, ymax, lqbin, lqmin, lqmax) hLQ2yEcal = ut.prepare_TH2D("hLQ2yEcal", ybin, ymin, ymax, lqbin, lqmin, lqmax) can = ut.box_canvas() tree.Draw(lQ2form + ":" + lyform + " >> hLQ2yAll") tree.Draw(lQ2form + ":" + lyform + " >> hLQ2yS1", "lowQ2s1_IsHit==1") tree.Draw(lQ2form + ":" + lyform + " >> hLQ2yS2", "lowQ2s2_IsHit==1") tree.Draw(lQ2form + ":" + lyform + " >> hLQ2yEcal", "ecal_IsHit==1") ytit = "log_{10}(#it{Q}^{2})" #+" / {0:.3f}".format(lqbin)+" GeV^{2}" xtit = "log_{10}(#it{y})" #+" / {0:.1f}".format(xbin) ut.put_yx_tit(hLQ2yAll, ytit, xtit, 1.3, 1.3) ut.set_margin_lbtr(gPad, 0.1, 0.1, 0.01, 0.01) gPad.SetGrid() hLQ2yAll.SetFillColor(rt.kRed - 3) hLQ2yS1.SetFillColor(rt.kYellow) hLQ2yS2.SetFillColor(rt.kGreen) hLQ2yEcal.SetFillColor(rt.kBlue) hLQ2yAll.Draw("box") hLQ2yEcal.Draw("box same") hLQ2yS2.Draw("box same") hLQ2yS1.Draw("box same") leg = ut.prepare_leg(0.12, 0.78, 0.2, 0.18, 0.035) leg.AddEntry(hLQ2yAll, "All quasi-real electrons", "f") leg.AddEntry(hLQ2yS1, "Tagger 1", "f") leg.AddEntry(hLQ2yS2, "Tagger 2", "f") leg.AddEntry(hLQ2yEcal, "ECAL", "f") leg.Draw("same") #ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
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")
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 fit_pt2_incoh(): #fit to incoherent MC pT^2 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() hPtIncoh = ut.prepare_TH1D("hPtIncoh", ptbin, ptmin, ptmax) ut.put_yx_tit(hPtIncoh, "Events / ({0:.3f}".format(ptbin) + " GeV^{2})", "#it{p}_{T}^{2} (GeV^{2})") tree_incoh.Draw("jRecPt*jRecPt >> hPtIncoh", strsel) #hPtIncoh.Sumw2() #hPtIncoh.Scale(1./hPtIncoh.Integral("width")) ut.set_margin_lbtr(gPad, 0.11, 0.09, 0.01, 0.01) 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) func_incoh_pt2.SetParameters(3000., 5.) r1 = (hPtIncoh.Fit(func_incoh_pt2, "RS")).Get() hPtIncoh.Draw() func_incoh_pt2.Draw("same") 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_pt2, "#it{A}*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.itemRes("#it{A}", r1, 0, rt.kRed) desc.itemRes("#it{b}", r1, 1, rt.kRed) desc.draw() #gPad.SetLogy() ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")