4 from AnalysisAlgorithmsConfig.ConfigBlock
import ConfigBlock
5 from AnalysisAlgorithmsConfig.ConfigAccumulator
import DataType
8 '''ConfigBlock for the bootstrap generator'''
11 super(BootstrapGeneratorConfig, self).
__init__()
12 self.addOption (
'nReplicas', 1000, type=int,
13 info=
"the number (int) of bootstrap replicas to generate. "
14 "The default is 1000.")
15 self.addOption (
'decoration',
None, type=str,
16 info=
"the name of the output vector branch containing the "
17 "bootstrapped weights. The default is bootstrapWeights.")
18 self.addOption (
'runOnMC',
False, type=bool,
19 info=
"toggle to force running on MC samples. The default is "
20 "False, i.e. run only on data.")
23 if config.dataType()
is not DataType.Data
and not self.runOnMC:
24 print(
"Skipping the configuration of CP::BootstrapGeneratorAlg since we are not running on data. "
25 "Set the option 'runOnMC' to True if you want to force the bootstrapping of MC too.")
28 alg = config.createAlgorithm(
'CP::BootstrapGeneratorAlg',
'BootstrapGenerator')
29 alg.nReplicas = self.nReplicas
30 alg.isData = config.dataType()
is DataType.Data
32 alg.decorationName = self.decoration
34 alg.decorationName =
"bootstrapWeights_%SYS%"
36 config.addOutputVar (
'EventInfo', alg.decorationName, alg.decorationName.split(
"_%SYS%")[0], noSys=
True)
45 Setup a simple bootstrapping algorithm
48 nReplicas -- the number of bootstrap replicas to generate
49 decoration -- the name of the output vector branch containing the bootstrapped weights
50 runOnMC -- toggle to force running on MC samples (default: only data)
54 config.setOptionValue (
'nReplicas', nReplicas)
55 config.setOptionValue (
'decoration', decoration)
56 config.setOptionValue (
'runOnMC', runOnMC)