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/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 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 diff --git a/config/global.yaml b/config/global.yaml index d05cd7e7..7ea4f584 100644 --- a/config/global.yaml +++ b/config/global.yaml @@ -24,8 +24,15 @@ 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, AnaTupleMerge ] + enabled: + AnaTuple: true + AnaTupleMerge: false + base: { stage: AnaTupleMerge } JEC: { stage: AnaTuple } JER: stage: AnaTuple