363 def compare_chans (self, chans, exp_chans):
364 assert chans.get_type() == 0
365 assert chans.get_unit() == 0
366 assert chans.get_bsflags() == (3<<28)
367
368 exp_chans = exp_chans.copy()
369 idHelper = self.detStore['CaloCell_ID'].tile_idHelper()
370
371 for coll in chans:
372 for c in coll:
373 lchan = [c.amplitude(),
374 c.time(),
375 c.quality(),
376 c.pedestal()]
377
378 cid = c.identify()
379 addr = (idHelper.section(cid),
380 idHelper.side(cid),
381 idHelper.module(cid),
382 idHelper.tower(cid),
383 idHelper.sampling(cid),
384 idHelper.pmt(cid))
385
386 l = exp_chans.get (addr)
387 if not l:
388 print ('xxx unexpected chan', addr, lchan)
389 assert 0
390 continue
391
392 l = l[:]
393
394 if (reldiff (lchan[0], l[0]) > 1e-3 or
395 reldiff (lchan[1], l[1]) > 1e-3 or
396 reldiff (lchan[2], l[2]) > 1e-3 or
397 reldiff (lchan[3], l[3]) > 1e-3):
398 print ('xxx chan mismatch: ', addr, lchan, l)
399 assert 0
400 del exp_chans[addr]
401
402 for extra in exp_chans:
403 print ('xxx unfound chan', extra)
404 assert 0
405 return
406
407
408