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 22 of file AsgAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

def python.AsgAnalysisConfig.CommonServicesConfig.__init__ (   self)

Definition at line 30 of file AsgAnalysisConfig.py.

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

Member Function Documentation

◆ instanceName()

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

Definition at line 54 of file AsgAnalysisConfig.py.

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

◆ makeAlgs()

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

Definition at line 58 of file AsgAnalysisConfig.py.

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

Member Data Documentation

◆ onlySystematicsCategories

python.AsgAnalysisConfig.CommonServicesConfig.onlySystematicsCategories

Definition at line 76 of file AsgAnalysisConfig.py.

◆ runSystematics

python.AsgAnalysisConfig.CommonServicesConfig.runSystematics

Definition at line 67 of file AsgAnalysisConfig.py.


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