Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Analysis/hh_bbww.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)}"
Expand Down
2 changes: 1 addition & 1 deletion Studies/DNN/config/dataset_split.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Studies/DNN/config/default_split_doubleLep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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) )
Expand Down
2 changes: 1 addition & 1 deletion Studies/DNN/config/default_split_singleLep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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) )
Expand Down
16 changes: 8 additions & 8 deletions Studies/DNN/create_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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 = [
Expand All @@ -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 = [
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion Studies/DNN/ds_setup/batch_config_parity0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Studies/DNN/ds_setup/batch_config_parity1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Studies/DNN/ds_setup/batch_config_parity2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Studies/DNN/ds_setup/batch_config_parity3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions Studies/DNN/train_dataset_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions Studies/DNN/weight_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/Run3_2022/weights.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/Run3_2022EE/weights.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/Run3_2023/weights.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/Run3_2023BPix/weights.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/Run3_2024/weights.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 9 additions & 2 deletions config/global.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down