ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Generators
PowhegControl
python
PowhegConfig.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3
from
AthenaCommon.SystemOfUnits
import
GeV
4
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
5
from
GeneratorConfig.Sequences
import
EvgenSequence, EvgenSequenceFactory
6
7
8
class
_RunArgs
:
9
"""Legacy runArgs compatibility object."""
10
pass
11
12
13
class
_RunOpts
:
14
"""Legacy run-options compatibility object."""
15
nprocs = 0
16
17
18
def
_make_run_args
(flags):
19
"""Create the legacy runArgs interface from CA flags."""
20
run_args =
_RunArgs
()
21
run_args.ecmEnergy = flags.Beam.Energy * 2 / GeV
22
run_args.maxEvents = (
23
flags.Exec.MaxEvents
24
if
flags.Exec.MaxEvents > 0
25
else
flags.Generator.nEventsPerJob
26
)
27
run_args.randomSeed = flags.Random.SeedOffset
28
29
if
flags.Output.EVNTFileName:
30
run_args.outputEVNTFile = flags.Output.EVNTFileName
31
if
flags.Generator.outputYODAFile:
32
run_args.outputYODAFile = flags.Generator.outputYODAFile
33
if
flags.Output.TXTFileName:
34
run_args.outputTXTFile = flags.Output.TXTFileName
35
36
return
run_args
37
38
39
def
PowhegCfg
(flags, process, settings=None, **generate_kwargs):
40
"""
41
Configure and run a legacy PowhegControl process.
42
'settings' contains assignments to public PowhegControl parameters.
43
Additional keyword arguments are forwarded to 'generate()'.
44
"""
45
from
PowhegControl.powheg_control
import
PowhegControl
46
47
run_args =
_make_run_args
(flags)
48
49
control = PowhegControl(
50
process_name=process,
51
run_args=run_args,
52
run_opts=
_RunOpts
(),
53
)
54
55
for
setting, value
in
(settings
or
{}).items():
56
setattr(control, setting, value)
57
58
control.generate(**generate_kwargs)
59
60
lhe_file = run_args.inputGeneratorFile
61
62
ca = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Generator))
63
64
from
GeneratorConfig.GeneratorInfoSvcConfig
import
GeneratorInfoSvcCfg
65
66
ca.merge(GeneratorInfoSvcCfg(flags, Generators=[
"Powheg"
]), sequenceName=EvgenSequence.Generator.value)
67
68
return
ca, lhe_file
python.PowhegConfig._RunArgs
Definition
PowhegConfig.py:8
python.PowhegConfig._RunOpts
Definition
PowhegConfig.py:13
python.PowhegConfig._make_run_args
_make_run_args(flags)
Definition
PowhegConfig.py:18
python.PowhegConfig.PowhegCfg
PowhegCfg(flags, process, settings=None, **generate_kwargs)
Definition
PowhegConfig.py:39
Generated on
for ATLAS Offline Software by
1.17.0