def evt_true_lx_ly_lQ2(): #generator distribution of true log_10(x), log_10(y) and log_10(Q^2) xbin = 0.1 xmin = -12 xmax = 0 ybin = 0.05 ymin = -4.5 ymax = 0 lqbin = 0.1 lqmin = -8 lqmax = 3 #Q2sel = "lowQ2s1_IsHit==1" #Q2sel = "lowQ2s2_IsHit==1" #Q2sel = "ecal_IsHit==1" #Q2sel = "lowQ2s1_IsHit==1 || lowQ2s2_IsHit==1" Q2sel = "lowQ2s1_IsHit==1 || lowQ2s2_IsHit==1 || ecal_IsHit==1" #Q2sel = "" hXYQ2 = ut.prepare_TH3D("hXYQ2", xbin, xmin, xmax, ybin, ymin, ymax, lqbin, lqmin, lqmax) can = ut.box_canvas() tree.Draw( "TMath::Log10(true_Q2):TMath::Log10(true_y):TMath::Log10(true_x) >> hXYQ2", Q2sel) pXYQ2 = hXYQ2.Project3DProfile("yx") ytit = "log_{10}(#it{y})" + " / {0:.3f}".format(ybin) xtit = "log_{10}(#it{x})" + " / {0:.3f}".format(xbin) pXYQ2.SetXTitle(xtit) pXYQ2.SetYTitle(ytit) pXYQ2.SetZTitle("log_{10}(#it{Q}^{2} (GeV^{2}))") pXYQ2.SetTitle("") pXYQ2.SetTitleOffset(1.3, "X") pXYQ2.SetTitleOffset(1.4, "Z") ut.set_margin_lbtr(gPad, 0.12, 0.1, 0.03, 0.16) gPad.SetGrid() pXYQ2.SetContour(300) pXYQ2.SetMinimum(lqmin) pXYQ2.SetMaximum(lqmax) pXYQ2.Draw("colz") #ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def gen_el_en_log10_theta_lQ2(): #electron energy, scattering angle and log10(Q^2) #bins in log_10(theta) ltbin = 0.2 ltmin = -8 ltmax = 1 #bins in energy ebin = 0.4 emin = 0 emax = 21 #bins in Q2 lqbin = 0.1 lqmin = -9 lqmax = 2.5 can = ut.box_canvas() hEnThetaQ2 = ut.prepare_TH3D("hEnThetaQ2", ltbin, ltmin, ltmax, ebin, emin, emax, lqbin, lqmin, lqmax) #form = "TMath::Log10(true_Q2):el_en:TMath::Log10(TMath::Pi()-el_theta)" #form = "TMath::Log10(true_Q2):gen_E:TMath::Log10(TMath::Pi()-gen_theta)" form = "TMath::Log10(true_Q2):true_el_E:TMath::Log10(TMath::Pi()-true_el_theta)" tree.Draw(form + " >> hEnThetaQ2") pEnThetaQ2 = hEnThetaQ2.Project3DProfile("yx") ytit = "Electron energy #it{E}_{e} / " + "{0:.1f} GeV".format(ebin) xtit = "Scattering angle log_{10}(#theta_{e}) / " + "{0:.2f} rad".format( ltbin) ut.put_yx_tit(pEnThetaQ2, ytit, xtit, 1.4, 1.3) pEnThetaQ2.SetTitleOffset(1.3, "Z") pEnThetaQ2.SetZTitle("log_{10}(#it{Q}^{2} (GeV^{2}))") pEnThetaQ2.SetTitle("") ut.set_margin_lbtr(gPad, 0.1, 0.1, 0.01, 0.15) #gPad.SetLogz() gPad.SetGrid() pEnThetaQ2.SetMinimum(lqmin) pEnThetaQ2.SetMaximum(lqmax) pEnThetaQ2.SetContour(300) pEnThetaQ2.Draw("colz") ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def true_lQ2_en_mlt(): #true log10(Q^2), electron energy and mlt = -log_10(pi-theta)in reconstruction range #bins in Q2 lqbin = 0.1 lqmin = -9 lqmax = -1 #bins in energy ebin = 0.4 emin = 2.2 emax = 18.1 #bins in mlt = -log_10(pi-theta) tbin = 0.1 tmin = 1.8 #tmax = 5.2 tmax = 4.3 can = ut.box_canvas() hQ2EnMlt = ut.prepare_TH3D("hQ2EnMlt", lqbin, lqmin, lqmax, ebin, emin, emax, tbin, tmin, tmax) form = "(-TMath::Log10(TMath::Pi()-true_el_theta)):true_el_E:(TMath::Log10(true_Q2))" tree.Draw(form + " >> hQ2EnMlt") pQ2EnMlt = hQ2EnMlt.Project3DProfile("yx") ytit = "Electron energy #it{E}_{e} / " + "{0:.1f} GeV".format(ebin) xtit = "log_{10}(#it{Q}^{2} (GeV^{2})) / " + "{0:.1f}".format( lqbin) + " GeV^{2}" ztit = "mlt = -log_{10}(#pi-#theta)" ut.put_yx_tit(pQ2EnMlt, ytit, xtit, 1.4, 1.3) pQ2EnMlt.SetTitleOffset(1.3, "Z") pQ2EnMlt.SetZTitle(ztit) pQ2EnMlt.SetTitle("") ut.set_margin_lbtr(gPad, 0.1, 0.1, 0.01, 0.15) #gPad.SetLogz() gPad.SetGrid() pQ2EnMlt.SetMinimum(tmin) pQ2EnMlt.SetMaximum(tmax) pQ2EnMlt.SetContour(300) pQ2EnMlt.Draw("colz") ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def true_el_en_mlt_lQ2(): #true electron energy, mlt = -log_10(pi-theta) and log10(Q^2) in reconstruction range #bins in mlt = -log_10(pi-theta) tbin = 0.1 tmin = 1.8 tmax = 5.2 #bins in energy ebin = 0.4 emin = 2.2 emax = 18.1 #bins in Q2 lqbin = 0.1 lqmin = -9 lqmax = -1 can = ut.box_canvas() hEnThetaQ2 = ut.prepare_TH3D("hEnThetaQ2", tbin, tmin, tmax, ebin, emin, emax, lqbin, lqmin, lqmax) form = "TMath::Log10(true_Q2):true_el_E:(-TMath::Log10(TMath::Pi()-true_el_theta))" tree.Draw(form + " >> hEnThetaQ2") pEnThetaQ2 = hEnThetaQ2.Project3DProfile("yx") ytit = "Electron energy #it{E}_{e} / " + "{0:.1f} GeV".format(ebin) xtit = "mlt = -log_{10}(#pi-#theta_{e}) / " + "{0:.2f} rad".format(tbin) ut.put_yx_tit(pEnThetaQ2, ytit, xtit, 1.4, 1.3) pEnThetaQ2.SetTitleOffset(1.3, "Z") pEnThetaQ2.SetZTitle("log_{10}(#it{Q}^{2} (GeV^{2}))") pEnThetaQ2.SetTitle("") ut.set_margin_lbtr(gPad, 0.1, 0.1, 0.01, 0.15) #gPad.SetLogz() gPad.SetGrid() pEnThetaQ2.SetMinimum(lqmin) pEnThetaQ2.SetMaximum(lqmax) pEnThetaQ2.SetContour(300) pEnThetaQ2.Draw("colz") ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def gen_lx_ly_lQ2(): #distribution of log_10(x), log_10(y) and log_10(Q^2) xbin = 0.05 xmin = -12 xmax = 0 ybin = 0.02 ymin = -4.5 ymax = 0 lqbin = 0.1 lqmin = -9 lqmax = 4.3 hXYQ2 = ut.prepare_TH3D("hXYQ2", xbin, xmin, xmax, ybin, ymin, ymax, lqbin, lqmin, lqmax) can = ut.box_canvas() tree.Draw("TMath::Log10(true_Q2):gen_v:gen_u >> hXYQ2") pXYQ2 = hXYQ2.Project3DProfile("yx") ytit = "log_{10}(#it{y})" + " / {0:.3f}".format(ybin) xtit = "log_{10}(#it{x})" + " / {0:.3f}".format(xbin) pXYQ2.SetXTitle(xtit) pXYQ2.SetYTitle(ytit) pXYQ2.SetZTitle("log_{10}(#it{Q}^{2} (GeV^{2}))") pXYQ2.SetTitle("") pXYQ2.SetTitleOffset(1.3, "X") pXYQ2.SetTitleOffset(1.4, "Z") ut.set_margin_lbtr(gPad, 0.12, 0.1, 0.03, 0.16) gPad.SetGrid() pXYQ2.SetContour(300) pXYQ2.SetMinimum(lqmin) pXYQ2.SetMaximum(lqmax) pXYQ2.Draw("colz") ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def gen_Q2_theta_E(): #Q^2 relative to theta and energy qbin = 0.035 qmin = 0 qmax = 3.2 tbin = 1.5e-3 tmin = 0 tmax = 0.1 ebin = 0.1 emin = 0.1 emax = 18 hQtE = ut.prepare_TH3D("hQtE", tbin, tmin, tmax, qbin, qmin, qmax, ebin, emin, emax) can = ut.box_canvas() tree.Draw("gen_E:true_Q2:(TMath::Pi()-gen_theta) >> hQtE") profile = hQtE.Project3DProfile("yx") profile.SetXTitle("Electron scattering angle #theta (rad)") profile.SetYTitle("#it{Q}^{2} (GeV^{2})") profile.SetZTitle("Electron energy E_{e^{-}} (GeV)") profile.SetTitle("") profile.SetTitleOffset(1.3, "X") profile.SetTitleOffset(1.4, "Z") ut.set_margin_lbtr(gPad, 0.1, 0.1, 0.03, 0.15) profile.SetContour(300) profile.Draw("colz") #ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")
def en_r_z(): #radial hit position and vertex position in z #meters zmin = 2 zmax = 16 zbin = 0.2 #cm rmin = 3.2 rmax = 15 rbin = 0.2 #GeV emin = 0.1 emax = 10 ebin = 0.1 infile = "/home/jaroslav/sim/lmon/data/beam-gas/rc_1a.root" infile = TFile.Open(infile) tree = infile.Get("ptree") can = ut.box_canvas() hz = ut.prepare_TH3D("hz", zbin, zmin, zmax, rbin, rmin, rmax, ebin, emin, emax) tree.Draw("en:(rpos/1e1):(vtx_z/1e3) >> hz") profile = hz.Project3DProfile("yx") #print("Entries:", profile.GetEntries()) profile.SetXTitle("Vertex #it{z} position (m)") profile.SetYTitle("Radius #it{r_{xy}} (cm) at #it{z} = 0") profile.SetZTitle("Photon energy (GeV)") profile.SetTitle("") profile.SetTitleOffset(1.3, "X") profile.SetTitleOffset(1.3, "Z") profile.GetXaxis().CenterTitle() profile.GetYaxis().CenterTitle() ut.set_margin_lbtr(gPad, 0.1, 0.1, 0.03, 0.15) profile.SetContour(300) #gPad.SetLogz() profile.Draw("colz") leg = ut.prepare_leg(0.2, 0.88, 0.18, 0.08, 0.035) leg.AddEntry("", "Plane at #it{z} = 0", "") leg.Draw("same") gPad.SetGrid() ut.invert_col(rt.gPad) can.SaveAs("01fig.pdf")