Skip to content
Snippets Groups Projects
Commit b79bc8b0 authored by Patrick Ecker's avatar Patrick Ecker
Browse files

imporoved the plot style

parent 94c996a8
No related branches found
No related tags found
1 merge request!63Low level cut study
......@@ -156,7 +156,7 @@ class CutInfo:
return [str(float(f))]
def scale_cut(self, percentage: float = 0.1) -> "CutInfo":
assert 0. <= percentage < 1., percentage
assert 0. <= percentage <= 1., percentage
if self.cut_type == "==":
cut_str = ""
cut_type = ""
......
......@@ -8,7 +8,7 @@ from rdstar.online_analysis.final_state_particles import fsp_cut_sets
from rdstar.studies.low_level_cut_study.decay_channels_cut_study import D_decay_label_to_cut_info_list as D_loose_dict, \
Dstar_decay_label_to_cut_info_list as Dstar_loose_dict
from rdstar.online_analysis.decay_channels import D_decay_label_to_cut_info_list, Dstar_decay_label_to_cut_info_list, \
D_decay_label_to_decay_id, Dstar_decay_label_to_decay_id
D_decay_label_to_decay_id, Dstar_decay_label_to_decay_id, Dstar_decay_channels, D_decay_channels
......@@ -77,6 +77,11 @@ combined_decay_mode_id_dict = {}
combined_decay_mode_id_dict.update(D_decay_label_to_decay_id)
combined_decay_mode_id_dict.update(Dstar_decay_label_to_decay_id)
combined_channel_dict = {}
combined_channel_dict.update(D_decay_channels)
combined_channel_dict.update(Dstar_decay_channels)
combined_channel_dict.update({"":""})
if __name__ == '__main__':
for channel, item in Dstar_decay_label_to_cut_info_list.items():
for c in item:
......
......@@ -9,7 +9,8 @@ from rdstar.offline_analysis.selection.selection_info_containers import CutInfo
from templatefitter.plotter.plot_style import set_matplotlibrc_params, KITColors
from rdstar.studies.low_level_cut_study.low_level_cut_defintions import fsp_cut_dict, D_cut_dict, combined_decay_mode_id_dict
from rdstar.studies.low_level_cut_study.low_level_cut_defintions import fsp_cut_dict, D_cut_dict, \
combined_decay_mode_id_dict, combined_channel_dict
class LowLevelCutPlotter:
......@@ -65,7 +66,7 @@ class LowLevelCutPlotter:
plt.cla()
plt.title(cut_info.cut_str, loc="center")
plt.title(channel, loc="right")
plt.savefig(save_path)
#plt.savefig(save_path)
continue
fig, ax = plt.subplots()
......@@ -88,20 +89,21 @@ class LowLevelCutPlotter:
)
plt.grid(False)
plt.title(cut_info.cut_str, loc="center")
plt.title(channel, loc="right")
plt.xlabel(cut_info.cut_label)
plt.ylabel("Entries")
plt.title(combined_channel_dict[channel], loc="right")
plt.legend(loc="best")
save_path = os.path.join(self.target_path, f"{key}_{new_cut_info.cut_name}_evaluation.pdf")
output.update({f"{key}_{new_cut_info.cut_name}_evaluation": save_path})
plt.savefig(save_path)
#plt.show()
#plt.savefig(save_path)
plt.show()
return output
if __name__ == '__main__':
#df = pd.read_hdf("/ceph/pecker/rdstar/low_level_cut_study/CombinedNTuples/e_ntuple_total.h5")
df = pd.read_hdf("/ceph/pecker/rdstar/low_level_cut_study/CombinedNTuples/dcharged_ntuple_total.h5")
llcp = LowLevelCutPlotter(n_tuple="dcharged_ntuple", target_path="")
df = pd.read_hdf("/ceph/pecker/rdstar/low_level_cut_study/prod_4thAug/CombinedNTuples/e_ntuple_total.h5")
#df = pd.read_hdf("/ceph/pecker/rdstar/low_level_cut_study/CombinedNTuples/dcharged_ntuple_total.h5")
llcp = LowLevelCutPlotter(n_tuple="e_ntuple", target_path="")
print(llcp.generate_output_dict())
llcp.get_df(df=df)
#llcp.apply_cuts(pivot=fsp_cut_dict["e_ntuple"]["cuts"][0], cut_infos=fsp_cut_dict["e_ntuple"]["cuts"])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment