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

Classes

class  PartonHistoryBlock

Functions

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

Variables

tuple KINEMATIC_VARS = ("pt", "eta", "phi", "m")
 INT_SUFFIXES = frozenset(("pdgId", "IsOnShell", "origin"))
tuple VECTOR_PREFIXES = ("MC_b_", "MC_bbar_", "MC_c_", "MC_cbar_")
 VECTOR_HISTORIES = frozenset(("Ttbarbbbar", "Ttbarccbar"))
dict BRANCHES
dict _TTBAR = BRANCHES["t"] + BRANCHES["tbar"] + BRANCHES["ttbar"]
dict TRUTH_BRANCHES

Function Documentation

◆ _get_aux_type()

str _get_aux_type ( str branch,
str prefix )
protected

Definition at line 17 of file PartonHistoryConfig.py.

17def _get_aux_type(branch: str, prefix: str) -> str:
18 # Handle specific cases where vectors are returned for each particle type
19 # In those cases, only external particles can be vectors, there is still
20 # a single particle allowed in named positions within decay chains
21 is_vector = prefix in VECTOR_HISTORIES and branch.startswith(VECTOR_PREFIXES) and "_from_" not in branch
22
23 if is_vector:
24 return "vector_int" if any(branch.endswith(s) for s in INT_SUFFIXES) else "vector_float"
25 else:
26 return "int" if any(branch.endswith(s) for s in INT_SUFFIXES) else "float"
27

◆ _make_particle_branches()

list _make_particle_branches ( str prefix,
* ,
bool include_pdgid = True,
Optional[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 28 of file PartonHistoryConfig.py.

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

◆ _replace_in_list()

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

Definition at line 71 of file PartonHistoryConfig.py.

71def _replace_in_list(string_list: list[str], old: str, new: str) -> list[str]:
72 return [item.replace(old, new) for item in string_list]
73
74
75# ---------------------------------------------------------------------------
76# Per-particle branch lists
77# ---------------------------------------------------------------------------
78
79

◆ _t_branches()

list _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 antitops (suffix starting with 'tbar'), the b-quark is named 'bbar'.

Definition at line 80 of file PartonHistoryConfig.py.

80def _t_branches(suffix: str = "t") -> list:
81 """Branches for a top quark and its full decay chain.
82
83 Sub-particles carry the FSR stage in their prefix so we pass ``stages=()``
84 to avoid appending a spurious stage token to the variable name.
85 For antitops (suffix starting with 'tbar'), the b-quark is named 'bbar'.
86 """
87 b_name = "bbar" if suffix.startswith("tbar") else "b"
88 sub_particles = ("W", b_name, "Wdecay1", "Wdecay2")
89 result = _make_particle_branches(suffix)
90 for particle in sub_particles:
91 for stage in ("beforeFSR", "afterFSR"):
92 result += _make_particle_branches(
93 f"{particle}_{stage}_from_{suffix}", stages=()
94 )
95 return result
96

◆ _t_FCNC_branches()

list _t_FCNC_branches ( str suffix = "t")
protected
Branches for a top quark undergoing FCNC decay t -> q X, X -> decay1 decay2.

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 q-quark is named 'qbar'.

Definition at line 97 of file PartonHistoryConfig.py.

97def _t_FCNC_branches(suffix: str = "t") -> list:
98 """Branches for a top quark undergoing FCNC decay t -> q X, X -> decay1 decay2.
99
100 Sub-particles carry the FSR stage in their prefix so we pass ``stages=()``
101 to avoid appending a spurious stage token to the variable name.
102 For tbar, the q-quark is named 'qbar'.
103 """
104 q_name = "qbar" if suffix == "tbar" else "q"
105 sub_particles = ("X", q_name, "Xdecay1", "Xdecay2")
106 result = _make_particle_branches(suffix)
107 for particle in sub_particles:
108 for stage in ("beforeFSR", "afterFSR"):
109 result += _make_particle_branches(
110 f"{particle}_{stage}_from_{suffix}", stages=()
111 )
112 return result
113

Variable Documentation

◆ _TTBAR

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

Definition at line 167 of file PartonHistoryConfig.py.

◆ BRANCHES

dict PartonHistoryConfig.BRANCHES

Definition at line 114 of file PartonHistoryConfig.py.

◆ INT_SUFFIXES

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

Definition at line 13 of file PartonHistoryConfig.py.

◆ KINEMATIC_VARS

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

Definition at line 12 of file PartonHistoryConfig.py.

◆ TRUTH_BRANCHES

dict PartonHistoryConfig.TRUTH_BRANCHES
Initial value:
= {
"Ttbar": _TTBAR,
"TtbarFCNC": BRANCHES["t_FCNC"] + BRANCHES["tbar_FCNC"] + BRANCHES["ttbar"],
"Ttbarbbbar": _TTBAR + BRANCHES["b"] + BRANCHES["bbar"],
"Ttbarccbar": _TTBAR + BRANCHES["c"] + BRANCHES["cbar"],
"Ttz": _TTBAR + BRANCHES["Z"],
"Ttw": _TTBAR + BRANCHES["W"],
"Tth": _TTBAR + BRANCHES["Higgs"],
"Ttgamma": _TTBAR + BRANCHES["Photon"],
"Tq": BRANCHES["t"] + BRANCHES["b"],
"Tzq": BRANCHES["t"] + BRANCHES["Z"] + BRANCHES["b"],
"Thq": BRANCHES["t"] + BRANCHES["Higgs"] + BRANCHES["b"] + BRANCHES["W"],
"Tqgamma": BRANCHES["t"] + BRANCHES["Photon"] + BRANCHES["b"],
"Wtb": BRANCHES["t"] + BRANCHES["W"] + BRANCHES["b"],
"FourTop": (
_t_branches("t1")
+ _t_branches("t2")
+ _t_branches("tbar1")
+ _t_branches("tbar2")
),
"HWW": BRANCHES["Higgs"],
"WW_nonresonant": (
_replace_in_list(BRANCHES["W"], "W", "W1")
+ _replace_in_list(BRANCHES["W"], "W", "W2")
),
"HWW_nonresonant": BRANCHES["Higgs"],
"HZZ": BRANCHES["Higgs"],
"Zb": BRANCHES["Z"] + BRANCHES["b"] + BRANCHES["bbar"],
"Ztautau": BRANCHES["Z_extended"],
}

Definition at line 169 of file PartonHistoryConfig.py.

◆ VECTOR_HISTORIES

PartonHistoryConfig.VECTOR_HISTORIES = frozenset(("Ttbarbbbar", "Ttbarccbar"))

Definition at line 15 of file PartonHistoryConfig.py.

◆ VECTOR_PREFIXES

tuple PartonHistoryConfig.VECTOR_PREFIXES = ("MC_b_", "MC_bbar_", "MC_c_", "MC_cbar_")

Definition at line 14 of file PartonHistoryConfig.py.