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