Skip to content
Snippets Groups Projects
Commit eec5d3ea authored by Wouter Deconinck's avatar Wouter Deconinck
Browse files

Add legend to all plots

parent e4ff1c87
No related branches found
No related tags found
No related merge requests found
......@@ -114,6 +114,16 @@ int dis_electrons(const std::string& config_name)
TFitResultPtr f_x_el_res = h_x_el_res->Fit("gaus", "S");
if (f_x_el_res == 0) f_x_el_res->Print("V");
TFitResultPtr f_Q2_jb_res = h_Q2_jb_res->Fit("gaus", "S");
if (f_Q2_jb_res == 0) f_Q2_jb_res->Print("V");
TFitResultPtr f_x_jb_res = h_x_jb_res->Fit("gaus", "S");
if (f_x_jb_res == 0) f_x_jb_res->Print("V");
TFitResultPtr f_Q2_da_res = h_Q2_da_res->Fit("gaus", "S");
if (f_Q2_da_res == 0) f_Q2_da_res->Print("V");
TFitResultPtr f_x_da_res = h_x_da_res->Fit("gaus", "S");
if (f_x_da_res == 0) f_x_da_res->Print("V");
// Plot our histograms.
// TODO: to start I'm explicitly plotting the histograms, but want to
// factorize out the plotting code moving forward.
......@@ -145,7 +155,7 @@ int dis_electrons(const std::string& config_name)
h2.DrawClone("hist same");
h3.DrawClone("hist same");
h4.DrawClone("hist same");
// FIXME hardcoded beam configuration
// legend
common_bench::plot::draw_label(ebeam, pbeam, detector);
TText* tptr1;
TPaveText t1(.6, .8417, .9, .925, "NB NDC");
......@@ -154,14 +164,14 @@ int dis_electrons(const std::string& config_name)
t1.SetTextSize(25);
tptr1 = t1.AddText("simulated");
tptr1->SetTextColor(common_bench::plot::kMpBlue);
tptr1 = t1.AddText("electron");
tptr1 = t1.AddText("EL method");
tptr1->SetTextColor(common_bench::plot::kMpOrange);
tptr1 = t1.AddText("JB");
tptr1 = t1.AddText("JB method");
tptr1->SetTextColor(common_bench::plot::kMpRed);
tptr1 = t1.AddText("DA");
tptr1 = t1.AddText("DA method");
tptr1->SetTextColor(common_bench::plot::kMpGreen);
t1.Draw();
c.Print(fmt::format("{}Q2.png", output_prefix).c_str());
c.Print(fmt::format("{}_Q2.png", output_prefix).c_str());
}
// Q2 resolution
......@@ -174,11 +184,11 @@ int dis_electrons(const std::string& config_name)
auto& h2 = *h_Q2_jb_res;
auto& h3 = *h_Q2_da_res;
// histogram style
h1.SetLineColor(common_bench::plot::kMpBlue);
h1.SetLineColor(common_bench::plot::kMpOrange);
h1.SetLineWidth(2);
h2.SetLineColor(common_bench::plot::kMpOrange);
h2.SetLineColor(common_bench::plot::kMpRed);
h2.SetLineWidth(2);
h3.SetLineColor(common_bench::plot::kMpRed);
h3.SetLineColor(common_bench::plot::kMpGreen);
h3.SetLineWidth(2);
// axes
h1.GetXaxis()->CenterTitle();
......@@ -187,9 +197,21 @@ int dis_electrons(const std::string& config_name)
h1.DrawClone("hist");
h2.DrawClone("hist same");
h3.DrawClone("hist same");
// FIXME hardcoded beam configuration
// legend
common_bench::plot::draw_label(ebeam, pbeam, detector);
c.Print(fmt::format("{}Q2resolution.png", output_prefix).c_str());
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);
t1.Draw();
c.Print(fmt::format("{}_Q2_resolution.png", output_prefix).c_str());
}
// x comparison
......@@ -219,7 +241,7 @@ int dis_electrons(const std::string& config_name)
h2.DrawClone("hist same");
h3.DrawClone("hist same");
h4.DrawClone("hist same");
// FIXME hardcoded beam configuration
// legend
common_bench::plot::draw_label(ebeam, pbeam, detector);
TText* tptr1;
TPaveText t1(.6, .8417, .9, .925, "NB NDC");
......@@ -228,10 +250,14 @@ int dis_electrons(const std::string& config_name)
t1.SetTextSize(25);
tptr1 = t1.AddText("simulated");
tptr1->SetTextColor(common_bench::plot::kMpBlue);
tptr1 = t1.AddText("reconstructed");
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);
t1.Draw();
c.Print(fmt::format("{}x.png", output_prefix).c_str());
c.Print(fmt::format("{}_x.png", output_prefix).c_str());
}
// x resolution
......@@ -244,11 +270,11 @@ int dis_electrons(const std::string& config_name)
auto& h2 = *h_x_jb_res;
auto& h3 = *h_x_da_res;
// histogram style
h1.SetLineColor(common_bench::plot::kMpBlue);
h1.SetLineColor(common_bench::plot::kMpOrange);
h1.SetLineWidth(2);
h2.SetLineColor(common_bench::plot::kMpOrange);
h2.SetLineColor(common_bench::plot::kMpRed);
h2.SetLineWidth(2);
h3.SetLineColor(common_bench::plot::kMpRed);
h3.SetLineColor(common_bench::plot::kMpGreen);
h3.SetLineWidth(2);
// axes
h1.GetXaxis()->CenterTitle();
......@@ -257,9 +283,21 @@ int dis_electrons(const std::string& config_name)
h1.DrawClone("hist");
h2.DrawClone("hist same");
h3.DrawClone("hist same");
// FIXME hardcoded beam configuration
// legend
common_bench::plot::draw_label(ebeam, pbeam, detector);
c.Print(fmt::format("{}xresolution.png", output_prefix).c_str());
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);
t1.Draw();
c.Print(fmt::format("{}_x_resolution.png", output_prefix).c_str());
}
common_bench::write_test({dis_Q2_resolution}, fmt::format("{}dis_electrons.json", output_prefix));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment