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

Constructor & Destructor Documentation

◆ __init__()

def python.AsgAnalysisConfig.GeneratorAnalysisBlock.__init__ (   self)

Definition at line 351 of file AsgAnalysisConfig.py.

351  def __init__ (self) :
352  super (GeneratorAnalysisBlock, self).__init__ ()
353  self.addOption ('saveCutBookkeepers', True, type=bool,
354  info="whether to save the cut bookkeepers information into the "
355  "output file. The default is True.")
356  self.addOption ('runNumber', None, type=int,
357  info="the MC runNumber (int). The default is None (autoconfigure "
358  "from metadata).")
359  self.addOption ('cutBookkeepersSystematics', None, type=bool,
360  info="whether to also save the cut bookkeepers systematics. The "
361  "default is None (follows the global systematics flag). Set to "
362  "False or True to override.")
363  self.addOption ('histPattern', None, type=str,
364  info="the histogram name pattern for the cut-bookkeeper histogram names")
365  self.addOption ('streamName', 'ANALYSIS', type=str,
366  info="name of the output stream to save the cut bookkeeper in. "
367  "The default is ANALYSIS.")
368  self.addOption ('detailedPDFinfo', False, type=bool,
369  info="save the necessary information to run the LHAPDF tool offline. "
370  "The default is False.")
371  self.addOption ('doHFProdFracReweighting', False, type=bool,
372  info="whether to apply HF production fraction reweighting. "
373  "The default is False.")
374  self.addOption ('truthParticleContainer', 'TruthParticles', type=str,
375  info="the name of the truth particle container to use for HF production fraction reweighting. "
376  "The default is 'TruthParticles'. ")

Member Function Documentation

◆ instanceName()

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

Definition at line 377 of file AsgAnalysisConfig.py.

377  def instanceName (self) :
378  """Return the instance name for this block"""
379  return self.streamName
380 

◆ makeAlgs()

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

Definition at line 381 of file AsgAnalysisConfig.py.

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

Member Data Documentation

◆ runNumber

python.AsgAnalysisConfig.GeneratorAnalysisBlock.runNumber

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