Skip to content

Commit 2cdb7cb

Browse files
committed
Disable POWHEG variations in unfolding. Change markers.
Comment out plotting of POWHEG uncertainties in the unfolding step to speed up the analysis. Use different markers for variations in plots per category.
1 parent 35e23c4 commit 2cdb7cb

File tree

1 file changed

+43
-41
lines changed

1 file changed

+43
-41
lines changed

machine_learning_hep/analysis/analyzer_jet.py

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,24 +1403,24 @@ def unfolding(self):
14031403

14041404
# get the prompt POWHEG variations
14051405

1406-
input_powheg_sys = []
1407-
input_powheg_xsection_sys = []
1408-
for i_powheg in range(len(self.powheg_prompt_variations)):
1409-
path = "%s%s.root" % (self.powheg_prompt_variations_path, self.powheg_prompt_variations[i_powheg])
1410-
input_powheg_sys_i = self.get_simulated_yields(path, 2, True)
1411-
if not input_powheg_sys_i:
1412-
self.logger.fatal(make_message_notfound("simulated yields", path))
1413-
input_powheg_sys_i.SetName("fh2_prompt_%s_%d" % (self.v_varshape_binning, i_powheg))
1414-
input_powheg_sys.append(input_powheg_sys_i)
1415-
input_powheg_xsection_sys_i = input_powheg_sys_i.Clone(input_powheg_sys_i.GetName() + "_xsec")
1416-
input_powheg_xsection_sys.append(input_powheg_xsection_sys_i)
1406+
#input_powheg_sys = []
1407+
#input_powheg_xsection_sys = []
1408+
#for i_powheg in range(len(self.powheg_prompt_variations)):
1409+
#path = "%s%s.root" % (self.powheg_prompt_variations_path, self.powheg_prompt_variations[i_powheg])
1410+
#input_powheg_sys_i = self.get_simulated_yields(path, 2, True)
1411+
#if not input_powheg_sys_i:
1412+
# self.logger.fatal(make_message_notfound("simulated yields", path))
1413+
#input_powheg_sys_i.SetName("fh2_prompt_%s_%d" % (self.v_varshape_binning, i_powheg))
1414+
#input_powheg_sys.append(input_powheg_sys_i)
1415+
#input_powheg_xsection_sys_i = input_powheg_sys_i.Clone(input_powheg_sys_i.GetName() + "_xsec")
1416+
#input_powheg_xsection_sys.append(input_powheg_xsection_sys_i)
14171417

14181418
input_powheg_z = []
14191419
input_powheg_xsection_z = []
1420-
input_powheg_sys_z = []
1421-
input_powheg_xsection_sys_z = []
1422-
tg_powheg = []
1423-
tg_powheg_xsection = []
1420+
#input_powheg_sys_z = []
1421+
#input_powheg_xsection_sys_z = []
1422+
#tg_powheg = []
1423+
#tg_powheg_xsection = []
14241424

14251425
# get simulated distributions from PYTHIA 6 and POWHEG and calculate their spread
14261426

@@ -1433,17 +1433,17 @@ def unfolding(self):
14331433
input_powheg_z[ibin2].Scale(1.0 / input_powheg_z[ibin2].Integral(input_powheg_z[ibin2].FindBin(self.lvarshape_binmin_reco[0]), input_powheg_z[ibin2].FindBin(self.lvarshape_binmin_reco[-1])), "width")
14341434
input_powheg_xsection_z.append(input_powheg_xsection.ProjectionX("input_powheg_xsection_z" + suffix, ibin2 + 1, ibin2 + 1, "e"))
14351435
input_powheg_xsection_z[ibin2].Scale(1.0, "width")
1436-
input_powheg_sys_z_iter = []
1437-
input_powheg_xsection_sys_z_iter = []
1438-
for i_powheg in range(len(self.powheg_prompt_variations)):
1439-
input_powheg_sys_z_iter.append(input_powheg_sys[i_powheg].ProjectionX("input_powheg_sys_z"+self.powheg_prompt_variations[i_powheg]+suffix, ibin2 + 1, ibin2 + 1, "e"))
1440-
input_powheg_sys_z_iter[i_powheg].Scale(1.0 / input_powheg_sys_z_iter[i_powheg].Integral(input_powheg_sys_z_iter[i_powheg].FindBin(self.lvarshape_binmin_reco[0]), input_powheg_sys_z_iter[i_powheg].FindBin(self.lvarshape_binmin_reco[-1])), "width")
1441-
input_powheg_xsection_sys_z_iter.append(input_powheg_xsection_sys[i_powheg].ProjectionX("input_powheg_xsection_sys_z"+self.powheg_prompt_variations[i_powheg]+suffix, ibin2 + 1, ibin2 + 1, "e"))
1442-
input_powheg_xsection_sys_z_iter[i_powheg].Scale(1.0, "width")
1443-
input_powheg_sys_z.append(input_powheg_sys_z_iter)
1444-
input_powheg_xsection_sys_z.append(input_powheg_xsection_sys_z_iter)
1445-
tg_powheg.append(tg_sys(input_powheg_z[ibin2], input_powheg_sys_z[ibin2]))
1446-
tg_powheg_xsection.append(tg_sys(input_powheg_xsection_z[ibin2], input_powheg_xsection_sys_z[ibin2]))
1436+
#input_powheg_sys_z_iter = []
1437+
#input_powheg_xsection_sys_z_iter = []
1438+
#for i_powheg in range(len(self.powheg_prompt_variations)):
1439+
# input_powheg_sys_z_iter.append(input_powheg_sys[i_powheg].ProjectionX("input_powheg_sys_z"+self.powheg_prompt_variations[i_powheg]+suffix, ibin2 + 1, ibin2 + 1, "e"))
1440+
# input_powheg_sys_z_iter[i_powheg].Scale(1.0 / input_powheg_sys_z_iter[i_powheg].Integral(input_powheg_sys_z_iter[i_powheg].FindBin(self.lvarshape_binmin_reco[0]), input_powheg_sys_z_iter[i_powheg].FindBin(self.lvarshape_binmin_reco[-1])), "width")
1441+
# input_powheg_xsection_sys_z_iter.append(input_powheg_xsection_sys[i_powheg].ProjectionX("input_powheg_xsection_sys_z"+self.powheg_prompt_variations[i_powheg]+suffix, ibin2 + 1, ibin2 + 1, "e"))
1442+
# input_powheg_xsection_sys_z_iter[i_powheg].Scale(1.0, "width")
1443+
#input_powheg_sys_z.append(input_powheg_sys_z_iter)
1444+
#input_powheg_xsection_sys_z.append(input_powheg_xsection_sys_z_iter)
1445+
#tg_powheg.append(tg_sys(input_powheg_z[ibin2], input_powheg_sys_z[ibin2]))
1446+
#tg_powheg_xsection.append(tg_sys(input_powheg_xsection_z[ibin2], input_powheg_xsection_sys_z[ibin2]))
14471447

