14def synthetic_event(pruned=()):
15 """A primary M with a per-step split kaon K, a split-once kaon K2 and a sibling.
16
17 K (set 0, weight 1) is split at t = 2..6 with decay probabilities P, two
18 clones per step. Geant4 decays it at t = 4 on a split step, so it is
19 continued by C, which ends by interacting at t = 7. Secondaries are created
20 along the line with the line's weight at that time. K2 (set 1) decays at
21 t = 3 into four clones of weight 1/4. Clones are pushed with K's mother.
22 """
23 P = {2.0: 0.2, 3.0: 0.25, 4.0: 0.3, 5.0: 0.15, 6.0: 0.4}
24 line = {1.0: 1.0}
25 w = 1.0
26 clones = []
27 for t, p in P.items():
28 clones += [(t, w * p / 2)] * 2
29 w *= 1 - p
30 line[t] = w
31 rows: dict[str, tuple] = {}
32 rows["M"] = (None, -1, NOT_SPLIT, 0.0, 0.0, 1.0, 0)
33 rows["s"] = ("M", -1, NOT_SPLIT, 0.0, 1.0, 1.0, G4)
34 rows["K"] = ("M", 0, SURVIVOR, 1.0, 1.0, line[4.0], G4)
35 rows["C"] = ("M", 0, SURVIVOR, 1.0, 4.0, line[6.0], K_NO_PROCESS)
36 for k, (t, wc) in enumerate(clones):
37 rows[f"c{k}"] = ("M", 0, DECAY, 1.0, t, wc, K_NO_PROCESS)
38 rows["y1"] = ("K", -1, NOT_SPLIT, 0.0, 2.5, line[2.0], G4)
39 rows["y2"] = ("C", -1, NOT_SPLIT, 0.0, 5.5, line[5.0], G4)
40 rows["z"] = ("C", -1, NOT_SPLIT, 0.0, 7.0, line[6.0], G4)
41 rows["mu_a"] = ("c2", -1, NOT_SPLIT, 0.0, 3.0, clones[2][1], G4)
42 rows["mu_b"] = ("c6", -1, NOT_SPLIT, 0.0, 5.0, clones[6][1], G4)
43 rows["K2"] = ("M", 1, SURVIVOR, 1.0, 1.0, 1.0, G4)
44 for k in range(4):
45 rows[f"d{k}"] = ("M", 1, DECAY, 1.0, 3.0, 0.25, K_NO_PROCESS)
46 rows["mu_c"] = ("d0", -1, NOT_SPLIT, 0.0, 3.0, 0.25, G4)
47 names = [n for n in rows if n not in pruned]
48 index = {n: i for i, n in enumerate(names)}
49 cols = [[] for _ in range(7)]
50 for n in names:
51 mother, *rest = rows[n]
52 cols[0].append(index[mother] if mother is not None else -1)
53 for c, v in zip(cols[1:], rest):
54 c.append(v)
55 return SplitProvenance(*cols), index, line
56
57