3from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory
import CompFactory
5from GeneratorConfig.GeneratorSettingsSemantics
import (
6 GeneratorSettingsLayer,
7 GeneratorSettingsPrecedence,
9from GeneratorConfig.Sequences
import EvgenSequence, EvgenSequenceFactory
10from Pythia8_i.Pythia8Tunes
import (
11 a14_nnpdf23lo_tune_cmds,
12 a2_mstw2008lo_tune_cmds,
14from AthenaCommon.SystemOfUnits
import GeV
17from AthenaCommon.Logging
import logging
18log = logging.getLogger(
"Pythia8Config")
23 Return a CA fragment that adds one command layer to Pythia8_i.
25 ca = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Generator))
27 CompFactory.Pythia8_i(name, Commands=GeneratorSettingsLayer(
29 values=tuple(commands
or ()),
30 precedence=precedence,
31 report_context=
"Pythia8Cfg.Commands",
39 The main Pythia8 configuration fragment that sets up the Pythia8_i algorithm
40 and returns a CA instance
44 "Main:timesAllowErrors = 500",
45 "ParticleDecays:limitTau0 = on",
46 "ParticleDecays:tau0Max = 10.0"
50 if "CollisionEnergy" not in kwargs:
51 kwargs[
"CollisionEnergy"] = flags.Beam.Energy * 2 / GeV
54 kwargs.setdefault(
"RandomSeed", flags.Random.SeedOffset)
55 kwargs.setdefault(
"Dsid", flags.Generator.DSID)
64 "StandardModel:sin2thetaW = 0.23113",
65 "StandardModel:sin2thetaWbar = 0.23146",
68 user_cmds = kwargs.pop(
"Commands",
None)
69 kwargs[
"Commands"] = GeneratorSettingsLayer(
70 source=
"base_fragment_commands",
71 values=tuple(base_cmds),
72 precedence=GeneratorSettingsPrecedence.BASE,
73 report_context=
"Pythia8Cfg.Commands",
77 ca = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Generator))
79 CompFactory.Pythia8_i(name, **kwargs)
86 source=
"user_commands",
88 precedence=GeneratorSettingsPrecedence.USER,
93 from GeneratorConfig.GeneratorInfoSvcConfig
import GeneratorInfoSvcCfg
94 ca.merge(GeneratorInfoSvcCfg(flags, Generators=[
"Pythia8"]), sequenceName=EvgenSequence.Generator.value)
101 Fragment for setting up EvtGen on top of Pythia 8
104 auxfiles = [
"inclusiveP8DsDPlus.pdt"]
106 whiteList = [-5334, 5334]
109 from EvtGen_i.EvtGenConfig
import EvtGenCfg
112 whiteList = whiteList,
121 Fragment for setting up A2 MSTW2008LO tune
125 user_cmds = list(kwargs.pop(
"Commands", []))
131 tune_cmds = a2_mstw2008lo_tune_cmds()
137 source=
"pythia_tune_A2_MSTW2008LO",
139 precedence=GeneratorSettingsPrecedence.TUNE,
146 source=
"job_options",
148 precedence=GeneratorSettingsPrecedence.USER,
152 from GeneratorConfig.GeneratorInfoSvcConfig
import GeneratorInfoSvcCfg
153 ca.merge(GeneratorInfoSvcCfg(flags, Tune=
"A2 MSTW2008LO"), sequenceName=EvgenSequence.Generator.value)
161 Fragment for setting up A14 tune with NNPDF23LO PDF
165 user_cmds = list(kwargs.pop(
"Commands", []))
171 tune_cmds = a14_nnpdf23lo_tune_cmds()
177 source=
"pythia_tune_A14_NNPDF23LO",
179 precedence=GeneratorSettingsPrecedence.TUNE,
186 source=
"job_options",
188 precedence=GeneratorSettingsPrecedence.USER,
192 from GeneratorConfig.GeneratorInfoSvcConfig
import GeneratorInfoSvcCfg
193 ca.merge(GeneratorInfoSvcCfg(flags, Tune=
"A14 NNPDF23LO"), sequenceName=EvgenSequence.Generator.value)
201 Config for Py8 tune A2 with MSTW2008LO tune
202 The default version of this includes EvtGen for standardised b fragmentation
203 This tune is generally only used for pile up samples at the start of run 2
204 for high pT physics at the start of run 2 the A14 tune is more appropriate.
205 There are also more recent soft QCD tunes, such as Monash,
206 but A2 was a conservative choice for initial 13 TeV pile up
220 Config for setting up Py8 with A14 tune
235 A function that ensures rapidity ordering is set
238 if any(
"SpaceShower:rapidityOrderMPI" in c
for c
in cmds):
243 if "SpaceShower:rapidityOrder" in c
and "MPI" not in c:
244 val = c.split(
"=", 1)[-1].
strip()
245 cmds.append(f
"SpaceShower:rapidityOrderMPI = {val}")
252 Modular fragment for MadGraph LHE input in Pythia8.
253 The Pythia8_i algorithm is configured through ShowerCfg (defaults to
254 Pythia8BaseCfg) so tune/EvtGen fragments can be injected without
255 instantiating Pythia8_i twice.
261 if flags.Generator.avoidExtracting
264 kwargs.setdefault(
"LHEFile", lhe_file)
267 ca = ShowerCfg(flags, **kwargs)
270 from GeneratorConfig.GeneratorInfoSvcConfig
import GeneratorInfoSvcCfg
271 ca.merge(GeneratorInfoSvcCfg(flags, Generators=[
"MadGraph"]), sequenceName=EvgenSequence.Generator.value)
Pythia8_A2_MSTW2008LO_EvtGen_Common_Cfg(flags, **kwargs)
Pythia8_MadGraph_Cfg(flags, ShowerCfg=Pythia8BaseCfg, **kwargs)
Pythia8_A14_NNPDF23LO_Common_Cfg(flags, **kwargs)
Pythia8_A14_NNPDF23LO_EvtGen_Common_Cfg(flags, **kwargs)
Pythia8BaseCfg(flags, name="Pythia8_i", **kwargs)
Pythia8EvtGenBaseCfg(flags, **kwargs)
Pythia8CommandsCfg(flags, source, commands, precedence, name="Pythia8_i")
Pythia8_A2_MSTW2008LO_Common_Cfg(flags, **kwargs)
ensureRapidityOrderMPI(cmds)