14481448
for ibin2 in range(self.p_nbin2_reco):
14491449
suffix = "%s_%.2f_%.2f" % \
@@ -1930,9 +1930,11 @@ def unfolding(self):
19301930
setup_legend(leg_input_mc_gen_z)
19311931
setup_histogram(input_mc_gen_z[ibin2], get_colour(2), get_marker(1))
19321932
y_min_h, y_max_h = get_y_window_his([unfolded_z_scaled_list[i_iter_choice][ibin2], input_mc_gen_z[ibin2], input_powheg_z[ibin2]])
1933-
y_min_g, y_max_g = get_y_window_gr([tg_powheg[ibin2]])
1934-
y_min = min(y_min_g, y_min_h)
1935-
y_max = max(y_max_g, y_max_h)
1933+
#y_min_g, y_max_g = get_y_window_gr([tg_powheg[ibin2]])
1934+
#y_min = min(y_min_g, y_min_h)
1935+
#y_max = max(y_max_g, y_max_h)
1936+
y_min = y_min_h
1937+
y_max = y_max_h
19361938
y_margin_up = 0.2
19371939
y_margin_down = 0.05
19381940
input_mc_gen_z[ibin2].GetYaxis().SetRangeUser(*get_plot_range(y_min, y_max, y_margin_down, y_margin_up))
@@ -1948,13 +1950,13 @@ def unfolding(self):
19481950
setup_histogram(input_powheg_z[ibin2], get_colour(3), get_marker(2))
19491951
leg_input_mc_gen_z.AddEntry(input_powheg_z[ibin2], "POWHEG + PYTHIA 6", "P")
19501952
input_powheg_z[ibin2].Draw("same")
1951-
setup_tgraph(tg_powheg[ibin2], get_colour(3), 0.3)
1952-
tg_powheg[ibin2].Draw("5")
1953+
#setup_tgraph(tg_powheg[ibin2], get_colour(3), 0.3)
1954+
#tg_powheg[ibin2].Draw("5")
19531955
leg_input_mc_gen_z.Draw("same")
19541956
latex = TLatex(0.5, 0.82, "%g #leq %s < %g GeV/#it{c}" % (self.lvar2_binmin_gen[ibin2], self.p_latexbin2var, self.lvar2_binmax_gen[ibin2]))
19551957
draw_latex(latex)
19561958
cinput_mc_gen_z.SaveAs("%s/unfolded_vs_mc_%s_%s.eps" % (self.d_resultsallpdata, self.v_varshape_binning, suffix_plot))
1957-
cinput_mc_gen_z.SaveAs("%s/unfolded_vs_mc_%s_%s.pdf" % (self.d_resultsallpdata, self.v_varshape_binning, suffix_plot))
1959+
#cinput_mc_gen_z.SaveAs("%s/unfolded_vs_mc_%s_%s.pdf" % (self.d_resultsallpdata, self.v_varshape_binning, suffix_plot))
19581960

19591961
# plot the comparison of the final cross-section and POWHEG
19601962

