Skip to content

Commit

Permalink
Format plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
vkucera committed Sep 4, 2024
1 parent 4480397 commit bf326a3
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions machine_learning_hep/plotting/plot_jetsubstructure_run3.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,12 @@ def report_means(self, h_stat, h_syst, iptjet):
sigma_z_var_stat = hist_means_stat.GetStdDev()
mean_z_var_syst = hist_means_syst.GetMean()
sigma_z_var_syst = hist_means_syst.GetStdDev()
make_plot(f"{self.var}_means_hf_comb_{iptjet}", list_obj=[hist_means_comb], suffix="pdf", title=f"HF mean variations comb {iptjet};{self.latex_obs}")
make_plot(f"{self.var}_means_hf_stat_{iptjet}", list_obj=[hist_means_stat], suffix="pdf", title=f"HF mean variations stat {iptjet};{self.latex_obs}")
make_plot(f"{self.var}_means_hf_syst_{iptjet}", list_obj=[hist_means_syst], suffix="pdf", title=f"HF mean variations syst {iptjet};{self.latex_obs}")
make_plot(f"{self.var}_means_hf_comb_{iptjet}", list_obj=[hist_means_comb], suffix="pdf",
title=f"HF mean variations comb {iptjet};{self.latex_obs}")
make_plot(f"{self.var}_means_hf_stat_{iptjet}", list_obj=[hist_means_stat], suffix="pdf",
title=f"HF mean variations stat {iptjet};{self.latex_obs}")
make_plot(f"{self.var}_means_hf_syst_{iptjet}", list_obj=[hist_means_syst], suffix="pdf",
title=f"HF mean variations syst {iptjet};{self.latex_obs}")
print(f"Mean HF {self.var} = stat {mean_z_stat} syst {mean_z_syst} ROOT stat {h_stat.GetMean()}")
print(f"Mean HF {self.var} = var comb {mean_z_var_comb} +- {sigma_z_var_comb}")
print(f"Mean HF {self.var} = var stat {mean_z_var_stat} +- {sigma_z_var_stat}")
Expand Down Expand Up @@ -294,16 +297,21 @@ def plot(self):
nameobj = f'h_ptjet-{self.var}_subtracted_notscaled_{string_pthf}_data'
h_after = self.get_object(nameobj, file_results)

list_obj = [project_hist(h, [1], {0: (iptjet + 1, iptjet + 1)}) for h in [h_before, h_sideband, h_after]]
list_obj = [project_hist(h, [1], {0: (iptjet + 1, iptjet + 1)})
for h in [h_before, h_sideband, h_after]]
labels_obj = ["signal region", "scaled sidebands", "after subtraction"]
colours = [get_colour(i, 1) for i in range(len(list_obj))]
markers = [get_marker(i) for i in range(len(list_obj))]
can, _ = make_plot(f"sidebands_{self.var}_{string_ptjet}_{string_pthf}", list_obj=list_obj, labels_obj=labels_obj,
opt_leg_g=self.opt_leg_g, opt_plot_g=self.opt_plot_g, offsets_xy=self.offsets_axes,
can, _ = make_plot(f"sidebands_{self.var}_{string_ptjet}_{string_pthf}",
list_obj=list_obj, labels_obj=labels_obj,
opt_leg_g=self.opt_leg_g, opt_plot_g=self.opt_plot_g,
offsets_xy=self.offsets_axes,
colours=colours, markers=markers, leg_pos=self.leg_pos,
margins_y=[self.y_margin_down, self.y_margin_up], margins_c=self.margins_can,
title=f";{self.title_x};counts")
list_new += draw_latex_lines([self.text_alice, self.text_jets, self.get_text_range_ptjet(iptjet), self.get_text_range_pthf(ipt, iptjet), self.text_sd], y_step=self.y_step)
list_new += draw_latex_lines([self.text_alice, self.text_jets, self.get_text_range_ptjet(iptjet),
self.get_text_range_pthf(ipt, iptjet), self.text_sd],
y_step=self.y_step)
self.save_canvas(can)

# Feed-down subtraction
Expand All @@ -329,7 +337,8 @@ def plot(self):
colours=colours, markers=markers, leg_pos=self.leg_pos,
margins_y=[self.y_margin_down, self.y_margin_up], margins_c=self.margins_can,
title=f";{self.title_x};counts")
list_new += draw_latex_lines([self.text_alice, self.text_jets, self.get_text_range_ptjet(iptjet), self.get_text_range_pthf(-1, iptjet), self.text_sd], y_step=self.y_step)
list_new += draw_latex_lines([self.text_alice, self.text_jets, self.get_text_range_ptjet(iptjet),
self.get_text_range_pthf(-1, iptjet), self.text_sd], y_step=self.y_step)
self.save_canvas(can)

# TODO: efficiency (prompt, non-prompt, iptjet dependence, old vs new)
Expand All @@ -354,7 +363,8 @@ def plot(self):
colours=colours, markers=markers, leg_pos=self.leg_pos,
margins_y=[self.y_margin_down, self.y_margin_up], margins_c=self.margins_can,
title=self.title_full)
list_new += draw_latex_lines([self.text_alice, self.text_jets, self.get_text_range_ptjet(iptjet), self.get_text_range_pthf(-1, iptjet), self.text_sd])
list_new += draw_latex_lines([self.text_alice, self.text_jets, self.get_text_range_ptjet(iptjet),
self.get_text_range_pthf(-1, iptjet), self.text_sd])
# gStyle.SetErrorX(0) # do not plot horizontal error bars of histograms
self.save_canvas(can)
# gStyle.SetErrorX(0.5) # reset default width
Expand Down

0 comments on commit bf326a3

Please sign in to comment.