Skip to content

Fix BST hit IDs after raw-bank filtering - #1539

Merged
baltzell merged 4 commits into
JeffersonLab:developmentfrom
alillari:fix/bst-original-adc-row-id
Oct 27, 2026
Merged

baltzell merged 4 commits into
JeffersonLab:developmentfrom
alillari:fix/bst-original-adc-row-id

Conversation

@alillari

Copy link
Copy Markdown
Contributor

Use bankDGTZ.trueIndex(i) + 1 for BST hit IDs in fetch_SVTHits, matching BMT. This preserves the original ADC-row identity after filtering and fixes the resulting MC::True.hitn associations.

Focused regression and CVT reconstruction tests pass on the updated branch.

Fixes #1538.

@yugotra

yugotra commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

I verified the change against the RawDataBank implementation and on background-merged MC. The
replacement with bankDGTZ.trueIndex(i) + 1 is correct and matches BMT: i is the filtered-bank
position, while trueIndex(i) is the original BST::adc row.

On 200 background-merged MC events, the base code produced 26,092 of 30,407 BST hit IDs whose
referenced ADC row had a different sector/layer/strip. This PR reduced that count to zero. Final
CVT track tables and matched residual tables were byte-for-byte identical, so the patch repairs
provenance without changing reconstruction.

I find no blocking problem and approve the code change. As a non-blocking follow-up, please commit
the focused regression test mentioned in the PR description: place an order-filtered BST::adc
row before an accepted row and assert that the reconstructed hit ID is trueIndex + 1, including
the cluster hit reference. The existing CVT test does not protect this boundary condition.
PR1539_REVIEW.txt

yugotra
yugotra previously approved these changes Oct 26, 2026

@yugotra yugotra left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I verified the change against the RawDataBank implementation and on background-merged MC. The
replacement with bankDGTZ.trueIndex(i) + 1 is correct and matches BMT: i is the filtered-bank
position, while trueIndex(i) is the original BST::adc row.

On 200 background-merged MC events, the base code produced 26,092 of 30,407 BST hit IDs whose
referenced ADC row had a different sector/layer/strip. This PR reduced that count to zero. Final
CVT track tables and matched residual tables were byte-for-byte identical, so the patch repairs
provenance without changing reconstruction.

I find no blocking problem and approve the code change. As a non-blocking follow-up, please commit
the focused regression test mentioned in the PR description: place an order-filtered BST::adc
row before an accepted row and assert that the reconstructed hit ID is trueIndex + 1, including
the cluster hit reference. The existing CVT test does not protect this boundary condition.

@alillari

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I’ve added the focused regression test covering filtered BST hit IDs and cluster hit references. It fails on the unfixed code and passes with the fix.

@alillari
alillari requested a review from yugotra October 26, 2026 17:44

@yugotra yugotra left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I reviewed the updated PR #1539. Recommendation: re-approve after authorizing the pending CI workflow.
I verified:

  • Four tests pass with the fix.
  • Temporarily restoring id = i + 1 makes exactly the leading- and interior-filtered-row tests fail.
  • Tests cover BST::Hits.ID, cluster HitN_ID references, unfiltered rows, and ADC=-1 timing rows.
  • No blocking code or test issue remains.

@baltzell
baltzell enabled auto-merge (squash) October 26, 2026 18:51
@baltzell
baltzell requested a review from yugotra October 26, 2026 18:51
auto-merge was automatically disabled October 26, 2026 20:47

Head branch was pushed to by a user without write access

@alillari

Copy link
Copy Markdown
Contributor Author

Fixed the test initialization to work with CLAS12DIR unset, as in CI. The full local unit-test workflow now passes. Hopefully it passes the test this time.

@yugotra yugotra left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I reviewed the updated PR #1539. Recommendation: re-approve.
I verified:

Four tests pass with the fix.
Temporarily restoring id = i + 1 makes exactly the leading- and interior-filtered-row tests fail.
Tests cover BST::Hits.ID, cluster HitN_ID references, unfiltered rows, and ADC=-1 timing rows.
No blocking code or test issue remains.

@baltzell

Copy link
Copy Markdown
Collaborator

@alillari Thanks for finding and fixing this (my) bug! When you update your branch we'll merge it.

@baltzell
baltzell enabled auto-merge (squash) October 27, 2026 16:51
@baltzell
baltzell merged commit 173e9ad into JeffersonLab:development Oct 27, 2026
25 checks passed
@c-dilks c-dilks added the bug label Oct 27, 2026
@alillari
alillari deleted the fix/bst-original-adc-row-id branch October 27, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BST hit IDs do not preserve original ADC row indices after filtering

4 participants