From bf326a3ee4d883c6292e59694dbc6b4f707af01e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= Date: Wed, 4 Sep 2024 14:51:36 +0200 Subject: [PATCH] Format plotting --- .../plotting/plot_jetsubstructure_run3.py | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/machine_learning_hep/plotting/plot_jetsubstructure_run3.py b/machine_learning_hep/plotting/plot_jetsubstructure_run3.py index e79b566ce2..abc7002230 100644 --- a/machine_learning_hep/plotting/plot_jetsubstructure_run3.py +++ b/machine_learning_hep/plotting/plot_jetsubstructure_run3.py @@ -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}") @@ -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 @@ -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) @@ -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