ATLAS Offline Software
Loading...
Searching...
No Matches
TileDQstatusConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3"""Define method to construct configured Tile DQ status tool and algorithm"""
4
5from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6from AthenaConfiguration.ComponentFactory import CompFactory
7from AthenaConfiguration.Enums import Format
8from TileConfiguration.TileConfigFlags import TileRunType
9
10def TileDQstatusToolCfg(flags, **kwargs):
11 """Return component accumulator with configured private Tile DQ status tool
12
13 Arguments:
14 flags -- Athena configuration flags
15 SimulateTrips - flag to simulate drawer trips. Defaults to False.
16 """
17
18 acc = ComponentAccumulator()
19
20 kwargs.setdefault('SimulateTrips', False)
21
22 from TileConditions.TileBadChannelsConfig import TileBadChannelsCondAlgCfg
23 acc.merge( TileBadChannelsCondAlgCfg(flags) )
24
25 TileDQstatusTool=CompFactory.TileDQstatusTool
26 acc.setPrivateTools( TileDQstatusTool(**kwargs) )
27
28 return acc
29
30
31def TileDQstatusAlgCfg(flags, **kwargs):
32 """Return component accumulator with configured Tile DQ status algorithm
33
34 Arguments:
35 flags -- Athena configuration flags
36 TileDQstatus - name of Tile DQ status produced
37 TileDigitsContainer - name of Tile digits container, provided it will be used,
38 otherwise it will be determined automatically depending on flags.
39 TileRawChannelContainer - name of Tile raw channel container, provided it will be used,
40 otherwise it will be determined automatically depending on flags.
41 TileBeamElemContainer - name of Tile beam elements container, provided it will be used,
42 otherwise it will be determined automatically depending on flags.
43 """
44
45
46 acc = ComponentAccumulator()
47 kwargs.setdefault('TileDQstatus', 'TileDQstatus')
48
49 name = kwargs['TileDQstatus'] + 'Alg'
50 kwargs.setdefault('name', name)
51
52 if not (flags.Input.isMC or flags.Overlay.DataOverlay or flags.Input.Format is Format.POOL):
53 if flags.Tile.RunType in [TileRunType.PHY, TileRunType.GAPLAS, TileRunType.GAPCIS]:
54 beamElemContainer = ""
55 else:
56 beamElemContainer = 'TileBeamElemCnt'
57
58 if flags.Tile.readDigits:
59 digitsContainer = 'TileDigitsCnt'
60 else:
61 digitsContainer = ""
62
63 rawChannelContainer = 'TileRawChannelCnt'
64
65 elif flags.Common.isOverlay and flags.Overlay.DataOverlay:
66 beamElemContainer = ''
67 digitsContainer = flags.Overlay.BkgPrefix + 'TileDigitsCnt'
68 rawChannelContainer = flags.Overlay.BkgPrefix + 'TileRawChannelCnt'
69
70 from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
71 acc.merge(SGInputLoaderCfg(flags, [f'TileDigitsContainer#{digitsContainer}']))
72 acc.merge(SGInputLoaderCfg(flags, [f'TileRawChannelContainer#{rawChannelContainer}']))
73 else:
74 beamElemContainer = ""
75 digitsContainer = ""
76 rawChannelContainer = ""
77
78 kwargs.setdefault('TileBeamElemContainer', beamElemContainer)
79 kwargs.setdefault('TileDigitsContainer', digitsContainer)
80 kwargs.setdefault('TileRawChannelContainer', rawChannelContainer)
81
82 if 'TileDQstatusTool' not in kwargs:
83 tileDQstatusTool = acc.popToolsAndMerge( TileDQstatusToolCfg(flags) )
84 kwargs['TileDQstatusTool'] = tileDQstatusTool
85
86 TileDQstatusAlg=CompFactory.TileDQstatusAlg
87 acc.addEventAlgo(TileDQstatusAlg(**kwargs), primary = True)
88
89 return acc
90
91
92
93if __name__ == "__main__":
94
95 from AthenaConfiguration.AllConfigFlags import initConfigFlags
96 from AthenaConfiguration.TestDefaults import defaultConditionsTags, defaultGeometryTags, defaultTestFiles
97 from AthenaCommon.Logging import log
98 from AthenaCommon.Constants import DEBUG
99
100 # Test setup
101 log.setLevel(DEBUG)
102
103 flags = initConfigFlags()
104 flags.Input.Files = defaultTestFiles.RAW_RUN2
105 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
106 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN2_DATA
107 flags.Tile.RunType = TileRunType.PHY
108 flags.lock()
109
110 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
111 acc = MainServicesCfg(flags)
112
113 from TileByteStream.TileByteStreamConfig import TileRawDataReadingCfg
114 acc.merge( TileRawDataReadingCfg(flags) )
115
116 acc.merge( TileDQstatusAlgCfg(flags) )
117
118 flags.dump()
119 acc.printConfig(withDetails = True, summariseProps = True)
120 acc.store( open('TileDQstatus.pkl','wb') )
121
122 sc = acc.run(maxEvents = 3)
123
124 import sys
125 # Success should be 0
126 sys.exit(not sc.isSuccess())
127
Produce a TileDQstatus object.
TileDQstatusAlgCfg(flags, **kwargs)
TileDQstatusToolCfg(flags, **kwargs)