SystematicsCalculator

class madspace.SystematicsCalculator(self: madspace._madspace_py.SystematicsCalculator, config: madspace._madspace_py.SystematicsConfig, subproc_args: collections.abc.Sequence[madspace._madspace_py.SubprocessSystArgs], nominal_pdf: madspace._madspace_py.PdfGrid | None = None, nominal_alpha_s: madspace._madspace_py.AlphaSGrid | None = None, context: madspace._madspace_py.Context = None, matrix_elements: collections.abc.Sequence[madspace._madspace_py.MatrixElement | None] = [], me_flavor_remap: collections.abc.Sequence[collections.abc.Sequence[SupportsInt]] = [], nominal_pdf2: madspace._madspace_py.PdfGrid | None = None)

Bases: pybind11_object

Computes LHEF weight variations (scale and PDF systematics) of combined, already-generated events.

The PDFs and alpha_s are evaluated with the regular batched madspace functions (PartonDensity, RunningCoupling) on context (a CPU context; one is created when none is given): the grids of the nominal PDF and of every varied member are registered as globals of that context under a private prefix. Built once per run from a SystematicsConfig, then reused for every combined event via compute.

Parameters:
  • config – The scale and PDF variations to compute.

  • subproc_args – Per-subprocess bookkeeping needed to reweight its events; indexed like the subprocess index passed to compute.

  • nominal_pdf – The PDF the events were generated with; nullopt for leptonic beams.

  • nominal_alpha_s – The alpha_s grid the events were generated with.

  • context – Context the PDF and alpha_s runtimes are built on; a private CPU context if nullptr.

  • matrix_elements – One matrix element per subprocess (may be empty or nullopt), enabling the exact renormalization-scale variation of subprocesses whose |M|^2 mixes several powers of alpha_s (qcd_power == -1): it is re-evaluated at the varied alpha_s on context. Must take (momenta, alpha_s, flavor) and return the matrix element only.

  • me_flavor_remap – me_flavor_remap[subprocess][flavor_index] is the flavor passed to that subprocess’s matrix element.

  • nominal_pdf2 – PDF of the second beam when its set differs from nominal_pdf (which is then the first beam’s). PDF member variations are then dropped with a warning; the scale variations use both sets.

property config

The configuration passed to the constructor.

static dynamical_scale(dyn: SupportsInt, momenta: collections.abc.Sequence[Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(4)']]) → float

Dynamical scale dyn (1-4; see SystematicsConfig::dyn_scales) of an event from its momenta (momenta[particle][component], E px py pz, incoming particles first).

initrwgt(self: madspace._madspace_py.SystematicsCalculator) → str

<initrwgt> header content (without the enclosing tag), following the conventions of systematics.py (weight groups and attributes).

property members

PDF members actually used (the nominal set’s member 0 first, when it is part of a group).

property pdf_groups

The PDF groups, one per set with members among variations.

static pdf_uncertainty(error_type: str, central: SupportsFloat | None, member_values: collections.abc.Sequence[tuple[SupportsInt, SupportsFloat]]) → tuple[float, float, float]

Combined PDF uncertainty for the given LHAPDF error_type.

Parameters:
  • error_type – LHAPDF ErrorType (replicas, hessian, …).

  • central – Central value; used when member 0 is absent from member_values.

  • member_values – (member number, value) pairs; member 0 is the central member.

Return:

(central, up, down); NaN entries when they cannot be computed.

property scale_variation_indices

Indices into variations of the scale variations (the envelope group).

summary(self: madspace._madspace_py.SystematicsCalculator) → str

JSON description of the variations and, once events were accumulated, the per-variation cross sections and the scale/PDF uncertainties.

property variations

Every variation to compute, in weight order.

property warnings

Warnings emitted while building the variation list.

property weight_count

Number of variations, i.e. weights per event.

property weight_ids

LHEF <weight> ids, in the order of variations.

weights(self: madspace._madspace_py.SystematicsCalculator, event_weight: collections.abc.Sequence[SupportsFloat], subprocess_index: collections.abc.Sequence[SupportsInt], flavor_index: collections.abc.Sequence[SupportsInt], ren_scale: collections.abc.Sequence[SupportsFloat], x1: collections.abc.Sequence[SupportsFloat], fact_scale1: collections.abc.Sequence[SupportsFloat], x2: collections.abc.Sequence[SupportsFloat], fact_scale2: collections.abc.Sequence[SupportsFloat], partial_weight_product: collections.abc.Sequence[SupportsFloat], momenta: collections.abc.Sequence[collections.abc.Sequence[collections.abc.Sequence[SupportsFloat]]] = [], alpha_qcd: collections.abc.Sequence[SupportsFloat] = []) → list[list[float]]