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
19 commands = kwargs.get("Commands", [])
20
21
22 base_cmds = [
23 "Main:timesAllowErrors = 500",
24 "ParticleDecays:limitTau0 = on",
25 "ParticleDecays:tau0Max = 10.0"
26 ]
27 commands.extend(base_cmds)
28
29
30 if "CollisionEnergy" not in kwargs:
31 kwargs["CollisionEnergy"] = flags.Beam.Energy * 2 / GeV
32
33
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
72 commands = list(dict.fromkeys(commands))
73 kwargs["Commands"] = commands
74
75
76 ca = ComponentAccumulator(EvgenSequenceFactory(EvgenSequence.Generator))
77 ca.addEventAlgo(
78 CompFactory.Pythia8_i("Pythia8_i", **kwargs)
79 )
80
81 return ca
82
83