Skip to content

Add neutron to PDGCode enum-to-string mapping#1759

Merged
oksuzian merged 2 commits intomainfrom
copilot/fix-pdgcode-enum-to-string
Mar 13, 2026
Merged

Add neutron to PDGCode enum-to-string mapping#1759
oksuzian merged 2 commits intomainfrom
copilot/fix-pdgcode-enum-to-string

Conversation

Copy link
Contributor

Copilot AI commented Mar 12, 2026

The PDGCode enum names proton/anti_proton but only has n0/anti_n0 for the neutron — inconsistent and less readable.

  • Add neutron = 2112 and anti_neutron = -2112 enum aliases in PDGCode and CompressedPDGCode
  • Change string representations from "n0""neutron" and "anti_n0""anti_neutron"
  • Existing n0/anti_n0 enum names kept as aliases — fully backward compatible
// Both work:
PDGCode::n0       // == 2112, still valid
PDGCode::neutron  // == 2112, new alias
Original prompt

This section details on the original issue you should resolve

<issue_title>no neutron in PDGCode enum-to-string</issue_title>
<issue_description>The PDGCode enum-to-string names a proton, but there is no neutron.

There are p0 and pi_plus. There is n0... should there be n_plus? We called n_plus a proton, it would make sense to say "neutron" instead of n0.
</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Add neutron = 2112 and anti_neutron = -2112 as enum aliases in
PDGCode, keeping backward-compatible n0/anti_n0 names. Change the
string representations from "n0"/"anti_n0" to "neutron"/"anti_neutron"
for consistency with how "proton" is already named. Apply the same
changes to CompressedPDGCode.

Co-authored-by: oksuzian <48927306+oksuzian@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix PDGCode enum-to-string for neutron Add neutron to PDGCode enum-to-string mapping Mar 12, 2026
Copilot AI requested a review from oksuzian March 12, 2026 21:29
@oksuzian oksuzian marked this pull request as ready for review March 13, 2026 01:52
@oksuzian oksuzian requested a review from rlcee March 13, 2026 01:52
@rlcee
Copy link
Collaborator

rlcee commented Mar 13, 2026

@FNALbuild run build test

@FNALbuild
Copy link
Collaborator

Hi @Copilot,
You have proposed changes to files in these packages:

  • DataProducts

which require these tests: build.

@Mu2e/write, @Mu2e/fnalbuild-users have access to CI actions on main.

📝 The author of this pull request is not a member of the Mu2e github organisation.

⌛ The following tests have been triggered for d0b0ace: build (Build queue - API unavailable)

About FNALbuild. Code review on Mu2e/Offline.

@FNALbuild
Copy link
Collaborator

☀️ The build tests passed at d0b0ace.

Test Result Details
test with Command did not list any other PRs to include
merge Merged d0b0ace at 627421c
build (prof) Log file. Build time: 04 min 06 sec
ceSimReco Log file.
g4test_03MT Log file.
transportOnly Log file.
POT Log file.
g4study Log file.
cosmicSimReco Log file.
cosmicOffSpill Log file.
ceSteps Log file.
ceDigi Log file.
muDauSteps Log file.
ceMix Log file.
rootOverlaps Log file.
g4surfaceCheck Log file.
trigger Log file. Return Code 1.
check_cmake Log file.
FIXME, TODO TODO (0) FIXME (0) in 4 files
clang-tidy 0 errors 0 warnings
whitespace check no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at d0b0ace after being merged into the base branch at 627421c.

For more information, please check the job page here.
Build artifacts are deleted after 5 days. If this is not desired, select Keep this build forever on the job page.

Copy link
Collaborator

@rlcee rlcee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my reading of the code, this should work.

@oksuzian oksuzian merged commit 1edce62 into main Mar 13, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

no neutron in PDGCode enum-to-string

4 participants