Skip to content

DecayFinder search/match fix#4231

Merged
osbornjd merged 2 commits into
sPHENIX-Collaboration:masterfrom
hrjheng:DecayFinder
Mar 24, 2026
Merged

DecayFinder search/match fix#4231
osbornjd merged 2 commits into
sPHENIX-Collaboration:masterfrom
hrjheng:DecayFinder

Conversation

@hrjheng

@hrjheng hrjheng commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work for users)
  • Requiring change in macros repository (Please provide links to the macros pull request in the last section)
  • I am a member of GitHub organization of sPHENIX Collaboration, EIC, or ECCE (contact Chris Pinkenburg to join)

What kind of change does this PR introduce? (Bug fix, feature, ...)

This PR fixes a DecayFinder mother-matching bug for charge-conjugate decay descriptors with a negatively charged mother. As an example, for a negatively charged Xi decay[Xi- -> {Lambda0 -> proton^+ pi^-} pi^-]cc, the parser assigns a signed m_mother_ID -3312, while the mother-search loop compares it against abs((*p)->pdg_id()) in charge-conjugate mode, making the match fail even when the decay is present

A simple fix, which always compares the unsigned PID for the charge-conjugate mode, is implemented

@cdean-github I am marking this as a draft PR for now, both for review and because it appears to fix the charged $\Xi$ decay. I have not yet been able to get the neutral $\Xi$ decay to work. Once I am more certain that the current issue with the neutral $\Xi$ decay is not related to DecayFinder, I will mark this as ready to merge.)

TODOs (if applicable)

Links to other PRs in macros and calibration repositories (if applicable)

@coderabbitai

coderabbitai Bot commented Mar 23, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Modified the decay-finding logic in DecayFinder::findDecay() to conditionally apply absolute-value transformations to the mother particle ID when charge-conjugate matching is enabled. This ensures consistent comparison between candidate particles and the target mother ID across both Geant4-truth and HepMC generator-particle search loops.

Changes

Cohort / File(s) Summary
DecayFinder Logic
offline/packages/decayfinder/DecayFinder.cc
Introduced mother_id_to_match derived value that selects abs(m_mother_ID) when charge-conjugate mode is active, otherwise uses m_mother_ID directly. Updated matching conditions in both Geant4-truth and HepMC loops to compare against this derived value instead of the raw m_mother_ID, ensuring charge-conjugate-aware particle identification.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sphenix-jenkins-ci

Copy link
Copy Markdown

Build & test report

Report for commit de78126e283bf6824684048c6259979c4e221da4:
Jenkins passed


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@hrjheng

hrjheng commented Mar 23, 2026

Copy link
Copy Markdown
Contributor Author

Marking this PR as ready to merge. The neutral $\Xi$ is working now (I did not set the correct decay descriptor yesterday)

@hrjheng hrjheng marked this pull request as ready for review March 23, 2026 13:55

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
offline/packages/decayfinder/DecayFinder.cc (1)

380-392: ⚠️ Potential issue | 🟠 Major

Reset the per-candidate state before each mother search.

aTrackFailedPT, aTrackFailedETA, aMotherHasPhoton, and aMotherHasPi0 are initialized once outside the loops and then reused for every matched mother. Once one candidate flips any of them, later candidates in the same event inherit that state and can be miscounted or marked unreconstructable incorrectly.

Suggested fix
       if (this_pid == mother_id_to_match)
       {
+        aTrackFailedPT = false;
+        aTrackFailedETA = false;
+        aMotherHasPhoton = false;
+        aMotherHasPi0 = false;
+
         if (Verbosity() >= VERBOSITY_MAX)
         {
           std::cout << "parent->pdg_id(): " << g4particle->get_pid() << std::endl;
         }
@@
       if (this_pid == mother_id_to_match)
       {
+        aTrackFailedPT = false;
+        aTrackFailedETA = false;
+        aMotherHasPhoton = false;
+        aMotherHasPi0 = false;
+
         if (Verbosity() >= VERBOSITY_MAX)
         {
           std::cout << "parent->pdg_id(): " << (*p)->pdg_id() << std::endl;
         }

Also applies to: 461-480


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4dfe3780-bffd-47bc-9b6c-6046413cb0ac

📥 Commits

Reviewing files that changed from the base of the PR and between 5f94b58 and de78126.

📒 Files selected for processing (1)
  • offline/packages/decayfinder/DecayFinder.cc

@osbornjd osbornjd merged commit fbace92 into sPHENIX-Collaboration:master Mar 24, 2026
22 checks passed
@hrjheng hrjheng deleted the DecayFinder branch March 26, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants