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 instanceName (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 21 of file AsgAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

def python.AsgAnalysisConfig.CommonServicesConfig.__init__ (   self)

Definition at line 29 of file AsgAnalysisConfig.py.

29  def __init__ (self) :
30  super (CommonServicesConfig, self).__init__ ()
31  self.addOption ('runSystematics', None, type=bool,
32  info="whether to turn on the computation of systematic variations. "
33  "The default is to run them on MC.")
34  self.addOption ('filterSystematics', None, type=str,
35  info="a regexp string against which the systematics names will be "
36  "matched. Only positive matches are retained and used in the evaluation "
37  "of the various algorithms.")
38  self.addOption ('onlySystematicsCategories', None, type=list,
39  info="a list of strings defining categories of systematics to enable "
40  "(only recommended for studies / partial ntuple productions). Choose amongst: "
41  "jets, electrons, muons, photons, taus, met, tracks, ftag, event. This option is overridden "
42  "by 'filterSystematics'.")
43  self.addOption ('systematicsHistogram', None , type=str,
44  info="the name (string) of the histogram to which a list of executed "
45  "systematics will be printed. The default is None (don't write out "
46  "the histogram).")
47  self.addOption ('separateWeightSystematics', False, type=bool,
48  info="if 'systematicsHistogram' is enabled, whether to create a separate "
49  "histogram holding only the names of weight-based systematics. This is useful "
50  "to help make histogramming frameworks more efficient by knowing in advance which "
51  "systematics need to recompute the observable and which don't.")
52 

Member Function Documentation

◆ instanceName()

def python.AsgAnalysisConfig.CommonServicesConfig.instanceName (   self)
Return the instance name for this block

Definition at line 53 of file AsgAnalysisConfig.py.

53  def instanceName (self) :
54  """Return the instance name for this block"""
55  return '' # no instance name, this is a singleton
56 

◆ makeAlgs()

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

Definition at line 57 of file AsgAnalysisConfig.py.

57  def makeAlgs (self, config) :
58 
59  sysService = config.createService( 'CP::SystematicsSvc', 'SystematicsSvc' )
60 
61  if self.runSystematics is False :
62  runSystematics = self.runSystematics
63  elif config.noSystematics() is not None :
64  # if option not set:
65  # check to see if set in config accumulator
66  self.runSystematics = not config.noSystematics()
67  runSystematics = self.runSystematics
68  else :
69  runSystematics = True
70 
71  if runSystematics :
72  sysService.sigmaRecommended = 1
73  if config.dataType() is DataType.Data:
74  # Only one type of allowed systematics on data: the JER variations!
75  self.onlySystematicsCategories = ['JER']
76  if self.onlySystematicsCategories is not None:
77  # Convert strings to enums and validate
78  requested_categories = []
79  for category_str in self.onlySystematicsCategories:
80  try:
81  category_enum = SystematicsCategories[category_str.upper()]
82  requested_categories += category_enum.value
83  except KeyError:
84  raise ValueError(f"Invalid systematics category passed to option 'onlySystematicsCategories': {category_str}. Must be one of {', '.join(category.name for category in SystematicsCategories)}")
85  # Construct regex pattern as logical-OR of category names
86  if len(requested_categories):
87  sysService.systematicsRegex = "^(?=.*(" + "|".join(requested_categories) + ")|$).*"
88  if self.filterSystematics is not None:
89  sysService.systematicsRegex = self.filterSystematics
90  config.createService( 'CP::SelectionNameSvc', 'SelectionNameSvc')
91 
92  if self.systematicsHistogram is not None:
93  # print out all systematics
94  allSysDumper = config.createAlgorithm( 'CP::SysListDumperAlg', 'SystematicsPrinter' )
95  allSysDumper.histogramName = self.systematicsHistogram
96 
97  if self.separateWeightSystematics:
98  # print out only the weight systematics (for more efficient histogramming down the line)
99  weightSysDumper = config.createAlgorithm( 'CP::SysListDumperAlg', 'OnlyWeightSystematicsPrinter' )
100  weightSysDumper.histogramName = f"{self.systematicsHistogram}OnlyWeights"
101  weightSysDumper.systematicsRegex = "^(GEN_|EL_EFF_|MUON_EFF_|PH_EFF_|TAUS_TRUEHADTAU_EFF_|FT_EFF_|extrapolation_pt_|JET_.*JvtEfficiency_|PRW_).*"
102 
103 
104 

Member Data Documentation

◆ onlySystematicsCategories

python.AsgAnalysisConfig.CommonServicesConfig.onlySystematicsCategories

Definition at line 75 of file AsgAnalysisConfig.py.

◆ runSystematics

python.AsgAnalysisConfig.CommonServicesConfig.runSystematics

Definition at line 66 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