ATLAS Offline Software
Loading...
Searching...
No Matches
python.Pythia8Config Namespace Reference

Functions

 Pythia8CommandsCfg (flags, source, commands, precedence, name="Pythia8_i")
 Pythia8BaseCfg (flags, name="Pythia8_i", **kwargs)
 Pythia8EvtGenBaseCfg (flags, **kwargs)
 Pythia8_A2_MSTW2008LO_Common_Cfg (flags, **kwargs)
 Pythia8_A14_NNPDF23LO_Common_Cfg (flags, **kwargs)
 Pythia8_A2_MSTW2008LO_EvtGen_Common_Cfg (flags, **kwargs)
 Pythia8_A14_NNPDF23LO_EvtGen_Common_Cfg (flags, **kwargs)
 ensureRapidityOrderMPI (cmds)
 Pythia8_MadGraph_Cfg (flags, ShowerCfg=Pythia8BaseCfg, **kwargs)
 Pythia8_Powheg_Cfg (flags, *, ShowerCfg, **kwargs)
 Pythia8_Powheg_Main31_Cfg (flags, ShowerCfg=Pythia8BaseCfg, NFinal=None, name="Pythia8_i", enable_shower_weights=True, include_pdf_variations=False, **kwargs)

Variables

 log = logging.getLogger("Pythia8Config")

Function Documentation

◆ ensureRapidityOrderMPI()

ensureRapidityOrderMPI ( cmds)
A function that ensures rapidity ordering is set

Definition at line 233 of file Pythia8Config.py.

233def ensureRapidityOrderMPI(cmds):
234 """
235 A function that ensures rapidity ordering is set
236 """
237 # if MPI‐ordering already explicitly set, do nothing
238 if any("SpaceShower:rapidityOrderMPI" in c for c in cmds):
239 return cmds
240
241 # find the first rapidityOrder value
242 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}")
246 break
247 return cmds
248
249

◆ Pythia8_A14_NNPDF23LO_Common_Cfg()

Pythia8_A14_NNPDF23LO_Common_Cfg ( flags,
** kwargs )
Fragment for setting up A14 tune with NNPDF23LO PDF

Definition at line 159 of file Pythia8Config.py.

159def Pythia8_A14_NNPDF23LO_Common_Cfg(flags, **kwargs):
160 """
161 Fragment for setting up A14 tune with NNPDF23LO PDF
162 """
163
164 # Remove any user command before calling base config
165 user_cmds = list(kwargs.pop("Commands", []))
166
167 # Get the base config
168 ca = Pythia8BaseCfg(flags, **kwargs)
169
170 # Get the tune commands and apply rapidity ordering
171 tune_cmds = a14_nnpdf23lo_tune_cmds()
172 tune_cmds = ensureRapidityOrderMPI(tune_cmds)
173
174 # Add the tune commands
175 ca.merge(Pythia8CommandsCfg(
176 flags,
177 source="pythia_tune_A14_NNPDF23LO",
178 commands=tune_cmds,
179 precedence=GeneratorSettingsPrecedence.TUNE,
180 ))
181
182 # Now apply the user commands
183 if user_cmds:
184 ca.merge(Pythia8CommandsCfg(
185 flags,
186 source="job_options",
187 commands=user_cmds,
188 precedence=GeneratorSettingsPrecedence.USER,
189 ))
190
191 # Broadcast tune to service
192 from GeneratorConfig.GeneratorInfoSvcConfig import GeneratorInfoSvcCfg
193 ca.merge(GeneratorInfoSvcCfg(flags, Tune="A14 NNPDF23LO"), sequenceName=EvgenSequence.Generator.value)
194
195 # Call the base config
196 return ca
197
198

◆ Pythia8_A14_NNPDF23LO_EvtGen_Common_Cfg()

Pythia8_A14_NNPDF23LO_EvtGen_Common_Cfg ( flags,
** kwargs )
Config for setting up Py8 with A14 tune 
with EvtGen

Definition at line 218 of file Pythia8Config.py.

218def Pythia8_A14_NNPDF23LO_EvtGen_Common_Cfg(flags, **kwargs):
219 """
220 Config for setting up Py8 with A14 tune
221 with EvtGen
222 """
223
224 # Add Pythia 8 to CA with correct tune settings
225 ca = Pythia8_A14_NNPDF23LO_Common_Cfg(flags, **kwargs)
226
227 # Add EvtGen
228 ca.merge(Pythia8EvtGenBaseCfg(flags, **kwargs))
229
230 return ca
231
232

