diff --git a/analyzer/modules/baseline.py b/analyzer/modules/baseline.py index 3a760671..6eb4c1b3 100644 --- a/analyzer/modules/baseline.py +++ b/analyzer/modules/baseline.py @@ -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) @@ -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))) diff --git a/analyzer/modules/jets.py b/analyzer/modules/jets.py index 15850d73..7c39fc9f 100644 --- a/analyzer/modules/jets.py +++ b/analyzer/modules/jets.py @@ -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]): @@ -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 diff --git a/analyzer/plotting/high_level_plots.py b/analyzer/plotting/high_level_plots.py index 41aa7d5e..2e007286 100644 --- a/analyzer/plotting/high_level_plots.py +++ b/analyzer/plotting/high_level_plots.py @@ -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 diff --git a/analyzer/plotting/simple_plot.py b/analyzer/plotting/simple_plot.py index 4bd21b3e..c58b5175 100644 --- a/analyzer/plotting/simple_plot.py +++ b/analyzer/plotting/simple_plot.py @@ -65,7 +65,7 @@ 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: @@ -73,7 +73,7 @@ def __init__( #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"} @@ -81,6 +81,8 @@ def __init__( 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 = []