def plot(): fin = ROOT.TFile.Open("output_chi2.root") canvas = ROOT.TCanvas("canvas", "canvas", 600, 600) for key in fin.GetListOfKeys(): h1 = key.ReadObj() name = h1.GetName() if "pt" in name: h1.GetYaxis().SetLabelSize(0.035) if h1.ClassName() == "TH2F": h1.Draw("box") else: h1.Draw("EP") canvas.SaveAs(name+".pdf") if h1.ClassName() == "TH2F": py = h1.ProfileY() py.Draw() canvas.SaveAs(name+"_profileY.pdf") cpt.save_compare(cpt.norm_hist(fin.Get("h_chi2")), cpt.norm_hist(fin.Get("h_chi2_ts")), "chi2_cmp") save_compare([cpt.norm_hist(fin.Get("h_chi2")), cpt.norm_hist(fin.Get("h_chi2_ts"))],["#Upsilon(1S)#Upsilon(1S)","baseline"],"chi2_cmp") # compare the slices labels = ["#chi^{2} < 10", "#chi^{2} [10, 100]", "#chi^{2} > 100"] for i in range(4): hists = get_chi2_slice( fin.Get("h_chi2_mu"+str(i+1)+"_d0") ) save_compare([cpt.norm_hist(x) for x in hists], labels, "cmp_mu"+str(i+1)+"_d0") for i in range(4): hists = get_chi2_slice( fin.Get("h_chi2_mu"+str(i+1)+"_z0") ) save_compare([cpt.norm_hist(x) for x in hists], labels, "cmp_mu"+str(i+1)+"_z0") fin.Close()
def compare_hist(): f1 = ROOT.TFile.Open("diff.root") cpt.save_compare(cpt.norm_hist(f1.Get("chi2_sig_xy")), cpt.norm_hist(f1.Get("chi2_sig_ts")), "chi2_sameevents") cpt.save_compare(cpt.norm_hist(f1.Get("m4l_xy")), cpt.norm_hist(f1.Get("m4l_ts")), "mass_sameevents") cpt.save_compare(cpt.norm_hist(f1.Get("m4l_full_xy")), cpt.norm_hist(f1.Get("m4l_full_ts")), "mass_fullRange_sameevents") f1.Close()