ATLAS Offline Software
Loading...
Searching...
No Matches
GeneratorConfigFlags.py
Go to the documentation of this file.
1"""Construct Generator configuration flags
2
3Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
4"""
5
6from 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 # Default PDG parameter settings
41 gencf.addFlag("Generator.PDGparams", True)
42
43 return gencf
44
45
46def generatorRunArgsToFlags(runArgs, flags):
47 """Fill generator configuration flags from run arguments."""
48
49 from AthenaCommon.SystemOfUnits import GeV
50
51 if hasattr(runArgs, "ecmEnergy"):
52 flags.Beam.Energy = runArgs.ecmEnergy/2 * GeV
53 else:
54 raise RuntimeError("No center of mass energy provided.")
55
56 if hasattr(runArgs, "ignoreBlackList"):
57 flags.Generator.ignoreBlackList = runArgs.ignoreBlackList
58
59 if hasattr(runArgs, "inputGeneratorFile"):
60 flags.Generator.inputGeneratorFile = runArgs.inputGeneratorFile
61
62 if hasattr(runArgs, "firstEvent"):
63 flags.Generator.firstEvent = runArgs.firstEvent
64
65 if hasattr(runArgs, "printEvts"):
66 flags.Generator.printEvts = runArgs.printEvts
67
68 if hasattr(runArgs, "outputYODAFile"):
69 flags.Generator.outputYODAFile = runArgs.outputYODAFile
70
71 if hasattr(runArgs, "rivetAnas"):
72 flags.Generator.rivetAnalyses = runArgs.rivetAnas