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
60 "StandardModel:sin2thetaW = 0.23113",
61 "StandardModel:sin2thetaWbar = 0.23146",
64 user_cmds = kwargs.pop(
"Commands",
None)
65 kwargs[
"Commands"] = GeneratorSettingsLayer(
66 source=
"base_fragment_commands",
67 values=tuple(base_cmds),
68 precedence=GeneratorSettingsPrecedence.BASE,
69 report_context=
"Pythia8Cfg.Commands",
73 ca = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Generator))
75 CompFactory.Pythia8_i(name, **kwargs)
82 source=
"user_commands",
84 precedence=GeneratorSettingsPrecedence.USER,
89 from GeneratorConfig.GeneratorInfoSvcConfig
import GeneratorInfoSvcCfg
90 ca.merge(GeneratorInfoSvcCfg(flags, Generators=[
"Pythia8"]), sequenceName=EvgenSequence.Generator.value)
97 Fragment for setting up EvtGen on top of Pythia 8
100 auxfiles = [
"inclusiveP8DsDPlus.pdt"]
102 whiteList = [-5334, 5334]
105 from EvtGen_i.EvtGenConfig
import EvtGenCfg
108 whiteList = whiteList,
117 Fragment for setting up A2 MSTW2008LO tune
121 user_cmds = list(kwargs.pop(
"Commands", []))
127 tune_cmds = a2_mstw2008lo_tune_cmds()
133 source=
"pythia_tune_A2_MSTW2008LO",
135 precedence=GeneratorSettingsPrecedence.TUNE,
142 source=
"job_options",
144 precedence=GeneratorSettingsPrecedence.USER,
148 from GeneratorConfig.GeneratorInfoSvcConfig
import GeneratorInfoSvcCfg
149 ca.merge(GeneratorInfoSvcCfg(flags, Tune=
"A2 MSTW2008LO"), sequenceName=EvgenSequence.Generator.value)
157 Fragment for setting up A14 tune with NNPDF23LO PDF
161 user_cmds = list(kwargs.pop(
"Commands", []))
167 tune_cmds = a14_nnpdf23lo_tune_cmds()
173 source=
"pythia_tune_A14_NNPDF23LO",
175 precedence=GeneratorSettingsPrecedence.TUNE,
182 source=
"job_options",
184 precedence=GeneratorSettingsPrecedence.USER,
188 from GeneratorConfig.GeneratorInfoSvcConfig
import GeneratorInfoSvcCfg
189 ca.merge(GeneratorInfoSvcCfg(flags, Tune=
"A14 NNPDF23LO"), sequenceName=EvgenSequence.Generator.value)
197 Config for Py8 tune A2 with MSTW2008LO tune
198 The default version of this includes EvtGen for standardised b fragmentation
199 This tune is generally only used for pile up samples at the start of run 2
200 for high pT physics at the start of run 2 the A14 tune is more appropriate.
201 There are also more recent soft QCD tunes, such as Monash,
202 but A2 was a conservative choice for initial 13 TeV pile up
216 Config for setting up Py8 with A14 tune
231 A function that ensures rapidity ordering is set
234 if any(
"SpaceShower:rapidityOrderMPI" in c
for c
in cmds):
239 if "SpaceShower:rapidityOrder" in c
and "MPI" not in c:
240 val = c.split(
"=", 1)[-1].
strip()
241 cmds.append(f
"SpaceShower:rapidityOrderMPI = {val}")
248 Modular fragment for MadGraph LHE input in Pythia8.
249 The Pythia8_i algorithm is configured through ShowerCfg (defaults to
250 Pythia8BaseCfg) so tune/EvtGen fragments can be injected without
251 instantiating Pythia8_i twice.
254 kwargs.setdefault(
"LHEFile",
"events.lhe")
257 ca = ShowerCfg(flags, **kwargs)
260 from GeneratorConfig.GeneratorInfoSvcConfig
import GeneratorInfoSvcCfg
261 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)