order.process

Classes to define physics processes.

Class Process

class Process(*args, **kwargs)[source]

Bases: UniqueObject, CopyMixin, AuxDataMixin, TagMixin, DataSourceMixin, LabelMixin, ColorMixin

Definition of a phyiscs process.

Arguments

xsecs should be a mapping of center-of-mass energies to cross sections values (automatically converted to scinum.Number instances).

color, color1, color2 and color3 are forwarded to the ColorMixin, label and label_short to the LabelMixin, is_data to the DataSourceMixin, tags to the TagMixin, aux to the AuxDataMixin, and name and id to the UniqueObject constructor.

A process can have parent-child relations to other processes. Initial child processes are set to processes.

Copy behavior

All attributes are copied.

Example

import order as od
from scinum import Number, REL

p = od.Process(
    name="ttH",
    id=1,
    xsecs={
        13: Number(0.5071, {"scale": 0.036j}),  # +-3.6% scale uncertainty
    },
    label=r"$t\bar{t}H$",
    color=(255, 0, 0),
)

p.get_xsec(13).str("%.2f")
# -> "0.51 +- 0.02 (scale)"

p.label_root
# -> "t#bar{t}H"

p2 = p.add_process(
    name="ttH_bb",
    id=2,
    xsecs={
        13: p.get_xsec(13) * 0.5824,
    },
    label=p.label + r", $b\bar{b}$",
)

p2 == p.get_process("ttH_bb")
# -> True

p2.label_root
# -> "t#bar{t}H, b#bar{b}"

p2.has_parent_process("ttH")
# -> True

Members

xsecs
type: dictionary (float -> scinum.Number)

Cross sections mapped to a center-of-mass energies with arbitrary units.

processes
type: UniqueObjectIndex
read-only

The UniqueObjectIndex of child processes.

parent_processes
type: UniqueObjectIndex
read-only

The UniqueObjectIndex of parent processes.

Methods:

get_xsec(ecm)

Returns the cross section (a scinum.Number instance) for a center-of-mass energy ecm.

set_xsec(ecm, xsec)

Sets the cross section for a center-of-mass energy ecm to xsec.

add_parent_process(*args, **kwargs)

Adds a parent process to the parent_processes index and returns it.

add_process(*args, **kwargs)

Adds a child process to the processes index and returns it.

clear_parent_processes()

Removes all parent processes from the parent_processes index.

clear_processes()

Removes all child processes from the processes index.

extend_parent_processes(objs)

Adds multiple parent processes to the parent_processes index and returns the added objects in a list.

extend_processes(objs)

Adds multiple child processes to the processes index and returns the added objects in a list.

get_leaf_processes()

Returns all child processes from the processes index that have no child processes themselves in a recursive fashion.

get_parent_process(obj[, deep, default])

Returns a parent process given by obj, which might be a name, id, or an instance from the parent_processes index.

get_process(obj[, deep, default])

Returns a child process given by obj, which might be a name, id, or an instance from the processes index.

get_root_processes()

Returns all parent processes from the parent_processes index that have no parent processes themselves in a recursive fashion.

has_parent_process(obj[, deep])

Checks if the parent_processes index contains an obj, which might be a name, id, or an instance.

has_process(obj[, deep])

Checks if the processes index contains an obj which might be a name, id, or an instance.

pretty_print([ecm, offset, max_depth, stream])

Prints this process and potentially its subprocesses down to a maximum depth max_depth in a structured fashion.

remove_parent_process(obj[, silent])

Removes a parent process obj which might be a name, id, or an instance from the parent_processes index.

remove_process(obj[, silent])

Removes a child process given by obj, which might be a name, id, or an instance from the processes index and returns the removed object.

walk_parent_processes([depth_first, ...])

Walks through the parent_processes index and per iteration, yields a parent process, its depth relative to this process, and its parent processes in a list that can be modified to alter the walking.

walk_processes([depth_first, include_self])

Walks through the processes index and per iteration, yields a child process, its depth relative to this process, and its child processes in a list that can be modified to alter the walking.

Attributes:

has_parent_processes

Returns True when this process has parent processes, False otherwise.

has_processes

Returns True when this process has child processes, False otherwise.

