diff --git a/src/decaylanguage/data/decfile.lark b/src/decaylanguage/data/decfile.lark index 261d4010..a752ef96 100644 --- a/src/decaylanguage/data/decfile.lark +++ b/src/decaylanguage/data/decfile.lark @@ -16,13 +16,13 @@ inc_factor: ("IncludeBirthFactor" | "IncludeDecayFactor") label ("yes" | "no") / setlsbw : "BlattWeisskopf" label value // Set Blatt-Weisskopf barrier factor for a lineshape -setlspw : "SetLineshapePW" label label label value +setlspw : "SetLineshapePW" LABEL LABEL LABEL INT // Redefine Partial Wave for label -> label label cdecay : "CDecay" label define : "Define" label value -particle_def: "Particle" label value value // Set the mass and width of a paricle (in GeV) +particle_def: "Particle" label value value // Set the mass and width of a particle (in GeV) model_alias : "ModelAlias" model_label model @@ -60,6 +60,7 @@ model_options : (value | LABEL | _NEWLINE | _COMMA)+ // To use a fast parser, we need to avoid conflicts %import common.WS_INLINE +%import common.INT %import common.SIGNED_NUMBER // Disregard comments, (multiple) newlines and whitespace in parser tree diff --git a/src/decaylanguage/dec/dec.py b/src/decaylanguage/dec/dec.py index fce79fd4..78bfe381 100644 --- a/src/decaylanguage/dec/dec.py +++ b/src/decaylanguage/dec/dec.py @@ -367,13 +367,29 @@ def dict_charge_conjugates(self) -> dict[str, str]: self._check_parsing() return get_charge_conjugate_defs(self._parsed_dec_file) + def get_particle_property_definitions(self) -> dict[str, dict[str, float]]: + """ + Return a dictionary of all particle property definitions + in the input parsed file, of the form "Particle ", + as {'PARTICLE1': {'mass': MASS1, 'width': WIDTH1}, + 'PARTICLE2': {'mass': MASS2, 'width': WIDTH2}, ...}. + + Note + ---- + Particles are often defined via aliases and post-processing may be needed + to match the mass and width to the actual particle. + """ + self._check_parsing() + return get_particle_property_definitions(self._parsed_dec_file) + def dict_pythia_definitions(self) -> dict[str, str | float]: """ - Return a dictionary of all Pythia definitions in the input parsed file, - of the form - "PythiaBothParam =