ATLAS Offline Software
Loading...
Searching...
No Matches
TileHid2RESrcIDConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3"""Define methods to construct configured TileHid2ReSrcIDCondAlg conditions algorithm"""
4
5from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6from AthenaConfiguration.ComponentFactory import CompFactory
7from IOVDbSvc.IOVDbSvcConfig import addFolders
8
9
10def TileHid2RESrcIDCondAlgCfg(flags, source='COOL', **kwargs):
11 """Return component accumulator with configured TileHid2ReSrcIDCondAlg conditions algorithm"""
12
13 forHLT = kwargs.get('ForHLT', False)
14 hid2RESrcID = 'TileHid2RESrcIDHLT' if forHLT else 'TileHid2RESrcID'
15 kwargs.setdefault('TileHid2RESrcID', hid2RESrcID)
16 kwargs.setdefault('name', f'{hid2RESrcID}CondAlg')
17
18 acc = ComponentAccumulator()
19
20 from TileGeoModel.TileGMConfig import TileGMCfg
21 acc.merge( TileGMCfg(flags) )
22
23 if source == 'COOL':
24 rodFolder = None
25 # Connect COOL Tile conditions proxies to the tool
26 if flags.IOVDb.DatabaseInstance == 'COMP200':
27 # In the COMP200 DB there is no conditions with ROD status
28 kwargs['FullTileMode'] = 1 # Configure predifined mapping for Run1
29 elif flags.Input.isMC:
30 rodFolder = '/TILE/OFL02/STATUS/ROD'
31 # Temporary tag is hardcoded until it is connected to the global tags
32 acc.merge(addFolders(flags, rodFolder, 'TILE_OFL', tag='TileOfl02StatusRod-RUN3-00', className='CondAttrListCollection'))
33 else:
34 rodFolder = '/TILE/ONL01/STATUS/ROD'
35 acc.merge(addFolders(flags, rodFolder, 'TILE', className='CondAttrListCollection'))
36
37 if rodFolder:
38 TileCondProxyCoolInt = CompFactory.getComp("TileCondProxyCool<TileCalibDrawerInt>")
39 rodStatusProxy = TileCondProxyCoolInt('TileCondProxyCool_ROD', Source=rodFolder)
40 kwargs['RODStatusProxy'] = rodStatusProxy
41
42 elif source == 'FILE':
43 TileCondProxyFileInt = CompFactory.getComp("TileCondProxyFile<TileCalibDrawerInt>")
44 rodStatusProxy = TileCondProxyFileInt('TileCondProxyFile_ROD', Source='TileDefault.fullrod')
45 kwargs['RODStatusProxy'] = rodStatusProxy
46
47 TileHid2ReSrcIDCondAlg = CompFactory.TileHid2RESrcIDCondAlg
48 acc.addCondAlgo( TileHid2ReSrcIDCondAlg(**kwargs) )
49
50 return acc
51
52
53
54if __name__ == "__main__":
55
56 from AthenaConfiguration.AllConfigFlags import initConfigFlags
57 from AthenaConfiguration.TestDefaults import defaultGeometryTags, defaultTestFiles
58 from AthenaCommon.Logging import log
59 from AthenaCommon.Constants import INFO
60
61 # Test setup
62 log.setLevel(INFO)
63
64 flags = initConfigFlags()
65 flags.Input.Files = defaultTestFiles.RAW_RUN2
66 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
67 flags.lock()
68
69 # Initialize configuration object, add accumulator, merge, and run.
70 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
71 cfg = MainServicesCfg(flags)
72
73 from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg
74 cfg.merge( ByteStreamReadCfg(flags) )
75
76 cfg.merge( TileHid2RESrcIDCondAlgCfg(flags, ForHLT=True) )
77
78 cfg.printConfig(withDetails = True, summariseProps = True)
79 cfg.store( open('TileHid2ReSrcIDCondAlg.pkl','wb') )
80
81 sc = cfg.run(3)
82
83 import sys
84 # Success should be 0
85 sys.exit(not sc.isSuccess())
TileHid2RESrcIDCondAlgCfg(flags, source='COOL', **kwargs)