◆ Pythia8_A2_MSTW2008LO_Common_Cfg()

Pythia8_A2_MSTW2008LO_Common_Cfg ( flags,
** kwargs )
Fragment for setting up A2 MSTW2008LO tune

Definition at line 119 of file Pythia8Config.py.

119def Pythia8_A2_MSTW2008LO_Common_Cfg(flags, **kwargs):
120 """
121 Fragment for setting up A2 MSTW2008LO tune
122 """
123
124 # Remove any user command before calling base config
125 user_cmds = list(kwargs.pop("Commands", []))
126
127 # Get the base config
128 ca = Pythia8BaseCfg(flags, **kwargs)
129
130 # Get the tune commands and apply rapidity ordering
131 tune_cmds = a2_mstw2008lo_tune_cmds()
132 tune_cmds = ensureRapidityOrderMPI(tune_cmds)
133
134 # Add the tune commands
135 ca.merge(Pythia8CommandsCfg(
136 flags,
137 source="pythia_tune_A2_MSTW2008LO",
138 commands=tune_cmds,
139 precedence=GeneratorSettingsPrecedence.TUNE,
140 ))
141
142 # Now apply the user commands
143 if user_cmds:
144 ca.merge(Pythia8CommandsCfg(
145 flags,
146 source="job_options",
147 commands=user_cmds,
148 precedence=GeneratorSettingsPrecedence.USER,
149 ))
150
151 # Broadcast tune to service
152 from GeneratorConfig.GeneratorInfoSvcConfig import GeneratorInfoSvcCfg
153 ca.merge(GeneratorInfoSvcCfg(flags, Tune="A2 MSTW2008LO"), sequenceName=EvgenSequence.Generator.value)
154
155 # Call the base config
156 return ca
157
158

◆ Pythia8_A2_MSTW2008LO_EvtGen_Common_Cfg()

Pythia8_A2_MSTW2008LO_EvtGen_Common_Cfg ( flags,
** kwargs )
Config for Py8 tune A2 with MSTW2008LO tune
The default version of this includes EvtGen for standardised b fragmentation
This tune is generally only used for pile up samples at the start of run 2 
for high pT physics at the start of run 2 the A14 tune is more appropriate.  
There are also more recent soft QCD tunes, such as Monash, 
but A2 was a conservative choice for initial 13 TeV pile up

Definition at line 199 of file Pythia8Config.py.

199def Pythia8_A2_MSTW2008LO_EvtGen_Common_Cfg(flags, **kwargs):
200 """
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
207 """
208
209 # Add Pythia 8 to CA with correct tune settings
210 ca = Pythia8_A2_MSTW2008LO_Common_Cfg(flags, **kwargs)
211
212 # Add EvtGen
213 ca.merge(Pythia8EvtGenBaseCfg(flags, **kwargs))
214
215 return ca
216
217

◆ Pythia8_MadGraph_Cfg()

Pythia8_MadGraph_Cfg ( flags,
ShowerCfg = Pythia8BaseCfg,
** kwargs )
Modular fragment for MadGraph LHE input in Pythia8.
The Pythia8_i algorithm is configured through ShowerCfg (defaults to
Pythia8BaseCfg) so tune/EvtGen fragments can be injected without
instantiating Pythia8_i twice.

Definition at line 250 of file Pythia8Config.py.

250def Pythia8_MadGraph_Cfg(flags, ShowerCfg=Pythia8BaseCfg, **kwargs):
251 """
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.
256 """
257 # Match Pythia8's input name to the file prepared by EvgenHelpers.
258 # This can still be overridden by setting in the config LHEFile="myfile.lhe[.gz]".
259 lhe_file = (
260 "events.lhe.gz"
261 if flags.Generator.avoidExtracting
262 else "events.lhe"
263 )
264 kwargs.setdefault("LHEFile", lhe_file)
265
266 # Configure Pythia8 through the selected shower fragment.
267 ca = ShowerCfg(flags, **kwargs)
268
269 # Announce MadGraph to service
270 from GeneratorConfig.GeneratorInfoSvcConfig import GeneratorInfoSvcCfg
271 ca.merge(GeneratorInfoSvcCfg(flags, Generators=["MadGraph"]), sequenceName=EvgenSequence.Generator.value)
272
273 return ca
274
275

