Skip to content
Snippets Groups Projects
Commit 76c7f87b authored by Cedric Verstege's avatar Cedric Verstege
Browse files

Add LHE weights for samples

parent 41e9995f
Branches
No related tags found
No related merge requests found
......@@ -444,28 +444,49 @@ dataset_map = {
},
}
scale_weights = [str(id) for id in range(1001, 1010)]
scale_weights_MLM = [str(id) for id in range(1001, 1046)]
# only take LHAPDFID 30600 into account
pdf_weights_MLM = [str(id) for id in range(1252, 1252 + 103)]
pdf_weights_aMC = [str(id) for id in range(1214, 1214 + 103)]
pdf_weights_madspin_4f = [str(id) for id in range(1500, 1500 + 103)]
pdf_weights_POWHEG = [str(id) for id in range(2000, 2000 + 103)]
ps_weights = ["nominal", "isrDefup", "isrDefdown", "fsrDefup", "fsrDefdown"]
cross_sections = {
# https://twiki.cern.ch/twiki/bin/viewauth/CMS/StandardModelCrossSectionsat13TeV
"DYJetsToLL": {
"cross_section": 6077.22, # +-1.49 (integration) +- 14.78 (pdf) +- 2% (scale)
"cross_section_up": 6199.67,
"cross_section_down": 5954.77,
"scale_weights": scale_weights,
"pdf_weights": pdf_weights_aMC,
"ps_weights": ps_weights,
},
# fractions are the part of the total generator xsec of all x-Jet samples
"DYJetsToLL_0J": {
"cross_section": 6077.22 * 0.797417146413568,
"cross_section_up": 6199.67 * 0.797417146413568,
"cross_section_down": 5954.77 * 0.797417146413568,
"scale_weights": scale_weights,
"pdf_weights": pdf_weights_aMC,
"ps_weights": ps_weights,
},
"DYJetsToLL_1J": {
"cross_section": 6077.22 * 0.148374046989264,
"cross_section_up": 6199.67 * 0.148374046989264,
"cross_section_down": 5954.77 * 0.148374046989264,
"scale_weights": scale_weights,
"pdf_weights": pdf_weights_aMC,
"ps_weights": ps_weights,
},
"DYJetsToLL_2J": {
"cross_section": 6077.22 * 0.0555935895441108,
"cross_section_up": 6199.67 * 0.0555935895441108,
"cross_section_down": 5954.77 * 0.0555935895441108,
"scale_weights": scale_weights,
"pdf_weights": pdf_weights_aMC,
"ps_weights": ps_weights,
},
# Bug in PtZ binned sample caused exclusion of ~70% of total xsec
# Z bosons with pT=0 (LO, no recoil at ME level) are removed.
......@@ -474,47 +495,82 @@ cross_sections = {
"cross_section": 6077.22 * 0.231834448420725,
"cross_section_up": 6199.67 * 0.231834448420725,
"cross_section_down": 5954.77 * 0.231834448420725,
"scale_weights": scale_weights,
"pdf_weights": pdf_weights_aMC,
"ps_weights": ps_weights,
},
"DYJetsToLL_PtZ_50To100": {
"cross_section": 6077.22 * 0.0620196047922826,
"cross_section_up": 6199.67 * 0.0620196047922826,
"cross_section_down": 5954.77 * 0.0620196047922826,
"scale_weights": scale_weights,
"pdf_weights": pdf_weights_aMC,
"ps_weights": ps_weights,
},
"DYJetsToLL_PtZ_100To250": {
"cross_section": 6077.22 * 0.0149712151859343,
"cross_section_up": 6199.67 * 0.0149712151859343,
"cross_section_down": 5954.77 * 0.0149712151859343,
"scale_weights": scale_weights,
"pdf_weights": pdf_weights_aMC,
"ps_weights": ps_weights,
},
"DYJetsToLL_PtZ_250To400": {
"cross_section": 6077.22 * 0.000579586121051813,
"cross_section_up": 6199.67 * 0.000579586121051813,
"cross_section_down": 5954.77 * 0.000579586121051813,
"scale_weights": scale_weights,
"pdf_weights": pdf_weights_aMC,
"ps_weights": ps_weights,
},
"DYJetsToLL_PtZ_400To650": {
"cross_section": 6077.22 * 7.84191691302318e-05,
"cross_section_up": 6199.67 * 7.84191691302318e-05,
"cross_section_down": 5954.77 * 7.84191691302318e-05,
"scale_weights": scale_weights,
"pdf_weights": pdf_weights_aMC,
"ps_weights": ps_weights,
},
"DYJetsToLL_PtZ_650ToInf": {
"cross_section": 6077.22 * 7.3844717597635e-06,
"cross_section_up": 6199.67 * 7.3844717597635e-06,
"cross_section_down": 5954.77 * 7.3844717597635e-06,
"scale_weights": scale_weights,
"pdf_weights": pdf_weights_aMC,
"ps_weights": ps_weights,
},
"DYJetsToLL_MLM": {
"cross_section": 6077.22, # +-1.49 (integration) +- 14.78 (pdf) +- 2% (scale)
"cross_section_up": 6199.67,
"cross_section_down": 5954.77,
"scale_weights": scale_weights_MLM,
"pdf_weights": pdf_weights_MLM,
"ps_weights": ps_weights,
},
"DYJetsToLL_herwig": {
"cross_section": 6077.22, # +-1.49 (integration) +- 14.78 (pdf) +- 2% (scale)
"cross_section_up": 6199.67,
"cross_section_down": 5954.77,
"scale_weights": scale_weights_MLM,
"pdf_weights": pdf_weights_MLM,
"ps_weights": [],
},
"DYJetsToLL_M-10to50": {
"cross_section": 15810.0, # from xsdb
"cross_section_up": 15815.764,
"cross_section_down": 15804.236,
"scale_weights": scale_weights,
"pdf_weights": pdf_weights_aMC,
"ps_weights": ps_weights,
},
# https://twiki.cern.ch/twiki/bin/viewauth/CMS/StandardModelCrossSectionsat13TeV
"WW": {
"cross_section": 118.7, # +2.5%-2.2%
"cross_section_up": 121.7,
"cross_section_down": 116.1,
"scale_weights": [],
"pdf_weights": [],
"ps_weights": ps_weights,
},
# TTbar https://twiki.cern.ch/twiki/bin/view/LHCPhysics/TtbarNNLO
# mtop=172.5GeV NNLO inclusive value= 831.76. BR(W->lnu)=3*0.1086
......@@ -523,6 +579,9 @@ cross_sections = {
"cross_section": 88.29, # +4.8%-6.1%
"cross_section_up": 92.53,
"cross_section_down": 82.90,
"scale_weights": scale_weights,
"pdf_weights": pdf_weights_POWHEG,
"ps_weights": ps_weights,
},
# Single Top xsecs from https://twiki.cern.ch/twiki/bin/view/LHCPhysics/SingleTopRefXsec
# and https://twiki.cern.ch/twiki/bin/view/LHCPhysics/SingleTopNNLORef
......@@ -530,32 +589,50 @@ cross_sections = {
"cross_section": 145.0, # +2.8 -1.9
"cross_section_up": 147.8,
"cross_section_down": 143.1,
"scale_weights": scale_weights,
"pdf_weights": pdf_weights_madspin_4f,
"ps_weights": ps_weights,
},
"ST_t-channel_antitop": {
"cross_section": 87.2, # +1.8 -1.5
"cross_section_up": 89.0,
"cross_section_down": 85.7,
"scale_weights": scale_weights,
"pdf_weights": pdf_weights_madspin_4f,
"ps_weights": ps_weights,
},
"ST_tw_top": {
"cross_section": 35.85,
"cross_section_up": 37.8,
"cross_section_down": 33.9,
"scale_weights": scale_weights,
"pdf_weights": pdf_weights_POWHEG,
"ps_weights": ps_weights,
},
"ST_tw_antitop": {
"cross_section": 35.85,
"cross_section_up": 37.8,
"cross_section_down": 33.9,
"scale_weights": scale_weights,
"pdf_weights": pdf_weights_POWHEG,
"ps_weights": ps_weights,
},
# WZ and ZZ not given in tables -> use value from xsdb
"WZ": {
"cross_section": 27.6,
"cross_section_up": 28.0,
"cross_section_down": 27.2,
"scale_weights": [],
"pdf_weights": [],
"ps_weights": ps_weights,
},
"ZZ": {
"cross_section": 12.17,
"cross_section_up": 12.19,
"cross_section_down": 12.15,
"scale_weights": [],
"pdf_weights": [],
"ps_weights": ps_weights,
},
# https://twiki.cern.ch/twiki/bin/viewauth/CMS/StandardModelCrossSectionsat13TeV
# Needs to be x3 for fermion BR
......@@ -563,6 +640,9 @@ cross_sections = {
"cross_section": 20508.9 * 3,
"cross_section_up": (20508.9 + np.sqrt(165.7**2 + 770.9**2)) * 3,
"cross_section_down": (20508.9 - np.sqrt(88.2**2 + 770.9**2)) * 3,
"scale_weights": scale_weights,
"pdf_weights": pdf_weights_aMC,
"ps_weights": ps_weights,
},
"WJetsToLNu_0J": {
"cross_section": 20508.9 * 3 * 0.812678269092906,
......@@ -572,6 +652,9 @@ cross_sections = {
"cross_section_down": (20508.9 - np.sqrt(88.2**2 + 770.9**2))
* 3
* 0.812678269092906,
"scale_weights": scale_weights,
"pdf_weights": pdf_weights_aMC,
"ps_weights": ps_weights,
},
"WJetsToLNu_1J": {
"cross_section": 20508.9 * 3 * 0.136514086118272,
......@@ -581,6 +664,9 @@ cross_sections = {
"cross_section_down": (20508.9 - np.sqrt(88.2**2 + 770.9**2))
* 3
* 0.136514086118272,
"scale_weights": scale_weights,
"pdf_weights": pdf_weights_aMC,
"ps_weights": ps_weights,
},
"WJetsToLNu_2J": {
"cross_section": 20508.9 * 3 * 0.0508076447888226,
......@@ -590,5 +676,8 @@ cross_sections = {
"cross_section_down": (20508.9 - np.sqrt(88.2**2 + 770.9**2))
* 3
* 0.0508076447888226,
"scale_weights": scale_weights,
"pdf_weights": pdf_weights_aMC,
"ps_weights": ps_weights,
},
}
......@@ -67,28 +67,6 @@ class CreateExcaliburMCConfig(AnalysisTask):
dataset_vars = dataset_map[self.data_period]["common_mc"]
dataset_vars.update(dataset_map[self.data_period][self.dataset])
scale = 1
if self.dataset in ("DYJetsToMuMu", "DYJetsToTauTau"):
# TODO: That scaling is not strictly true, should use dedicated cross-section from dataset map
scale = 1 / 3
# elif self.dataset in DY_SETS:
# n_inc = float(self.input()['GetGeneratorWeights_DYJetsToLL'].load()["number_generated_events"])
# # gen_w_inc = float(self.input()['GetGeneratorWeights_DYJetsToLL'].load()["generator_weight"])
# n_xj = 0
# for dataset in DY_SETS:
# if dataset == 'DYJetsToLL': continue
# n_xj += float(self.input()['GetGeneratorWeights_{}'.format(dataset)].load()["number_generated_events"])
# # gen_w_m = float(self.input()['GetGeneratorWeights_{}'.format(dataset)].load()["generator_weight"])
# n = float(self.input()['GetGeneratorWeights'].load()["number_generated_events"])
# if self.dataset == 'DYJetsToLL':
# scale = n_inc/(n_inc+n_xj)
# else:
# scale = n_xj/(n_inc+n_xj)
print("Mulitplying xsec with factor {}".format(scale))
xsec = cross_sections[self.dataset]["cross_section"] * scale
xsec_up = cross_sections[self.dataset]["cross_section_up"] * scale
xsec_down = cross_sections[self.dataset]["cross_section_down"] * scale
jer_shift = 0
if self.energy_shift == Energy_Shifts.JER_UP:
jer_shift = +1
......@@ -111,9 +89,6 @@ class CreateExcaliburMCConfig(AnalysisTask):
jer=dataset_vars["jer_version"],
jer_shift=int(jer_shift),
roccor=dataset_vars["roccor"],
cross_section=xsec,
cross_section_up=xsec_up,
cross_section_down=xsec_down,
pileup_weight_file=os.path.abspath(self.input()["PileUpWeights"].abspath),
pileup_weight_file_up=os.path.abspath(
self.input()["PileUpWeights_up"].abspath
......@@ -121,7 +96,18 @@ class CreateExcaliburMCConfig(AnalysisTask):
pileup_weight_file_down=os.path.abspath(
self.input()["PileUpWeights_down"].abspath
),
scale_weights=cross_sections[self.dataset]["scale_weights"],
)
variables.update(cross_sections[self.dataset])
variables["gen_weights_scale"] = [
f"genWeight_{_id}" for _id in cross_sections[self.dataset]["scale_weights"]
]
variables["gen_weights_pdf"] = [
f"genWeight_{_id}" for _id in cross_sections[self.dataset]["pdf_weights"]
]
variables["gen_weights_ps"] = [
f"genWeight_{_id}" for _id in cross_sections[self.dataset]["ps_weights"]
]
gen_weights = self.input()["GetGeneratorWeights"].load()
variables.update(gen_weights)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment