10 from __future__
import print_function
11 from __future__
import division
13 from eFEXNTuple
import *
18 hist, edge = np.histogram(data, binning)
21 for i
in range(len(hist)):
24 newbin.append(edge[i+1])
26 newbin[-1] = binning[-1]
30 hist1, edge = np.histogram(data1, binning)
31 hist2, edge = np.histogram(data2, binning)
35 for i
in range(len(hist1)):
38 if total_1 > 0
and total_2 > 0:
39 newbin.append(edge[i+1])
42 newbin[-1] = binning[-1]
46 bins =
rebin(bins, all_data)
47 hist_all, edges = np.histogram(all_data, bins)
48 hist_selected, edges = np.histogram(selected_data, bins)
49 bin_centre = [(edges[i] + edges[i+1])/2.
for i
in range(len(edges)-1)]
50 hist_height = hist_selected / hist_all
51 hist_error = ((hist_selected**0.5 / hist_all)**2. + (hist_all**0.5 * hist_selected / hist_all**2.)**2.)**0.5
52 return (hist_height, bin_centre, hist_error)
58 for each
in myntuple.entries():
59 each.set_class_type(
"e")
60 if each.is_in_crack(each.leading_l_id()):
62 if abs(each.truth_e_eta[each.leading_l_id()]) > 2.3:
64 all_e_ET.append(each.truth_e_ET[each.leading_l_id()])
65 matched_tobs = each.get_eg_matchedtob_id()[each.leading_l_id()]
67 for i
in matched_tobs:
68 if not each.eg_haveseed[i]:
70 if each.eg_ET[i] <= 22:
76 selected_e_ET.append(each.truth_e_ET[each.leading_l_id()])
78 hist_height, bin_centre, hist_error =
turn_on_curve(all_e_ET, selected_e_ET,
range(0,100,5))
79 histplot([bin_centre], [hist_height], [hist_error], errorbar_limit=1, filename=
"egammatrunon")
82 if __name__ ==
"__main__":
84 print(
"Error: too many arguments")
85 print(
"Example: python makeplots.py PATH/TO/INPUT")
87 if len(sys.argv) == 1:
88 print(
"Error: need the path to the input file")
89 print(
"Example: python makeplots.py PATH/TO/INPUT")
90 print(
"Info: Using default input file path")
91 inputfile =
"myfile.root"
93 inputfile = sys.argv[1]