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

Functions

 Pythia8BaseCfg (flags, name="Pythia8_i", **kwargs)
 Pythia8EvtGenBaseCfg (flags, **kwargs)
 Pythia8_A2_MSTW2008LO_Common_Cfg (flags, **kwargs)
 Pythia8_A2_MSTW2008LO_EvtGen_Common_Cfg (flags, **kwargs)
 ensureRapidityOrderMPI (cmds)

Variables

 log = logging.getLogger("Pythia8Config")

Function Documentation

◆ ensureRapidityOrderMPI()

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

Definition at line 163 of file Pythia8Config.py.

163def ensureRapidityOrderMPI(cmds):
164 """
165 A function that ensures rapidity ordering is set
166 """
167 # if MPI‐ordering already explicitly set, do nothing
168 if any("SpaceShower:rapidityOrderMPI" in c for c in cmds):
169 return cmds
170
171 # find the first rapidityOrder value
172 for c in cmds:
173 if "SpaceShower:rapidityOrder" in c and "MPI" not in c:
174 val = c.split("=", 1)[-1].strip()
175 cmds.append(f"SpaceShower:rapidityOrderMPI = {val}")
176 break
177 return cmds

◆ Pythia8_A2_MSTW2008LO_Common_Cfg()

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

Definition at line 108 of file Pythia8Config.py.

108def Pythia8_A2_MSTW2008LO_Common_Cfg(flags, **kwargs):
109 """
110 Fragment for setting up A2 MSTW2008LO tune
111 """
112 # Defaults
113 cmds = kwargs.get("Commands", [])
114
115 # Tune parameters
116 cmds.extend([
117 "Tune:pp = 5",
118 "MultipartonInteractions:bProfile = 4",
119 "MultipartonInteractions:a1 = 0.03",
120 "MultipartonInteractions:pT0Ref = 1.90",
121 "MultipartonInteractions:ecmPow = 0.30",
122 "SpaceShower:rapidityOrder = 0",
123 "PDF:pSet = LHAPDF6:MSTW2008lo68cl",
124 "ColourReconnection:range = 2.28"
125 ])
126
127 # Now call rapidity ordering
128 cmds = ensureRapidityOrderMPI(cmds)
129
130 # Update kwargs
131 kwargs["Commands"] = list(dict.fromkeys(cmds))
132
133 # Now get the base config
134 ca = Pythia8BaseCfg(flags, **kwargs)
135
136 # Broadcast tune to service
137 from GeneratorConfig.GeneratorInfoSvcConfig import GeneratorInfoSvcCfg
138 ca.merge(GeneratorInfoSvcCfg(flags, Tune="A2 MSTW2008LO"), sequenceName=EvgenSequence.Generator.value)
139
140 # Call the base config
141 return ca
142
143

◆ 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 144 of file Pythia8Config.py.

144def Pythia8_A2_MSTW2008LO_EvtGen_Common_Cfg(flags, **kwargs):
145 """
146 Config for Py8 tune A2 with MSTW2008LO tune
147 The default version of this includes EvtGen for standardised b fragmentation
148 This tune is generally only used for pile up samples at the start of run 2
149 for high pT physics at the start of run 2 the A14 tune is more appropriate.
150 There are also more recent soft QCD tunes, such as Monash,
151 but A2 was a conservative choice for initial 13 TeV pile up
152 """
153
154 # Add Pythia 8 to CA with correct tune settings
155 ca = Pythia8_A2_MSTW2008LO_Common_Cfg(flags, **kwargs)
156
157 # Add EvtGen
158 ca.merge(Pythia8EvtGenBaseCfg(flags, **kwargs))
159
160 return ca
161
162

◆ 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 13 of file Pythia8Config.py.

13def Pythia8BaseCfg(flags, name="Pythia8_i", **kwargs):
14 """
15 The main Pythia8 configuration fragment that sets up the Pythia8_i algorithm
16 and returns a CA instance
17 """
18 # Default commands
19 commands = kwargs.get("Commands", [])
20
21 # Baseline P8 settings
22 base_cmds = [
23 "Main:timesAllowErrors = 500",
24 "ParticleDecays:limitTau0 = on",
25 "ParticleDecays:tau0Max = 10.0"
26 ]
27 commands.extend(base_cmds)
28
29 # Collision energy
30 if "CollisionEnergy" not in kwargs:
31 kwargs["CollisionEnergy"] = flags.Beam.Energy * 2 / GeV
32
33 # Extended settings
34 if flags.Generator.PDGparams:
35
36 from EvgenProdTools.offline_dict import parameters
37
38
39 particle_params = parameters.get("particles")
40 if particle_params:
41 for pdg_str, vals in particle_params.items():
42
43 pdg = int(pdg_str)
44 if 6 <= pdg < 26:
45 commands.append(f"{pdg}:m0 = {vals['mass']}")
46 commands.append(f"{pdg}:mWidth = {vals['width']}")
47 else:
48 log.warning("Could not retrieve standard ATLAS particle parameters")
49
50
51 ew_params = parameters.get("EW_parameters")
52 if ew_params:
53
54 for key, val in ew_params.items():
55 if key[1] in ('sin2thetaW', 'sin2thetaWbar'):
56 commands.append(f"StandardModel:{key[1]} = {val}")
57 else:
58 log.warning("Could not retrieve standard ATLAS EW parameters")
59 else:
60
61 commands.extend([
62 "6:m0 = 172.5",
63 "23:m0 = 91.1876",
64 "23:mWidth = 2.4952",
65 "24:m0 = 80.399",
66 "24:mWidth = 2.085",
67 "StandardModel:sin2thetaW = 0.23113",
68 "StandardModel:sin2thetaWbar = 0.23146",
69 ])
70
71 # Remove duplicate commands and update kwargs
72 commands = list(dict.fromkeys(commands))
73 kwargs["Commands"] = commands
74
75 # Create CA object
76 ca = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Generator))
77 ca.addEventAlgo(
78 CompFactory.Pythia8_i("Pythia8_i", **kwargs)
79 )
80
81 # Announce generator to service
82 from GeneratorConfig.GeneratorInfoSvcConfig import GeneratorInfoSvcCfg
83 ca.merge(GeneratorInfoSvcCfg(flags, Generators=["Pythia8"]), sequenceName=EvgenSequence.Generator.value)
84
85 return ca
86
87

◆ Pythia8EvtGenBaseCfg()

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

Definition at line 88 of file Pythia8Config.py.

88def Pythia8EvtGenBaseCfg(flags, **kwargs):
89 """
90 Fragment for setting up EvtGen on top of Pythia 8
91 """
92 # Custom settings
93 auxfiles = ["inclusiveP8DsDPlus.pdt"]
94 # FHerwig has problems with omega b* (5334), so not present in the base EvtGen fragment.
95 whiteList = [-5334, 5334]
96
97 # Add custom EvtGenCfg
98 from EvtGen_i.EvtGenConfig import EvtGenCfg
99 ca = EvtGenCfg(
100 flags,
101 whiteList = whiteList,
102 auxfiles = auxfiles
103 )
104
105 return ca
106
107

Variable Documentation

◆ log

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

Definition at line 10 of file Pythia8Config.py.