260 extraOptions=None):
261
262
263
264 if block.algName == "AddConfigBlocks" and isinstance(blockConfig, dict):
265 blockConfig = [options | {'algName': algName} for algName, options in blockConfig.items()]
266
267 elif not isinstance(blockConfig, list):
268 blockConfig = [blockConfig]
269
270 for options in blockConfig:
271
272 if 'containerName' in options:
273 containerName = options['containerName']
274 elif containerName is not None:
275 options['containerName'] = containerName
276
277 logCPAlgTextCfg.debug(f"Configuring {block.algName}")
278 seq, funcOpts = block.makeConfig(options)
279 if not seq._blocks:
280 continue
281 algOpts = seq.setOptions(options)
282
283
284 if containerName is None:
285 for opt in algOpts:
286 if 'name' in opt and opt['name'] == 'containerName':
287 containerName = opt.get('value', None)
288 break
289
290 if configSeq is not None:
291 configSeq += seq
292
293
294 extraOptionsForAlg = extraOptions.copy() if extraOptions is not None else None
295 if extraOptionsForAlg is None:
296 extraOptionsList = ["skipOnData", "skipOnMC", "skipWithSystematics", "onlyForDSIDs"]
297 for i in algOpts:
298 if i['name'] in extraOptionsList and i['defaultValue'] != i['value']:
299 if extraOptionsForAlg is None:
300 extraOptionsForAlg = {}
301 extraOptionsForAlg[i['name']] = i['value']
302 else:
303 for name, value in extraOptionsForAlg.items():
304 seq.setOptionValue(f'.{name}', value)
305 algOpts = seq.getOptions()
306
307
308 algOpts = [i['name'] for i in algOpts]
309 expectedOptions =
set(funcOpts)
310 expectedOptions |=
set(algOpts)
311 expectedOptions |=
set(block.subAlgs)
312
313 difference =
set(options.keys()) - expectedOptions
314 difference.discard('__placeholder__')
315 if difference:
316 difference = "\n".join(difference)
317 raise ValueError(f"There are options set that are not used for "
318 f"{block.algName}:\n{difference}\n"
319 "Please check your configuration.")
320
321
322 for alg
in self._order.
get(block.algName, []):
323 if alg in options:
324 subAlg = block.subAlgs[alg]
325 self._configureAlg(subAlg, options[alg], configSeq, containerName, extraOptionsForAlg)
326 return configSeq
327
328
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)