the ConfigBlock for generator algorithms
Definition at line 372 of file AsgAnalysisConfig.py.
◆ __init__()
| def python.AsgAnalysisConfig.GeneratorAnalysisBlock.__init__ |
( |
|
self | ) |
|
Definition at line 375 of file AsgAnalysisConfig.py.
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 "
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'. ")
◆ 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
◆ makeAlgs()
| def python.AsgAnalysisConfig.GeneratorAnalysisBlock.makeAlgs |
( |
|
self, |
|
|
|
config |
|
) |
| |
Definition at line 405 of file AsgAnalysisConfig.py.
405 def makeAlgs (self, config) :
407 if config.dataType()
is DataType.Data:
410 log = logging.getLogger(
'makeGeneratorAnalysisSequence')
412 if self.runNumber
is None:
413 self.runNumber = config.runNumber()
415 if self.saveCutBookkeepers
and not self.runNumber:
416 raise ValueError (
"invalid run number: " +
str(self.runNumber))
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()
426 alg.enableSystematics = self.cutBookkeepersSystematics
428 alg.histPattern = self.histPattern
429 config.addPrivateTool(
'truthWeightTool',
'PMGTools::PMGTruthWeightTool' )
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')
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)
442 if self.doHFProdFracReweighting:
443 generatorInfo = config.flags.Input.GeneratorsInfo
444 log.info(f
"Loaded generator info: {generatorInfo}")
448 if not generatorInfo:
449 log.warning(
"No generator info found.")
451 elif isinstance(generatorInfo, dict):
452 if "Pythia8" in generatorInfo:
454 elif "Sherpa" in generatorInfo
and "2.2.8" in generatorInfo[
"Sherpa"]:
456 elif "Sherpa" in generatorInfo
and "2.2.10" in generatorInfo[
"Sherpa"]:
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.")
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.")
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.")
467 elif "Sherpa" in generatorInfo
and "2.2.1" in generatorInfo[
"Sherpa"]:
469 elif "Herwig7" in generatorInfo
and "7.1.3" in generatorInfo[
"Herwig7"]:
471 elif "Herwig7" in generatorInfo
and "7.2.1" in generatorInfo[
"Herwig7"]:
473 elif "Herwig7" in generatorInfo
and "7." in generatorInfo[
"Herwig7"]:
475 elif "amc@NLO" in generatorInfo:
478 log.warning(f
"HF production fraction reweighting is not configured for this generator: {generatorInfo}")
479 log.warning(
"New weights need to be calculated.")
482 log.warning(
"Failed to determine generator from metadata")
485 log.info(f
"Using HF production fraction weights calculated using DSID {DSID}")
487 log.warning(
"HF production fraction reweighting will return dummy weights of 1.0")
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')
◆ runNumber
| python.AsgAnalysisConfig.GeneratorAnalysisBlock.runNumber |
The documentation for this class was generated from the following file: