4 import matplotlib.pyplot
as plt
5 from matplotlib.ticker
import NullFormatter
8 This is a sample code for ROC curve plotting (Feel free to change it to Your needs!) 9 Code is ran from "Validation/MtdValidation/test" directory 10 Before running the code initialize cmsenv 11 Run the code by using python3 -> 'python3 ROC_ploter.py' 12 Change the DQM File and ROC plot output directories accordingly to Your workspace 17 print(
"All libraries has been read in!")
19 directory_path = os.getenv(
'PWD')
20 ROC_plots_directory = directory_path +
'/ROC' 24 def __init__(self,filename_Sig: str, filename_Bkg: str,dz_cut: str,dtSignif_cut: bool):
26 self.filename_sig = directory_path + filename_Sig
27 self.filename_bkg = directory_path + filename_Bkg
29 self.cut_type = dtSignif_cut
30 self.dz_cut_description = dz_cut
32 self.Tree_Sig = up.open(self.filename_sig)[
"DQMData/Run 1/MTD/Run summary/ElectronIso;1"]
33 self.Tree_Bkg = up.open(self.filename_bkg)[
"DQMData/Run 1/MTD/Run summary/ElectronIso;1"]
43 self.Sig_hists[
'Sig_noMTD_EB'] = self.Tree_Sig[
'Ele_chIso_sum_Sig_EB;1'].to_numpy()
44 self.Sig_hists[
'Sig_noMTD_EE'] = self.Tree_Sig[
'Ele_chIso_sum_Sig_EE;1'].to_numpy()
45 self.Bkg_hists[
'Bkg_noMTD_EB'] = self.Tree_Bkg[
'Ele_chIso_sum_Bkg_EB;1'].to_numpy()
46 self.Bkg_hists[
'Bkg_noMTD_EE'] = self.Tree_Bkg[
'Ele_chIso_sum_Bkg_EE;1'].to_numpy()
48 if self.cut_type ==
True:
50 self.Sig_hists[
'Sig_4sigma_EB'] = self.Tree_Sig[
'Ele_chIso_sum_MTD_4sigma_Sig_EB;1'].to_numpy()
51 self.Sig_hists[
'Sig_3sigma_EB'] = self.Tree_Sig[
'Ele_chIso_sum_MTD_3sigma_Sig_EB;1'].to_numpy()
52 self.Sig_hists[
'Sig_2sigma_EB'] = self.Tree_Sig[
'Ele_chIso_sum_MTD_2sigma_Sig_EB;1'].to_numpy()
54 self.Sig_hists[
'Sig_4sigma_EE'] = self.Tree_Sig[
'Ele_chIso_sum_MTD_4sigma_Sig_EE;1'].to_numpy()
55 self.Sig_hists[
'Sig_3sigma_EE'] = self.Tree_Sig[
'Ele_chIso_sum_MTD_3sigma_Sig_EE;1'].to_numpy()
56 self.Sig_hists[
'Sig_2sigma_EE'] = self.Tree_Sig[
'Ele_chIso_sum_MTD_2sigma_Sig_EE;1'].to_numpy()
58 self.Bkg_hists[
'Bkg_4sigma_EB'] = self.Tree_Bkg[
'Ele_chIso_sum_MTD_4sigma_Bkg_EB;1'].to_numpy()
59 self.Bkg_hists[
'Bkg_3sigma_EB'] = self.Tree_Bkg[
'Ele_chIso_sum_MTD_3sigma_Bkg_EB;1'].to_numpy()
60 self.Bkg_hists[
'Bkg_2sigma_EB'] = self.Tree_Bkg[
'Ele_chIso_sum_MTD_2sigma_Bkg_EB;1'].to_numpy()
62 self.Bkg_hists[
'Bkg_4sigma_EE'] = self.Tree_Bkg[
'Ele_chIso_sum_MTD_4sigma_Bkg_EE;1'].to_numpy()
63 self.Bkg_hists[
'Bkg_3sigma_EE'] = self.Tree_Bkg[
'Ele_chIso_sum_MTD_3sigma_Bkg_EE;1'].to_numpy()
64 self.Bkg_hists[
'Bkg_2sigma_EE'] = self.Tree_Bkg[
'Ele_chIso_sum_MTD_2sigma_Bkg_EE;1'].to_numpy()
71 self.Sig_hists[
'Sig_cut1_EB'] = self.Tree_Sig[
'Ele_chIso_sum_MTD_1_Sig_EB;1'].to_numpy()
72 self.Sig_hists[
'Sig_cut2_EB'] = self.Tree_Sig[
'Ele_chIso_sum_MTD_2_Sig_EB;1'].to_numpy()
73 self.Sig_hists[
'Sig_cut3_EB'] = self.Tree_Sig[
'Ele_chIso_sum_MTD_3_Sig_EB;1'].to_numpy()
74 self.Sig_hists[
'Sig_cut5_EB'] = self.Tree_Sig[
'Ele_chIso_sum_MTD_5_Sig_EB;1'].to_numpy()
76 self.Sig_hists[
'Sig_cut1_EE'] = self.Tree_Sig[
'Ele_chIso_sum_MTD_1_Sig_EE;1'].to_numpy()
77 self.Sig_hists[
'Sig_cut2_EE'] = self.Tree_Sig[
'Ele_chIso_sum_MTD_2_Sig_EE;1'].to_numpy()
78 self.Sig_hists[
'Sig_cut3_EE'] = self.Tree_Sig[
'Ele_chIso_sum_MTD_3_Sig_EE;1'].to_numpy()
79 self.Sig_hists[
'Sig_cut5_EE'] = self.Tree_Sig[
'Ele_chIso_sum_MTD_5_Sig_EE;1'].to_numpy()
81 self.Bkg_hists[
'Bkg_cut1_EB'] = self.Tree_Bkg[
'Ele_chIso_sum_MTD_1_Bkg_EB;1'].to_numpy()
82 self.Bkg_hists[
'Bkg_cut2_EB'] = self.Tree_Bkg[
'Ele_chIso_sum_MTD_2_Bkg_EB;1'].to_numpy()
83 self.Bkg_hists[
'Bkg_cut3_EB'] = self.Tree_Bkg[
'Ele_chIso_sum_MTD_3_Bkg_EB;1'].to_numpy()
84 self.Bkg_hists[
'Bkg_cut5_EB'] = self.Tree_Bkg[
'Ele_chIso_sum_MTD_5_Bkg_EB;1'].to_numpy()
86 self.Bkg_hists[
'Bkg_cut1_EE'] = self.Tree_Bkg[
'Ele_chIso_sum_MTD_1_Bkg_EE;1'].to_numpy()
87 self.Bkg_hists[
'Bkg_cut2_EE'] = self.Tree_Bkg[
'Ele_chIso_sum_MTD_2_Bkg_EE;1'].to_numpy()
88 self.Bkg_hists[
'Bkg_cut3_EE'] = self.Tree_Bkg[
'Ele_chIso_sum_MTD_3_Bkg_EE;1'].to_numpy()
89 self.Bkg_hists[
'Bkg_cut5_EE'] = self.Tree_Bkg[
'Ele_chIso_sum_MTD_5_Bkg_EE;1'].to_numpy()
93 efficiency_Sig_noMTD_EB , efficiency_Bkg_noMTD_EB , efficiency_Sig_noMTD_EE , efficiency_Bkg_noMTD_EE = [],[],[],[]
95 if self.cut_type ==
True:
97 efficiency_Sig_4sigma_EB , efficiency_Bkg_4sigma_EB , efficiency_Sig_4sigma_EE , efficiency_Bkg_4sigma_EE = [],[],[],[]
98 efficiency_Sig_3sigma_EB , efficiency_Bkg_3sigma_EB , efficiency_Sig_3sigma_EE , efficiency_Bkg_3sigma_EE = [],[],[],[]
99 efficiency_Sig_2sigma_EB , efficiency_Bkg_2sigma_EB , efficiency_Sig_2sigma_EE , efficiency_Bkg_2sigma_EE = [],[],[],[]
101 for i
in range( len(self.Sig_hists[
'Sig_noMTD_EB'][0]) ):
103 efficiency_Sig_noMTD_EB.append( sum(self.Sig_hists[
'Sig_noMTD_EB'][0][0:i+1])/sum(self.Sig_hists[
'Sig_noMTD_EB'][0]) )
104 efficiency_Sig_4sigma_EB.append( sum(self.Sig_hists[
'Sig_4sigma_EB'][0][0:i+1])/sum(self.Sig_hists[
'Sig_4sigma_EB'][0]) )
105 efficiency_Sig_3sigma_EB.append( sum(self.Sig_hists[
'Sig_3sigma_EB'][0][0:i+1])/sum(self.Sig_hists[
'Sig_3sigma_EB'][0]) )
106 efficiency_Sig_2sigma_EB.append( sum(self.Sig_hists[
'Sig_2sigma_EB'][0][0:i+1])/sum(self.Sig_hists[
'Sig_2sigma_EB'][0]) )
108 efficiency_Bkg_noMTD_EB.append( sum(self.Bkg_hists[
'Bkg_noMTD_EB'][0][0:i+1])/sum(self.Bkg_hists[
'Bkg_noMTD_EB'][0]) )
109 efficiency_Bkg_4sigma_EB.append( sum(self.Bkg_hists[
'Bkg_4sigma_EB'][0][0:i+1])/sum(self.Bkg_hists[
'Bkg_4sigma_EB'][0]) )
110 efficiency_Bkg_3sigma_EB.append( sum(self.Bkg_hists[
'Bkg_3sigma_EB'][0][0:i+1])/sum(self.Bkg_hists[
'Bkg_3sigma_EB'][0]) )
111 efficiency_Bkg_2sigma_EB.append( sum(self.Bkg_hists[
'Bkg_2sigma_EB'][0][0:i+1])/sum(self.Bkg_hists[
'Bkg_2sigma_EB'][0]) )
114 efficiency_Sig_noMTD_EE.append( sum(self.Sig_hists[
'Sig_noMTD_EE'][0][0:i+1])/sum(self.Sig_hists[
'Sig_noMTD_EE'][0]) )
115 efficiency_Sig_4sigma_EE.append( sum(self.Sig_hists[
'Sig_4sigma_EE'][0][0:i+1])/sum(self.Sig_hists[
'Sig_4sigma_EE'][0]) )
116 efficiency_Sig_3sigma_EE.append( sum(self.Sig_hists[
'Sig_3sigma_EE'][0][0:i+1])/sum(self.Sig_hists[
'Sig_3sigma_EE'][0]) )
117 efficiency_Sig_2sigma_EE.append( sum(self.Sig_hists[
'Sig_2sigma_EE'][0][0:i+1])/sum(self.Sig_hists[
'Sig_2sigma_EE'][0]) )
119 efficiency_Bkg_noMTD_EE.append( sum(self.Bkg_hists[
'Bkg_noMTD_EE'][0][0:i+1])/sum(self.Bkg_hists[
'Bkg_noMTD_EE'][0]) )
120 efficiency_Bkg_4sigma_EE.append( sum(self.Bkg_hists[
'Bkg_4sigma_EE'][0][0:i+1])/sum(self.Bkg_hists[
'Bkg_4sigma_EE'][0]) )
121 efficiency_Bkg_3sigma_EE.append( sum(self.Bkg_hists[
'Bkg_3sigma_EE'][0][0:i+1])/sum(self.Bkg_hists[
'Bkg_3sigma_EE'][0]) )
122 efficiency_Bkg_2sigma_EE.append( sum(self.Bkg_hists[
'Bkg_2sigma_EE'][0][0:i+1])/sum(self.Bkg_hists[
'Bkg_2sigma_EE'][0]) )
125 self.Sig_iso_eff[
'Sig_noMTD_EB'] , self.Bkg_iso_eff[
'Bkg_noMTD_EB'] = efficiency_Sig_noMTD_EB , efficiency_Bkg_noMTD_EB
126 self.Sig_iso_eff[
'Sig_4sigma_EB'] , self.Bkg_iso_eff[
'Bkg_4sigma_EB'] = efficiency_Sig_4sigma_EB , efficiency_Bkg_4sigma_EB
127 self.Sig_iso_eff[
'Sig_3sigma_EB'] , self.Bkg_iso_eff[
'Bkg_3sigma_EB'] = efficiency_Sig_3sigma_EB , efficiency_Bkg_3sigma_EB
128 self.Sig_iso_eff[
'Sig_2sigma_EB'] , self.Bkg_iso_eff[
'Bkg_2sigma_EB'] = efficiency_Sig_2sigma_EB , efficiency_Bkg_2sigma_EB
130 self.Sig_iso_eff[
'Sig_noMTD_EE'] , self.Bkg_iso_eff[
'Bkg_noMTD_EE'] = efficiency_Sig_noMTD_EE , efficiency_Bkg_noMTD_EE
131 self.Sig_iso_eff[
'Sig_4sigma_EE'] , self.Bkg_iso_eff[
'Bkg_4sigma_EE'] = efficiency_Sig_4sigma_EE , efficiency_Bkg_4sigma_EE
132 self.Sig_iso_eff[
'Sig_3sigma_EE'] , self.Bkg_iso_eff[
'Bkg_3sigma_EE'] = efficiency_Sig_3sigma_EE , efficiency_Bkg_3sigma_EE
133 self.Sig_iso_eff[
'Sig_2sigma_EE'] , self.Bkg_iso_eff[
'Bkg_2sigma_EE'] = efficiency_Sig_2sigma_EE , efficiency_Bkg_2sigma_EE
137 efficiency_Sig_cut1_EB , efficiency_Bkg_cut1_EB , efficiency_Sig_cut1_EE , efficiency_Bkg_cut1_EE = [],[],[],[]
138 efficiency_Sig_cut2_EB , efficiency_Bkg_cut2_EB , efficiency_Sig_cut2_EE , efficiency_Bkg_cut2_EE = [],[],[],[]
139 efficiency_Sig_cut3_EB , efficiency_Bkg_cut3_EB , efficiency_Sig_cut3_EE , efficiency_Bkg_cut3_EE = [],[],[],[]
140 efficiency_Sig_cut5_EB , efficiency_Bkg_cut5_EB , efficiency_Sig_cut5_EE , efficiency_Bkg_cut5_EE = [],[],[],[]
142 for i
in range( len(self.Sig_hists[
'Sig_noMTD_EB'][0]) ):
144 efficiency_Sig_noMTD_EB.append( sum(self.Sig_hists[
'Sig_noMTD_EB'][0][0:i+1])/sum(self.Sig_hists[
'Sig_noMTD_EB'][0]) )
145 efficiency_Sig_cut1_EB.append( sum(self.Sig_hists[
'Sig_cut1_EB'][0][0:i+1])/sum(self.Sig_hists[
'Sig_cut1_EB'][0]) )
146 efficiency_Sig_cut2_EB.append( sum(self.Sig_hists[
'Sig_cut2_EB'][0][0:i+1])/sum(self.Sig_hists[
'Sig_cut2_EB'][0]) )
147 efficiency_Sig_cut3_EB.append( sum(self.Sig_hists[
'Sig_cut3_EB'][0][0:i+1])/sum(self.Sig_hists[
'Sig_cut3_EB'][0]) )
148 efficiency_Sig_cut5_EB.append( sum(self.Sig_hists[
'Sig_cut5_EB'][0][0:i+1])/sum(self.Sig_hists[
'Sig_cut5_EB'][0]) )
150 efficiency_Bkg_noMTD_EB.append( sum(self.Bkg_hists[
'Bkg_noMTD_EB'][0][0:i+1])/sum(self.Bkg_hists[
'Bkg_noMTD_EB'][0]) )
151 efficiency_Bkg_cut1_EB.append( sum(self.Bkg_hists[
'Bkg_cut1_EB'][0][0:i+1])/sum(self.Bkg_hists[
'Bkg_cut1_EB'][0]) )
152 efficiency_Bkg_cut2_EB.append( sum(self.Bkg_hists[
'Bkg_cut2_EB'][0][0:i+1])/sum(self.Bkg_hists[
'Bkg_cut2_EB'][0]) )
153 efficiency_Bkg_cut3_EB.append( sum(self.Bkg_hists[
'Bkg_cut3_EB'][0][0:i+1])/sum(self.Bkg_hists[
'Bkg_cut3_EB'][0]) )
154 efficiency_Bkg_cut5_EB.append( sum(self.Bkg_hists[
'Bkg_cut5_EB'][0][0:i+1])/sum(self.Bkg_hists[
'Bkg_cut5_EB'][0]) )
157 efficiency_Sig_noMTD_EE.append( sum(self.Sig_hists[
'Sig_noMTD_EE'][0][0:i+1])/sum(self.Sig_hists[
'Sig_noMTD_EE'][0]) )
158 efficiency_Sig_cut1_EE.append( sum(self.Sig_hists[
'Sig_cut1_EE'][0][0:i+1])/sum(self.Sig_hists[
'Sig_cut1_EE'][0]) )
159 efficiency_Sig_cut2_EE.append( sum(self.Sig_hists[
'Sig_cut2_EE'][0][0:i+1])/sum(self.Sig_hists[
'Sig_cut2_EE'][0]) )
160 efficiency_Sig_cut3_EE.append( sum(self.Sig_hists[
'Sig_cut3_EE'][0][0:i+1])/sum(self.Sig_hists[
'Sig_cut3_EE'][0]) )
161 efficiency_Sig_cut5_EE.append( sum(self.Sig_hists[
'Sig_cut5_EE'][0][0:i+1])/sum(self.Sig_hists[
'Sig_cut5_EE'][0]) )
163 efficiency_Bkg_noMTD_EE.append( sum(self.Bkg_hists[
'Bkg_noMTD_EE'][0][0:i+1])/sum(self.Bkg_hists[
'Bkg_noMTD_EE'][0]) )
164 efficiency_Bkg_cut1_EE.append( sum(self.Bkg_hists[
'Bkg_cut1_EE'][0][0:i+1])/sum(self.Bkg_hists[
'Bkg_cut1_EE'][0]) )
165 efficiency_Bkg_cut2_EE.append( sum(self.Bkg_hists[
'Bkg_cut2_EE'][0][0:i+1])/sum(self.Bkg_hists[
'Bkg_cut2_EE'][0]) )
166 efficiency_Bkg_cut3_EE.append( sum(self.Bkg_hists[
'Bkg_cut3_EE'][0][0:i+1])/sum(self.Bkg_hists[
'Bkg_cut3_EE'][0]) )
167 efficiency_Bkg_cut5_EE.append( sum(self.Bkg_hists[
'Bkg_cut5_EE'][0][0:i+1])/sum(self.Bkg_hists[
'Bkg_cut5_EE'][0]) )
170 self.Sig_iso_eff[
'Sig_noMTD_EB'] , self.Bkg_iso_eff[
'Bkg_noMTD_EB'] = efficiency_Sig_noMTD_EB , efficiency_Bkg_noMTD_EB
171 self.Sig_iso_eff[
'Sig_cut1_EB'] , self.Bkg_iso_eff[
'Bkg_cut1_EB'] = efficiency_Sig_cut1_EB , efficiency_Bkg_cut1_EB
172 self.Sig_iso_eff[
'Sig_cut2_EB'] , self.Bkg_iso_eff[
'Bkg_cut2_EB'] = efficiency_Sig_cut2_EB , efficiency_Bkg_cut2_EB
173 self.Sig_iso_eff[
'Sig_cut3_EB'] , self.Bkg_iso_eff[
'Bkg_cut3_EB'] = efficiency_Sig_cut3_EB , efficiency_Bkg_cut3_EB
174 self.Sig_iso_eff[
'Sig_cut5_EB'] , self.Bkg_iso_eff[
'Bkg_cut5_EB'] = efficiency_Sig_cut5_EB , efficiency_Bkg_cut5_EB
176 self.Sig_iso_eff[
'Sig_noMTD_EE'] , self.Bkg_iso_eff[
'Bkg_noMTD_EE'] = efficiency_Sig_noMTD_EE , efficiency_Bkg_noMTD_EE
177 self.Sig_iso_eff[
'Sig_cut1_EE'] , self.Bkg_iso_eff[
'Bkg_cut1_EE'] = efficiency_Sig_cut1_EE , efficiency_Bkg_cut1_EE
178 self.Sig_iso_eff[
'Sig_cut2_EE'] , self.Bkg_iso_eff[
'Bkg_cut2_EE'] = efficiency_Sig_cut2_EE , efficiency_Bkg_cut2_EE
179 self.Sig_iso_eff[
'Sig_cut3_EE'] , self.Bkg_iso_eff[
'Bkg_cut3_EE'] = efficiency_Sig_cut3_EE , efficiency_Bkg_cut3_EE
180 self.Sig_iso_eff[
'Sig_cut5_EE'] , self.Bkg_iso_eff[
'Bkg_cut5_EE'] = efficiency_Sig_cut5_EE , efficiency_Bkg_cut5_EE
184 if self.cut_type ==
True:
186 plt.plot(self.Sig_iso_eff[
'Sig_noMTD_EB'],self.Bkg_iso_eff[
'Bkg_noMTD_EB'], label =
'noMTD')
187 plt.plot(self.Sig_iso_eff[
'Sig_4sigma_EB'],self.Bkg_iso_eff[
'Bkg_4sigma_EB'], label =
'4sigma cut')
188 plt.plot(self.Sig_iso_eff[
'Sig_3sigma_EB'],self.Bkg_iso_eff[
'Bkg_3sigma_EB'], label =
'3sigma cut')
189 plt.plot(self.Sig_iso_eff[
'Sig_2sigma_EB'],self.Bkg_iso_eff[
'Bkg_2sigma_EB'], label =
'2sigma cut')
190 plt.legend(loc=
'best')
194 plt.xlabel(
"Signal efficiency")
195 plt.ylabel(
"Background efficiency")
196 plt.title(f
'ROC curves for BTL, {self.dz_cut_description}')
198 plt.savefig(ROC_plots_directory+f
'ROC_curve_BTL_dtsignif_{self.dz_cut_description}')
201 plt.plot(self.Sig_iso_eff[
'Sig_noMTD_EE'],self.Bkg_iso_eff[
'Bkg_noMTD_EE'], label =
'noMTD')
202 plt.plot(self.Sig_iso_eff[
'Sig_4sigma_EE'],self.Bkg_iso_eff[
'Bkg_4sigma_EE'], label =
'4sigma cut')
203 plt.plot(self.Sig_iso_eff[
'Sig_3sigma_EE'],self.Bkg_iso_eff[
'Bkg_3sigma_EE'], label =
'3sigma cut')
204 plt.plot(self.Sig_iso_eff[
'Sig_2sigma_EE'],self.Bkg_iso_eff[
'Bkg_2sigma_EE'], label =
'2sigma cut')
205 plt.legend(loc=
'best')
209 plt.xlabel(
"Signal efficiency")
210 plt.ylabel(
"Background efficiency")
211 plt.title(f
'ROC curves for ETL, {self.dz_cut_description}')
213 plt.savefig(ROC_plots_directory+f
'ROC_curve_ETL_dtsignif_{self.dz_cut_description}')
219 plt.plot(self.Sig_iso_eff[
'Sig_noMTD_EB'],self.Bkg_iso_eff[
'Bkg_noMTD_EB'], label =
'noMTD')
220 plt.plot(self.Sig_iso_eff[
'Sig_cut1_EB'],self.Bkg_iso_eff[
'Bkg_cut1_EB'], label =
'cut1 - 300ps')
221 plt.plot(self.Sig_iso_eff[
'Sig_cut2_EB'],self.Bkg_iso_eff[
'Bkg_cut2_EB'], label =
'cut2 - 270ps')
222 plt.plot(self.Sig_iso_eff[
'Sig_cut3_EB'],self.Bkg_iso_eff[
'Bkg_cut3_EB'], label =
'cut3 - 240ps')
223 plt.plot(self.Sig_iso_eff[
'Sig_cut5_EB'],self.Bkg_iso_eff[
'Bkg_cut5_EB'], label =
'cut5 - 180ps')
224 plt.legend(loc=
'best')
228 plt.xlabel(
"Signal efficiency")
229 plt.ylabel(
"Background efficiency")
230 plt.title(f
'ROC curves for BTL, {self.dz_cut_description}')
232 plt.savefig(ROC_plots_directory+f
'ROC_curve_BTL_abs_dt_{self.dz_cut_description}')
235 plt.plot(self.Sig_iso_eff[
'Sig_noMTD_EE'],self.Bkg_iso_eff[
'Bkg_noMTD_EE'], label =
'noMTD')
236 plt.plot(self.Sig_iso_eff[
'Sig_cut1_EE'],self.Bkg_iso_eff[
'Bkg_cut1_EE'], label =
'cut1 - 300ps')
237 plt.plot(self.Sig_iso_eff[
'Sig_cut2_EE'],self.Bkg_iso_eff[
'Bkg_cut2_EE'], label =
'cut2 - 270ps')
238 plt.plot(self.Sig_iso_eff[
'Sig_cut3_EE'],self.Bkg_iso_eff[
'Bkg_cut3_EE'], label =
'cut3 - 240ps')
239 plt.plot(self.Sig_iso_eff[
'Sig_cut5_EE'],self.Bkg_iso_eff[
'Bkg_cut5_EE'], label =
'cut5 - 180ps')
240 plt.legend(loc=
'best')
244 plt.xlabel(
"Signal efficiency")
245 plt.ylabel(
"Background efficiency")
246 plt.title(f
'ROC curves for ETL, {self.dz_cut_description}')
248 plt.savefig(ROC_plots_directory+f
'ROC_curve_ETL_abs_dt_{self.dz_cut_description}')
256 plt.plot(i.Sig_iso_eff[
'Sig_noMTD_EB'],i.Bkg_iso_eff[
'Bkg_noMTD_EB'],label=f
'noMTD {i.dz_cut_description}')
257 plt.legend(loc=
'best')
261 plt.xlabel(
"Signal efficiency")
262 plt.ylabel(
"Background efficiency")
263 plt.title(
'ROC curves for BTL, no MTD case')
265 plt.savefig(ROC_plots_directory+
'ROC_curve_BTL_noMTD_dzCuts')
269 plt.plot(i.Sig_iso_eff[
'Sig_noMTD_EE'],i.Bkg_iso_eff[
'Bkg_noMTD_EE'],label=f
'noMTD {i.dz_cut_description}')
270 plt.legend(loc=
'best')
274 plt.xlabel(
"Signal efficiency")
275 plt.ylabel(
"Background efficiency")
276 plt.title(
'ROC curves for ETL, no MTD case')
278 plt.savefig(ROC_plots_directory+
'ROC_curve_ETL_noMTD_dzCuts')
289 dz010_cut_obj =
MTD_Ele_Iso(
'DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO_Sig_dz010_v5.root',
'DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO_Bkg_dz010_v5.root',
'dz_1mm',
True)
290 dz020_cut_obj =
MTD_Ele_Iso(
'DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO_Sig_dz020_v5.root',
'DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO_Bkg_dz020_v5.root',
'dz_2mm',
True)
291 dz030_cut_obj =
MTD_Ele_Iso(
'DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO_Sig_dz030_v5.root',
'DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO_Bkg_dz030_v5.root',
'dz_3mm',
True)
292 dz040_cut_obj =
MTD_Ele_Iso(
'DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO_Sig_dz040_v5.root',
'DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO_Bkg_dz040_v5.root',
'dz_4mm',
True)
293 dz050_cut_obj =
MTD_Ele_Iso(
'DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO_Sig_dz050_v5.root',
'DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO_Bkg_dz050_v5.root',
'dz_5mm',
True)
295 dz010_cut_obj.Read_hists()
296 dz020_cut_obj.Read_hists()
297 dz030_cut_obj.Read_hists()
298 dz040_cut_obj.Read_hists()
299 dz050_cut_obj.Read_hists()
301 dz010_cut_obj.Calculate_efficiencies()
302 dz020_cut_obj.Calculate_efficiencies()
303 dz030_cut_obj.Calculate_efficiencies()
304 dz040_cut_obj.Calculate_efficiencies()
305 dz050_cut_obj.Calculate_efficiencies()
308 dz010_cut_obj.Plot_ROC_curves(0.75,1.0,0.05,0.4,
True)
309 dz020_cut_obj.Plot_ROC_curves(0.75,1.0,0.05,0.4,
True)
310 dz030_cut_obj.Plot_ROC_curves(0.75,1.0,0.05,0.4,
True)
311 dz040_cut_obj.Plot_ROC_curves(0.75,1.0,0.05,0.4,
True)
312 dz050_cut_obj.Plot_ROC_curves(0.75,1.0,0.05,0.4,
True)
319 if __name__ ==
"__main__":
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def Plot_ROC_curves_vs_dz_noMTD
def Calculate_efficiencies(self)
if(threadIdxLocalY==0 &&threadIdxLocalX==0)