the ConfigBlock for generator algorithms
Definition at line 312 of file AsgAnalysisConfig.py.
◆ __init__()
def python.AsgAnalysisConfig.GeneratorAnalysisBlock.__init__ |
( |
|
self | ) |
|
Definition at line 315 of file AsgAnalysisConfig.py.
316 super (GeneratorAnalysisBlock, self).__init__ ()
317 self.addOption (
'saveCutBookkeepers',
True, type=bool,
318 info=
"whether to save the cut bookkeepers information into the "
319 "output file. The default is True.")
320 self.addOption (
'runNumber',
None, type=int,
321 info=
"the MC runNumber (int). The default is None (autoconfigure "
323 self.addOption (
'cutBookkeepersSystematics',
None, type=bool,
324 info=
"whether to also save the cut bookkeepers systematics. The "
325 "default is None (follows the global systematics flag). Set to "
326 "False or True to override.")
327 self.addOption (
'histPattern',
None, type=str,
328 info=
"the histogram name pattern for the cut-bookkeeper histogram names")
329 self.addOption (
'streamName',
'ANALYSIS', type=str,
330 info=
"name of the output stream to save the cut bookkeeper in. "
331 "The default is ANALYSIS.")
332 self.addOption (
'detailedPDFinfo',
False, type=bool,
333 info=
"save the necessary information to run the LHAPDF tool offline. "
334 "The default is False.")
335 self.addOption (
'doHFProdFracReweighting',
False, type=bool,
336 info=
"whether to apply HF production fraction reweighting. "
337 "The default is False.")
338 self.addOption (
'truthParticleContainer',
'TruthParticles', type=str,
339 info=
"the name of the truth particle container to use for HF production fraction reweighting. "
340 "The default is 'TruthParticles'. ")
◆ instanceName()
def python.AsgAnalysisConfig.GeneratorAnalysisBlock.instanceName |
( |
|
self | ) |
|
Return the instance name for this block
Definition at line 341 of file AsgAnalysisConfig.py.
341 def instanceName (self) :
342 """Return the instance name for this block"""
343 return self.streamName
◆ makeAlgs()
def python.AsgAnalysisConfig.GeneratorAnalysisBlock.makeAlgs |
( |
|
self, |
|
|
|
config |
|
) |
| |
Definition at line 345 of file AsgAnalysisConfig.py.
345 def makeAlgs (self, config) :
347 if config.dataType()
is DataType.Data:
351 from AthenaCommon.Logging
import logging
354 log = logging.getLogger(
'makeGeneratorAnalysisSequence')
356 if self.runNumber
is None:
357 self.runNumber = config.runNumber()
359 if self.saveCutBookkeepers
and not self.runNumber:
360 raise ValueError (
"invalid run number: " +
str(self.runNumber))
363 if self.saveCutBookkeepers:
364 alg = config.createAlgorithm(
'CP::AsgCutBookkeeperAlg',
'CutBookkeeperAlg')
365 alg.RootStreamName = self.streamName
366 alg.runNumber = self.runNumber
367 if self.cutBookkeepersSystematics
is None:
368 alg.enableSystematics =
not config.noSystematics()
370 alg.enableSystematics = self.cutBookkeepersSystematics
372 alg.histPattern = self.histPattern
373 config.addPrivateTool(
'truthWeightTool',
'PMGTools::PMGTruthWeightTool' )
376 alg = config.createAlgorithm(
'CP::PMGTruthWeightAlg',
'PMGTruthWeightAlg' )
377 config.addPrivateTool(
'truthWeightTool',
'PMGTools::PMGTruthWeightTool' )
378 alg.decoration =
'generatorWeight_%SYS%'
379 config.addOutputVar (
'EventInfo',
'generatorWeight_%SYS%',
'weight_mc')
381 if self.detailedPDFinfo:
382 alg = config.createAlgorithm(
'CP::PDFinfoAlg',
'PDFinfoAlg', reentrant=
True )
383 for var
in [
"PDFID1",
"PDFID2",
"PDGID1",
"PDGID2",
"Q",
"X1",
"X2",
"XF1",
"XF2"]:
384 config.addOutputVar (
'EventInfo', var,
'PDFinfo_' + var, noSys=
True)
386 if self.doHFProdFracReweighting:
387 generatorInfo = config.autoconfigFlags().Input.GeneratorsInfo
388 log.info(f
"Loaded generator info: {generatorInfo}")
392 if not generatorInfo:
393 log.warning(
"No generator info found.")
395 elif isinstance(generatorInfo, dict):
396 if "Pythia8" in generatorInfo:
398 elif "Sherpa" in generatorInfo
and "2.2.8" in generatorInfo[
"Sherpa"]:
400 elif "Sherpa" in generatorInfo
and "2.2.10" in generatorInfo[
"Sherpa"]:
402 elif "Sherpa" in generatorInfo
and "2.2.11" in generatorInfo[
"Sherpa"]:
403 log.warning(
"HF production fraction reweighting is not configured for Sherpa 2.2.11. Using weights for Sherpa 2.2.10 instead.")
405 elif "Sherpa" in generatorInfo
and "2.2.12" in generatorInfo[
"Sherpa"]:
406 log.warning(
"HF production fraction reweighting is not configured for Sherpa 2.2.12. Using weights for Sherpa 2.2.10 instead.")
408 elif "Sherpa" in generatorInfo
and "2.2.14" in generatorInfo[
"Sherpa"]:
409 log.warning(
"HF production fraction reweighting is not configured for Sherpa 2.2.14. New weights need to be calculated.")
411 elif "Sherpa" in generatorInfo
and "2.2.1" in generatorInfo[
"Sherpa"]:
413 elif "Herwig7" in generatorInfo
and "7.1.3" in generatorInfo[
"Herwig7"]:
415 elif "Herwig7" in generatorInfo
and "7.2.1" in generatorInfo[
"Herwig7"]:
417 elif "Herwig7" in generatorInfo
and "7." in generatorInfo[
"Herwig7"]:
419 elif "amc@NLO" in generatorInfo:
422 log.warning(f
"HF production fraction reweighting is not configured for this generator: {generatorInfo}")
423 log.warning(
"New weights need to be calculated.")
426 log.warning(
"Failed to determine generator from metadata")
429 log.info(f
"Using HF production fraction weights calculated using DSID {DSID}")
431 log.warning(
"HF production fraction reweighting will return dummy weights of 1.0")
433 alg = config.createAlgorithm(
'CP::SysTruthWeightAlg',
'SysTruthWeightAlg' + self.streamName )
434 config.addPrivateTool(
'sysTruthWeightTool',
'PMGTools::PMGHFProductionFractionTool' )
435 alg.decoration =
'prodFracWeight_%SYS%'
436 alg.TruthParticleContainer = self.truthParticleContainer
437 alg.sysTruthWeightTool.ShowerGenerator = DSID
438 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: