ATLAS Offline Software
Loading...
Searching...
No Matches
PartonHistoryConfig Namespace Reference

Classes

class  PartonHistoryBlock

Functions

str _get_aux_type (str branch)
list _make_particle_branches (str prefix, *, bool include_pdgid=True, tuple stages=None, tuple extra=())
list[str_replace_in_list (list[str] string_list, str old, str new)
list _t_branches (str suffix="t")

Variables

tuple KINEMATIC_VARS = ("pt", "eta", "phi", "m")
 INT_SUFFIXES = frozenset(("pdgId", "IsOnShell", "origin"))
dict BRANCHES
dict _TTBAR = BRANCHES["t"] + BRANCHES["tbar"] + BRANCHES["ttbar"]
dict TRUTH_BRANCHES

Function Documentation

◆ _get_aux_type()

str PartonHistoryConfig._get_aux_type ( str branch)
protected

Definition at line 14 of file PartonHistoryConfig.py.

14def _get_aux_type(branch: str) -> str:
15 return "int" if any(branch.endswith(s) for s in INT_SUFFIXES) else "float"
16
17

◆ _make_particle_branches()

list PartonHistoryConfig._make_particle_branches ( str prefix,
* ,
bool include_pdgid = True,
tuple stages = None,
tuple extra = () )
protected
Generate standard kinematic branch names for a particle.

Parameters
----------
prefix:
    Particle label as it appears in the branch name, e.g. ``"t"`` ->
    ``MC_t_beforeFSR_pt``. When the prefix already encodes the FSR stage
    (e.g. ``"W_beforeFSR_from_t"``), pass ``stages=()``.
include_pdgid:
    Append ``pdgId`` after the kinematic variables for each stage.
stages:
    FSR stage tokens to iterate over. Defaults to
    ``("beforeFSR", "afterFSR")``. Pass ``()`` when the FSR stage is
    already embedded in prefix — branches become ``MC_{prefix}_{var}``.
extra:
    Additional branch suffixes appended verbatim, e.g. ``("IsOnShell",)``.

Definition at line 18 of file PartonHistoryConfig.py.

24) -> list:
25 """Generate standard kinematic branch names for a particle.
26
27 Parameters
28 ----------
29 prefix:
30 Particle label as it appears in the branch name, e.g. ``"t"`` ->
31 ``MC_t_beforeFSR_pt``. When the prefix already encodes the FSR stage
32 (e.g. ``"W_beforeFSR_from_t"``), pass ``stages=()``.
33 include_pdgid:
34 Append ``pdgId`` after the kinematic variables for each stage.
35 stages:
36 FSR stage tokens to iterate over. Defaults to
37 ``("beforeFSR", "afterFSR")``. Pass ``()`` when the FSR stage is
38 already embedded in prefix — branches become ``MC_{prefix}_{var}``.
39 extra:
40 Additional branch suffixes appended verbatim, e.g. ``("IsOnShell",)``.
41 """
42 if stages is None:
43 stages = ("beforeFSR", "afterFSR")
44 result = []
45 if stages:
46 for stage in stages:
47 for var in KINEMATIC_VARS:
48 result.append(f"MC_{prefix}_{stage}_{var}")
49 if include_pdgid:
50 result.append(f"MC_{prefix}_{stage}_pdgId")
51 else:
52 for var in KINEMATIC_VARS:
53 result.append(f"MC_{prefix}_{var}")
54 if include_pdgid:
55 result.append(f"MC_{prefix}_pdgId")
56 for suffix in extra:
57 result.append(f"MC_{prefix}_{suffix}")
58 return result
59
60

◆ _replace_in_list()

list[str] PartonHistoryConfig._replace_in_list ( list[str] string_list,
str old,
str new )
protected

Definition at line 61 of file PartonHistoryConfig.py.

61def _replace_in_list(string_list: list[str], old: str, new: str) -> list[str]:
62 return [item.replace(old, new) for item in string_list]
63
64
65# ---------------------------------------------------------------------------
66# Per-particle branch lists
67# ---------------------------------------------------------------------------
68
69

