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

fixed an issue with the plotting

parent 74e8fac3
Branches
No related tags found
1 merge request!63Low level cut study
......@@ -44,7 +44,7 @@ class LowLevelCutPlotter:
return output
def plot_on(self) -> Dict[str, os.fspath]:
def plot_on(self, save: bool = True) -> Dict[str, os.fspath]:
output = {}
relevant_keys = [key for key in self.cut_dicts if key.startswith(self.n_tuple)]
for key in relevant_keys:
......@@ -66,7 +66,8 @@ class LowLevelCutPlotter:
plt.cla()
plt.title(cut_info.cut_str, loc="center")
plt.title(channel, loc="right")
plt.savefig(save_path)
if save:
plt.savefig(save_path)
continue
fig, ax = plt.subplots()
......@@ -95,16 +96,18 @@ class LowLevelCutPlotter:
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()
if save:
plt.savefig(save_path)
else:
plt.show()
return output
if __name__ == '__main__':
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="")
#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="dcharged_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"])
llcp.plot_on()
\ No newline at end of file
llcp.plot_on(save=False)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment