CustomFunction¶
-
class CustomFunction : public madspace::FunctionGenerator¶
A 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.
Public Types
Public Functions
-
CustomFunction(std::size_t function_index, CustomFunctionType type, std::size_t particle_count, const nested_vector2<me_int_t> &pdg_id_options = {})¶
- 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.
-
inline CustomFunction(const MatrixElementApi &function_api, CustomFunctionType type, std::size_t particle_count, const nested_vector2<me_int_t> &pdg_id_options = {})¶
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.
-
inline std::size_t function_index() const¶
Index of the loaded library in the context.
-
inline CustomFunctionType type() const¶
What the function computes.
-
inline bool dynamic_pdg_ids() const¶
Whether the PDG ids are selected per event by a
flavor_indexargument.