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

Allow dec file Decay statements to effectively be able to set a particle as stable #353

Merged
merged 4 commits into from
Jul 24, 2023
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
4 changes: 2 additions & 2 deletions src/decaylanguage/data/decfile.lark
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jetset_def : "JetSetPar" LABEL "=" SIGNED_NUMBER

ls_def : ("LSFLAT" | "LSNONRELBW") label // Choose a lineshape for a particle

inc_factor: ("IncludeBirthFactor" | "IncludeDecayFactor") label ("yes" | "no") // Presence of the birth/decay factor and form-factor
inc_factor: ("IncludeBirthFactor" | "IncludeDecayFactor") label ("yes" | "no") // Presence of the birth/decay momentum factor and form-factor

setlsbw : "BlattWeisskopf" label value // Set Blatt-Weisskopf barrier factor for a lineshape

Expand All @@ -39,7 +39,7 @@ global_photos : boolean_photos
boolean_photos : "yesPhotos" -> yes
| "noPhotos" -> no

decay : "Decay" particle _NEWLINE+ decayline+ "Enddecay"
decay : "Decay" particle _NEWLINE+ decayline* "Enddecay"
decayline : value particle* photos? model _NEWLINE+
value : SIGNED_NUMBER
photos : "PHOTOS"
Expand Down
2 changes: 1 addition & 1 deletion tests/data/minimalistic.dec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Example decfile for testing purposes:

# Line with "End" is strictly speaking not necessary
# Such "empty" files are relevant in LHCb for example when special decays are all defined in PYthon code
# Such "empty" files are relevant in LHCb for example when special decays are all defined in Python code
# inserted in commented-out lines
End
#
7 changes: 7 additions & 0 deletions tests/data/test_stable-particle.dec
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Example decay chain for testing purposes:
# An empty list of decay modes makes the particle stable!

Decay K_S0
Enddecay

End
10 changes: 10 additions & 0 deletions tests/dec/test_dec.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ def test_non_parsed_decfile():
p.list_decay_mother_names()


def test_decfile_defining_stable_particle():
p = DecFileParser(DIR / "../data/test_stable-particle.dec")
p.parse()

assert (
p.number_of_decays == 1
) # The decay of K_S0, even if no decay modes are defined
assert p.list_decay_modes("K_S0") == []


def test_non_existent_decay():
p = DecFileParser(DIR / "../data/test_example_Dst.dec")
p.parse()
Expand Down