ATLAS Offline Software
Loading...
Searching...
No Matches
TileCellBuilderTestConfig.TestAlg Class Reference
Inheritance diagram for TileCellBuilderTestConfig.TestAlg:
Collaboration diagram for TileCellBuilderTestConfig.TestAlg:

Public Member Functions

 __init__ (self, name, prepAlg)
 initialize (self)
 finalize (self)
 execute (self)
 compare_cells (self, ccc, exp_cells, rctype)
 check_ei (self, extra_flags)
 make_bad_chan_lines (self, chans)
 check_bad_chan_lines (self)

Static Public Member Functions

 update_qbit (qb, rctype)

Public Attributes

 prepAlg = prepAlg
 tool1 = gettool ('tool1')
 tool2 = gettool ('tool2')
 tool5 = gettool ('tool5')
 tool6 = gettool ('tool6')
 tool7 = gettool ('tool7')
 tool8 = gettool ('tool8')
 tool9 = gettool ('tool9')
 tool10 = gettool ('tool10')
 tool11 = gettool ('tool11')

Detailed Description

Definition at line 396 of file TileCellBuilderTestConfig.py.

Constructor & Destructor Documentation

◆ __init__()

TileCellBuilderTestConfig.TestAlg.__init__ ( self,
name,
prepAlg )

Definition at line 397 of file TileCellBuilderTestConfig.py.

397 def __init__ (self, name, prepAlg):
398 Alg.__init__ (self, name)
399 self.prepAlg = prepAlg
400 return
401

Member Function Documentation

◆ check_bad_chan_lines()

TileCellBuilderTestConfig.TestAlg.check_bad_chan_lines ( self)

Definition at line 523 of file TileCellBuilderTestConfig.py.

523 def check_bad_chan_lines (self):
524 for name, (chans, lines) in baddefs.items():
525 xlines = self.make_bad_chan_lines (chans)
526 if xlines.strip() != lines.strip():
527 print ('xxx Bad chan lines need updating: ', name)
528 print (xlines)
529 return
530
531

◆ check_ei()

TileCellBuilderTestConfig.TestAlg.check_ei ( self,
extra_flags )

Definition at line 499 of file TileCellBuilderTestConfig.py.

499 def check_ei (self, extra_flags):
500 ei = self.evtStore['EventInfo']
501 assert ei.eventFlags (ROOT.xAOD.EventInfo.Tile) == (0xf0f0005 | extra_flags)
502 assert ei.errorState (ROOT.xAOD.EventInfo.Tile) == ROOT.xAOD.EventInfo.Error
503 return
504
505

◆ compare_cells()

TileCellBuilderTestConfig.TestAlg.compare_cells ( self,
ccc,
exp_cells,
rctype )

Definition at line 451 of file TileCellBuilderTestConfig.py.

451 def compare_cells (self, ccc, exp_cells, rctype):
452 exp_cells = exp_cells.copy()
453 idHelper = self.detStore['CaloCell_ID'].tile_idHelper()
454
455 for c in ccc:
456 lcell = [c.ene1(), c.ene2(), c.time1(), c.time2(),
457 c.qual1(), c.qual2(),
458 c.qbit1(), c.qbit2(),
459 c.gain1(), c.gain2()]
460
461 cid = c.ID()
462 addr = (idHelper.section(cid),
463 idHelper.side(cid),
464 idHelper.module(cid),
465 idHelper.tower(cid),
466 idHelper.sampling(cid))
467 l = exp_cells.get (addr)
468 if not l:
469 print ('xxx unexpected cell', addr, lcell)
470 assert 0
471 continue
472
473 l = l[:]
474
475 # Low 3 bits of qbit correspond to rctype, unless cell was masked.
476 if l[0] != 0: l[6] = TestAlg.update_qbit (l[6], rctype)
477 if l[1] != 0: l[7] = TestAlg.update_qbit (l[7], rctype)
478
479 if (abs (lcell[0] - l[0]) > 1e-3 or
480 abs (lcell[1] - l[1]) > 1e-3 or
481 abs (lcell[2] - l[2]) > 1e-3 or
482 abs (lcell[3] - l[3]) > 1e-3 or
483 abs (lcell[4] != l[4]) or
484 abs (lcell[5] != l[5]) or
485 abs (lcell[6] != l[6]) or
486 abs (lcell[7] != l[7]) or
487 abs (lcell[8] != l[8]) or
488 abs (lcell[9] != l[9])):
489 print ('xxx cell mismatch: ', addr, lcell, l)
490 assert 0
491 del exp_cells[addr]
492
493 for extra in exp_cells:
494 print ('xxx unfound cell', extra)
495 assert 0
496 return
497
498

◆ execute()

TileCellBuilderTestConfig.TestAlg.execute ( self)

Definition at line 429 of file TileCellBuilderTestConfig.py.

