Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EvtGen uses GeV, not the standard HEP system of units, hence MeV! #455

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ dependencies = [
"numpy>=1.12",
"pandas>=0.22",
"particle>=0.22.0",
"hepunits>=2.0.0",
"plumbum>=1.7.0",
]
dynamic = ["version"]
Expand Down
18 changes: 13 additions & 5 deletions src/decaylanguage/dec/dec.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
from pathlib import Path
from typing import Any, Callable, Iterable

from hepunits import GeV
from lark import Lark, Token, Transformer, Tree, Visitor
from lark.lexer import TerminalDef
from particle import Particle
Expand Down Expand Up @@ -460,9 +461,12 @@ def get_particle_property_definitions(self) -> dict[str, dict[str, float]]:

Note
----
1) Particles are often defined via aliases and post-processing may be needed
1) Masses and widths are in GeV in EvtGen, hence the "Particle <PARTICLE> <MASS>" statement
needs to use GeV! A conversion to MeV may be done on the fly when information is required
from the Particle package, which uses MeV, the (standard) HEP System of Units.
2) Particles are often defined via aliases and post-processing may be needed
to match the mass and width to the actual particle.
2) The mass (width) parameter is compulsory (optional).
3) The mass (width) parameter is compulsory (optional).
When not specified, the width is taken from the particle or alias.
"""
self._check_parsing()
Expand Down Expand Up @@ -1629,9 +1633,12 @@ def get_particle_property_definitions(parsed_file: Tree) -> dict[str, dict[str,

Note
----
1) Particles are often defined via aliases and post-processing may be needed
1) Masses and widths are in GeV in EvtGen, hence the "Particle <PARTICLE> <MASS>" statement
needs to use GeV! A conversion to MeV may be done on the fly when information is required
from the Particle package, which uses MeV, the (standard) HEP System of Units.
2) Particles are often defined via aliases and post-processing may be needed
to match the mass and width to the actual particle.
2) The mass (width) parameter is compulsory (optional).
3) The mass (width) parameter is compulsory (optional).
When not specified, the width is taken from the particle or alias.

Parameters
Expand All @@ -1650,7 +1657,8 @@ def get_set_width_or_default(children: list[Tree]) -> float:
token_name: str = children[0].value
try:
pname: str = aliases.get(token_name, token_name) if aliases else token_name
return Particle.from_evtgen_name(pname).width # type: ignore[return-value]
# Convert the width to GeV !
return Particle.from_evtgen_name(pname).width / GeV # type: ignore[operator]
except Exception as err:
raise RuntimeError(
f"Particle name/alias {token_name!r} not found! Check your dec file(s)!"
Expand Down
12 changes: 10 additions & 2 deletions tests/data/defs-aliases-chargeconj.dec
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ ChargeConj Omega_cc+sig anti-Omega_cc-sig

# Specifications typically relevant when dealing with lineshapes,
# and typically using particle name aliases
# Important note on values below: masses and widths are in GeV in EvtGen!
#
Alias MyK*0 K*0
Particle MyK*0 0.892 0.051 # To set a particle mass and width
Expand Down Expand Up @@ -280,9 +281,16 @@ LSNONRELBW rho0
BlattWeisskopf rho0 3.0
IncludeBirthFactor rho0 no
IncludeDecayFactor rho0 yes
# Redefined particles only need to specify the mass, and the width is optional
#
# Redefined particles only need to specify the mass, and the width is optional,
# in which case the value is taken from the alias
# and will correspond to the nominal mass as provided by the Particle package
Alias MyRho0 rho0
Particle MyRho0 0.8
Particle MyRho0 0.77
#
# Redefine one of the mass or width of a particle (not an alias, as in the cases above)
# Unlike above, the width is taken from the particle since no alias is present
Particle chi_c0 3.42

# Pythia 8 parameter modifications
# (Very important that there are no blank spaces in the parameter string!)
Expand Down
3 changes: 2 additions & 1 deletion tests/dec/test_dec.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ def test_particle_property_definitions():
"MyK*0": {"mass": 0.892, "width": 0.051},
"MyPhi": {"mass": 1.02, "width": 0.004},
"rho0": {"mass": 0.8, "width": 0.2},
"MyRho0": {"mass": 0.8, "width": 147.4},
"MyRho0": {"mass": 0.77, "width": 0.1474},
"chi_c0": {"mass": 3.42, "width": 0.0107},
}


Expand Down
Loading