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, 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"))
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 PartonHistoryConfig._get_aux_type ( str branch,
str prefix )
protected

Definition at line 15 of file PartonHistoryConfig.py.

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

◆ _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 26 of file PartonHistoryConfig.py.

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

◆ _replace_in_list()

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

Definition at line 69 of file PartonHistoryConfig.py.

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

◆ _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 78 of file PartonHistoryConfig.py.

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

Variable Documentation

◆ _TTBAR

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

Definition at line 147 of file PartonHistoryConfig.py.

◆ BRANCHES

dict PartonHistoryConfig.BRANCHES

Definition at line 96 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 149 of file PartonHistoryConfig.py.

◆ VECTOR_HISTORIES

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

Definition at line 13 of file PartonHistoryConfig.py.

◆ VECTOR_PREFIXES

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

Definition at line 12 of file PartonHistoryConfig.py.