429 def execute (self):
430 tool = getattr (self, self.prepAlg.tool)
431
432 ccc = ROOT.CaloCellContainer(ROOT.SG.VIEW_ELEMENTS)
433 if not tool.process (ccc, self.getContext()):
434 return StatusCode.Failure
435
436 rctype = self.prepAlg.rctype
437 self.compare_cells (ccc, self.prepAlg.exp_cells, rctype)
438 self.compare_cells (self.evtStore['MBTSContainer'], self.prepAlg.exp_mbts, rctype)
439 self.compare_cells (self.evtStore['E4prContainer'], exp_e4_0, rctype)
440
441 self.check_ei (self.prepAlg.extra_ei_flags)
442 return StatusCode.Success
443
444

◆ finalize()

TileCellBuilderTestConfig.TestAlg.finalize ( self)

Definition at line 424 of file TileCellBuilderTestConfig.py.

424 def finalize (self):
425 self.check_bad_chan_lines()
426 return StatusCode.Success
427
428

◆ initialize()

TileCellBuilderTestConfig.TestAlg.initialize ( self)

Definition at line 402 of file TileCellBuilderTestConfig.py.

402 def initialize (self):
403 ROOT.ICaloCellMakerTool
404
405 def gettool (name):
406 tool = ROOT.ToolHandle(ROOT.ICaloCellMakerTool)('TileCellBuilder/' + name)
407 if not tool.retrieve():
408 assert 0
409 return tool
410
411 self.tool1 = gettool ('tool1')
412 self.tool2 = gettool ('tool2')
413 self.tool5 = gettool ('tool5')
414 self.tool6 = gettool ('tool6')
415 self.tool7 = gettool ('tool7')
416 self.tool8 = gettool ('tool8')
417 self.tool9 = gettool ('tool9')
418 self.tool10 = gettool ('tool10')
419 self.tool11 = gettool ('tool11')
420
421 return StatusCode.Success
422
423
void initialize()

◆ make_bad_chan_lines()

TileCellBuilderTestConfig.TestAlg.make_bad_chan_lines ( self,
chans )

Definition at line 506 of file TileCellBuilderTestConfig.py.

506 def make_bad_chan_lines (self, chans):
507 idHelper = self.detStore['CaloCell_ID'].tile_idHelper()
508 hwidHelper = self.detStore['TileHWID']
509 cabling = ROOT.TileCablingService.getInstance()
510
511 lines = []
512 for addr, data in chans:
513 pmt_id = idHelper.pmt_id (*addr)
514 channel_id = cabling.s2h_channel_id (pmt_id)
515 frag = hwidHelper.frag (channel_id)
516 channel = hwidHelper.channel (channel_id)
517 line = '0x%03x %d 0 %d %d %d' % (frag, channel, data[0], data[1], data[2])
518 lines.append (line)
519
520 return '\n'.join (lines)
521
522

◆ update_qbit()

TileCellBuilderTestConfig.TestAlg.update_qbit ( qb,
rctype )
static

Definition at line 446 of file TileCellBuilderTestConfig.py.

446 def update_qbit (qb, rctype):
447 if qb == 0: return 0
448 return qb&(~7) | rctype
449
450

Member Data Documentation

◆ prepAlg

TileCellBuilderTestConfig.TestAlg.prepAlg = prepAlg

Definition at line 399 of file TileCellBuilderTestConfig.py.

◆ tool1

TileCellBuilderTestConfig.TestAlg.tool1 = gettool ('tool1')

Definition at line 411 of file TileCellBuilderTestConfig.py.

◆ tool10

TileCellBuilderTestConfig.TestAlg.tool10 = gettool ('tool10')

Definition at line 418 of file TileCellBuilderTestConfig.py.

◆ tool11

TileCellBuilderTestConfig.TestAlg.tool11 = gettool ('tool11')

Definition at line 419 of file TileCellBuilderTestConfig.py.

◆ tool2

TileCellBuilderTestConfig.TestAlg.tool2 = gettool ('tool2')

Definition at line 412 of file TileCellBuilderTestConfig.py.

◆ tool5

TileCellBuilderTestConfig.TestAlg.tool5 = gettool ('tool5')

Definition at line 413 of file TileCellBuilderTestConfig.py.

◆ tool6

TileCellBuilderTestConfig.TestAlg.tool6 = gettool ('tool6')

Definition at line 414 of file TileCellBuilderTestConfig.py.

◆ tool7

TileCellBuilderTestConfig.TestAlg.tool7 = gettool ('tool7')

Definition at line 415 of file TileCellBuilderTestConfig.py.

◆ tool8

TileCellBuilderTestConfig.TestAlg.tool8 = gettool ('tool8')

Definition at line 416 of file TileCellBuilderTestConfig.py.

◆ tool9

TileCellBuilderTestConfig.TestAlg.tool9 = gettool ('tool9')

Definition at line 417 of file TileCellBuilderTestConfig.py.


The documentation for this class was generated from the following file: