Add support for RapidSim names#756
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #756 +/- ##
==========================================
- Coverage 97.92% 97.31% -0.62%
==========================================
Files 31 35 +4
Lines 2559 2607 +48
==========================================
+ Hits 2506 2537 +31
- Misses 53 70 +17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
To improve the coverage, I should add a test that mocks |
|
Hello @admorris, I will look at this next week ... One immediate reaction is indeed why RapidSim uses non PDG/EvtGen standard names in the 2020s!? It's more complication for absolute zero gain. The obvious question is whether it would not be simpler in the end to sort the issue at source? In the end they must be using names as labels, right, so should be rather easy? Have you checked this with the authors? I am not saying I am opposing to having another submodule as we already have for LHCb. Just asking for the record. Thanks. |
|
Hi Eduardo That's a fair suggestion. I just had a go at converting RapidSim's There are a lot of open PRs and issues in RapidSim which suggest it's not being actively maintained. But I'm sure Greig and Dan are still contactable. |
|
Hi. I checked briefly your data file and all 4 misses are for wrongly assigned PDGIDs from RapidSim authors. I could find the correct replacements in https://github.com/scikit-hep/particle/blob/main/src/particle/data/conversions.csv. I don't know how you and LHCb would like to proceed, but that seems like the main point here, else I am happy to merge this as-is if that helps with support for LHCb. I see many LHCb analysts still using RapidSim, hence it is useful and should be maintained. If the authors are not active anymore, could the package be taken over by LHCb somehow? I see it is effectively dead, since the last release is from 2019 and the latest merge from 2 years ago - https://github.com/gcowan/RapidSim! |
| with open("src/particle/rapidsim/data/pdgid_to_rapidsimname.csv", "w") as out_csv: | ||
| out_csv.write( | ||
| f"# (c) Scikit-HEP project - Particle package data file - pdgid_to_rapidsimname.csv - {date}\n" | ||
| ) |
There was a problem hiding this comment.
| ) | |
| ) | |
| csvfile.write( | |
| "# Auto generated by 'admin/dump_pdgid_to_rapidsimname.py'\n", | |
| ) |
| @@ -0,0 +1,185 @@ | |||
| # (c) Scikit-HEP project - Particle package data file - pdgid_to_rapidsimname.csv - 2026-04-24 | |||
There was a problem hiding this comment.
| # (c) Scikit-HEP project - Particle package data file - pdgid_to_rapidsimname.csv - 2026-04-24 | |
| # (c) Scikit-HEP project - Particle package data file - pdgid_to_rapidsimname.csv - 2026-04-24 | |
| # Auto generated by 'admin/dump_pdgid_to_rapidsimname.py |
| """ | ||
| lines: list[str] = ["PDGID,STR\n"] | ||
| with dat_file.open(encoding="utf-8") as f: | ||
| next(f) # skip header line |
There was a problem hiding this comment.
There is now an extra line to skip given my added comment, right?
eduardo-rodrigues
left a comment
There was a problem hiding this comment.
This looks great and I only made a couple of trivial suggestions.
Another suggestion would be to add somewhere in the docs the link to RapidSim, probably in admin/dump_pdgid_to_rapidsim.py but also in the functions to and from?
I let you decide if you update the docs for this new functionality here or in a follow-up PR.
Last thing: did you then decide what to do overall, I mean given the exchange above? Even if some work is going to be done to revive and modernise RapidSim, it may still take a while before that's available. If helpful we can move on merging and releasing this asap. Just let me know.
Thank you again for the great and clear enhancement.
I added support for the RapidSim particle-naming convention (oh how I wish they just used EvtGen names!)
It largely follows the same strategy as the LHCb names, but with the important difference of loading from
$RAPIDSIM_ROOT/config/particles.datif present, which is nice if you're usingparticlein e.g. a conda environment withrapidsiminstalled.