◆ _t_branches()

list PartonHistoryConfig._t_branches ( str suffix = "t")
protected
Branches for a top quark and its full decay chain.

Sub-particles carry the FSR stage in their prefix so we pass ``stages=()``
to avoid appending a spurious stage token to the variable name.
For tbar, the b-quark is named 'bbar'.

Definition at line 70 of file PartonHistoryConfig.py.

70def _t_branches(suffix: str = "t") -> list:
71 """Branches for a top quark and its full decay chain.
72
73 Sub-particles carry the FSR stage in their prefix so we pass ``stages=()``
74 to avoid appending a spurious stage token to the variable name.
75 For tbar, the b-quark is named 'bbar'.
76 """
77 b_name = "bbar" if suffix == "tbar" else "b"
78 sub_particles = ("W", b_name, "Wdecay1", "Wdecay2")
79 result = _make_particle_branches(suffix)
80 for particle in sub_particles:
81 for stage in ("beforeFSR", "afterFSR"):
82 result += _make_particle_branches(
83 f"{particle}_{stage}_from_{suffix}", stages=()
84 )
85 return result
86
87

Variable Documentation

◆ _TTBAR

dict PartonHistoryConfig._TTBAR = BRANCHES["t"] + BRANCHES["tbar"] + BRANCHES["ttbar"]
protected

Definition at line 139 of file PartonHistoryConfig.py.

◆ BRANCHES

dict PartonHistoryConfig.BRANCHES

Definition at line 88 of file PartonHistoryConfig.py.

◆ INT_SUFFIXES

PartonHistoryConfig.INT_SUFFIXES = frozenset(("pdgId", "IsOnShell", "origin"))

Definition at line 11 of file PartonHistoryConfig.py.

◆ KINEMATIC_VARS

tuple PartonHistoryConfig.KINEMATIC_VARS = ("pt", "eta", "phi", "m")

Definition at line 10 of file PartonHistoryConfig.py.

◆ TRUTH_BRANCHES

dict PartonHistoryConfig.TRUTH_BRANCHES
Initial value:
1= {
2 "Ttbar": _TTBAR,
3 "Ttbarbbbar": _TTBAR + BRANCHES["b"] + BRANCHES["bbar"],
4 "Ttbarccbar": _TTBAR + BRANCHES["c"] + BRANCHES["cbar"],
5 "Ttz": _TTBAR + BRANCHES["Z"],
6 "Ttw": _TTBAR + BRANCHES["W"],
7 "Tth": _TTBAR + BRANCHES["Higgs"],
8 "Ttgamma": _TTBAR + BRANCHES["Photon"],
9 "Tzq": BRANCHES["t"] + BRANCHES["Z"] + BRANCHES["b"],
10 "Thq": BRANCHES["t"] + BRANCHES["Higgs"] + BRANCHES["b"] + BRANCHES["W"],
11 "Tqgamma": BRANCHES["t"] + BRANCHES["Photon"] + BRANCHES["b"],
12 "Wtb": BRANCHES["t"] + BRANCHES["W"] + BRANCHES["b"],
13 "FourTop": (
14 _replace_in_list(BRANCHES["t"], "t_", "t1_")
15 + _replace_in_list(BRANCHES["t"], "t_", "t2_")
16 + _replace_in_list(BRANCHES["tbar"], "tbar_", "tbar1_")
17 + _replace_in_list(BRANCHES["tbar"], "tbar_", "tbar2_")
18 ),
19 "HWW": BRANCHES["Higgs"],
20 "WW_nonresonant": (
21 _replace_in_list(BRANCHES["W"], "W", "W1")
22 + _replace_in_list(BRANCHES["W"], "W", "W2")
23 ),
24 "HWW_nonresonant": BRANCHES["Higgs"],
25 "HZZ": BRANCHES["Higgs"],
26 "Zb": BRANCHES["Z"] + BRANCHES["b"] + BRANCHES["bbar"],
27 "Ztautau": BRANCHES["Z_extended"],
28}

Definition at line 141 of file PartonHistoryConfig.py.