CustomFunction¶
- class madspace.CustomFunction(*args, **kwargs)¶
Bases:
FunctionGeneratorA user-supplied function of the event momenta, loaded as a UMAMI library.
Custom cuts, scales and biases use the UMAMI interface as a generic batched function. The library is loaded like a matrix element, with Context::load_matrix_element. It receives the momenta (
UMAMI_IN_MOMENTA), the particle count (UMAMI_IN_PARTICLE_COUNT) and the PDG ids of the external particles (UMAMI_IN_PDG_IDS). It returns one value per event underUMAMI_OUT_CUTorUMAMI_OUT_BIAS, or a scale returns the three valuesUMAMI_OUT_REN_SCALE,UMAMI_OUT_FACT_SCALE_1andUMAMI_OUT_FACT_SCALE_2.With a single PDG-id option the ids are constant. With several options the ids are selected per event by the
flavor_indexargument.batchis the leading batch dimension.Arguments
momenta–float, shape(batch, particle_count, 4)– the event momenta.flavor_index–int, shape(batch,)– index into the PDG-id options. Present only with more than one option.
Returns
cutorbias–float, shape(batch,)– the function value.ren_scale,fact_scale1,fact_scale2–float, shape(batch,)– the scales, for a function of typescale.
Overloaded function.
__init__(self: madspace._madspace_py.CustomFunction, function_index: typing.SupportsInt, type: madspace._madspace_py.CustomFunction.CustomFunctionType, particle_count: typing.SupportsInt, pdg_id_options: collections.abc.Sequence[collections.abc.Sequence[typing.SupportsInt]] = []) -> None
- Parameters:
function_index – Index of the loaded library in the context.
type – What the function computes.
particle_count – Number of external particles.
pdg_id_options – PDG ids of the external particles, one list per flavor option. Empty passes zeros.
__init__(self: madspace._madspace_py.CustomFunction, function_api: madspace._madspace_py.MatrixElementApi, type: madspace._madspace_py.CustomFunction.CustomFunctionType, particle_count: typing.SupportsInt, pdg_id_options: collections.abc.Sequence[collections.abc.Sequence[typing.SupportsInt]] = []) -> None
Take the index from an already-loaded library.
- Parameters:
function_api – The loaded library.
type – What the function computes.
particle_count – Number of external particles.
pdg_id_options – See the other constructor.
- class CustomFunctionType(*args, **kwargs)¶
Bases:
pybind11_objectMembers:
cut
scale
bias
Overloaded function.
__init__(self: madspace._madspace_py.CustomFunction.CustomFunctionType, value: typing.SupportsInt) -> None
__init__(self: madspace._madspace_py.CustomFunction.CustomFunctionType, name: str) -> None
- bias = <CustomFunctionType.bias: 2>¶
- cut = <CustomFunctionType.cut: 0>¶
- CustomFunction.CustomFunctionType.name -> str
- scale = <CustomFunctionType.scale: 1>¶
- property value¶
- bias = <CustomFunctionType.bias: 2>¶
- cut = <CustomFunctionType.cut: 0>¶
- dynamic_pdg_ids(self: madspace._madspace_py.CustomFunction) bool¶
Whether the PDG ids are selected per event by a
flavor_indexargument.
- function_index(self: madspace._madspace_py.CustomFunction) int¶
Index of the loaded library in the context.
- scale = <CustomFunctionType.scale: 1>¶
- type(self: madspace._madspace_py.CustomFunction) madspace._madspace_py.CustomFunction.CustomFunctionType¶
What the function computes.