61 def EvoMon(old_calib, new_calib, mapping, old_iov, new_iov):
67 information = {
"Total_mods": 0,
69 "IBL" :{
"bad":0,
"ok":0},
70 "Blayer":{
"bad":0,
"ok":0},
71 "L1" :{
"bad":0,
"ok":0},
72 "L2" :{
"bad":0,
"ok":0},
73 "Disk" :{
"bad":0,
"ok":0}
77 for mod
in range(2048):
79 mod_str = mapping[
str(mod)]
81 print(
"%-18s - %4i" % (mod_str, mod), end=
'\r')
82 plot_range = np.array([0,75000])
84 if str(mod)
not in new_calib:
87 if mod_str.startswith(
"L0"):
89 elif mod_str.startswith(
"L1"):
91 elif mod_str.startswith(
"L2"):
93 elif mod_str.startswith(
"D"):
97 if mod_str.startswith(
"LI_S15"):
100 information[
"Total_mods"] += 1
101 fig = Figure(figsize=(13,10))
102 axs = fig.add_subplot(1,1,1)
105 for fe
in range(len(new_calib[
str(mod)])):
107 information[
"Total_FE"] += 1
113 if mod_layer !=
"IBL":
114 newCal_normal_pix = new_calib[
str(mod)][fe][12:15]
115 oldCal_normal_pix = old_calib[
str(mod)][fe][12:15]
123 newQ = new_calib[
str(mod)][fe][4:20]
124 oldQ = old_calib[
str(mod)][fe][4:20]
126 plot_range = np.array([0,35000])
129 m,b = np.polyfit(newQ ,oldQ,1)
131 boolFit = (abs((1-m)/m)*100) > 5
133 if boolFit
or boolTOT:
134 key =
"%-18s - %i" % (mod_str, mod)
136 if key
not in log_info:
137 log_info[key] =
"\tFE%02i ---> slope: %5.2f - dev: %5.1f%%\n" % (fe,m, abs((1-m)/m)*100)
139 log_info[key] +=
"\tFE%02i ---> slope: %5.2f - dev: %5.1f%%\n" % (fe,m, abs((1-m)/m)*100)
141 if key
not in log_info:
142 log_info[key] =
"\tFE%02i ---> Charge= %5ie (dev %6.2f%%) out of error bars. Expected: %5ie\n" % (fe, realQ[0], realQ[1], realQ[2])
144 log_info[key] +=
"\tFE%02i ---> Charge= %5ie (dev %6.2f%%) out of error bars. Expected: %5ie\n" % (fe, realQ[0], realQ[1], realQ[2])
146 information[mod_layer][
"bad"] += 1
155 information[mod_layer][
"ok"] += 1
159 lstyle =
"dotted" if fe < 8
else "solid"
160 axs.plot(newQ ,oldQ, marker=
'o', linestyle=lstyle, label = (
"FE%02d" % (fe)))
161 axs.set_xlim(plot_range)
162 axs.set_ylim(plot_range)
165 fig.suptitle(
"Hash ID %d - %s" % (mod, mod_str))
166 axs.legend(loc=
'upper left', ncol=4)
167 axs.set_xlabel(new_iov+
" - Charge[e]")
168 axs.set_ylabel(old_iov+
" - Charge[e]")
169 axs.plot(plot_range,plot_range,
"k:",lw=1)
171 if mod_layer ==
'IBL':
172 axs.plot([16000,16000],plot_range,
"k:",lw=1)
173 axs.text(17000,1000,
"TOT@10 = 16 ke")
174 elif mod_layer ==
'Blayer':
175 axs.plot([20000,20000],plot_range,
"k:",lw=1)
176 axs.text(21000,1000,
"TOT@18 = 20 ke")
178 axs.plot([20000,20000],plot_range,
"k:",lw=1)
179 axs.text(21000,1000,
"TOT@30 = 20 ke")
181 storage =
"plots/" + mod_layer +
"/"
183 canvas = FigureCanvasAgg(fig)
184 canvas.print_figure(storage+
"Id"+
str(mod)+
"_" +mod_str+status+
".png", dpi=150)
187 fig = Figure(figsize=(13,10))
188 fig.suptitle(
"Fit slopes for all modules")
189 axs = fig.add_subplot(1,1,1)
190 axs.hist(np.clip(slopes, -1, 2), bins=100)
191 axs.set_xlabel(
"Fit slope")
192 axs.set_ylabel(
"Counts")
194 stats = (f
'$\\mu$ = {np.mean(np.clip(slopes, -1, 2)):.3f}\n'
195 f
'$\\sigma$ = {np.std(np.clip(slopes, -1, 2)):.3f}')
196 bbox = dict(boxstyle=
'round', fc=
'blanchedalmond', ec=
'orange', alpha=0.5)
197 axs.text(0.95, 0.07, stats, fontsize=9, bbox=bbox, transform=axs.transAxes)
199 FigureCanvasAgg(fig).print_figure(
"plots/FitSlopes.png", dpi=150)
201 return information, log_info