Skip to content

Commit f2e8768

Browse files
committed
Update POWHEG scaling
1 parent 24e9846 commit f2e8768

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

machine_learning_hep/analysis/analyzer_jets.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,9 +1108,6 @@ def estimate_feeddown(self):
11081108
bins_obs[var],
11091109
)
11101110
fill_hist_fast(h3_fd_gen_orig[var], df[["pt_jet", "pt_cand", f"{colname}"]])
1111-
self._save_hist(
1112-
project_hist(h3_fd_gen_orig[var], [0, 2], {}), f"fd/h_ptjet-{var}_feeddown_gen_noeffscaling.png"
1113-
)
11141111

11151112
case "sim":
11161113
h3_fd_gen_orig = {}
@@ -1120,15 +1117,11 @@ def estimate_feeddown(self):
11201117
label = f"-{var}" if var else ""
11211118
if fh := rfile.Get(f"h_mass-ptjet-pthf{label}"):
11221119
h3_fd_gen_orig[var] = project_hist(fh, list(range(1, get_dim(fh))), {})
1123-
ensure_sumw2(h3_fd_gen_orig[var])
1124-
self._save_hist(
1125-
project_hist(h3_fd_gen_orig[var], [0, 2], {}),
1126-
f"fd/h_ptjet-{var}_feeddown_genonly_noeffscaling.png",
1127-
)
11281120
h_norm = rfile.Get("histonorm")
1129-
powheg_xsection_scale_factor = h_norm.GetBinContent(5)
1121+
powheg_xsection_avg = h_norm.GetBinContent(6) / h_norm.GetBinContent(5)
1122+
powheg_xsection_scale_factor = powheg_xsection_avg / h_norm.GetBinContent(5)
11301123
self.logger.info("powheg_xsection_scale_factor = %f", powheg_xsection_scale_factor)
1131-
self.logger.info("POWHEG luminosity (mb^{-1}): %g", 1.0 / powheg_xsection_scale_factor)
1124+
self.logger.info("POWHEG luminosity (mb^{-1}): %g", 1. / powheg_xsection_scale_factor)
11321125

11331126
case fd_input:
11341127
self.logger.critical("Invalid feeddown input %s", fd_input)

machine_learning_hep/data/data_run3/database_ml_parameters_D0Jet_pp.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ D0Jet_pp:
7171
filter: "abs(fPosZ) < 10."
7272

7373
coll_powheg_fd:
74+
level: fd
7475
trees:
7576
O2d0cmcpjetmcco: [fEventWeight]
7677
collcnt_mc:

machine_learning_hep/processer_jet.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def process_histomass_single(self, index):
240240

241241
with TFile.Open(self.l_histomass[index], "recreate") as _:
242242
dfevtorig = read_df(self.l_evtorig[index])
243-
histonorm = TH1F("histonorm", "histonorm", 5, 0, 5)
243+
histonorm = TH1F("histonorm", "histonorm", 6, 0, 6)
244244
histonorm.SetBinContent(1, len(dfquery(dfevtorig, self.s_evtsel)))
245245
if self.l_collcnt:
246246
dfcollcnt = read_df(self.l_collcnt[index])
@@ -259,14 +259,16 @@ def process_histomass_single(self, index):
259259
if self.l_wgt:
260260
self.logger.info("Filling event weights")
261261
dfwgt = read_df(self.l_wgt[index])
262-
histonorm.SetBinContent(5, dfwgt["fEventWeight"].sum())
262+
histonorm.SetBinContent(5, len(dfwgt["fEventWeight"]))
263+
histonorm.SetBinContent(6, dfwgt["fEventWeight"].sum())
263264
elif self.datatype == "fd":
264265
self.logger.warning("No event weights found, empty list: %s", self.l_wgt)
265266
get_axis(histonorm, 0).SetBinLabel(1, "N_{evt}")
266267
get_axis(histonorm, 0).SetBinLabel(2, "N_{coll}")
267268
get_axis(histonorm, 0).SetBinLabel(3, "N_{coll}^{TVX}")
268269
get_axis(histonorm, 0).SetBinLabel(4, "N_{BC}^{TVX}")
269-
get_axis(histonorm, 0).SetBinLabel(5, "w_{POWHEG}")
270+
get_axis(histonorm, 0).SetBinLabel(5, "N_{POWHEG}")
271+
get_axis(histonorm, 0).SetBinLabel(6, "sum_xs_{POWHEG}")
270272
histonorm.Write()
271273

272274
if self.datatype != "fd":

0 commit comments

Comments
 (0)