144def athenaCfg(flags, parser=None):
145 """Top-level cfg function when running in athena"""
146 from AthenaConfiguration.Enums import Format
147
148
149 set_flags(flags)
150
151
152 flags.Common.isOnline = lambda f: not f.Input.isMC
153
154
155 if not parser:
156 parser = flags.getArgumentParser()
157 parser.add_argument('--preExec', metavar='CMD', nargs='+',
158 help='Commands executed before Python configuration')
159 parser.add_argument('--postExec', metavar='CMD', nargs='+',
160 help='Commands executed after Python configuration')
161 parser.add_argument('--preInclude', metavar='CMD', nargs='+',
162 help='Module to execute before Python configuration')
163 parser.add_argument('--postInclude', metavar='CMD', nargs='+',
164 help='Module to execute after Python configuration')
165
166
167 args = flags.fillFromArgs(parser=parser)
168
169 if flags.Trigger.writeBS:
170 flags.Output.doWriteBS = True
171 else:
172 flags.Output.doWriteRDO = True
173 if not flags.Output.RDOFileName:
174 flags.Output.RDOFileName = 'RDO_TRIG.pool.root'
175
176
177
178 if flags.Trigger.selectChains or len(flags.Trigger.enabledSignatures)==1:
179 flags.Scheduler.ShowControlFlow = True
180 flags.Scheduler.ShowDataDeps = True
181
182 processPreInclude(args, flags)
183 processPreExec(args, flags)
184
185
186 _allflags = flags.clone()
187 _allflags.lock()
188 if _allflags.Concurrency.NumThreads == 0:
189 raise RuntimeError("Trigger jobs must be run in multi-threaded mode. Use --threads=1 (or greater).")
190
191 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
192 cfg = MainServicesCfg(_allflags)
193 del _allflags
194
195
196 lock_and_restrict(flags)
197
198 if flags.Input.Format is Format.BS:
199 from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg
200 cfg.merge(ByteStreamReadCfg(flags))
201 else:
202 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
203 cfg.merge(PoolReadCfg(flags))
204
205
206 cfg.merge(runHLTCfg(flags, checkMT=False))
207
208
209 processPostInclude(args, flags, cfg)
210
211
212 processPostExec(args, flags, cfg)
213
214
215 from AthenaConfiguration.Utils import setupLoggingLevels
216 setupLoggingLevels(flags, cfg)
217
218 return cfg
219
220