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)

Variables

 log = logging.getLogger("Pythia8Config")

Function Documentation

◆ ensureRapidityOrderMPI()

python.Pythia8Config.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()

python.Pythia8Config.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()

python.Pythia8Config.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()

python.Pythia8Config.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()

python.Pythia8Config.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()

python.Pythia8Config.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

◆ Pythia8BaseCfg()

python.Pythia8Config.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()

python.Pythia8Config.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()

python.Pythia8Config.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.