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 if extraOptions is None:
297 extraOptionsList = ["skipOnData", "skipOnMC", "onlyForDSIDs"]
298 for i in algOpts:
299 if i['name'] in extraOptionsList and i['defaultValue'] != i['value']:
300 if extraOptions is None:
301 extraOptions = {}
302 extraOptions[i['name']] = i['value']
303 else:
304 algOpts = seq.setOptions(extraOptions.copy())
305
306
307 algOpts = [i['name'] for i in algOpts]
308 expectedOptions =
set(funcOpts)
309 expectedOptions |=
set(algOpts)
310 expectedOptions |=
set(block.subAlgs)
311
312 difference =
set(options.keys()) - expectedOptions
313 difference.discard('__placeholder__')
314 if difference:
315 difference = "\n".join(difference)
316 raise ValueError(f"There are options set that are not used for "
317 f"{block.algName}:\n{difference}\n"
318 "Please check your configuration.")
319
320
321 for alg
in self._order.
get(block.algName, []):
322 if alg in options:
323 subAlg = block.subAlgs[alg]
324 self._configureAlg(subAlg, options[alg], configSeq, containerName, extraOptions)
325 return configSeq
326
327
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)