Skip to content
Open
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
17 changes: 9 additions & 8 deletions analyzer/modules/baseline.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ def createSelection(events, analyzer):
passes_b_dr = med_dr > 1

if "HLT" in events.fields:
#hlt = functools.reduce(op.or_, [events.HLT[x] for x in hlt_names])
hlt = functools.reduce(op.or_, [events.HLT[x] for x in hlt_names])
selection.add('hlt',hlt)
#passes_hlt = functools.reduce(op.or_, [events.HLT[x] for x in hlt_names])
#selection.add("hlt", hlt)
for n in hlt_names:
#hlt = functools.reduce(op.or_, [events.HLT[x] for x in hlt_names])
selection.add(f"hlt_{n}", events.HLT[n])

#for n in hlt_names:
# hlt = functools.reduce(op.or_, [events.HLT[x] for x in hlt_names])
#selection.add(f"hlt_{n}", events.HLT[n])
selection.add("highptjet", passes_highptjet)
selection.add("jets", passes_jets)
selection.add("0Lep", passes_0Lep)
Expand Down Expand Up @@ -189,9 +189,10 @@ def createCRSelection(events, analyzer):
# top_two_dr = ak.fill_none(filled_jets[:, 0].delta_r(filled_jets[:, 1]), False)
hlt_names = analyzer.profile.hlt
if "HLT" in events.fields:
for n in hlt_names:
#hlt = functools.reduce(op.or_, [events.HLT[x] for x in hlt_names])
selection.add(f"hlt_{n}", events.HLT[n])
hlt = functools.reduce(op.or_, [events.HLT[x] for x in hlt_names])
# for n in hlt_names:
# selection.add(f"hlt_{n}", events.HLT[n])
selection.add('hlt', hlt)
selection.add("ht1200", (events.HT >= 1200))
selection.add("highptjet", (ak.fill_none(filled_jets[:, 0].pt > 300, False)))
selection.add("jets", ((ak.num(good_jets) >= 4) & (ak.num(good_jets) <= 6)))
Expand Down
21 changes: 11 additions & 10 deletions analyzer/modules/jets.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,14 @@ def createJetHistograms(events, analyzer):
name=f"$\phi$ of jet {i+1}",
description=f"$\phi$ of jet {i+1}",
)
analyzer.H(f"phi_vs_eta",
[makeAxis(50,-5,5,f"$\eta$"),
makeAxis(50,-5,5,f"$\phi$")],
[gj.eta, gj.phi],
name=f"$\eta$ vs $\phi$ of jet ",
description=rf"$\eta$ vs $\phi$ of jet "
)
analyzer.H(f"phi_{i+1}_vs_eta_{i+1}",
[makeAxis(50,-5,5,f"$\eta_{{{i+1}}}$"),
makeAxis(50,-5,5,f"$\phi_{{{i+1}}}$")],
[gj[:,i].eta,
gj[:,i].phi],
name=f"$\eta$ vs $\phi$ of jet {i+1}",
description=rf"$\eta$ vs $\phi$ of jet {i+1}"
)

masks = {}
for i, j in list(x for x in it.combinations(range(0, 4), 2) if x[0] != x[1]):
Expand Down Expand Up @@ -144,12 +145,12 @@ def createJetHistograms(events, analyzer):
mask = ak.num(gj, axis=1) > i
masked_jets = gj[mask]
htratio = masked_jets[:, i].pt / events.HT[mask]
analyzer.H(f"pt_ht_ratio_{i}",
analyzer.H(f"pt_ht_ratio_{i+1}",
hist.axis.Regular(50, 0, 1, name="pt_o_ht", label=r"$\frac{p_{T}}{HT}$"),
htratio,
mask=mask,
name=rf"Ratio of jet {i} $p_T$ to event HT",
description=rf"Ratio of jet {i} $p_T$ to event HT",
name=rf"Ratio of jet {i+1} $p_T$ to event HT",
description=rf"Ratio of jet {i+1} $p_T$ to event HT",
)

return events, analyzer
Expand Down
5 changes: 4 additions & 1 deletion analyzer/plotting/high_level_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,5 +241,8 @@ def plot2D(
if zscorename and hasattr(ax, "cax"):
cax = ax.cax
cax.set_ylabel(zscorename)


#uncomment to place box around where the "hole" is in phi v eta for 2018 data.
# from matplotlib.patches import Rectangle
# ax.add_patch(Rectangle((-3.2,-1.57),1.9,0.7,fill=False,edgecolor='black'))
return fig
6 changes: 4 additions & 2 deletions analyzer/plotting/simple_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,24 @@ def __init__(
#self.cut_list_for_plot and self.cut_table_dict are actually what get used in plotting
#self.cut_list_for_plot is a string to be put on the plot itself and contains shortened names for the cuts.
#Whereas self.cut_table_dict is a dictionary with keys=dataset names (Ex: Data2018) and values of each cut in plain words.
#self.cut_table_dict is plotted below the plots as a table.
#self.cut_table_dict is plotted below the plots as a table or individually.

self.cut_list_dict = {}
for i in results:
for j in i.results.keys():
#list(dict.fromkeys(...)) gets rid of duplicates
self.cut_list_dict[j] =list(dict.fromkeys(i.results[j].cut_list))

cut_map = {"hlt": "", "ht1200": "HT ≥ 1200", "highptjet": "Jet-PT ≥ 300",
cut_map = {"hlt": "", "ht1200": "HT ≥ 1200", "highptjet": "Leading Jet-PT ≥ 300",
"jets": "4 ≤ N-Jets ≤ 6", "0Lep": "0e, 0μ", "0looseb": "0b",
"2bjet": "Med-b Jets ≥ 2", "1tightbjet": "Tight-b Jets ≥ 1",
"b_dr": "b-jet ΔR > 1", "bbpt": "b-jet 1+2 > 200"}

self.cut_table_dict = {}
for dataset in self.cut_list_dict:
cut_map['hlt'] = ' | '.join(self.sample_manager[dataset].profile.hlt)
for i in self.sample_manager[dataset].profile.hlt:
cut_map[f'hlt_{i}'] = i
self.cut_table_dict[dataset] = [cut_map[i] for i in self.cut_list_dict[dataset]]

self.cut_list_for_plot = []
Expand Down