262 extraOptions=None):
263
264
265
266 if block.algName == "AddConfigBlocks" and isinstance(blockConfig, dict):
267 blockConfig = [options | {'algName': algName} for algName, options in blockConfig.items()]
268
269 elif not isinstance(blockConfig, list):
270 blockConfig = [blockConfig]
271
272 for options in blockConfig:
273
274 if 'containerName' in options:
275 containerName = options['containerName']
276 elif containerName is not None and 'containerName' not in options:
277 options['containerName'] = containerName
278
279 logCPAlgTextCfg.debug(f"Configuring {block.algName}")
280 seq, funcOpts = block.makeConfig(options)
281 if not seq._blocks:
282 continue
283 algOpts = seq.setOptions(options)
284
285
286 if containerName is None:
287 for opt in algOpts:
288 if 'name' in opt and opt['name'] == 'containerName':
289 containerName = opt.get('value', None)
290 break
291
292 if configSeq is not None:
293 configSeq += seq
294
295
296 extraOptionsForAlg = extraOptions.copy() if extraOptions is not None else None
297 if extraOptionsForAlg is None:
298 extraOptionsList = ["skipOnData", "skipOnMC", "onlyForDSIDs"]
299 for i in algOpts:
300 if i['name'] in extraOptionsList and i['defaultValue'] != i['value']:
301 if extraOptionsForAlg is None:
302 extraOptionsForAlg = {}
303 extraOptionsForAlg[i['name']] = i['value']
304 else:
305 algOpts = seq.setOptions(extraOptionsForAlg.copy())
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?)