ATLAS Offline Software
Loading...
Searching...
No Matches
TileRawChannelMakerConfig.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 raw channel maker algorithm"""
4
5from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6from AthenaConfiguration.ComponentFactory import CompFactory
7from AthenaConfiguration.Enums import ProductionStep
8from TileConfiguration.TileConfigFlags import TileRunType
9
10def TileRawChannelMakerCfg(flags, **kwargs):
11 """Return component accumulator with configured Tile raw channel maker algorithm
12
13 Arguments:
14 flags -- Athena configuration flags
15 """
16
17 acc = ComponentAccumulator()
18
19 from TileConditions.TileInfoLoaderConfig import TileInfoLoaderCfg
20 acc.merge( TileInfoLoaderCfg(flags) )
21
22 kwargs.setdefault('name', 'TileRChMaker')
23 name = kwargs['name']
24
25 if flags.Common.ProductionStep in [ProductionStep.PileUpPresampling, ProductionStep.PileUpPretracking, ProductionStep.MinbiasPreprocessing]:
26 kwargs.setdefault('TileDigitsContainer', flags.Overlay.BkgPrefix + 'TileDigitsCnt')
27 else:
28 kwargs.setdefault('TileDigitsContainer', 'TileDigitsCnt')
29
30 from AthenaCommon.Logging import logging
31 mlog = logging.getLogger( 'TileRawChannelMakerCfg' )
32
33 if flags.Tile.doOverflowFit:
34 kwargs.setdefault('FitOverflow', True)
35 from TileRecUtils.TileRawChannelBuilderFitConfig import TileRawChannelBuilderFitOverflowCfg
36 tileRawChannelBuilderFitOverflow = acc.popToolsAndMerge( TileRawChannelBuilderFitOverflowCfg(flags) )
37 kwargs.setdefault('TileRawChannelBuilderFitOverflow', tileRawChannelBuilderFitOverflow)
38 else:
39 kwargs.setdefault('FitOverflow', False)
40
41 tileRawChannelBuilder = []
42
43 if flags.Tile.doFit:
44 from TileRecUtils.TileRawChannelBuilderFitConfig import TileRawChannelBuilderFitFilterCfg
45 tileRawChannelBuilderFitFilter = acc.popToolsAndMerge( TileRawChannelBuilderFitFilterCfg(flags) )
46 tileRawChannelBuilder += [tileRawChannelBuilderFitFilter]
47 mlog.info(" adding now TileRawChannelBuilderFitFilter with name %s to the algorithm: %s",
48 tileRawChannelBuilderFitFilter.name, name)
49
50 if flags.Tile.doMF:
51 from TileRecUtils.TileRawChannelBuilderMFConfig import TileRawChannelBuilderMFCfg
52 tileRawChannelBuilderMF = acc.popToolsAndMerge( TileRawChannelBuilderMFCfg(flags) )
53 tileRawChannelBuilder += [tileRawChannelBuilderMF]
54 mlog.info(" adding now TileRawChannelBuilderMF with name %s to the algorithm: %s",
55 tileRawChannelBuilderMF.name, name)
56
57 if flags.Tile.doOF1:
58 from TileRecUtils.TileRawChannelBuilderOptConfig import TileRawChannelBuilderOF1Cfg
59 tileRawChannelBuilderOF1 = acc.popToolsAndMerge( TileRawChannelBuilderOF1Cfg(flags) )
60 tileRawChannelBuilder += [tileRawChannelBuilderOF1]
61 mlog.info(" adding now TileRawChannelBuilderOpt2Filter with name %s to the algorithm: %s",
62 tileRawChannelBuilderOF1.name, name)
63
64 if flags.Tile.doWiener:
65 from TileRecUtils.TileRawChannelBuilderWienerConfig import TileRawChannelBuilderWienerCfg
66 tileRawChannelBuilderWiener = acc.popToolsAndMerge( TileRawChannelBuilderWienerCfg(flags) )
67 tileRawChannelBuilder += [tileRawChannelBuilderWiener]
68 mlog.info(" adding now TileRawChannelBuilderWienerFilter with name %s to the algorithm: %s",
69 tileRawChannelBuilderWiener.name, name)
70
71 if flags.Tile.doOpt2:
72 from TileRecUtils.TileRawChannelBuilderOptConfig import TileRawChannelBuilderOpt2Cfg
73 tileRawChannelBuilderOpt2 = acc.popToolsAndMerge( TileRawChannelBuilderOpt2Cfg(flags) )
74 tileRawChannelBuilder += [tileRawChannelBuilderOpt2]
75 mlog.info(" adding now TileRawChannelBuilderOpt2Filter with name %s to the algorithm: %s",
76 tileRawChannelBuilderOpt2.name, name)
77
78 if flags.Tile.doOptATLAS:
79 from TileRecUtils.TileRawChannelBuilderOptConfig import TileRawChannelBuilderOptATLASCfg
80 tileRawChannelBuilderOptATLAS = acc.popToolsAndMerge( TileRawChannelBuilderOptATLASCfg(flags) )
81 tileRawChannelBuilder += [tileRawChannelBuilderOptATLAS]
82 mlog.info(" adding now TileRawChannelBuilderOpt2Filter with name %s to the algorithm: %s",
83 tileRawChannelBuilderOptATLAS.name, name)
84
85 if flags.Tile.doTileNN:
86 from TileRecUtils.TileRawChannelNNMakerConfig import TileRawChannelNNMakerCfg
87 acc.merge( TileRawChannelNNMakerCfg(flags) )
88 mlog.info(" adding now TileRawChannelNNMaker as a separate algorithm alongside: %s", name)
89
90 kwargs.setdefault('TileRawChannelBuilder', tileRawChannelBuilder)
91
92 if flags.Common.isOverlay and flags.Concurrency.NumThreads > 0:
93 kwargs.setdefault('Cardinality', flags.Concurrency.NumThreads)
94
95 TileRawChannelMaker=CompFactory.TileRawChannelMaker
96 acc.addEventAlgo(TileRawChannelMaker(**kwargs), primary = True)
97
98 return acc
99
100
102 """Return component accumulator with configured Tile raw channel maker algorithm for HS
103
104 Arguments:
105 flags -- Athena configuration flags
106 """
107
108 kwargs.setdefault('name', 'TileRChMaker_DigiHSTruth')
109 kwargs.setdefault('TileDigitsContainer', 'TileDigitsCnt_DigiHSTruth')
110
111 acc = TileRawChannelMakerCfg(flags, **kwargs)
112 rawChannelMaker = acc.getPrimary()
113
114 rawChannelbuilders = rawChannelMaker.TileRawChannelBuilder
115
116 for rawChannelBuilder in rawChannelbuilders:
117 rawChannelBuilder.TileRawChannelContainer = f'{rawChannelBuilder.TileRawChannelContainer}_DigiHSTruth'
118
119 return acc
120
121
122def TileRawChannelOutputCfg(flags, tileRawChannelMaker, streamName):
123 """Return component accumulator with configured Output stream for Tile raw channel maker algorithm
124
125 Arguments:
126 flags -- Athena configuration flags
127 tileRawChannelMaker -- Tile raw channel maker algorithm
128 streamName -- name of output stream.
129 """
130
131 outputItemList = []
132 rawChannelbuilders = tileRawChannelMaker.TileRawChannelBuilder
133
134 for rawChannelBuilder in rawChannelbuilders:
135 outputItemList += [f'TileRawChannelContainer#{rawChannelBuilder.TileRawChannelContainer}']
136
137 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
138 acc = OutputStreamCfg(flags, streamName, ItemList = outputItemList)
139
140 return acc
141
142
143def TileRawChannelMakerOutputCfg(flags, streamName = 'ESD', **kwargs):
144 """Return component accumulator with configured Tile raw channel maker algorithm and Output stream
145
146 Arguments:
147 flags -- Athena configuration flags
148 streamName -- name of output stream. Defaults to ESD.
149 """
150
151 acc = TileRawChannelMakerCfg(flags, **kwargs)
152 acc.merge( TileRawChannelOutputCfg(flags, acc.getPrimary(), streamName) )
153
154 return acc
155
156
157def TileRawChannelMakerDigiHSTruthOutputCfg(flags, streamName = 'ESD', **kwargs):
158 """Return component accumulator with configured Tile raw channel maker algorithm and Output stream
159
160 Arguments:
161 flags -- Athena configuration flags
162 streamName -- name of output stream. Defaults to ESD.
163 """
164
165 acc = TileRawChannelMakerDigiHSTruthCfg(flags, **kwargs)
166 acc.merge( TileRawChannelOutputCfg(flags, acc.getPrimary(), streamName) )
167
168 return acc
169
170
171if __name__ == "__main__":
172
173 from AthenaConfiguration.AllConfigFlags import initConfigFlags
174 from AthenaConfiguration.TestDefaults import defaultConditionsTags, defaultGeometryTags, defaultTestFiles
175 from AthenaCommon.Logging import log
176 from AthenaCommon.Constants import DEBUG
177
178 # Test setup
179 log.setLevel(DEBUG)
180
181 flags = initConfigFlags()
182 flags.Input.Files = defaultTestFiles.RAW_RUN2
183 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
184 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN2_DATA
185 flags.Tile.RunType = TileRunType.PHY
186 flags.Tile.doFit = True
187 flags.Tile.doOF1 = True
188 flags.Tile.doWiener = True
189 flags.Tile.doOpt2 = True
190 flags.Tile.doOptATLAS = True
191 flags.Tile.doTileNN = True
192 flags.Tile.correctTimeJumps = True
193 flags.Tile.NoiseFilter = 1
194 flags.Output.ESDFileName = "myESD.pool.root"
195 flags.Exec.MaxEvents=3
196 flags.fillFromArgs()
197
198 flags.lock()
199
200 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
201 acc = MainServicesCfg(flags)
202
203 from TileByteStream.TileByteStreamConfig import TileRawDataReadingCfg
204 acc.merge( TileRawDataReadingCfg(flags, readMuRcv=False) )
205
206 acc.merge( TileRawChannelMakerOutputCfg(flags) )
207
208 flags.dump()
209 acc.printConfig(withDetails = True, summariseProps = True)
210 acc.store( open('TileRawChannelMaker.pkl','wb') )
211
212 sc = acc.run()
213
214 import sys
215 # Success should be 0
216 sys.exit(not sc.isSuccess())
217
TileRawChannelOutputCfg(flags, tileRawChannelMaker, streamName)
TileRawChannelMakerOutputCfg(flags, streamName='ESD', **kwargs)
TileRawChannelMakerDigiHSTruthOutputCfg(flags, streamName='ESD', **kwargs)
TileRawChannelMakerDigiHSTruthCfg(flags, **kwargs)