◆ Pythia8_Powheg_Cfg()

Pythia8_Powheg_Cfg ( flags,
* ,
ShowerCfg,
** kwargs )
Configure Pythia8 to shower POWHEG-BOX LHE input without veto matching.
CA translation of share/common/Pythia8_Powheg.py (+ Pythia8_LHEF.py).
The Pythia8_i algorithm is configured through ShowerCfg so tune/EvtGen
fragments can be injected without instantiating Pythia8_i twice.

Definition at line 276 of file Pythia8Config.py.

276def Pythia8_Powheg_Cfg(flags, *, ShowerCfg, **kwargs):
277 """
278 Configure Pythia8 to shower POWHEG-BOX LHE input without veto matching.
279 CA translation of share/common/Pythia8_Powheg.py (+ Pythia8_LHEF.py).
280 The Pythia8_i algorithm is configured through ShowerCfg so tune/EvtGen
281 fragments can be injected without instantiating Pythia8_i twice.
282 """
283 lhe_file = (
284 "events.lhe.gz"
285 if flags.Generator.avoidExtracting
286 else "events.lhe"
287 )
288 kwargs.setdefault("LHEFile", lhe_file)
289
290 ca = ShowerCfg(flags, **kwargs)
291
292 from GeneratorConfig.GeneratorInfoSvcConfig import GeneratorInfoSvcCfg
293
294 ca.merge(GeneratorInfoSvcCfg(flags, Generators=["Powheg"]), sequenceName=EvgenSequence.Generator.value)
295
296 return ca
297
298

◆ Pythia8_Powheg_Main31_Cfg()

Pythia8_Powheg_Main31_Cfg ( flags,
ShowerCfg = Pythia8BaseCfg,
NFinal = None,
name = "Pythia8_i",
enable_shower_weights = True,
include_pdf_variations = False,
** kwargs )
Configure POWHEG LHE showering with the PowhegMain31 veto hook.
CA translation of share/common/Pythia8_Powheg_Main31.py.
NFinal is the number of outgoing particles in the Born-level POWHEG
process, excluding additional POWHEG radiation.

By default this fragment also enables the legacy Pythia8 shower
uncertainty weights. Set enable_shower_weights=False to disable, or
include_pdf_variations=True to add the PDF-variation weights.

Definition at line 299 of file Pythia8Config.py.

307):
308 """
309 Configure POWHEG LHE showering with the PowhegMain31 veto hook.
310 CA translation of share/common/Pythia8_Powheg_Main31.py.
311 NFinal is the number of outgoing particles in the Born-level POWHEG
312 process, excluding additional POWHEG radiation.
313
314 By default this fragment also enables the legacy Pythia8 shower
315 uncertainty weights. Set enable_shower_weights=False to disable, or
316 include_pdf_variations=True to add the PDF-variation weights.
317 """
318 if NFinal is None:
319 raise ValueError("Pythia8_Powheg_Main31_Cfg: NFinal is process-specific "
320 "and must be set explicitly (Born final-state multiplicity)")
321
322 # Delay user commands until after the matching layer so that USER
323 # precedence can override matching settings when explicitly requested.
324 user_commands = kwargs.pop("Commands", None)
325
326 user_hooks = list(kwargs.pop("UserHooks", ()) or ())
327 if "PowhegMain31" not in user_hooks:
328 user_hooks.append("PowhegMain31")
329
330 ca = Pythia8_Powheg_Cfg(flags, ShowerCfg=ShowerCfg, name=name, UserHooks=user_hooks, **kwargs)
331
332 ca.merge(Pythia8CommandsCfg(
333 flags,
334 source="powheg_main31_matching",
335 commands=[
336 "SpaceShower:pTmaxMatch = 2",
337 "TimeShower:pTmaxMatch = 2",
338 "Powheg:veto = 1",
339 f"Powheg:NFinal = {NFinal}",
340 ],
341 precedence=GeneratorSettingsPrecedence.MATCHING,
342 name=name,
343 ))
344
345 if enable_shower_weights:
346 from Pythia8_i.Pythia8ShowerWeights import Pythia8ShowerWeightsCfg
347 ca.merge(Pythia8ShowerWeightsCfg(
348 flags,
349 name=name,
350 include_pdf_variations=include_pdf_variations,
351 ))
352
353 if user_commands:
354 ca.merge(Pythia8CommandsCfg(
355 flags,
356 source="job_options",
357 commands=user_commands,
358 precedence=GeneratorSettingsPrecedence.USER,
359 name=name,
360 ))
361
362 return ca

