ATLAS Offline Software
GeneratorConfigFlags.py
Go to the documentation of this file.
1 """Construct Generator configuration flags
2 
3 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
4 """
5 
6 from AthenaConfiguration.AthConfigFlags import AthConfigFlags
7 
8 
10  """Return an AthConfigFlags object with required flags"""
11  gencf = AthConfigFlags()
12 
13  # Ignore black list
14  gencf.addFlag("Generator.ignoreBlackList", False)
15 
16  # Input Generator File
17  gencf.addFlag("Generator.inputGeneratorFile", '')
18 
19  # Number of input files per job
20  gencf.addFlag("Generator.inputFilesPerJob", 1)
21 
22  # Events per job
23  gencf.addFlag("Generator.nEventsPerJob", 10000)
24 
25  # Events per job
26  gencf.addFlag("Generator.DSID", 999999)
27 
28  # First event
29  gencf.addFlag("Generator.firstEvent", -1)
30 
31  # Number of HepMC events to print
32  gencf.addFlag("Generator.printEvts", 0)
33 
34  # Output yoda file for jobs that require Rivet
35  gencf.addFlag("Generator.outputYODAFile", '')
36 
37  # Output yoda file for jobs that require Rivet
38  gencf.addFlag("Generator.rivetAnalyses", '')
39 
40  return gencf
41 
42 
43 def generatorRunArgsToFlags(runArgs, flags):
44  """Fill generator configuration flags from run arguments."""
45 
46  from AthenaCommon.SystemOfUnits import GeV
47 
48  if hasattr(runArgs, "ecmEnergy"):
49  flags.Beam.Energy = runArgs.ecmEnergy/2 * GeV
50  else:
51  raise RuntimeError("No center of mass energy provided.")
52 
53  if hasattr(runArgs, "ignoreBlackList"):
54  flags.Generator.ignoreBlackList = runArgs.ignoreBlackList
55 
56  if hasattr(runArgs, "inputGeneratorFile"):
57  flags.Generator.inputGeneratorFile = runArgs.inputGeneratorFile
58 
59  if hasattr(runArgs, "firstEvent"):
60  flags.Generator.firstEvent = runArgs.firstEvent
61 
62  if hasattr(runArgs, "printEvts"):
63  flags.Generator.printEvts = runArgs.printEvts
64 
65  if hasattr(runArgs, "outputYODAFile"):
66  flags.Generator.outputYODAFile = runArgs.outputYODAFile
67 
68  if hasattr(runArgs, "rivetAnas"):
69  flags.Generator.rivetAnalyses = runArgs.rivetAnas
SystemOfUnits
python.GeneratorConfigFlags.generatorRunArgsToFlags
def generatorRunArgsToFlags(runArgs, flags)
Definition: GeneratorConfigFlags.py:43
python.GeneratorConfigFlags.createGeneratorConfigFlags
def createGeneratorConfigFlags()
Definition: GeneratorConfigFlags.py:9