is_leaf_process

Returns True when this process has no child processes, False otherwise.

is_root_process

Returns True when this process has no parent processes, False otherwise.

get_xsec(ecm)[source]

Returns the cross section (a scinum.Number instance) for a center-of-mass energy ecm.

set_xsec(ecm, xsec)[source]

Sets the cross section for a center-of-mass energy ecm to xsec. When xsec is not a scinum.Number instance, it is converted to one. The (probably converted) value is returned.

add_parent_process(*args, **kwargs)

Adds a parent process to the parent_processes index and returns it. Also adds this process to the processes index of the added process. See UniqueObjectIndex.add() for more info.

add_process(*args, **kwargs)

Adds a child process to the processes index and returns it. Also adds this process to the parent_processes index of the added process. See UniqueObjectIndex.add() for more info.

clear_parent_processes()

Removes all parent processes from the parent_processes index. Also removes this process instance from the processes index of all removed process.

clear_processes()

Removes all child processes from the processes index. Also removes this process instance from the parent_processes index of all removed processes.

extend_parent_processes(objs)

Adds multiple parent processes to the parent_processes index and returns the added objects in a list. Also adds this process to the processes index of the added process.

extend_processes(objs)

Adds multiple child processes to the processes index and returns the added objects in a list. Also adds this process to the parent_processes index of the added process.

get_leaf_processes()

Returns all child processes from the processes index that have no child processes themselves in a recursive fashion.

get_parent_process(obj, deep=True, default=no_default)

Returns a parent process given by obj, which might be a name, id, or an instance from the parent_processes index. If deep is True, the lookup is recursive. When no process is found, default is returned when set. Otherwise, an error is raised.

get_process(obj, deep=True, default=no_default)

Returns a child process given by obj, which might be a name, id, or an instance from the processes index. If deep is True, the lookup is recursive. When no process is found, default is returned when set. Otherwise, an error is raised.

get_root_processes()

Returns all parent processes from the parent_processes index that have no parent processes themselves in a recursive fashion.

has_parent_process(obj, deep=True)

Checks if the parent_processes index contains an obj, which might be a name, id, or an instance. If deep is True, the lookup is recursive.

property has_parent_processes

Returns True when this process has parent processes, False otherwise.

has_process(obj, deep=True)

Checks if the processes index contains an obj which might be a name, id, or an instance. If deep is True, the lookup is recursive.

property has_processes

Returns True when this process has child processes, False otherwise.

property is_leaf_process

Returns True when this process has no child processes, False otherwise.

property is_root_process

Returns True when this process has no parent processes, False otherwise.

pretty_print(ecm=None, offset=40, max_depth=-1, stream=None, **kwargs)[source]

Prints this process and potentially its subprocesses down to a maximum depth max_depth in a structured fashion. When ecm is set, process cross section values are shown as well with a maximum horizontal distance of offset. stream can be a file object and defaults to sys.stdout. All kwargs are forwarded to the Number.str() methods of the cross section numbers.

remove_parent_process(obj, silent=False)

Removes a parent process obj which might be a name, id, or an instance from the parent_processes index. Also removes this instance from the processes index of the removed parent process. Returns the removed object. Unless silent is True, an error is raised if the object was not found. See UniqueObjectIndex.remove() for more info.

remove_process(obj, silent=False)

Removes a child process given by obj, which might be a name, id, or an instance from the processes index and returns the removed object. Also removes this process from the parent_processes index of the removed process. Unless silent is True, an error is raised if the object was not found. See UniqueObjectIndex.remove() for more info.

walk_parent_processes(depth_first=False, include_self=False)

Walks through the parent_processes index and per iteration, yields a parent process, its depth relative to this process, and its parent processes in a list that can be modified to alter the walking. When depth_first is True, iterate depth-first instead of the default breadth-first. When include_self is True, also yield this process instance with a depth of 0.

walk_processes(depth_first=False, include_self=False)

Walks through the processes index and per iteration, yields a child process, its depth relative to this process, and its child processes in a list that can be modified to alter the walking. When depth_first is True, iterate depth-first instead of the default breadth-first. When include_self is True, also yield this process instance with a depth of 0.