@@ -1965,9 +1967,11 @@ def unfolding(self):
19651967
setup_histogram(unfolded_z_xsection_list[i_iter_choice][ibin2], get_colour(1), get_marker(0))
19661968
leg_input_mc_gen_z_xsection.AddEntry(unfolded_z_xsection_list[i_iter_choice][ibin2], "unfolded data", "P")
19671969
y_min_h, y_max_h = get_y_window_his(unfolded_z_xsection_list[i_iter_choice][ibin2])
1968-
y_min_g, y_max_g = get_y_window_gr(tg_powheg_xsection[ibin2])
1969-
y_min = min(y_min_g, y_min_h)
1970-
y_max = max(y_max_g, y_max_h)
1970+
#y_min_g, y_max_g = get_y_window_gr(tg_powheg_xsection[ibin2])
1971+
#y_min = min(y_min_g, y_min_h)
1972+
#y_max = max(y_max_g, y_max_h)
1973+
y_min = y_min_h
1974+
y_max = y_max_h
19711975
y_margin_up = 0.2
19721976
y_margin_down = 0.05
19731977
unfolded_z_xsection_list[i_iter_choice][ibin2].GetYaxis().SetRangeUser(*get_plot_range(y_min, y_max, y_margin_down, y_margin_up))
@@ -1980,13 +1984,13 @@ def unfolding(self):
19801984
setup_histogram(input_powheg_xsection_z[ibin2], get_colour(3), get_marker(2))
19811985
leg_input_mc_gen_z_xsection.AddEntry(input_powheg_xsection_z[ibin2], "POWHEG + PYTHIA 6", "P")
19821986
input_powheg_xsection_z[ibin2].Draw("same")
1983-
setup_tgraph(tg_powheg_xsection[ibin2], get_colour(3), 0.3)
1984-
tg_powheg_xsection[ibin2].Draw("5")
1987+
#setup_tgraph(tg_powheg_xsection[ibin2], get_colour(3), 0.3)
1988+
#tg_powheg_xsection[ibin2].Draw("5")
19851989
latex = TLatex(0.5, 0.82, "%g #leq %s < %g GeV/#it{c}" % (self.lvar2_binmin_gen[ibin2], self.p_latexbin2var, self.lvar2_binmax_gen[ibin2]))
19861990
draw_latex(latex)
19871991
leg_input_mc_gen_z_xsection.Draw("same")
19881992
cinput_mc_gen_z_xsection.SaveAs("%s/unfolded_vs_mc_%s_xsection_%s.eps" % (self.d_resultsallpdata, self.v_varshape_binning, suffix_plot))
1989-
cinput_mc_gen_z_xsection.SaveAs("%s/unfolded_vs_mc_%s_xsection_%s.pdf" % (self.d_resultsallpdata, self.v_varshape_binning, suffix_plot))
1993+
#cinput_mc_gen_z_xsection.SaveAs("%s/unfolded_vs_mc_%s_xsection_%s.pdf" % (self.d_resultsallpdata, self.v_varshape_binning, suffix_plot))
19901994

19911995
for ibin2 in range(self.p_nbin2_reco):
19921996
suffix = "%s_%.2f_%.2f" % \
@@ -2467,16 +2471,14 @@ def jetsystematics(self):
24672471
y_margin_down = 0.05
24682472
for sys_var in range(self.systematic_variations[sys_cat]):
24692473
if sys_var == 0:
2470-
#if sys_cat == 0:
24712474
input_histograms_default[ibin2].GetYaxis().SetRangeUser(*get_plot_range(y_min, y_max, y_margin_down, y_margin_up))
2472-
#input_histograms_default[ibin2].GetYaxis().SetRangeUser(0.0, input_histograms_default[ibin2].GetMaximum() * 2.5)
24732475
input_histograms_default[ibin2].GetXaxis().SetRangeUser(round(self.lvarshape_binmin_gen[0], 2), round(self.lvarshape_binmax_gen[-1], 2))
24742476
input_histograms_default[ibin2].SetTitle("")
24752477
input_histograms_default[ibin2].SetXTitle(self.v_varshape_latex)
24762478
input_histograms_default[ibin2].SetYTitle("1/#it{N}_{jets} d#it{N}/d%s" % self.v_varshape_latex)
24772479
input_histograms_default[ibin2].Draw()
24782480
leg_sysvar_each.AddEntry(input_histograms_sys[ibin2][sys_cat][sys_var], self.systematic_varlabels[sys_cat][sys_var], "P")
2479-
setup_histogram(input_histograms_sys[ibin2][sys_cat][sys_var], get_colour(nsys + 1))
2481+
setup_histogram(input_histograms_sys[ibin2][sys_cat][sys_var], get_colour(nsys + 1), get_marker(nsys + 1))
24802482
input_histograms_sys[ibin2][sys_cat][sys_var].Draw("same")
24812483
nsys = nsys + 1
24822484
latex = TLatex(0.15, 0.82, "%g #leq %s < %g GeV/#it{c}" % (self.lvar2_binmin_gen[ibin2], self.p_latexbin2var, self.lvar2_binmax_gen[ibin2]))

0 commit comments

Comments
 (0)