12 """Return a level-of-detail function that also schedules an algorithm.
14 LEVEL is the level of detail.
16 ALG is the name of the algorithm.
19 def lodfunc (reqlev, blockargs, hookargs):
20 if reqlev < level:
return False
21 algmod = __import__ (
'egammaD3PDAnalysis.' + alg +
'Config',
22 fromlist = [alg +
'Config'])
23 algfunc = getattr (algmod, alg +
'Cfg')
24 def hookfn (c, flags, acc, *args, **kw):
25 acc.merge (algfunc (flags,
26 prefix = hookargs[
'prefix'],
27 sgkey = hookargs[
'sgkey'],
28 typeName = hookargs[
'typeName'],
29 allowMissing = hookargs.get(
'allowMissing',
False)))
31 hookargs[
'd3pdo'].defineHook (hookfn)
37 """Define a block, and schedule an algorithm if the block is used.
39 D3PDO is the D3PDObject for which the block should be defined.
41 LEVEL is the level of detail.
43 BLOCKNAME is the name of the block.
45 BLOCKFUNC is the function that creates the block.
47 ALG is the name of the algorithm.
50 lodfunc = defineAlgLODFunc (level, alg)
51 d3pdo.defineBlock (lodfunc, blockname, blockfunc, **kw)