the ConfigBlock for generator algorithms
Definition at line 348 of file AsgAnalysisConfig.py.
◆ __init__()
| def python.AsgAnalysisConfig.GeneratorAnalysisBlock.__init__ |
( |
|
self | ) |
|
Definition at line 351 of file AsgAnalysisConfig.py.
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 "
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'. ")
◆ 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
◆ makeAlgs()
| def python.AsgAnalysisConfig.GeneratorAnalysisBlock.makeAlgs |
( |
|
self, |
|
|
|
config |
|
) |
| |
Definition at line 381 of file AsgAnalysisConfig.py.
381 def makeAlgs (self, config) :
383 if config.dataType()
is DataType.Data:
386 log = logging.getLogger(
'makeGeneratorAnalysisSequence')
388 if self.runNumber
is None:
389 self.runNumber = config.runNumber()
391 if self.saveCutBookkeepers
and not self.runNumber:
392 raise ValueError (
"invalid run number: " +
str(self.runNumber))
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()
402 alg.enableSystematics = self.cutBookkeepersSystematics
404 alg.histPattern = self.histPattern
405 config.addPrivateTool(
'truthWeightTool',
'PMGTools::PMGTruthWeightTool' )
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')
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)
418 if self.doHFProdFracReweighting:
419 generatorInfo = config.flags.Input.GeneratorsInfo
420 log.info(f
"Loaded generator info: {generatorInfo}")
424 if not generatorInfo:
425 log.warning(
"No generator info found.")
427 elif isinstance(generatorInfo, dict):
428 if "Pythia8" in generatorInfo:
430 elif "Sherpa" in generatorInfo
and "2.2.8" in generatorInfo[
"Sherpa"]:
432 elif "Sherpa" in generatorInfo
and "2.2.10" in generatorInfo[
"Sherpa"]:
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.")
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.")
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.")
443 elif "Sherpa" in generatorInfo
and "2.2.1" in generatorInfo[
"Sherpa"]:
445 elif "Herwig7" in generatorInfo
and "7.1.3" in generatorInfo[
"Herwig7"]:
447 elif "Herwig7" in generatorInfo
and "7.2.1" in generatorInfo[
"Herwig7"]:
449 elif "Herwig7" in generatorInfo
and "7." in generatorInfo[
"Herwig7"]:
451 elif "amc@NLO" in generatorInfo:
454 log.warning(f
"HF production fraction reweighting is not configured for this generator: {generatorInfo}")
455 log.warning(
"New weights need to be calculated.")
458 log.warning(
"Failed to determine generator from metadata")
461 log.info(f
"Using HF production fraction weights calculated using DSID {DSID}")
463 log.warning(
"HF production fraction reweighting will return dummy weights of 1.0")
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')
◆ runNumber
| python.AsgAnalysisConfig.GeneratorAnalysisBlock.runNumber |
The documentation for this class was generated from the following file: