108 report_counter_dict = {
"empty" : 0 ,
"all_zeros":0}
110 for module, frontEnds
in new_calib.items():
114 for itr_fe
in range(nFE):
116 failures = frontEnds[itr_fe].
count(0) + frontEnds[itr_fe].
count(-28284.3)
119 if module
not in report_dict:
120 report_dict[module] = []
123 if failures != len(frontEnds[itr_fe]):
124 report_counter_dict[
"empty"] += 1
125 report_dict[module].append(
" FE%02d with %i zeros. Positions:" % (itr_fe,failures))
128 for itr_par
in range(len(frontEnds[itr_fe])):
129 if( frontEnds[itr_fe][itr_par] == 0
or frontEnds[itr_fe][itr_par] == -28284.3):
131 report_dict[module][-1] = report_dict[module][-1] + (
" %s,"%(str(itr_par)))
134 val_list = [new_calib[module][i][itr_par]
for i
in range(nFE)
if new_calib[module][i][itr_par] != 0 ]
135 val_list_fit = [new_calib[module][i][itr_par]
for i
in range(nFE)
if new_calib[module][i][itr_par] != 0
and new_calib[module][i][itr_par] != -28284.3 ]
139 new_calib[module][itr_fe][itr_par] =
recover_thr(frontEnds[itr_fe][4], frontEnds[itr_fe][8], val_list, ref_calib[module][itr_fe][itr_par] )
143 new_calib[module][itr_fe][itr_par] =
recover_thr(frontEnds[itr_fe][0], frontEnds[itr_fe][8], val_list, ref_calib[module][itr_fe][itr_par])
147 new_calib[module][itr_fe][itr_par] =
recover_thr(frontEnds[itr_fe][0], frontEnds[itr_fe][4], val_list, ref_calib[module][itr_fe][itr_par])
152 if itr_par == 13
or itr_par == 16:
153 new_calib[module][itr_fe][itr_par] =
recover(val_list_fit, ref_calib[module][itr_fe][itr_par])
155 new_calib[module][itr_fe][itr_par] =
recover(val_list, ref_calib[module][itr_fe][itr_par])
159 report_counter_dict[
"all_zeros"] += 1
160 report_dict[module].append(
" FE%02d full copy" % itr_fe)
161 new_calib[module][itr_fe] = ref_calib[module][itr_fe]
163 return report_dict, report_counter_dict
168 from PixelCalibAlgs.CheckValues
import CheckThresholds
169 CheckThresholds(new_calib,iov,namef)
172 updated_calib = ref_calib.copy()
175 updated_calib.update(new_calib)
178 for key, values
in updated_calib.items():
179 total_fe += len(values)
182 print(
"%-45s: %6i" % (
"Total modules in the calibration candidate",len(updated_calib)))
183 print(
"%-45s: %6i\n" % (
"Total FE in the calibration candidate",total_fe))
190 Fprint(updated_calib,
"PIX_FINAL_calibration_candidate.txt")
196 for key, values
in dict.items():
199 f.write(
"%s %i %i %i %i %i %i %i %i %i %i %i %i %.6g %.6g %.6g %.6g %.6g %.6g %.6g %.6g\n" % (
201 value[ 0], value[ 1], value[ 2], value[ 3],
202 value[ 4], value[ 5], value[ 6], value[ 7],
203 value[ 8], value[ 9], value[10], value[11],
204 value[12], value[13], value[14],
205 value[15], value[16], value[17],