11 from eFEXNTuple
import *
16 hist, edge = np.histogram(data, binning)
19 for i
in range(len(hist)):
22 newbin.append(edge[i+1])
24 newbin[-1] = binning[-1]
28 hist1, edge = np.histogram(data1, binning)
29 hist2, edge = np.histogram(data2, binning)
33 for i
in range(len(hist1)):
36 if total_1 > 0
and total_2 > 0:
37 newbin.append(edge[i+1])
40 newbin[-1] = binning[-1]
44 bins =
rebin(bins, all_data)
45 hist_all, edges = np.histogram(all_data, bins)
46 hist_selected, edges = np.histogram(selected_data, bins)
47 bin_centre = [(edges[i] + edges[i+1])/2.
for i
in range(len(edges)-1)]
48 hist_height = hist_selected / hist_all
49 hist_error = ((hist_selected**0.5 / hist_all)**2. + (hist_all**0.5 * hist_selected / hist_all**2.)**2.)**0.5
50 return (hist_height, bin_centre, hist_error)
55 selected_l_ET_TLV = []
56 selected_l_eta_TLV = []
57 selected_l_ET_Oregon = []
58 selected_l_eta_Oregon = []
60 for each
in myntuple.entries():
61 each.set_class_type(
"tau")
62 if each.leading_l_id()
is None:
66 if each.is_in_crack(each.leading_l_id()):
68 if abs(each.truth_tauvisible_eta[each.leading_l_id()]) > 2.3:
72 all_l_ET.append(each.truth_tauvisible_ET[each.leading_l_id()])
73 all_l_eta.append(each.truth_tauvisible_eta[each.leading_l_id()])
74 matched_tobs = each.get_eg_matchedtob_id()[each.leading_l_id()]
76 oregon_selected =
False
77 for i
in matched_tobs:
78 if each.eg_tauTLV_Et[i] <= 12:
80 if each.eg_tauTLV_Iso[i] < 0.66
and each.eg_tauTLV_Et[i] <= 15:
84 for i
in matched_tobs:
85 if each.eg_tauOregon_Et[i] <= 12:
87 if each.eg_tauOregon_Iso[i] < 0.66
and each.eg_tauOregon_Et[i] <= 15:
89 oregon_selected =
True
92 selected_l_ET_TLV.append(each.truth_tauvisible_ET[each.leading_l_id()])
95 selected_l_ET_Oregon.append(each.truth_tauvisible_ET[each.leading_l_id()])
97 hist_height, bin_centre, hist_error =
turn_on_curve(all_l_ET, selected_l_ET_TLV,
range(0,100,5))
98 histplot([bin_centre], [hist_height], [hist_error], errorbar_limit=1, filename=
"tautlvtrunon")
99 hist_height, bin_centre, hist_error =
turn_on_curve(all_l_ET, selected_l_ET_Oregon,
range(0,100,5))
100 histplot([bin_centre], [hist_height], [hist_error], errorbar_limit=1, filename=
"tauoregontrunon")
105 if __name__ ==
"__main__":
106 if len(sys.argv) > 2:
107 print(
"Error: too many arguments")
108 print(
"Example: python makeplots.py PATH/TO/INPUT")
110 if len(sys.argv) == 1:
111 print(
"Error: need the path to the input file")
112 print(
"Example: python makeplots.py PATH/TO/INPUT")
113 print(
"Info: Using default input file path")
114 inputfile =
"myfile.root"
116 inputfile = sys.argv[1]