From c6ab90f11ee996a67f19c754533efeeb0f073866 Mon Sep 17 00:00:00 2001 From: Daniel Hundhausen Date: Mon, 12 Feb 2024 13:08:20 +0100 Subject: [PATCH 1/5] change path of scaling files in rate plots --- menu_tools/utils/scalings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menu_tools/utils/scalings.py b/menu_tools/utils/scalings.py index 5a42e4bd..a4b5a941 100644 --- a/menu_tools/utils/scalings.py +++ b/menu_tools/utils/scalings.py @@ -19,7 +19,7 @@ def load_scaling_params(obj: Object, eta_range: str) -> tuple[float, float]: """ fname = str(obj).replace("inclusive", eta_range) fpath = os.path.join( - "outputs", "object_performance", obj.version, "scalings", fname + ".yaml" + "outputs", obj.version, "object_performance", "scalings", fname + ".yaml" ) try: with open(fpath, "r") as f: From 93b4063ab1eaea8bb9b2479aa8ded69b90ab4c44 Mon Sep 17 00:00:00 2001 From: Daniel Hundhausen Date: Mon, 12 Feb 2024 13:22:40 +0100 Subject: [PATCH 2/5] change output dir structure --- menu_tools/object_performance/plotter.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/menu_tools/object_performance/plotter.py b/menu_tools/object_performance/plotter.py index 21b8c3ea..cf4b4b40 100755 --- a/menu_tools/object_performance/plotter.py +++ b/menu_tools/object_performance/plotter.py @@ -20,12 +20,12 @@ class Plotter: - outdir_base = "outputs/object_performance/" - def _make_output_dirs(self, version: str) -> None: - os.makedirs(f"{self.outdir_base}/{version}/turnons", exist_ok=True) - os.makedirs(f"{self.outdir_base}/{version}/distributions", exist_ok=True) - os.makedirs(f"{self.outdir_base}/{version}/scalings", exist_ok=True) + os.makedirs(f"outputs/{version}/object_performance/turnons", exist_ok=True) + os.makedirs( + f"outputs/{version}/object_performance/distributions", exist_ok=True + ) + os.makedirs(f"outputs/{version}/object_performance/scalings", exist_ok=True) def _create_new_plot(self) -> tuple[plt.Figure, plt.Axes]: fig, ax = plt.subplots(figsize=(10, 10)) @@ -44,11 +44,13 @@ def __init__(self, name, cfg, turnon_collection): @property def _outdir_turnons(self) -> str: - return os.path.join(self.outdir_base, self.version, "turnons") + return os.path.join("outputs", self.version, "object_performance", "turnons") @property def _outdir_distributions(self) -> str: - return os.path.join(self.outdir_base, self.version, "distributions") + return os.path.join( + "outputs", self.version, "object_performance", "distributions" + ) def _style_plot(self, fig, ax, legend_loc="lower right"): ax.axvline(self.threshold, ls=":", c="k") @@ -393,8 +395,9 @@ def plot(self): ax.set_ylim(0, np.max(y_points)) plot_fname = os.path.join( - self.outdir_base, + "outputs", self.version, + "object_performance", "scalings", f"{self.plot_name}_{self.version}", ) @@ -412,8 +415,6 @@ def plot(self): class ScalingCentral: - outdir = "outputs/object_performance/" - def __init__(self, cfg_plots_path: str) -> None: with open(cfg_plots_path, "r") as f: self.cfg_plots = yaml.safe_load(f) @@ -453,8 +454,8 @@ def _write_scalings_to_file(self, obj: Object, params: np.ndarray) -> None: """ fpath = os.path.join( "outputs", - "object_performance", obj.version, + "object_performance", "scalings", ) os.makedirs(fpath, exist_ok=True) From a863f598517d06ebb57e3c00b034e6e91f2a29b5 Mon Sep 17 00:00:00 2001 From: Daniel Hundhausen Date: Mon, 12 Feb 2024 15:13:31 +0100 Subject: [PATCH 3/5] improve V29 rate plots config --- configs/V29/rate_plots/all_rate_plots.yaml | 46 ++++++++-------------- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/configs/V29/rate_plots/all_rate_plots.yaml b/configs/V29/rate_plots/all_rate_plots.yaml index 410b2c55..7c76f59e 100644 --- a/configs/V29/rate_plots/all_rate_plots.yaml +++ b/configs/V29/rate_plots/all_rate_plots.yaml @@ -4,11 +4,22 @@ HTRates: test_objects: - phase1PuppiHT:default - seededConePuppiHT:default - # - trackerJet:default + - trackerHT:default binning: - min: 40 - max: 420 - step: 20 + min: 50 + max: 975 + step: 25 + +MuonRates: + sample: MinBias + version: V29 + test_objects: + - gmtMuon:default + - gmtTkMuon:default + binning: + min: 0 + max: 75 + step: 3 JetDefaultRates: sample: MinBias @@ -16,7 +27,7 @@ JetDefaultRates: test_objects: - phase1PuppiJet:default - seededConePuppiJet:default - # - trackerJet:default + - trackerJet:default binning: min: 40 max: 420 @@ -35,36 +46,13 @@ EGRates: max: 97 step: 3 -MuonRates: - sample: MinBias - version: V29 - test_objects: - # - gmtMuon:default - # - gmtMuon:oldRateID - - gmtTkMuon:default - binning: - min: 0 - max: 75 - step: 3 - TauRates: sample: MinBias version: V29 test_objects: - nnTau:default - # - caloTau:default + - caloTau:default binning: min: 10 max: 155 step: 5 - -MuonRates: - sample: MinBias - version: V29 - test_objects: - # - gmtMuon:default - - gmtTkMuon:default - binning: - min: 0 - max: 100 - step: 10 From b0b656633022652c17031245c8eca8c4f26ba584 Mon Sep 17 00:00:00 2001 From: Daniel Hundhausen Date: Mon, 12 Feb 2024 15:13:54 +0100 Subject: [PATCH 4/5] adapt test --- menu_tools/object_performance/tests/test_turnons_v29.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menu_tools/object_performance/tests/test_turnons_v29.py b/menu_tools/object_performance/tests/test_turnons_v29.py index 9c4c0e85..9bea1fea 100644 --- a/menu_tools/object_performance/tests/test_turnons_v29.py +++ b/menu_tools/object_performance/tests/test_turnons_v29.py @@ -32,7 +32,7 @@ def test_matching_plots_reproduced(test_name): # Load result and assert correct outcome with open( - f"outputs/object_performance/V29/turnons/{test_name}.json", + f"outputs/V29/object_performance/turnons/{test_name}.json", "r", ) as f: test_result = json.load(f) From a80e5bc2c43a6604ac8ab34c614fcd13cca7f375 Mon Sep 17 00:00:00 2001 From: Daniel Hundhausen Date: Wed, 14 Feb 2024 15:06:36 +0100 Subject: [PATCH 5/5] work on rate plots --- configs/V29/rate_plots/all_rate_plots.yaml | 58 ---------------------- configs/V29/rate_plots/eg.yaml | 12 +++++ configs/V29/rate_plots/ht.yaml | 11 ++++ configs/V29/rate_plots/jets.yaml | 27 ++++++++++ configs/V29/rate_plots/met.yaml | 10 ++++ configs/V29/rate_plots/muons.yaml | 22 ++++++++ configs/V29/rate_plots/taus.yaml | 23 +++++++++ 7 files changed, 105 insertions(+), 58 deletions(-) delete mode 100644 configs/V29/rate_plots/all_rate_plots.yaml create mode 100644 configs/V29/rate_plots/eg.yaml create mode 100644 configs/V29/rate_plots/ht.yaml create mode 100644 configs/V29/rate_plots/jets.yaml create mode 100644 configs/V29/rate_plots/met.yaml create mode 100644 configs/V29/rate_plots/muons.yaml create mode 100644 configs/V29/rate_plots/taus.yaml diff --git a/configs/V29/rate_plots/all_rate_plots.yaml b/configs/V29/rate_plots/all_rate_plots.yaml deleted file mode 100644 index 7c76f59e..00000000 --- a/configs/V29/rate_plots/all_rate_plots.yaml +++ /dev/null @@ -1,58 +0,0 @@ -HTRates: - sample: MinBias - version: V29 - test_objects: - - phase1PuppiHT:default - - seededConePuppiHT:default - - trackerHT:default - binning: - min: 50 - max: 975 - step: 25 - -MuonRates: - sample: MinBias - version: V29 - test_objects: - - gmtMuon:default - - gmtTkMuon:default - binning: - min: 0 - max: 75 - step: 3 - -JetDefaultRates: - sample: MinBias - version: V29 - test_objects: - - phase1PuppiJet:default - - seededConePuppiJet:default - - trackerJet:default - binning: - min: 40 - max: 420 - step: 20 - -EGRates: - sample: MinBias - version: V29 - test_objects: - - EG:default - - tkElectron:NoIso - - tkElectron:Iso - - tkPhoton:Iso - binning: - min: 10 - max: 97 - step: 3 - -TauRates: - sample: MinBias - version: V29 - test_objects: - - nnTau:default - - caloTau:default - binning: - min: 10 - max: 155 - step: 5 diff --git a/configs/V29/rate_plots/eg.yaml b/configs/V29/rate_plots/eg.yaml new file mode 100644 index 00000000..4c1a38e8 --- /dev/null +++ b/configs/V29/rate_plots/eg.yaml @@ -0,0 +1,12 @@ +EGRates: + sample: MinBias + version: V29 + test_objects: + - EG:default + - tkElectron:NoIso + - tkElectron:Iso + - tkPhoton:Iso + binning: + min: 10 + max: 97 + step: 3 diff --git a/configs/V29/rate_plots/ht.yaml b/configs/V29/rate_plots/ht.yaml new file mode 100644 index 00000000..c855e7f9 --- /dev/null +++ b/configs/V29/rate_plots/ht.yaml @@ -0,0 +1,11 @@ +HTRates: + sample: MinBias + version: V29 + test_objects: + - phase1PuppiHT:default + - seededConePuppiHT:default + - trackerHT:default + binning: + min: 50 + max: 975 + step: 25 diff --git a/configs/V29/rate_plots/jets.yaml b/configs/V29/rate_plots/jets.yaml new file mode 100644 index 00000000..738c05ca --- /dev/null +++ b/configs/V29/rate_plots/jets.yaml @@ -0,0 +1,27 @@ +JetDefaultRates: + sample: MinBias + version: V29 + test_objects: + - phase1PuppiJet:default + - seededConePuppiJet:default + # - seededConeExtendedPuppiJet:default + - trackerJet:default + # - caloJet:default + binning: + min: 40 + max: 420 + step: 20 + +JetsByRegion: + sample: MinBias + version: V29 + test_objects: + - phase1PuppiJet:default:barrel + - phase1PuppiJet:default:endcap + - seededConePuppiJet:default:barrel + - seededConePuppiJet:default:endcap + binning: + min: 40 + max: 420 + step: 20 + diff --git a/configs/V29/rate_plots/met.yaml b/configs/V29/rate_plots/met.yaml new file mode 100644 index 00000000..7e527eaa --- /dev/null +++ b/configs/V29/rate_plots/met.yaml @@ -0,0 +1,10 @@ +METRates: + sample: MinBias + version: V29 + test_objects: + - puppiMET:default + - trackerMET:default + binning: + min: 50 + max: 500 + step: 25 diff --git a/configs/V29/rate_plots/muons.yaml b/configs/V29/rate_plots/muons.yaml new file mode 100644 index 00000000..74c911b0 --- /dev/null +++ b/configs/V29/rate_plots/muons.yaml @@ -0,0 +1,22 @@ +gmtMuonByRegion: + sample: MinBias + version: V29 + test_objects: + - gmtMuon:default:barrel + - gmtMuon:default:overlap + - gmtMuon:default:endcap + binning: + min: 0 + max: 75 + step: 3 + +MuonRates: + sample: MinBias + version: V29 + test_objects: + - gmtMuon:default + - gmtTkMuon:default + binning: + min: 0 + max: 75 + step: 3 diff --git a/configs/V29/rate_plots/taus.yaml b/configs/V29/rate_plots/taus.yaml new file mode 100644 index 00000000..16ba3066 --- /dev/null +++ b/configs/V29/rate_plots/taus.yaml @@ -0,0 +1,23 @@ +TauRates: + sample: MinBias + version: V29 + test_objects: + - nnTau:default + - caloTau:default + binning: + min: 10 + max: 155 + step: 5 + +TauRatesByRegion: + sample: MinBias + version: V29 + test_objects: + - caloTau:default:barrel + - caloTau:default:endcap + - nnTau:default:barrel + - nnTau:default:endcap + binning: + min: 10 + max: 155 + step: 5