FeynKit · latest
On this page

ParticleSelector

symbolica.community.hepkit Class

ParticleSelector()

A model-independent way to identify an external particle.

Selectors may use a UFO particle name or a signed PDG code, making process definitions convenient while deferring validation to a concrete model.

Examples

from symbolica.community import hepkit as hep
electron = hep.ParticleSelector.by_pdg(11)
positron = hep.ParticleSelector.by_name("e+")

Member details

name

Property · read-only#
name: str

Return the selected particle name.

Raises TypeError for a PDG selector. Use is_name to distinguish the selector variants before accessing their payloads.

Examples

Using the setup in the ParticleSelector class example:

assert hep.ParticleSelector.by_name("e-").name == "e-"

pdg

Property · read-only#
pdg: int

Return the selected PDG code.

Raises TypeError for a name selector. Use is_pdg to distinguish the selector variants before accessing their payloads.

Examples

Using the setup in the ParticleSelector class example:

assert hep.ParticleSelector.by_pdg(11).pdg == 11

is_name

Property · read-only#
is_name: bool

Report whether this selector identifies a particle by name.

Examples

Using the setup in the ParticleSelector class example:

assert hep.ParticleSelector.by_name("e-").is_name

is_pdg

Property · read-only#
is_pdg: bool

Report whether this selector identifies a particle by PDG code.

Examples

Using the setup in the ParticleSelector class example:

assert hep.ParticleSelector.by_pdg(11).is_pdg

by_name

Static method#
by_name(name: str) -> ParticleSelector

Select a particle by its model name.

Examples

Using the setup in the ParticleSelector class example:

hep.ParticleSelector.by_name("e-").name

Parameters

NameTypeDefaultDescription
namestr—

Particle name as it appears in the model.

by_pdg

Static method#
by_pdg(pdg: int) -> ParticleSelector

Select a particle by its signed PDG code.

Examples

Using the setup in the ParticleSelector class example:

hep.ParticleSelector.by_pdg(11).pdg

Parameters

NameTypeDefaultDescription
pdgint—

Signed PDG code of the particle.

__str__

Method#
__str__() -> str

Format the selector as its particle name or signed PDG code.

Examples

Using the setup in the ParticleSelector class example:

str(hep.ParticleSelector.by_pdg(11))

__repr__

Method#
__repr__() -> str

Return a constructor-style representation of the selector.

Examples

Using the setup in the ParticleSelector class example:

print(hep.ParticleSelector.by_pdg(11))  # electron selector in a process

__eq__

Method#
__eq__(other: Any) -> bool

Compare with another selector, a particle name, or a PDG code.

Examples

Using the setup in the ParticleSelector class example:

hep.ParticleSelector.by_pdg(11) == 11

Parameters

NameTypeDefaultDescription
otherAny—

Selector, particle-name string, or integer PDG code to compare with.