ATLAS Offline Software
CaloCellContainerAliasAlg_test.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration.
3 #
4 # File: CaloRec/python/CaloCellContainerAliasAlg_test.py
5 # Author: scott snyder
6 # Date: Nov, 2019
7 # Brief: Test for CaloCellContainerAliasAlg.
8 #
9 
10 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
11 from AthenaConfiguration.ComponentFactory import CompFactory
12 from AthenaPython.PyAthenaComps import Alg, StatusCode
13 import ROOT
14 
15 
16 class CreateDataAlg (Alg):
17  def execute (self):
18  ccc = ROOT.CaloCellContainer()
19  self.evtStore.record (ccc, 'AllCalo', False)
20  return StatusCode.Success
21 
22 
23 class CheckAliasAlg (Alg):
24  def execute (self):
25  ccc1 = self.evtStore['AllCalo']
26  ccc2 = self.evtStore['CellAlias']
27  assert (repr(ccc1) == repr(ccc2))
28  return StatusCode.Success
29 
30 
31 def testCfg (flags):
32  result = ComponentAccumulator()
33 
34  from LArGeoAlgsNV.LArGMConfig import LArGMCfg
35  from TileGeoModel.TileGMConfig import TileGMCfg
36  result.merge(LArGMCfg(flags))
37  result.merge(TileGMCfg(flags))
38 
39  from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg
40  result.merge(LArOnOffIdMappingCfg(flags))
41 
42  result.addEventAlgo (CreateDataAlg ('CreateDataAlg'))
43 
44  CaloCellContainerAliasAlg=CompFactory.CaloCellContainerAliasAlg
45  result.addEventAlgo (CaloCellContainerAliasAlg ('aliasAlg',
46  Cells = 'AllCalo',
47  Alias = 'CellAlias'))
48 
49  result.addEventAlgo (CheckAliasAlg ('CheckAliasAlg'))
50  return result
51 
52 
53 from AthenaConfiguration.AllConfigFlags import initConfigFlags
54 from AthenaConfiguration.TestDefaults import defaultTestFiles
55 flags = initConfigFlags()
56 flags.Input.Files = defaultTestFiles.RDO_RUN2
57 flags.Input.TimeStamps = [1000]
58 flags.Detector.GeometryLAr = True
59 flags.Detector.GeometryTile = True
60 flags.needFlagsCategory('Tile')
61 flags.needFlagsCategory('LAr')
62 
63 flags.lock()
64 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
65 acc = MainServicesCfg(flags)
66 
67 from McEventSelector.McEventSelectorConfig import McEventSelectorCfg
68 acc.merge (McEventSelectorCfg (flags))
69 
70 acc.merge (testCfg (flags))
71 acc.run(1)
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.CaloCellContainerAliasAlg_test.CheckAliasAlg
Definition: CaloCellContainerAliasAlg_test.py:23
python.CaloCellContainerAliasAlg_test.CreateDataAlg
Definition: CaloCellContainerAliasAlg_test.py:16
python.CaloCellContainerAliasAlg_test.testCfg
def testCfg(flags)
Definition: CaloCellContainerAliasAlg_test.py:31
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
PyAthena::repr
std::string repr(PyObject *o)
returns the string representation of a python object equivalent of calling repr(o) in python
Definition: PyAthenaUtils.cxx:106
python.CaloCellContainerAliasAlg_test.CheckAliasAlg.execute
def execute(self)
Definition: CaloCellContainerAliasAlg_test.py:24
LArCablingConfig.LArOnOffIdMappingCfg
def LArOnOffIdMappingCfg(configFlags)
Definition: LArCablingConfig.py:62
LArGMConfig.LArGMCfg
def LArGMCfg(flags)
Definition: LArGMConfig.py:8
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.CaloCellContainerAliasAlg_test.CreateDataAlg.execute
def execute(self)
Definition: CaloCellContainerAliasAlg_test.py:17
TileGMConfig.TileGMCfg
def TileGMCfg(flags)
Definition: TileGMConfig.py:7