ATLAS Offline Software
BootstrapGeneratorConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 # AnaAlgorithm import(s):
4 from AnalysisAlgorithmsConfig.ConfigBlock import ConfigBlock
5 from AnalysisAlgorithmsConfig.ConfigAccumulator import DataType
6 
7 class BootstrapGeneratorConfig(ConfigBlock):
8  '''ConfigBlock for the bootstrap generator'''
9 
10  def __init__(self):
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.setOptionValue('skipOnMC', True)
19 
20  def makeAlgs(self, config):
21 
22  alg = config.createAlgorithm( 'CP::BootstrapGeneratorAlg', 'BootstrapGenerator')
23  alg.nReplicas = self.nReplicas
24  alg.isData = config.dataType() is DataType.Data
25  if self.decoration:
26  alg.decorationName = self.decoration
27  else:
28  alg.decorationName = "bootstrapWeights_%SYS%"
29 
30  config.addOutputVar ('EventInfo', alg.decorationName, alg.decorationName.split("_%SYS%")[0], noSys=True)
31 
32  return
33 
35  nReplicas = None,
36  decoration = None):
37  """
38  Setup a simple bootstrapping algorithm
39 
40  Keyword arguments:
41  nReplicas -- the number of bootstrap replicas to generate
42  decoration -- the name of the output vector branch containing the bootstrapped weights
43  """
44 
45  config = BootstrapGeneratorConfig()
46  config.setOptionValue ('nReplicas', nReplicas)
47  config.setOptionValue ('decoration', decoration)
48  seq.append (config)
python.BootstrapGeneratorConfig.BootstrapGeneratorConfig.makeAlgs
def makeAlgs(self, config)
Definition: BootstrapGeneratorConfig.py:20
python.BootstrapGeneratorConfig.BootstrapGeneratorConfig
Definition: BootstrapGeneratorConfig.py:7
python.BootstrapGeneratorConfig.BootstrapGeneratorConfig.__init__
def __init__(self)
Definition: BootstrapGeneratorConfig.py:10
python.BootstrapGeneratorConfig.makeBootstrapGeneratorConfig
def makeBootstrapGeneratorConfig(seq, nReplicas=None, decoration=None)
Definition: BootstrapGeneratorConfig.py:34