ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
python.AsgAnalysisConfig.CommonServicesConfig Class Reference
Inheritance diagram for python.AsgAnalysisConfig.CommonServicesConfig:
Collaboration diagram for python.AsgAnalysisConfig.CommonServicesConfig:

Public Member Functions

def __init__ (self)
 
def makeAlgs (self, config)
 

Public Attributes

 runSystematics
 
 onlySystematicsCategories
 

Detailed Description

the ConfigBlock for common services

The idea here is that all algorithms need some common services, and I should
provide configuration blocks for those.  For now there is just a single
block, but in the future I might break out e.g. the systematics service.

Definition at line 20 of file AsgAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

def python.AsgAnalysisConfig.CommonServicesConfig.__init__ (   self)

Definition at line 28 of file AsgAnalysisConfig.py.

28  def __init__ (self) :
29  super (CommonServicesConfig, self).__init__ ()
30  self.addOption ('runSystematics', None, type=bool,
31  info="whether to turn on the computation of systematic variations. "
32  "The default is to run them on MC.")
33  self.addOption ('filterSystematics', None, type=str,
34  info="a regexp string against which the systematics names will be "
35  "matched. Only positive matches are retained and used in the evaluation "
36  "of the various algorithms.")
37  self.addOption ('onlySystematicsCategories', None, type=list,
38  info="a list of strings defining categories of systematics to enable "
39  "(only recommended for studies / partial ntuple productions). Choose amongst: "
40  "jets, electrons, muons, photons, taus, met, ftag, event. This option is overridden "
41  "by 'filterSystematics'.")
42  self.addOption ('systematicsHistogram', None , type=str,
43  info="the name (string) of the histogram to which a list of executed "
44  "systematics will be printed. The default is None (don't write out "
45  "the histogram).")
46 

Member Function Documentation

◆ makeAlgs()

def python.AsgAnalysisConfig.CommonServicesConfig.makeAlgs (   self,
  config 
)

Definition at line 47 of file AsgAnalysisConfig.py.

47  def makeAlgs (self, config) :
48 
49  sysService = config.createService( 'CP::SystematicsSvc', 'SystematicsSvc' )
50 
51  if self.runSystematics is not None :
52  runSystematics = self.runSystematics
53  elif config.noSystematics() is not None :
54  # if option not set:
55  # check to see if set in config accumulator
56  self.runSystematics = not config.noSystematics()
57  runSystematics = self.runSystematics
58  else :
59  runSystematics = True
60 
61  if runSystematics :
62  sysService.sigmaRecommended = 1
63  if config.dataType() is DataType.Data:
64  # Only one type of allowed systematics on data: the JER variations!
65  self.onlySystematicsCategories = ['JER']
66  if self.onlySystematicsCategories is not None:
67  # Convert strings to enums and validate
68  requested_categories = []
69  for category_str in self.onlySystematicsCategories:
70  try:
71  category_enum = SystematicsCategories[category_str.upper()]
72  requested_categories += category_enum.value
73  except KeyError:
74  raise ValueError(f"Invalid systematics category passed to option 'onlySystematicsCategories': {category_str}. Must be one of {', '.join(category.name for category in SystematicsCategories)}")
75  # Construct regex pattern as logical-OR of category names
76  if len(requested_categories):
77  sysService.systematicsRegex = "^(?=.*(" + "|".join(requested_categories) + ")|$).*"
78  if self.filterSystematics is not None:
79  sysService.systematicsRegex = self.filterSystematics
80  config.createService( 'CP::SelectionNameSvc', 'SelectionNameSvc')
81 
82  if self.systematicsHistogram is not None:
83  sysDumper = config.createAlgorithm( 'CP::SysListDumperAlg', 'SystematicsPrinter' )
84  sysDumper.histogramName = self.systematicsHistogram
85 
86 

Member Data Documentation

◆ onlySystematicsCategories

python.AsgAnalysisConfig.CommonServicesConfig.onlySystematicsCategories

Definition at line 65 of file AsgAnalysisConfig.py.

◆ runSystematics

python.AsgAnalysisConfig.CommonServicesConfig.runSystematics

Definition at line 56 of file AsgAnalysisConfig.py.


The documentation for this class was generated from the following file:
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18