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