◆ Pythia8BaseCfg()

Pythia8BaseCfg ( flags,
name = "Pythia8_i",
** kwargs )
The main Pythia8 configuration fragment that sets up the Pythia8_i algorithm
and returns a CA instance

Definition at line 37 of file Pythia8Config.py.

37def Pythia8BaseCfg(flags, name="Pythia8_i", **kwargs):
38 """
39 The main Pythia8 configuration fragment that sets up the Pythia8_i algorithm
40 and returns a CA instance
41 """
42 # Baseline P8 settings
43 base_cmds = [
44 "Main:timesAllowErrors = 500",
45 "ParticleDecays:limitTau0 = on",
46 "ParticleDecays:tau0Max = 10.0"
47 ]
48
49 # Collision energy
50 if "CollisionEnergy" not in kwargs:
51 kwargs["CollisionEnergy"] = flags.Beam.Energy * 2 / GeV
52
53 # Random Seed and DSID
54 kwargs.setdefault("RandomSeed", flags.Random.SeedOffset)
55 kwargs.setdefault("Dsid", flags.Generator.DSID)
56
57 # Load basic parameters
58 base_cmds.extend([
59 "6:m0 = 172.5",
60 "23:m0 = 91.1876",
61 "23:mWidth = 2.4952",
62 "24:m0 = 80.399",
63 "24:mWidth = 2.085",
64 "StandardModel:sin2thetaW = 0.23113",
65 "StandardModel:sin2thetaWbar = 0.23146",
66 ])
67
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",
74 )
75
76 # Create CA object
77 ca = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Generator))
78 ca.addEventAlgo(
79 CompFactory.Pythia8_i(name, **kwargs)
80 )
81
82 # Add the user commands
83 if user_cmds:
84 ca.merge(Pythia8CommandsCfg(
85 flags,
86 source="user_commands",
87 commands=user_cmds,
88 precedence=GeneratorSettingsPrecedence.USER,
89 name=name,
90 ))
91
92 # Announce generator to service
93 from GeneratorConfig.GeneratorInfoSvcConfig import GeneratorInfoSvcCfg
94 ca.merge(GeneratorInfoSvcCfg(flags, Generators=["Pythia8"]), sequenceName=EvgenSequence.Generator.value)
95
96 return ca
97
98

◆ Pythia8CommandsCfg()

Pythia8CommandsCfg ( flags,
source,
commands,
precedence,
name = "Pythia8_i" )
Return a CA fragment that adds one command layer to Pythia8_i.

Definition at line 21 of file Pythia8Config.py.

21def Pythia8CommandsCfg(flags, source, commands, precedence, name="Pythia8_i"):
22 """
23 Return a CA fragment that adds one command layer to Pythia8_i.
24 """
25 ca = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Generator))
26 ca.addEventAlgo(
27 CompFactory.Pythia8_i(name, Commands=GeneratorSettingsLayer(
28 source=source,
29 values=tuple(commands or ()),
30 precedence=precedence,
31 report_context="Pythia8Cfg.Commands",
32 ))
33 )
34 return ca
35
36

◆ Pythia8EvtGenBaseCfg()

Pythia8EvtGenBaseCfg ( flags,
** kwargs )
Fragment for setting up EvtGen on top of Pythia 8

Definition at line 99 of file Pythia8Config.py.

99def Pythia8EvtGenBaseCfg(flags, **kwargs):
100 """
101 Fragment for setting up EvtGen on top of Pythia 8
102 """
103 # Custom settings
104 auxfiles = ["inclusiveP8DsDPlus.pdt"]
105 # FHerwig has problems with omega b* (5334), so not present in the base EvtGen fragment.
106 whiteList = [-5334, 5334]
107
108 # Add custom EvtGenCfg
109 from EvtGen_i.EvtGenConfig import EvtGenCfg
110 ca = EvtGenCfg(
111 flags,
112 whiteList = whiteList,
113 auxfiles = auxfiles
114 )
115
116 return ca
117
118

Variable Documentation

◆ log

python.Pythia8Config.log = logging.getLogger("Pythia8Config")

Definition at line 18 of file Pythia8Config.py.