diff --git a/benchmarks/dis/analysis/dis_electrons.cxx b/benchmarks/dis/analysis/dis_electrons.cxx index 8b55c4ee4ab7a7532932ff9c8539fabe17a503fe..a3b68c4647f210e93e0b99e8d982708ea27664fd 100644 --- a/benchmarks/dis/analysis/dis_electrons.cxx +++ b/benchmarks/dis/analysis/dis_electrons.cxx @@ -82,6 +82,12 @@ int dis_electrons(const std::string& config_name) .Define("Q2_da", "InclusiveKinematicsDA.Q2") .Define("Q2_sigma", "InclusiveKinematicsSigma.Q2") .Define("Q2_esigma", "InclusiveKinematicseSigma.Q2") + .Define("logQ2_sim", "log10(Q2_sim)") + .Define("logQ2_el", "log10(Q2_el)") + .Define("logQ2_jb", "log10(Q2_jb)") + .Define("logQ2_da", "log10(Q2_da)") + .Define("logQ2_sigma", "log10(Q2_sigma)") + .Define("logQ2_esigma", "log10(Q2_esigma)") .Define("Q2_el_res", combinatorial_diff_ratio, {"Q2_sim", "Q2_el"}) .Define("Q2_jb_res", combinatorial_diff_ratio, {"Q2_sim", "Q2_jb"}) .Define("Q2_da_res", combinatorial_diff_ratio, {"Q2_sim", "Q2_da"}) @@ -107,6 +113,12 @@ int dis_electrons(const std::string& config_name) auto h_Q2_da = d0.Histo1D({"h_Q2_da", "; GeV^2; counts", 100, -5, 25}, "Q2_da"); auto h_Q2_sigma = d0.Histo1D({"h_Q2_sigma", "; GeV^2; counts", 100, -5, 25}, "Q2_sigma"); auto h_Q2_esigma = d0.Histo1D({"h_Q2_esigma", "; GeV^2; counts", 100, -5, 25}, "Q2_esigma"); + auto h_logQ2_sim = d0.Histo1D({"h_logQ2_sim", "; GeV^2; counts", 100, -1, 4}, "logQ2_sim"); + auto h_logQ2_el = d0.Histo1D({"h_logQ2_el", "; GeV^2; counts", 100, -1, 4}, "logQ2_el"); + auto h_logQ2_jb = d0.Histo1D({"h_logQ2_jb", "; GeV^2; counts", 100, -1, 4}, "logQ2_jb"); + auto h_logQ2_da = d0.Histo1D({"h_logQ2_da", "; GeV^2; counts", 100, -1, 4}, "logQ2_da"); + auto h_logQ2_sigma = d0.Histo1D({"h_logQ2_sigma", "; GeV^2; counts", 100, -1, 4}, "logQ2_sigma"); + auto h_logQ2_esigma = d0.Histo1D({"h_logQ2_esigma", "; GeV^2; counts", 100, -1, 4}, "logQ2_esigma"); auto h_Q2_el_res = d0.Histo1D({"h_Q2_el_res", "; ; counts", 100, -1, 1}, "Q2_el_res"); auto h_Q2_jb_res = d0.Histo1D({"h_Q2_jb_res", "; ; counts", 100, -1, 1}, "Q2_jb_res"); auto h_Q2_da_res = d0.Histo1D({"h_Q2_da_res", "; ; counts", 100, -1, 1}, "Q2_da_res"); @@ -158,35 +170,35 @@ int dis_electrons(const std::string& config_name) fmt::print(" - electron: {} +/- {}\n", f_Q2_el_res->Parameter(1), f_Q2_el_res->Error(1)); } else { - fmt::print("Q2 electron fit failed\n"); + fmt::print("Q2 electron fit failed, %d\n", f_Q2_el_res); return 1; } if (f_Q2_sigma_res == 0) { fmt::print(" - sigma: {} +/- {}\n", f_Q2_sigma_res->Parameter(1), f_Q2_sigma_res->Error(1)); } else { - fmt::print("Q2 sigma fit failed\n"); + fmt::print("Q2 sigma fit failed, %d\n", f_Q2_sigma_res); return 1; } if (f_Q2_esigma_res == 0) { fmt::print(" - esigma: {} +/- {}\n", f_Q2_esigma_res->Parameter(1), f_Q2_esigma_res->Error(1)); } else { - fmt::print("Q2 esigma fit failed\n"); + fmt::print("Q2 esigma fit failed, %d\n", f_Q2_esigma_res); return 1; } if (f_Q2_jb_res == 0) { fmt::print(" - JB: {} +/- {}\n", f_Q2_jb_res->Parameter(1), f_Q2_jb_res->Error(1)); } else { - fmt::print("Q2 JB fit failed (FIXME: allowed to fail)\n"); + fmt::print("Q2 JB fit failed (FIXME: allowed to fail), %d\n", f_Q2_jb_res); //return 1; } if (f_Q2_da_res == 0) { fmt::print(" - DA: {} +/- {}\n", f_Q2_da_res->Parameter(1), f_Q2_da_res->Error(1)); } else { - fmt::print("Q2 DA fit failed\n"); + fmt::print("Q2 DA fit failed, %d\n", f_Q2_da_res); return 1; } fmt::print("x resolution:\n"); @@ -194,35 +206,35 @@ int dis_electrons(const std::string& config_name) fmt::print(" - electron: {} +/- {}\n", f_x_el_res->Parameter(1), f_x_el_res->Error(1)); } else { - fmt::print("x electron fit failed\n"); + fmt::print("x electron fit failed, %d\n", f_x_el_res); return 1; } if (f_x_sigma_res == 0) { fmt::print(" - sigma: {} +/- {}\n", f_x_sigma_res->Parameter(1), f_x_sigma_res->Error(1)); } else { - fmt::print("x sigma fit failed\n"); + fmt::print("x sigma fit failed: %d\n", f_x_sigma_res); return 1; } if (f_x_esigma_res == 0) { fmt::print(" - esigma: {} +/- {}\n", f_x_esigma_res->Parameter(1), f_x_esigma_res->Error(1)); } else { - fmt::print("x esigma fit failed\n"); + fmt::print("x esigma fit failed, %d\n", f_x_esigma_res); return 1; } if (f_x_jb_res == 0) { fmt::print(" - JB: {} +/- {}\n", f_x_jb_res->Parameter(1), f_x_jb_res->Error(1)); } else { - fmt::print("x JB fit failed (FIXME: allowed to fail)\n"); + fmt::print("x JB fit failed (FIXME: allowed to fail), %d\n", f_x_jb_res); //return 1; } if (f_x_da_res == 0) { fmt::print(" - DA: {} +/- {}\n", f_x_da_res->Parameter(1), f_x_da_res->Error(1)); } else { - fmt::print("x DA fit failed\n"); + fmt::print("x DA fit failed, %d\n", f_x_da_res); return 1; } @@ -230,18 +242,83 @@ int dis_electrons(const std::string& config_name) // TODO: to start I'm explicitly plotting the histograms, but want to // factorize out the plotting code moving forward. - // Q2 comparison + // Q2 comparison (panels) + { + TCanvas c("c", "c", 1800, 1200); + c.Divide(3,2); + c.cd(); + gPad->SetLogx(false); + gPad->SetLogy(true); + auto& h1 = *h_logQ2_sim; + auto& h2 = *h_logQ2_el; + auto& h3 = *h_logQ2_jb; + auto& h4 = *h_logQ2_da; + auto& h5 = *h_logQ2_sigma; + auto& h6 = *h_logQ2_esigma; + // histogram style + h1.SetLineColor(common_bench::plot::kMpBlue); + h1.SetLineWidth(2); + h2.SetLineColor(common_bench::plot::kMpOrange); + h2.SetLineWidth(2); + h3.SetLineColor(common_bench::plot::kMpRed); + h3.SetLineWidth(2); + h4.SetLineColor(common_bench::plot::kMpGreen); + h4.SetLineWidth(2); + h5.SetLineColor(common_bench::plot::kMpMoss); + h5.SetLineWidth(2); + h6.SetLineColor(common_bench::plot::kMpCyan); + h6.SetLineWidth(2); + // axes + h1.GetXaxis()->CenterTitle(); + h1.GetYaxis()->CenterTitle(); + // draw everything + c.cd(1); + h1.DrawClone("hist"); + c.cd(2); + h2.DrawClone("hist"); + c.cd(3); + h3.DrawClone("hist"); + c.cd(4); + h4.DrawClone("hist"); + c.cd(5); + h5.DrawClone("hist"); + c.cd(6); + h6.DrawClone("hist"); + // legend + common_bench::plot::draw_label(ebeam, pbeam, detector); + TText* tptr1; + TPaveText t1(.6, .8417, .9, .925, "NB NDC"); + t1.SetFillColorAlpha(kWhite, 0); + t1.SetTextFont(43); + t1.SetTextSize(25); + tptr1 = t1.AddText("simulated"); + tptr1->SetTextColor(common_bench::plot::kMpBlue); + tptr1 = t1.AddText("e method"); + tptr1->SetTextColor(common_bench::plot::kMpOrange); + tptr1 = t1.AddText("JB method"); + tptr1->SetTextColor(common_bench::plot::kMpRed); + tptr1 = t1.AddText("DA method"); + tptr1->SetTextColor(common_bench::plot::kMpGreen); + tptr1 = t1.AddText("#Sigma method"); + tptr1->SetTextColor(common_bench::plot::kMpMoss); + tptr1 = t1.AddText("e#Sigma method"); + tptr1->SetTextColor(common_bench::plot::kMpCyan); + t1.Draw(); + c.Print(fmt::format("{}_logQ2_panels.png", output_prefix).c_str()); + } + + // Q2 comparison (overlays) { TCanvas c("c", "c", 1200, 1200); c.cd(); gPad->SetLogx(false); gPad->SetLogy(true); - auto& h1 = *h_Q2_sim; - auto& h2 = *h_Q2_el; - auto& h3 = *h_Q2_jb; - auto& h4 = *h_Q2_da; - auto& h5 = *h_Q2_sigma; - auto& h6 = *h_Q2_esigma; + auto& h1 = *h_logQ2_sim; + auto& h2 = *h_logQ2_el; + auto& h3 = *h_logQ2_jb; + auto& h4 = *h_logQ2_da; + auto& h5 = *h_logQ2_sigma; + auto& h6 = *h_logQ2_esigma; // histogram style h1.SetLineColor(common_bench::plot::kMpBlue); h1.SetLineWidth(2); @@ -285,10 +362,69 @@ int dis_electrons(const std::string& config_name) tptr1 = t1.AddText("e#Sigma method"); tptr1->SetTextColor(common_bench::plot::kMpCyan); t1.Draw(); - c.Print(fmt::format("{}_Q2.png", output_prefix).c_str()); + c.Print(fmt::format("{}_logQ2_overlays.png", output_prefix).c_str()); } - // Q2 resolution + // Q2 resolution (panels) + { + TCanvas c("c", "c", 1800, 1200); + c.Divide(3,2); + c.cd(); + gPad->SetLogx(false); + gPad->SetLogy(true); + auto& h1 = *h_Q2_el_res; + auto& h2 = *h_Q2_jb_res; + auto& h3 = *h_Q2_da_res; + auto& h4 = *h_Q2_sigma_res; + auto& h5 = *h_Q2_esigma_res; + // histogram style + h1.SetLineColor(common_bench::plot::kMpOrange); + h1.SetLineWidth(2); + h2.SetLineColor(common_bench::plot::kMpRed); + h2.SetLineWidth(2); + h3.SetLineColor(common_bench::plot::kMpGreen); + h3.SetLineWidth(2); + h4.SetLineColor(common_bench::plot::kMpMoss); + h4.SetLineWidth(2); + h5.SetLineColor(common_bench::plot::kMpCyan); + h5.SetLineWidth(2); + // axes + h1.GetXaxis()->CenterTitle(); + h1.GetYaxis()->CenterTitle(); + // draw everything + c.cd(1); + h1.DrawClone("hist"); + c.cd(2); + h2.DrawClone("hist"); + c.cd(3); + h3.DrawClone("hist"); + c.cd(4); + h4.DrawClone("hist"); + c.cd(5); + h5.DrawClone("hist"); + // legend + common_bench::plot::draw_label(ebeam, pbeam, detector); + TText* tptr1; + TPaveText t1(.6, .8417, .9, .925, "NB NDC"); + t1.SetFillColorAlpha(kWhite, 0); + t1.SetTextFont(43); + t1.SetTextSize(25); + tptr1 = t1.AddText("EL method"); + tptr1->SetTextColor(common_bench::plot::kMpOrange); + tptr1 = t1.AddText("JB method"); + tptr1->SetTextColor(common_bench::plot::kMpRed); + tptr1 = t1.AddText("DA method"); + tptr1->SetTextColor(common_bench::plot::kMpGreen); + tptr1 = t1.AddText("#Sigma method"); + tptr1->SetTextColor(common_bench::plot::kMpMoss); + tptr1 = t1.AddText("e#Sigma method"); + tptr1->SetTextColor(common_bench::plot::kMpCyan); + t1.Draw(); + c.Print(fmt::format("{}_Q2_res_panels.png", output_prefix).c_str()); + } + + + // Q2 resolution (overlays) { TCanvas c("c", "c", 1200, 1200); c.cd(); @@ -337,10 +473,75 @@ int dis_electrons(const std::string& config_name) tptr1 = t1.AddText("e#Sigma method"); tptr1->SetTextColor(common_bench::plot::kMpCyan); t1.Draw(); - c.Print(fmt::format("{}_Q2_resolution.png", output_prefix).c_str()); + c.Print(fmt::format("{}_Q2_res_overlays.png", output_prefix).c_str()); } - // x comparison + // x comparison (panels) + { + TCanvas c("c", "c", 1800, 1200); + c.Divide(3,2); + c.cd(); + gPad->SetLogx(true); + gPad->SetLogy(true); + auto& h1 = *h_x_sim; + auto& h2 = *h_x_el; + auto& h3 = *h_x_jb; + auto& h4 = *h_x_da; + auto& h5 = *h_x_sigma; + auto& h6 = *h_x_esigma; + // histogram style + h1.SetLineColor(common_bench::plot::kMpBlue); + h1.SetLineWidth(2); + h2.SetLineColor(common_bench::plot::kMpOrange); + h2.SetLineWidth(2); + h3.SetLineColor(common_bench::plot::kMpRed); + h3.SetLineWidth(2); + h4.SetLineColor(common_bench::plot::kMpGreen); + h4.SetLineWidth(2); + h5.SetLineColor(common_bench::plot::kMpMoss); + h5.SetLineWidth(2); + h6.SetLineColor(common_bench::plot::kMpCyan); + h6.SetLineWidth(2); + // axes + h1.GetXaxis()->CenterTitle(); + h1.GetYaxis()->CenterTitle(); + // draw everything + c.cd(1); + h1.DrawClone("hist"); + c.cd(2); + h2.DrawClone("hist"); + c.cd(3); + h3.DrawClone("hist"); + c.cd(4); + h4.DrawClone("hist"); + c.cd(5); + h5.DrawClone("hist"); + c.cd(6); + h6.DrawClone("hist"); + // legend + common_bench::plot::draw_label(ebeam, pbeam, detector); + TText* tptr1; + TPaveText t1(.6, .8417, .9, .925, "NB NDC"); + t1.SetFillColorAlpha(kWhite, 0); + t1.SetTextFont(43); + t1.SetTextSize(25); + tptr1 = t1.AddText("simulated"); + tptr1->SetTextColor(common_bench::plot::kMpBlue); + tptr1 = t1.AddText("EL method"); + tptr1->SetTextColor(common_bench::plot::kMpOrange); + tptr1 = t1.AddText("JB method"); + tptr1->SetTextColor(common_bench::plot::kMpRed); + tptr1 = t1.AddText("DA method"); + tptr1->SetTextColor(common_bench::plot::kMpGreen); + tptr1 = t1.AddText("#Sigma method"); + tptr1->SetTextColor(common_bench::plot::kMpMoss); + tptr1 = t1.AddText("e#Sigma method"); + tptr1->SetTextColor(common_bench::plot::kMpCyan); + t1.Draw(); + c.Print(fmt::format("{}_x_panels.png", output_prefix).c_str()); + } + + // x comparison (overlays) { TCanvas c("c", "c", 1200, 1200); c.cd(); @@ -395,10 +596,68 @@ int dis_electrons(const std::string& config_name) tptr1 = t1.AddText("e#Sigma method"); tptr1->SetTextColor(common_bench::plot::kMpCyan); t1.Draw(); - c.Print(fmt::format("{}_x.png", output_prefix).c_str()); + c.Print(fmt::format("{}_x_overlays.png", output_prefix).c_str()); + } + + // x resolution (panels) + { + TCanvas c("c", "c", 1800, 1200); + c.Divide(3,2); + c.cd(); + gPad->SetLogx(false); + gPad->SetLogy(true); + auto& h1 = *h_x_el_res; + auto& h2 = *h_x_jb_res; + auto& h3 = *h_x_da_res; + auto& h4 = *h_x_sigma_res; + auto& h5 = *h_x_esigma_res; + // histogram style + h1.SetLineColor(common_bench::plot::kMpOrange); + h1.SetLineWidth(2); + h2.SetLineColor(common_bench::plot::kMpRed); + h2.SetLineWidth(2); + h3.SetLineColor(common_bench::plot::kMpGreen); + h3.SetLineWidth(2); + h4.SetLineColor(common_bench::plot::kMpMoss); + h4.SetLineWidth(2); + h5.SetLineColor(common_bench::plot::kMpCyan); + h5.SetLineWidth(2); + // axes + h1.GetXaxis()->CenterTitle(); + h1.GetYaxis()->CenterTitle(); + // draw everything + c.cd(1); + h1.DrawClone("hist"); + c.cd(2); + h2.DrawClone("hist"); + c.cd(3); + h3.DrawClone("hist"); + c.cd(4); + h4.DrawClone("hist"); + c.cd(5); + h5.DrawClone("hist"); + // legend + common_bench::plot::draw_label(ebeam, pbeam, detector); + TText* tptr1; + TPaveText t1(.6, .8417, .9, .925, "NB NDC"); + t1.SetFillColorAlpha(kWhite, 0); + t1.SetTextFont(43); + t1.SetTextSize(25); + tptr1 = t1.AddText("EL method"); + tptr1->SetTextColor(common_bench::plot::kMpOrange); + tptr1 = t1.AddText("JB method"); + tptr1->SetTextColor(common_bench::plot::kMpRed); + tptr1 = t1.AddText("DA method"); + tptr1->SetTextColor(common_bench::plot::kMpGreen); + tptr1 = t1.AddText("#Sigma method"); + tptr1->SetTextColor(common_bench::plot::kMpMoss); + tptr1 = t1.AddText("e#Sigma method"); + tptr1->SetTextColor(common_bench::plot::kMpCyan); + t1.Draw(); + c.Print(fmt::format("{}_x_res_panels.png", output_prefix).c_str()); } - // x resolution + // x resolution (overlays) { TCanvas c("c", "c", 1200, 1200); c.cd(); @@ -447,7 +706,7 @@ int dis_electrons(const std::string& config_name) tptr1 = t1.AddText("e#Sigma method"); tptr1->SetTextColor(common_bench::plot::kMpCyan); t1.Draw(); - c.Print(fmt::format("{}_x_resolution.png", output_prefix).c_str()); + c.Print(fmt::format("{}_x_res_overlays.png", output_prefix).c_str()); } common_bench::write_test({dis_Q2_resolution}, fmt::format("{}dis_electrons.json", output_prefix));