239 def compare_cells (self, ccc, exp_cells, noise_thresh=0):
240 exp_cells = exp_cells.copy()
241 idHelper = self.detStore['CaloCell_ID'].tile_idHelper()
242
243 for c in ccc:
244 lcell = [c.ene1(), c.ene2(), c.time1(), c.time2(),
245 c.qual1(), c.qual2(),
246 c.qbit1(), c.qbit2(),
247 c.gain1(), c.gain2()]
248
249 cid = c.ID()
250 addr = (idHelper.section(cid),
251 idHelper.side(cid),
252 idHelper.module(cid),
253 idHelper.tower(cid),
254 idHelper.sampling(cid))
255 l = exp_cells.get (addr)
256 if not l:
257 if abs(lcell[0]) > noise_thresh:
258 print ('xxx unexpected cell', addr, lcell, flush=True)
259 assert 0
260 continue
261
262 l = l[:]
263
264 thr = max (1e-3, noise_thresh)
265 if (abs (lcell[0] - l[0]) > thr or
266 abs (lcell[1] - l[1]) > thr or
267 abs (lcell[2] - l[2]) > thr or
268 abs (lcell[3] - l[3]) > thr or
269 abs (lcell[4] != l[4]) or
270 abs (lcell[5] != l[5]) or
271 abs (lcell[6] != l[6]) or
272 abs (lcell[7] != l[7]) or
273 abs (lcell[8] != l[8]) or
274 abs (lcell[9] != l[9])):
275 print ('xxx cell mismatch: ', addr, lcell, l, flush=True)
276 assert 0
277 del exp_cells[addr]
278
279 for extra in exp_cells:
280 print ('xxx unfound cell', extra, flush=True)
281 assert 0
282 return
283
284