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