10 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
11 from AthenaPython.PyAthenaComps
import Alg, StatusCode
12 from AthenaCommon.Logging
import logging
24 Alg.__init__ (self, name)
28 ROOT.ICaloEstimatedGainTool
30 self.
tool = ROOT.ToolHandle(ROOT.ICaloEstimatedGainTool)(
'CaloEstimatedGainTool')
33 return StatusCode.Success
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)
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)
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)
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,
65 self.
testcell (elt1, [(1000, 0), (50000, 1), (300000, 2)])
67 elt2 = mgr.get_element (ROOT.CaloCell_ID.LARHEC,
69 self.
testcell (elt2, [(1000, 1), (50000, 1), (300000, 2)])
71 elt3 = mgr.get_element (ROOT.CaloCell_ID.LARFCAL,
73 self.
testcell (elt3, [(1000, 0), (50000, 1), (800000, 2)])
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)),
82 return StatusCode.Success
88 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
89 from TileGeoModel.TileGMConfig
import TileGMCfg
93 from CaloTools.CaloEstimatedGainToolConfig
import CaloEstimatedGainToolCfg
94 acc = CaloEstimatedGainToolCfg (flags)
98 result.addEventAlgo (TestAlg (
'TestAlg'))
102 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
103 from AthenaConfiguration.TestDefaults
import defaultTestFiles
105 flags.Input.Files = defaultTestFiles.RDO_RUN2
106 flags.Detector.GeometryLAr =
True
107 flags.Detector.GeometryTile =
True
108 flags.needFlagsCategory(
'Tile')
109 flags.needFlagsCategory(
'LAr')
112 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
115 acc.merge (testCfg (flags))