order.process

Classes to define physics processes.

Class Process

class Process(*args, **kwargs)

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 is 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, id and context 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 except for references to child and parent processes. Also note the copy behavior of UniqueObject’s.

Example

import order as od
from scinum import Number, REL

p = od.Process("ttH", 1,
    xsecs={
        13: Number(0.5071, {"scale": (REL, 0.036)}),  # +-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("ttH_bb", 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.

classmethod pretty_print_all(*args, contenxt=None, **kwargs)

Calls pretty_print() of all root processes in the instance cache for context and forwards all args and kwargs. When context is all, root processes of all indices are printed.

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. 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. When context is None, the default_context of the processes index is used. 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(context=None)

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

clear_processes(context=None)

Removes all child processes from the processes index for context. Also removes this process instance from the parent_processes index of all removed processes. When context is None, the default_context of the processes index is used

extend_parent_processes(objs, context=None)

Adds multiple parent processes to the parent_processes index for context and returns the added objects in a list. Also adds this process to the processes index of the added process. When context is None, the default_context of the processes index is used.

extend_processes(objs, context=None)

Adds multiple child processes to the processes index for context and returns the added objects in a list. Also adds this process to the parent_processes index of the added process. When context is None, the default_context of the processes index is used.

get_leaf_processes(context=None)

Returns all child processes from the processes index for context that have no child processes themselves in a recursive fashion. When context is None, the default_context of the processes index is used.

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

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

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

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

get_root_processes(context=None)

Returns all parent processes from the parent_processes index for context that have no parent processes themselves in a recursive fashion. When context is None, the default_context of the parent_processes index is used.

has_parent_process(obj, deep=True, context=None)

Checks if the parent_processes index for context contains an obj, which might be a name, id, or an instance. If deep is True, the lookup is recursive. When context is None, the default_context of the parent_processes index is used.

property has_parent_processes

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

has_process(obj, deep=True, context=None)

Checks if the processes index for context contains an obj which might be a name, id, or an instance. If deep is True, the lookup is recursive. When context is None, the default_context of the processes index is used.

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)

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, context=None, silent=False)

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

remove_process(obj, context=None, silent=False)

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

walk_parent_processes(context=None, depth_first=False, include_self=False)

Walks through the parent_processes index for context 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 context is None, the default_context of the parent_processes index is used. When context is all, all indices are traversed. 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(context=None, depth_first=False, include_self=False)

Walks through the processes index for context 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 context is None, the default_context of the processes index is used. When context is all, all indices are traversed. 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.