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)
56 for each
in myntuple.entries():
57 each.set_class_type(
"e")
58 if each.is_in_crack(each.leading_l_id()):
60 if abs(each.truth_e_eta[each.leading_l_id()]) > 2.3:
62 all_e_ET.append(each.truth_e_ET[each.leading_l_id()])
63 matched_tobs = each.get_eg_matchedtob_id()[each.leading_l_id()]
65 for i
in matched_tobs:
66 if not each.eg_haveseed[i]:
68 if each.eg_ET[i] <= 22:
74 selected_e_ET.append(each.truth_e_ET[each.leading_l_id()])
76 hist_height, bin_centre, hist_error =
turn_on_curve(all_e_ET, selected_e_ET,
range(0,100,5))
77 histplot([bin_centre], [hist_height], [hist_error], errorbar_limit=1, filename=
"egammatrunon")
80 if __name__ ==
"__main__":
82 print(
"Error: too many arguments")
83 print(
"Example: python makeplots.py PATH/TO/INPUT")
85 if len(sys.argv) == 1:
86 print(
"Error: need the path to the input file")
87 print(
"Example: python makeplots.py PATH/TO/INPUT")
88 print(
"Info: Using default input file path")
89 inputfile =
"myfile.root"
91 inputfile = sys.argv[1]