From a0a429ed0fb14733be1d9b6698af39ddd6b0d609 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Thu, 29 Jan 2026 22:41:19 +0100 Subject: [PATCH 1/4] Fixed weight definitions --- Analysis/hh_bbww.py | 4 ++-- Studies/DNN/config/dataset_split.yaml | 2 +- Studies/DNN/config/default_split_doubleLep.yaml | 2 +- Studies/DNN/config/default_split_singleLep.yaml | 2 +- Studies/DNN/create_dataset.py | 16 ++++++++-------- Studies/DNN/ds_setup/batch_config_parity0.yaml | 2 +- Studies/DNN/ds_setup/batch_config_parity1.yaml | 2 +- Studies/DNN/ds_setup/batch_config_parity2.yaml | 2 +- Studies/DNN/ds_setup/batch_config_parity3.yaml | 2 +- Studies/DNN/train_dataset_selector.py | 6 +++--- Studies/DNN/weight_calculator.py | 8 ++++---- config/Run3_2022/weights.yaml | 2 +- config/Run3_2022EE/weights.yaml | 2 +- config/Run3_2023/weights.yaml | 2 +- config/Run3_2023BPix/weights.yaml | 2 +- config/Run3_2024/weights.yaml | 2 +- 16 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Analysis/hh_bbww.py b/Analysis/hh_bbww.py index 616fd18c..b7319181 100644 --- a/Analysis/hh_bbww.py +++ b/Analysis/hh_bbww.py @@ -79,8 +79,8 @@ def GetBTagWeight(global_cfg_dict, cat, applyBtag=False): def GetWeight(channel, cat, boosted_categories): # do you need all these args? - # weights_to_apply = ["weight_MC_Lumi_pu", "ExtraDYWeight"] - weights_to_apply = ["weight_MC_Lumi_pu"] + # weights_to_apply = ["weight_base", "ExtraDYWeight"] + weights_to_apply = ["weight_base"] total_weight = "*".join(weights_to_apply) for lep_index in [1, 2]: total_weight = f"{total_weight} * {GetLepWeight(lep_index)}" diff --git a/Studies/DNN/config/dataset_split.yaml b/Studies/DNN/config/dataset_split.yaml index fac4aa44..d991a5be 100644 --- a/Studies/DNN/config/dataset_split.yaml +++ b/Studies/DNN/config/dataset_split.yaml @@ -7,7 +7,7 @@ batch_dict: storage_folder: /eos/user/d/daebi/bbWW/anaTuples/shared/Run3_2022/ -selection_branches: [ 'lep1_type', 'lep2_type', 'weight_MC_Lumi_pu', 'event', 'centralJet_pt' ] +selection_branches: [ 'lep1_type', 'lep2_type', 'weight_base', 'event', 'centralJet_pt' ] # Cuts for uproot selection_cut: (tree['lep1_type'] > 0) & (tree['lep2_type'] > 0) & (ak.count(tree['centralJet_pt'], axis=1) > 1) diff --git a/Studies/DNN/config/default_split_doubleLep.yaml b/Studies/DNN/config/default_split_doubleLep.yaml index e3a85676..29ba1200 100644 --- a/Studies/DNN/config/default_split_doubleLep.yaml +++ b/Studies/DNN/config/default_split_doubleLep.yaml @@ -8,7 +8,7 @@ batch_dict: storage_folder: /eos/user/d/daebi/bbWW_development/anaTuples/FullForTraining/ -selection_branches: [ 'lep1_legType', 'lep2_legType', 'weight_MC_Lumi_pu', 'event', 'centralJet_pt', 'SelectedFatJet_pt' ] +selection_branches: [ 'lep1_legType', 'lep2_legType', 'weight_base', 'event', 'centralJet_pt', 'SelectedFatJet_pt' ] # Cuts for uproot selection_cut: (tree['lep1_legType'] > 0) & (tree['lep2_legType'] > 0) & ( (ak.count(tree['centralJet_pt'], axis=1) > 1) | (ak.count(tree['SelectedFatJet_pt'], axis=1) > 0) ) diff --git a/Studies/DNN/config/default_split_singleLep.yaml b/Studies/DNN/config/default_split_singleLep.yaml index cd9ce255..4a7729eb 100644 --- a/Studies/DNN/config/default_split_singleLep.yaml +++ b/Studies/DNN/config/default_split_singleLep.yaml @@ -9,7 +9,7 @@ batch_dict: storage_folder: /eos/user/d/daebi/bbWW_development/anaTuples/FullForTraining/ -selection_branches: [ 'lep1_legType', 'lep2_legType', 'weight_MC_Lumi_pu', 'event', 'centralJet_pt', 'SelectedFatJet_pt' ] +selection_branches: [ 'lep1_legType', 'lep2_legType', 'weight_base', 'event', 'centralJet_pt', 'SelectedFatJet_pt' ] # Cuts for uproot selection_cut: (tree['lep1_legType'] > 0) & (tree['lep2_legType'] <= 0) & ( (ak.count(tree['centralJet_pt'], axis=1) > 1) | (ak.count(tree['SelectedFatJet_pt'], axis=1) > 0) ) diff --git a/Studies/DNN/create_dataset.py b/Studies/DNN/create_dataset.py index 5999e61c..1c1156b2 100644 --- a/Studies/DNN/create_dataset.py +++ b/Studies/DNN/create_dataset.py @@ -172,7 +172,7 @@ def create_dict(config_dict, output_folder, era): process_dict[signal_name][dataset_name]["total_cut"] += int( np.sum(eval(total_cut)) ) - eval_string = f"float(np.sum(tree[{total_cut}].weight_MC_Lumi_pu))" + eval_string = f"float(np.sum(tree[{total_cut}].weight_base))" process_dict[signal_name][dataset_name]["weight_cut"] += eval( eval_string ) @@ -221,7 +221,7 @@ def create_dict(config_dict, output_folder, era): np.sum(eval(total_cut)) ) eval_string = ( - f"float(np.sum(tree[{total_cut}].weight_MC_Lumi_pu))" + f"float(np.sum(tree[{total_cut}].weight_base))" ) process_dict[signal_name][dataset_name][ "weight_cut" @@ -279,7 +279,7 @@ def create_dict(config_dict, output_folder, era): "total_cut" ] += int(np.sum(eval(total_cut))) eval_string = ( - f"float(np.sum(tree[{total_cut}].weight_MC_Lumi_pu))" + f"float(np.sum(tree[{total_cut}].weight_base))" ) process_dict[background_name][dataset_name][ "weight_cut" @@ -514,7 +514,7 @@ def create_file(config_dict, output_folder, out_filename): for name in df_in.GetColumnNames(): if name.startswith("gen"): continue - if name.startswith("weight_") and not name == "weight_MC_Lumi_pu": + if name.startswith("weight_") and not name == "weight_base": continue master_column_names_vec.push_back(name) master_column_types = [ @@ -527,7 +527,7 @@ def create_file(config_dict, output_folder, out_filename): for name in df_in.GetColumnNames(): if name.startswith("gen"): continue - if name.startswith("weight_") and not name == "weight_MC_Lumi_pu": + if name.startswith("weight_") and not name == "weight_base": continue local_column_names_vec.push_back(name) local_column_types = [ @@ -720,7 +720,7 @@ def create_weight_file(inName, outName, bb_low=70, bb_high=150, bb_min=70, bb_ma "centralJet_hadronFlavour", "centralJet_pt", "SelectedFatJet_hadronFlavour", - "weight_MC_Lumi_pu", + "weight_base", ] branches = tree.arrays(branches_to_load) @@ -757,8 +757,8 @@ def create_weight_file(inName, outName, bb_low=70, bb_high=150, bb_min=70, bb_ma # Initialize the two branches, class weight and adv weight # Starting from their genWeight (includes XS and such) - class_weight = branches["weight_MC_Lumi_pu"] - adv_weight = branches["weight_MC_Lumi_pu"] + class_weight = branches["weight_base"] + adv_weight = branches["weight_base"] # Lets just flatten the weight by bb_mass first for each sample for this_name in np.unique(sample_name): diff --git a/Studies/DNN/ds_setup/batch_config_parity0.yaml b/Studies/DNN/ds_setup/batch_config_parity0.yaml index 57de1431..c51ebce8 100644 --- a/Studies/DNN/ds_setup/batch_config_parity0.yaml +++ b/Studies/DNN/ds_setup/batch_config_parity0.yaml @@ -6,7 +6,7 @@ meta_data: selection_branches: - lep1_type - lep2_type - - weight_MC_Lumi_pu + - weight_base - event selection_cut: (tree['lep1_type'] >= 0) & (tree['lep2_type'] >= 0) & (tree['event']%4 == 0) diff --git a/Studies/DNN/ds_setup/batch_config_parity1.yaml b/Studies/DNN/ds_setup/batch_config_parity1.yaml index 7a7839fc..6bdd185e 100644 --- a/Studies/DNN/ds_setup/batch_config_parity1.yaml +++ b/Studies/DNN/ds_setup/batch_config_parity1.yaml @@ -6,7 +6,7 @@ meta_data: selection_branches: - lep1_type - lep2_type - - weight_MC_Lumi_pu + - weight_base - event selection_cut: (tree['lep1_type'] >= 0) & (tree['lep2_type'] >= 0) & (tree['event']%4 == 1) diff --git a/Studies/DNN/ds_setup/batch_config_parity2.yaml b/Studies/DNN/ds_setup/batch_config_parity2.yaml index 0074f0ec..cc4ec7f7 100644 --- a/Studies/DNN/ds_setup/batch_config_parity2.yaml +++ b/Studies/DNN/ds_setup/batch_config_parity2.yaml @@ -6,7 +6,7 @@ meta_data: selection_branches: - lep1_type - lep2_type - - weight_MC_Lumi_pu + - weight_base - event selection_cut: (tree['lep1_type'] >= 0) & (tree['lep2_type'] >= 0) & (tree['event']%4 == 2) diff --git a/Studies/DNN/ds_setup/batch_config_parity3.yaml b/Studies/DNN/ds_setup/batch_config_parity3.yaml index d304499c..5f2e9fb3 100644 --- a/Studies/DNN/ds_setup/batch_config_parity3.yaml +++ b/Studies/DNN/ds_setup/batch_config_parity3.yaml @@ -6,7 +6,7 @@ meta_data: selection_branches: - lep1_type - lep2_type - - weight_MC_Lumi_pu + - weight_base - event selection_cut: (tree['lep1_type'] >= 0) & (tree['lep2_type'] >= 0) & (tree['event']%4 == 3) diff --git a/Studies/DNN/train_dataset_selector.py b/Studies/DNN/train_dataset_selector.py index 5cd5562e..63dfa94b 100644 --- a/Studies/DNN/train_dataset_selector.py +++ b/Studies/DNN/train_dataset_selector.py @@ -138,7 +138,7 @@ def create_dict(config_dict, output_folder): process_dict[signal_name][dataset_name]["total_cut"] += int( np.sum(eval(total_cut)) ) - eval_string = f"float(np.sum(tree[{total_cut}].weight_MC_Lumi_pu))" + eval_string = f"float(np.sum(tree[{total_cut}].weight_base))" process_dict[signal_name][dataset_name]["weight_cut"] += eval( eval_string ) @@ -187,7 +187,7 @@ def create_dict(config_dict, output_folder): np.sum(eval(total_cut)) ) eval_string = ( - f"float(np.sum(tree[{total_cut}].weight_MC_Lumi_pu))" + f"float(np.sum(tree[{total_cut}].weight_base))" ) process_dict[signal_name][dataset_name][ "weight_cut" @@ -245,7 +245,7 @@ def create_dict(config_dict, output_folder): "total_cut" ] += int(np.sum(eval(total_cut))) eval_string = ( - f"float(np.sum(tree[{total_cut}].weight_MC_Lumi_pu))" + f"float(np.sum(tree[{total_cut}].weight_base))" ) process_dict[background_name][dataset_name][ "weight_cut" diff --git a/Studies/DNN/weight_calculator.py b/Studies/DNN/weight_calculator.py index 98764fe4..72a2e68a 100644 --- a/Studies/DNN/weight_calculator.py +++ b/Studies/DNN/weight_calculator.py @@ -18,7 +18,7 @@ def create_weight_file(inName, outName, bb_low=70, bb_high=150, bb_min=70, bb_ma "X_mass", "centralJet_hadronFlavour", "SelectedFatJet_hadronFlavour", - "weight_MC_Lumi_pu", + "weight_base", "centralJet_pt", "SelectedFatJet_pt", ] @@ -52,9 +52,9 @@ def create_weight_file(inName, outName, bb_low=70, bb_high=150, bb_min=70, bb_ma # Initialize the two branches, class weight and adv weight # Starting from their genWeight (includes XS and such) - class_weight = branches["weight_MC_Lumi_pu"] - adv_weight = branches["weight_MC_Lumi_pu"] - flat_jetpt_weight = branches["weight_MC_Lumi_pu"] + class_weight = branches["weight_base"] + adv_weight = branches["weight_base"] + flat_jetpt_weight = branches["weight_base"] # Flatten jet1:jet2 pt spectrum for resolved jets, and flatten fatjet pt spectrum for boosted jets # Doing this to avoid the DNN learning mbb diff --git a/config/Run3_2022/weights.yaml b/config/Run3_2022/weights.yaml index 8880d1a6..42e4b092 100644 --- a/config/Run3_2022/weights.yaml +++ b/config/Run3_2022/weights.yaml @@ -1,6 +1,6 @@ norm: PileUp_Lumi_MC: - expression: weight_MC_Lumi_pu{scale}_rel * final_weight + expression: weight_base_pu{scale}_rel * final_weight name: CMS_pileup_{} MuonID_SF_Iso_ID: expression: weight_lep1_MuonID_SF_{muIso_WP_for_SF}PFIso_{muID_WP_for_SF}ID{scale}_rel * weight_lep2_MuonID_SF_{muIso_WP_for_SF}PFIso_{muID_WP_for_SF}ID{scale}_rel * final_weight diff --git a/config/Run3_2022EE/weights.yaml b/config/Run3_2022EE/weights.yaml index 8880d1a6..42e4b092 100644 --- a/config/Run3_2022EE/weights.yaml +++ b/config/Run3_2022EE/weights.yaml @@ -1,6 +1,6 @@ norm: PileUp_Lumi_MC: - expression: weight_MC_Lumi_pu{scale}_rel * final_weight + expression: weight_base_pu{scale}_rel * final_weight name: CMS_pileup_{} MuonID_SF_Iso_ID: expression: weight_lep1_MuonID_SF_{muIso_WP_for_SF}PFIso_{muID_WP_for_SF}ID{scale}_rel * weight_lep2_MuonID_SF_{muIso_WP_for_SF}PFIso_{muID_WP_for_SF}ID{scale}_rel * final_weight diff --git a/config/Run3_2023/weights.yaml b/config/Run3_2023/weights.yaml index 8880d1a6..42e4b092 100644 --- a/config/Run3_2023/weights.yaml +++ b/config/Run3_2023/weights.yaml @@ -1,6 +1,6 @@ norm: PileUp_Lumi_MC: - expression: weight_MC_Lumi_pu{scale}_rel * final_weight + expression: weight_base_pu{scale}_rel * final_weight name: CMS_pileup_{} MuonID_SF_Iso_ID: expression: weight_lep1_MuonID_SF_{muIso_WP_for_SF}PFIso_{muID_WP_for_SF}ID{scale}_rel * weight_lep2_MuonID_SF_{muIso_WP_for_SF}PFIso_{muID_WP_for_SF}ID{scale}_rel * final_weight diff --git a/config/Run3_2023BPix/weights.yaml b/config/Run3_2023BPix/weights.yaml index 8880d1a6..42e4b092 100644 --- a/config/Run3_2023BPix/weights.yaml +++ b/config/Run3_2023BPix/weights.yaml @@ -1,6 +1,6 @@ norm: PileUp_Lumi_MC: - expression: weight_MC_Lumi_pu{scale}_rel * final_weight + expression: weight_base_pu{scale}_rel * final_weight name: CMS_pileup_{} MuonID_SF_Iso_ID: expression: weight_lep1_MuonID_SF_{muIso_WP_for_SF}PFIso_{muID_WP_for_SF}ID{scale}_rel * weight_lep2_MuonID_SF_{muIso_WP_for_SF}PFIso_{muID_WP_for_SF}ID{scale}_rel * final_weight diff --git a/config/Run3_2024/weights.yaml b/config/Run3_2024/weights.yaml index f906b8d2..261baac8 100644 --- a/config/Run3_2024/weights.yaml +++ b/config/Run3_2024/weights.yaml @@ -1,6 +1,6 @@ norm: PileUp_Lumi_MC: - expression: weight_MC_Lumi_pu{scale}_rel * final_weight + expression: weight_base_pu{scale}_rel * final_weight name: CMS_pileup_{} MuonID_SF_Iso_ID: expression: weight_lep1_MuonID_SF_{muIso_WP_for_SF}PFIso_{muID_WP_for_SF}ID{scale}_rel * weight_lep2_MuonID_SF_{muIso_WP_for_SF}PFIso_{muID_WP_for_SF}ID{scale}_rel * final_weight From 1e10e89b1c6a4ea22f5bcae794ab9f9e105e644e Mon Sep 17 00:00:00 2001 From: Konstantin Date: Thu, 29 Jan 2026 22:56:16 +0100 Subject: [PATCH 2/4] updated corrections list --- config/global.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/config/global.yaml b/config/global.yaml index d05cd7e7..eaea3964 100644 --- a/config/global.yaml +++ b/config/global.yaml @@ -24,8 +24,11 @@ corrections: fatJetName: fatbjet # SelectedFatJet muScaRe: { stage: AnaTuple, mu_pt_for_ScaReApplication: "nano" } eleES: { stage: AnaTuple } - MC_Lumi_pu: { stage: AnaTuple } - pu: { stages: [ AnaCache, AnaTuple ] } + lumi: { stage: AnaTuple } + xs: { stage: AnaTuple } + gen: { stage: AnaTuple } + pu: { stages: [ AnaTuple ] } + base: { stage: AnaTupleMerge } JEC: { stage: AnaTuple } JER: stage: AnaTuple From a30bd48aa4025f21c5c11600fce276848b5c8e46 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Fri, 30 Jan 2026 00:28:22 +0100 Subject: [PATCH 3/4] fixed pu application --- config/global.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/global.yaml b/config/global.yaml index eaea3964..7ea4f584 100644 --- a/config/global.yaml +++ b/config/global.yaml @@ -27,7 +27,11 @@ corrections: lumi: { stage: AnaTuple } xs: { stage: AnaTuple } gen: { stage: AnaTuple } - pu: { stages: [ AnaTuple ] } + pu: + stages: [ AnaTuple, AnaTupleMerge ] + enabled: + AnaTuple: true + AnaTupleMerge: false base: { stage: AnaTupleMerge } JEC: { stage: AnaTuple } JER: From 98cb6843e49b8250958db621180ea8945325f286 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Fri, 30 Jan 2026 11:46:49 +0100 Subject: [PATCH 4/4] Updated submodules --- Corrections | 2 +- FLAF | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Corrections b/Corrections index c8a2b00c..dbecc972 160000 --- a/Corrections +++ b/Corrections @@ -1 +1 @@ -Subproject commit c8a2b00c265e5310d174d8249d0f03059b87cc5c +Subproject commit dbecc9725e37cfccbc89b60f313077d39c60628a diff --git a/FLAF b/FLAF index 2d96e65e..37aa49fe 160000 --- a/FLAF +++ b/FLAF @@ -1 +1 @@ -Subproject commit 2d96e65e4e3e854281c115163319ba4929b94375 +Subproject commit 37aa49fe8777dbd01023db0d71363c6e7994fec6