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

Public Member Functions

 __init__ (self, name)
 initialize (self)
 testcell (self, elt, elist)
 execute (self)

Public Attributes

 tool = ROOT.ToolHandle(ROOT.ICaloEstimatedGainTool)('CaloEstimatedGainTool')

Detailed Description

Definition at line 22 of file CaloEstimatedGainTool_test.py.

Constructor & Destructor Documentation

◆ __init__()

python.CaloEstimatedGainTool_test.TestAlg.__init__ ( self,
name )

Definition at line 23 of file CaloEstimatedGainTool_test.py.

23 def __init__ (self, name):
24 Alg.__init__ (self, name)
25 return
26

Member Function Documentation

◆ execute()

python.CaloEstimatedGainTool_test.TestAlg.execute ( self)

Definition at line 59 of file CaloEstimatedGainTool_test.py.

59 def execute (self):
60 log = logging.getLogger ('TestAlg')
61 ctx = self.getContext()
62 mgr = self.condStore['CaloDetDescrManager'].find (ctx.eventID())
63 elt1 = mgr.get_element (ROOT.CaloCell_ID.LAREM,
64 2, True, 0.5, 0.1)
65 self.testcell (elt1, [(1000, 0), (50000, 1), (300000, 2)])
66
67 elt2 = mgr.get_element (ROOT.CaloCell_ID.LARHEC,
68 2, False, 2.1, 0.1)
69 self.testcell (elt2, [(1000, 1), (50000, 1), (300000, 2)])
70
71 elt3 = mgr.get_element (ROOT.CaloCell_ID.LARFCAL,
72 1, False, 4.9, 0.1)
73 self.testcell (elt3, [(1000, 0), (50000, 1), (800000, 2)])
74
75 elt4 = mgr.get_element (ROOT.CaloCell_ID.TileBar1, 0.3, 0.1)
76 self.testcell (elt4, [((1000, 1000), i32(ROOT.CaloGain.TILEHIGHHIGH)),
77 ((1000, 50000), i32(ROOT.CaloGain.TILEHIGHLOW)),
78 ((50000, 1000), i32(ROOT.CaloGain.TILEHIGHLOW)),
79 ((50000, 50000), i32(ROOT.CaloGain.TILELOWLOW)),
80 ])
81 log.info ('finished')
82 return StatusCode.Success
83
84

◆ initialize()

python.CaloEstimatedGainTool_test.TestAlg.initialize ( self)

Definition at line 27 of file CaloEstimatedGainTool_test.py.

27 def initialize (self):
28 ROOT.ICaloEstimatedGainTool
29
30 self.tool = ROOT.ToolHandle(ROOT.ICaloEstimatedGainTool)('CaloEstimatedGainTool')
31 if not self.tool.retrieve():
32 assert 0
33 return StatusCode.Success
34
35
void initialize()

◆ testcell()

python.CaloEstimatedGainTool_test.TestAlg.testcell ( self,
elt,
elist )

Definition at line 36 of file CaloEstimatedGainTool_test.py.

36 def testcell (self, elt, elist):
37 ctx = self.getContext()
38 for (e, gain) in elist:
39 if isinstance(e, type(())):
40 cell = ROOT.TileCell(elt, e[0])
41 cell.setEnergy (e[0], e[1], 0, 0)
42 else:
43 cell = ROOT.CaloCell (elt, e, 0, 0, 0)
44 g = i32(self.tool.estimatedGain (ctx, elt, e, 0))
45 assert g == gain, (e, g, gain)
46 g = i32(self.tool.estimatedGain (ctx, elt, e, 1))
47 assert g == gain, (e, g, gain)
48
49 g = i32(self.tool.estimatedGain (ctx, cell, 0))
50 assert g == gain, (e, g, gain)
51 g = i32(self.tool.estimatedGain (ctx, cell, elt, 0))
52 assert g == gain, (e, g, gain)
53 g = i32(self.tool.estimatedGain (ctx, cell, 1))
54 assert g == gain, (e, g, gain)
55 g = i32(self.tool.estimatedGain (ctx, cell, elt, 1))
56 assert g == gain, (e, g, gain)
57 return
58

Member Data Documentation

◆ tool

python.CaloEstimatedGainTool_test.TestAlg.tool = ROOT.ToolHandle(ROOT.ICaloEstimatedGainTool)('CaloEstimatedGainTool')

Definition at line 30 of file CaloEstimatedGainTool_test.py.


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