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