Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
farakiko committed Feb 21, 2024
1 parent 532df56 commit e0a8ca9
Show file tree
Hide file tree
Showing 17 changed files with 3,098 additions and 505 deletions.
158 changes: 30 additions & 128 deletions binder/combine.ipynb

Large diffs are not rendered by default.

3,182 changes: 2,895 additions & 287 deletions binder/hists_plots.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion combine/config_make_templates_diffbins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ regions_massbins:
"VBF97": 20
"ggF975pt250to300": 10
"ggF975pt300to450": 10
"ggF975pt450toInf": 10
"ggF975pt450toInf": 20

"WJetsCR": 10
"TopCR": 10
Expand Down
28 changes: 24 additions & 4 deletions combine/make_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,32 @@ def get_templates(years, channels, samples, samples_dir, regions_sel, model_path

for sample in os.listdir(samples_dir[year]):

for key in utils.combine_samples:
if "WJetsToLNu_1J" in sample:
print(f"Skipping sample {sample}")
continue
if "WJetsToLNu_2J" in sample:
print(f"Skipping sample {sample}")
continue

if "VBFHToWWToLNuQQ_" in sample:
print(f"Skipping sample {sample}")
continue

# first: check if the sample is in one of combine_samples_by_name
sample_to_use = None
for key in utils.combine_samples_by_name:
if key in sample:
sample_to_use = utils.combine_samples[key]
sample_to_use = utils.combine_samples_by_name[key]
break
else:
sample_to_use = sample

# second: if not, combine under common label
if sample_to_use is None:
for key in utils.combine_samples:
if key in sample:
sample_to_use = utils.combine_samples[key]
break
else:
sample_to_use = sample

if sample_to_use not in samples:
continue
Expand Down
28 changes: 24 additions & 4 deletions combine/make_templates_diffbins.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,32 @@ def get_templates(years, channels, samples, samples_dir, regions_sel, regions_ma

for sample in os.listdir(samples_dir[year]):

for key in utils.combine_samples:
if "WJetsToLNu_1J" in sample:
print(f"Skipping sample {sample}")
continue
if "WJetsToLNu_2J" in sample:
print(f"Skipping sample {sample}")
continue

if "VBFHToWWToLNuQQ_" in sample:
print(f"Skipping sample {sample}")
continue

# first: check if the sample is in one of combine_samples_by_name
sample_to_use = None
for key in utils.combine_samples_by_name:
if key in sample:
sample_to_use = utils.combine_samples[key]
sample_to_use = utils.combine_samples_by_name[key]
break
else:
sample_to_use = sample

# second: if not, combine under common label
if sample_to_use is None:
for key in utils.combine_samples:
if key in sample:
sample_to_use = utils.combine_samples[key]
break
else:
sample_to_use = sample

if sample_to_use not in samples:
continue
Expand Down
Binary file modified combine/templates/v6/hists_templates_Run2.pkl
Binary file not shown.
28 changes: 24 additions & 4 deletions combine/templates/v6/make_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,32 @@ def get_templates(years, channels, samples, samples_dir, regions_sel, model_path

for sample in os.listdir(samples_dir[year]):

for key in utils.combine_samples:
if "WJetsToLNu_1J" in sample:
print(f"Skipping sample {sample}")
continue
if "WJetsToLNu_2J" in sample:
print(f"Skipping sample {sample}")
continue

if "VBFHToWWToLNuQQ_" in sample:
print(f"Skipping sample {sample}")
continue

# first: check if the sample is in one of combine_samples_by_name
sample_to_use = None
for key in utils.combine_samples_by_name:
if key in sample:
sample_to_use = utils.combine_samples[key]
sample_to_use = utils.combine_samples_by_name[key]
break
else:
sample_to_use = sample

# second: if not, combine under common label
if sample_to_use is None:
for key in utils.combine_samples:
if key in sample:
sample_to_use = utils.combine_samples[key]
break
else:
sample_to_use = sample

if sample_to_use not in samples:
continue
Expand Down
20 changes: 11 additions & 9 deletions combine/templates/v6/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,22 @@

warnings.filterwarnings("ignore", message="Found duplicate branch ")

# (name of sample, name in templates)
combine_samples = {
# data
"SingleElectron_": "Data",
"SingleMuon_": "Data",
"EGamma_": "Data",
# signal
combine_samples_by_name = {
"GluGluHToWW_Pt-200ToInf_M-125": "ggF",
"VBFHToWWToAny_M-125_TuneCP5_withDipoleRecoil": "VBF",
# "VBFHToWWToLNuQQ_M-125_withDipoleRecoil": "VBF",
"ttHToNonbb_M125": "ttH",
"HWminusJ_HToWW_M-125": "WH",
"HWplusJ_HToWW_M-125": "WH",
"HZJ_HToWW_M-125": "ZH",
"GluGluZH_HToWW_M-125_TuneCP5_13TeV-powheg-pythia8": "ZH",
"GluGluHToTauTau": "HTauTau",
}

combine_samples = {
# data
"SingleElectron_": "Data",
"SingleMuon_": "Data",
"EGamma_": "Data",
# bkg
"QCD_Pt": "QCD",
"DYJets": "DYJets",
Expand All @@ -38,9 +39,10 @@
"ZZ": "Diboson",
"JetsToQQ": "WZQQ",
"EWK": "EWKvjets",
# "GluGluHToTauTau": "HTauTau", # TODO: check how many events
}

signals = ["VBF", "ggF"]

# (name in templates, name in cards)
labels = {
# sigs
Expand Down
Binary file modified combine/templates/v7/hists_templates_Run2.pkl
Binary file not shown.
20 changes: 11 additions & 9 deletions combine/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,22 @@

warnings.filterwarnings("ignore", message="Found duplicate branch ")

# (name of sample, name in templates)
combine_samples = {
# data
"SingleElectron_": "Data",
"SingleMuon_": "Data",
"EGamma_": "Data",
# signal
combine_samples_by_name = {
"GluGluHToWW_Pt-200ToInf_M-125": "ggF",
"VBFHToWWToAny_M-125_TuneCP5_withDipoleRecoil": "VBF",
# "VBFHToWWToLNuQQ_M-125_withDipoleRecoil": "VBF",
"ttHToNonbb_M125": "ttH",
"HWminusJ_HToWW_M-125": "WH",
"HWplusJ_HToWW_M-125": "WH",
"HZJ_HToWW_M-125": "ZH",
"GluGluZH_HToWW_M-125_TuneCP5_13TeV-powheg-pythia8": "ZH",
"GluGluHToTauTau": "HTauTau",
}

combine_samples = {
# data
"SingleElectron_": "Data",
"SingleMuon_": "Data",
"EGamma_": "Data",
# bkg
"QCD_Pt": "QCD",
"DYJets": "DYJets",
Expand All @@ -38,9 +39,10 @@
"ZZ": "Diboson",
"JetsToQQ": "WZQQ",
"EWK": "EWKvjets",
# "GluGluHToTauTau": "HTauTau", # TODO: check how many events
}

signals = ["VBF", "ggF"]

# (name in templates, name in cards)
labels = {
# sigs
Expand Down
21 changes: 17 additions & 4 deletions python/make_stacked_hists.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,25 @@ def make_events_dict(
print(f"Skipping sample {sample}")
continue

for key in utils.combine_samples:
if "VBFHToWWToLNuQQ_" in sample:
print(f"Skipping sample {sample}")
continue

# first: check if the sample is in one of combine_samples_by_name
sample_to_use = None
for key in utils.combine_samples_by_name:
if key in sample:
sample_to_use = utils.combine_samples[key]
sample_to_use = utils.combine_samples_by_name[key]
break
else:
sample_to_use = sample

# second: if not, combine under common label
if sample_to_use is None:
for key in utils.combine_samples:
if key in sample:
sample_to_use = utils.combine_samples[key]
break
else:
sample_to_use = sample

if sample_to_use not in samples:
continue
Expand Down
20 changes: 11 additions & 9 deletions python/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,23 @@

warnings.filterwarnings("ignore", message="Found duplicate branch ")

# (name of sample, name in templates)
combine_samples = {
# data
"SingleElectron_": "Data",
"SingleMuon_": "Data",
"EGamma_": "Data",
# signal

combine_samples_by_name = {
"GluGluHToWW_Pt-200ToInf_M-125": "ggF",
"VBFHToWWToAny_M-125_TuneCP5_withDipoleRecoil": "VBF",
# "VBFHToWWToLNuQQ_M-125_withDipoleRecoil": "VBF",
"ttHToNonbb_M125": "ttH",
"HWminusJ_HToWW_M-125": "WH",
"HWplusJ_HToWW_M-125": "WH",
"HZJ_HToWW_M-125": "ZH",
"GluGluZH_HToWW_M-125_TuneCP5_13TeV-powheg-pythia8": "ZH",
"GluGluHToTauTau": "HTauTau",
}

combine_samples = {
# data
"SingleElectron_": "Data",
"SingleMuon_": "Data",
"EGamma_": "Data",
# bkg
"QCD_Pt": "QCD",
"DYJets": "DYJets",
Expand All @@ -43,8 +45,8 @@
"ZZ": "Diboson",
"JetsToQQ": "WZQQ",
"EWK": "EWKvjets",
"GluGluHToTauTau": "HTauTau",
}

signals = ["VBF", "ggF"]


Expand Down
19 changes: 10 additions & 9 deletions python/utilsAN.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,22 @@
warnings.filterwarnings("ignore", message="Found duplicate branch ")


# (name of sample, name in templates)
combine_samples = {
# data
"SingleElectron_": "Data",
"SingleMuon_": "Data",
"EGamma_": "Data",
# signal
combine_samples_by_name = {
"GluGluHToWW_Pt-200ToInf_M-125": "ggF",
"VBFHToWWToAny_M-125_TuneCP5_withDipoleRecoil": "VBF",
# "VBFHToWWToLNuQQ_M-125_withDipoleRecoil": "VBF",
"ttHToNonbb_M125": "ttH",
"HWminusJ_HToWW_M-125": "WH",
"HWplusJ_HToWW_M-125": "WH",
"HZJ_HToWW_M-125": "ZH",
"GluGluZH_HToWW_M-125_TuneCP5_13TeV-powheg-pythia8": "ZH",
"GluGluHToTauTau": "HTauTau",
}

combine_samples = {
# data
"SingleElectron_": "Data",
"SingleMuon_": "Data",
"EGamma_": "Data",
# bkg
"QCD_Pt": "QCD",
"DYJets": "DYJets",
Expand All @@ -44,8 +45,8 @@
"ZZ": "Diboson",
"JetsToQQ": "WZQQ",
"EWK": "EWKvjets",
# "GluGluHToTauTau": "HTauTau",
}

signals = ["VBF", "ggF"]


Expand Down
20 changes: 10 additions & 10 deletions python/utilsCombine.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,22 @@
warnings.filterwarnings("ignore", message="Found duplicate branch ")


# (name of sample, name in templates)
combine_samples = {
# data
"SingleElectron_": "Data",
"SingleMuon_": "Data",
"EGamma_": "Data",
# signal
combine_samples_by_name = {
"GluGluHToWW_Pt-200ToInf_M-125": "ggF",
"VBFHToWWToAny_M-125_TuneCP5_withDipoleRecoil": "VBF",
# "VBFHToWWToLNuQQ_M-125_withDipoleRecoil": "VBF",
"ttHToNonbb_M125": "ttH",
"HWminusJ_HToWW_M-125": "WH",
"HWplusJ_HToWW_M-125": "WH",
"HZJ_HToWW_M-125": "ZH",
"GluGluZH_HToWW_M-125_TuneCP5_13TeV-powheg-pythia8": "ZH",
"GluGluHToTauTau": "HTauTau",
}

combine_samples = {
# data
"SingleElectron_": "Data",
"SingleMuon_": "Data",
"EGamma_": "Data",
# bkg
"QCD_Pt": "QCD",
"DYJets": "DYJets",
Expand All @@ -44,10 +45,9 @@
"ZZ": "Diboson",
"JetsToQQ": "WZQQ",
"EWK": "EWKvjets",
# "GluGluHToTauTau": "HTauTau",
}

signals = ["ggF", "VBF"]
signals = ["VBF", "ggF"]


def get_sum_sumgenweight(pkl_files, year, sample):
Expand Down
Loading

0 comments on commit e0a8ca9

Please sign in to comment.