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

Public Member Functions

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

Public Attributes

 runNumber
 

Detailed Description

the ConfigBlock for generator algorithms

Definition at line 372 of file AsgAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

def python.AsgAnalysisConfig.GeneratorAnalysisBlock.__init__ (   self)

Definition at line 375 of file AsgAnalysisConfig.py.

375  def __init__ (self) :
376  super (GeneratorAnalysisBlock, self).__init__ ()
377  self.addOption ('saveCutBookkeepers', True, type=bool,
378  info="whether to save the cut bookkeepers information into the "
379  "output file. The default is True.")
380  self.addOption ('runNumber', None, type=int,
381  info="the MC runNumber (int). The default is None (autoconfigure "
382  "from metadata).")
383  self.addOption ('cutBookkeepersSystematics', None, type=bool,
384  info="whether to also save the cut bookkeepers systematics. The "
385  "default is None (follows the global systematics flag). Set to "
386  "False or True to override.")
387  self.addOption ('histPattern', None, type=str,
388  info="the histogram name pattern for the cut-bookkeeper histogram names")
389  self.addOption ('streamName', 'ANALYSIS', type=str,
390  info="name of the output stream to save the cut bookkeeper in. "
391  "The default is ANALYSIS.")
392  self.addOption ('detailedPDFinfo', False, type=bool,
393  info="save the necessary information to run the LHAPDF tool offline. "
394  "The default is False.")
395  self.addOption ('doHFProdFracReweighting', False, type=bool,
396  info="whether to apply HF production fraction reweighting. "
397  "The default is False.")
398  self.addOption ('truthParticleContainer', 'TruthParticles', type=str,
399  info="the name of the truth particle container to use for HF production fraction reweighting. "
400  "The default is 'TruthParticles'. ")

Member Function Documentation

◆ instanceName()

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

Definition at line 401 of file AsgAnalysisConfig.py.

401  def instanceName (self) :
402  """Return the instance name for this block"""
403  return self.streamName
404 

◆ makeAlgs()

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

Definition at line 405 of file AsgAnalysisConfig.py.

405  def makeAlgs (self, config) :
406 
407  if config.dataType() is DataType.Data:
408  # there are no generator weights in data!
409  return
410  log = logging.getLogger('makeGeneratorAnalysisSequence')
411 
412  if self.runNumber is None:
413  self.runNumber = config.runNumber()
414 
415  if self.saveCutBookkeepers and not self.runNumber:
416  raise ValueError ("invalid run number: " + str(self.runNumber))
417 
418  # Set up the CutBookkeepers algorithm:
419  if self.saveCutBookkeepers:
420  alg = config.createAlgorithm('CP::AsgCutBookkeeperAlg', 'CutBookkeeperAlg')
421  alg.RootStreamName = self.streamName
422  alg.runNumber = self.runNumber
423  if self.cutBookkeepersSystematics is None:
424  alg.enableSystematics = not config.noSystematics()
425  else:
426  alg.enableSystematics = self.cutBookkeepersSystematics
427  if self.histPattern:
428  alg.histPattern = self.histPattern
429  config.addPrivateTool( 'truthWeightTool', 'PMGTools::PMGTruthWeightTool' )
430 
431  # Set up the weights algorithm:
432  alg = config.createAlgorithm( 'CP::PMGTruthWeightAlg', 'PMGTruthWeightAlg' )
433  config.addPrivateTool( 'truthWeightTool', 'PMGTools::PMGTruthWeightTool' )
434  alg.decoration = 'generatorWeight_%SYS%'
435  config.addOutputVar ('EventInfo', 'generatorWeight_%SYS%', 'weight_mc')
436 
437  if self.detailedPDFinfo:
438  alg = config.createAlgorithm( 'CP::PDFinfoAlg', 'PDFinfoAlg', reentrant=True )
439  for var in ["PDFID1","PDFID2","PDGID1","PDGID2","Q","X1","X2","XF1","XF2"]:
440  config.addOutputVar ('EventInfo', var, 'PDFinfo_' + var, noSys=True)
441 
442  if self.doHFProdFracReweighting:
443  generatorInfo = config.flags.Input.GeneratorsInfo
444  log.info(f"Loaded generator info: {generatorInfo}")
445 
446  DSID = "000000"
447 
448  if not generatorInfo:
449  log.warning("No generator info found.")
450  DSID = "000000"
451  elif isinstance(generatorInfo, dict):
452  if "Pythia8" in generatorInfo:
453  DSID = "410470"
454  elif "Sherpa" in generatorInfo and "2.2.8" in generatorInfo["Sherpa"]:
455  DSID = "421152"
456  elif "Sherpa" in generatorInfo and "2.2.10" in generatorInfo["Sherpa"]:
457  DSID = "700122"
458  elif "Sherpa" in generatorInfo and "2.2.11" in generatorInfo["Sherpa"]:
459  log.warning("HF production fraction reweighting is not configured for Sherpa 2.2.11. Using weights for Sherpa 2.2.10 instead.")
460  DSID = "700122"
461  elif "Sherpa" in generatorInfo and "2.2.12" in generatorInfo["Sherpa"]:
462  log.warning("HF production fraction reweighting is not configured for Sherpa 2.2.12. Using weights for Sherpa 2.2.10 instead.")
463  DSID = "700122"
464  elif "Sherpa" in generatorInfo and "2.2.14" in generatorInfo["Sherpa"]:
465  log.warning("HF production fraction reweighting is not configured for Sherpa 2.2.14. New weights need to be calculated.")
466  DSID = "000000"
467  elif "Sherpa" in generatorInfo and "2.2.1" in generatorInfo["Sherpa"]:
468  DSID = "410250"
469  elif "Herwig7" in generatorInfo and "7.1.3" in generatorInfo["Herwig7"]:
470  DSID = "411233"
471  elif "Herwig7" in generatorInfo and "7.2.1" in generatorInfo["Herwig7"]:
472  DSID = "600666"
473  elif "Herwig7" in generatorInfo and "7." in generatorInfo["Herwig7"]:
474  DSID = "410558"
475  elif "amc@NLO" in generatorInfo:
476  DSID = "410464"
477  else:
478  log.warning(f"HF production fraction reweighting is not configured for this generator: {generatorInfo}")
479  log.warning("New weights need to be calculated.")
480  DSID = "000000"
481  else:
482  log.warning("Failed to determine generator from metadata")
483  DSID = "000000"
484 
485  log.info(f"Using HF production fraction weights calculated using DSID {DSID}")
486  if DSID == "000000":
487  log.warning("HF production fraction reweighting will return dummy weights of 1.0")
488 
489  alg = config.createAlgorithm( 'CP::SysTruthWeightAlg', 'SysTruthWeightAlg' + self.streamName )
490  config.addPrivateTool( 'sysTruthWeightTool', 'PMGTools::PMGHFProductionFractionTool' )
491  alg.decoration = 'prodFracWeight_%SYS%'
492  alg.TruthParticleContainer = self.truthParticleContainer
493  alg.sysTruthWeightTool.ShowerGenerator = DSID
494  config.addOutputVar ('EventInfo', 'prodFracWeight_%SYS%', 'weight_HF_prod_frac')
495 

Member Data Documentation

◆ runNumber

python.AsgAnalysisConfig.GeneratorAnalysisBlock.runNumber

Definition at line 413 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
str
Definition: BTagTrackIpAccessor.cxx:11