Skip to content

INTT hit duplication implementation#4290

Open
hrjheng wants to merge 11 commits into
sPHENIX-Collaboration:masterfrom
hrjheng:InttHitCarryover_dev
Open

INTT hit duplication implementation#4290
hrjheng wants to merge 11 commits into
sPHENIX-Collaboration:masterfrom
hrjheng:InttHitCarryover_dev

Conversation

@hrjheng

@hrjheng hrjheng commented Jun 7, 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 introduces an optional INTT hit-duplication implementation in Fun4AllStreamingInputManager as a possible mitigation for the hit carry-over issue. When enabled, raw hits found at a later BCO, (N + M * 120), are copied into the raw-hit container with their BCO reassigned to N.
The duplication is disabled by default. The maximum shift multiple, controlled by the variable m_InttHitCarryOverShiftMaxMultiple, is configurable, while the carry-over shift is currently fixed at 120.

[Update 2026.06.11] The idea is to introduce an additional "second" duplication pass, in which hits in the next (or subsequent) strobes with FPHX BCO = 0 are also duplicated. I suspect this is necessary in addition to the "first" duplication pass because your previous slides indicate a non-negligible population of hits whose FPHX BCO is reset, particularly near the end of a strobe (two spikes appear in the subsequent strobe: one at FPHX BCO = 0 and another at the nominal +120 shift)
To avoid duplicating the same hits twice, the "second" pass is skipped whenever the target BCO (i.e. the BCO to which hits are being duplicated) corresponds to FPHX BCO = 0. In that case, the first duplication has already recovered all possible carried-over hits

(This strategy still requires careful study and discussion, so the PR is currently marked as a draft)

TODOs (if applicable)

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

INTT Hit Carry-Over Mitigation via Optional Hit Duplication

Motivation / Context

This PR introduces an optional hit duplication mechanism in Fun4AllStreamingInputManager to mitigate hit carry-over issues in the INTT (Inner Nuclear Tracking Telescope). The INTT detector exhibits a known issue where hits detected at later BCO (Bunch Crossing) values can carry over from previous strobe periods due to FPHX (Front-end Physics-to-Host neXus) BCO resets. This duplication strategy recovers such hits by copying them into earlier BCO windows where they originated.

Key Changes

INTT Hit Duplication Implementation

  • Configuration interface: Two new public methods enable feature control:

    • EnableInttHitDuplication(bool): Enable/disable the mitigation (defaults to disabled)
    • InttHitCarryOverShiftMaxMultiple(int): Configure maximum shift multiple (defaults to 4)
  • Fixed parameters:

    • Carry-over shift: Fixed at 120 BCOs (read-only constant)
    • With max multiple of 4, hits are duplicated from BCOs N+120, N+240, N+360, and N+480
  • Two-pass duplication strategy:

    • Pass 1: Duplicates hits by adding multiple carry-over shifts with filtering based on hit BCO values
    • Pass 2: Recovers "reset" hits (FPHX BCO = 0 cases) in subsequent strobes; skips duplication when target BCO % 120 = 0 to avoid double-processing
  • Pre-reading mechanism: Extends the INTT hit pool until the highest stashed BCO reaches the duplication threshold (select_crossings + max_shift), with guards to prevent infinite loops when no new data appears

Micromegas Pool Filling Change

  • FillMicromegasPool() now calls iter->FillPool() with no arguments instead of iter->FillPool(ref_bco_minus_range)
  • This changes the conditions under which Micromegas data are staged, potentially affecting hit selection timing

Minor Formatting

  • Range-based loop variable formatting updates in INTT and MVTX hit map iterations (semantics unchanged)

Potential Risk Areas

AI Note: AI-assisted analysis may contain errors; human review of the following concerns is strongly recommended.

  1. Reconstruction Behavior Changes: Hit duplication fundamentally alters INTT reconstruction by creating additional copies of hits with modified BCO values. This will increase hit multiplicities and could affect downstream reconstruction algorithms, trigger efficiency studies, and physics analyses.

  2. Complex Duplication Logic: The two-pass duplication scheme, particularly the condition target_refbco == 0 for skipping the second pass, introduces complex state-dependent behavior that could harbor subtle bugs. The logic for determining which hits qualify for reset-shift duplication (filtering on FPHX_BCO and relative BCO values) needs careful verification.

  3. Micromegas Impact: The change to FillMicromegasPool() removes the ref_bco_minus_range parameter, fundamentally altering how the BCO range is applied. The implications for Micromegas hit selection are not clearly documented.

  4. Memory Usage: Duplication increases the number of hits stored in the container, potentially increasing memory consumption during reconstruction.

  5. Performance: Pre-reading the INTT pool to reach the duplication threshold may introduce additional latency, though the infinite-loop guard should prevent runaway behavior.

  6. Feature Disabled by Default: The feature must be explicitly enabled, which may lead to inconsistent reconstruction practices if not properly documented in analysis guides.

Possible Future Improvements

  • Performance optimization: Consider caching BCO lookups to avoid repeated map searches during duplication
  • Documentation: Clearer explanation of Micromegas behavior change and when/how to enable INTT duplication
  • Validation: Create QA/validation histograms comparing reconstructed hits with/without duplication enabled
  • Configuration: Consider making the 120-BCO shift value configurable rather than a fixed constant
  • Parameter study: Systematic study of optimal max_shift_multiple value for different running conditions

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@hrjheng, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 8 minutes and 37 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 00a1d30d-d0a8-4776-af71-c239629f10ec

📥 Commits

Reviewing files that changed from the base of the PR and between 176ba1d and cbf9380.

📒 Files selected for processing (1)
  • offline/framework/fun4allraw/Fun4AllStreamingInputManager.cc
📝 Walkthrough

Walkthrough

Adds optional INTT hit duplication to Fun4AllStreamingInputManager: two new public configuration methods and private members in the header, a BCO-threshold-driven pool prefill loop, and a two-pass duplication strategy during hit insertion. Separately, FillMicromegasPool() drops the ref_bco_minus_range argument from iter->FillPool().

Changes

INTT Hit Duplication Feature

Layer / File(s) Summary
INTT duplication configuration interface
offline/framework/fun4allraw/Fun4AllStreamingInputManager.h
Adds <vector> include, public setters EnableInttHitDuplication(bool) and InttHitCarryOverShiftMaxMultiple(int), and private members m_InttHitDuplication, m_InttHitCarryOverShift (default 120), and m_InttHitCarryOverShiftMaxMultiple (default 4).
INTT pool prefill and two-pass hit duplication
offline/framework/fun4allraw/Fun4AllStreamingInputManager.cc
When enabled, extends the INTT pool via repeated FillInttPool() calls until the highest BCO reaches select_crossings + max_shift (with an infinite-loop guard). During insertion, Pass 1 copies hits to bco + k*shift with adjusted FPHX BCO; Pass 2 duplicates FPHX-BCO-reset hits while skipping BCO targets already covered by Pass 1. Also applies cosmetic auto & reformatting to m_InttRawHitMap and m_MvtxRawHitMap loops.

Micromegas FillPool Argument Removal

Layer / File(s) Summary
FillMicromegasPool drops ref_bco_minus_range
offline/framework/fun4allraw/Fun4AllStreamingInputManager.cc
Removes the ref_bco_minus_range offset calculation and changes iter->FillPool(ref_bco_minus_range) to iter->FillPool() with no arguments.

Possibly related PRs

  • sPHENIX-Collaboration/coresoftware#4094: Modifies the same INTT BCO selection and per-crossing iteration logic in Fun4AllStreamingInputManager.cc around select_crossings, making it a direct predecessor to the carry-over shift logic added here.

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 4af70f2dd2331b3748d4234ede69e0eed835b096:
Jenkins passed


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@osbornjd osbornjd 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.

This seems like a reasonable implementation to me, we should test it out and see if it improves the cluster/hit drop off towards the end of the strobe width

@sphenix-jenkins-ci

Copy link
Copy Markdown

Build & test report

Report for commit 6ce8662791365c156efa10702d1cc6026ee8d39b:
Jenkins on fire


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@sphenix-jenkins-ci

Copy link
Copy Markdown

Build & test report

Report for commit 88b10946a50a324a94399ffc39c04f1b0f1c5cf6:
Jenkins on fire


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@sphenix-jenkins-ci

Copy link
Copy Markdown

Build & test report

Report for commit 418247ecb2937d0d99002613f8439419c9ef3cca:
Jenkins on fire


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@sphenix-jenkins-ci

Copy link
Copy Markdown

Build & test report

Report for commit 3844e7c18dfce80a3527e09a12014bf248beb0b5:
Jenkins on fire


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@hrjheng hrjheng marked this pull request as ready for review June 16, 2026 19:56

@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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 97c8f8ac-55d4-4a5b-90d8-b7450e113e47

📥 Commits

Reviewing files that changed from the base of the PR and between d9e42ff and 176ba1d.

📒 Files selected for processing (2)
  • offline/framework/fun4allraw/Fun4AllStreamingInputManager.cc
  • offline/framework/fun4allraw/Fun4AllStreamingInputManager.h

Comment thread offline/framework/fun4allraw/Fun4AllStreamingInputManager.cc Outdated
@sphenix-jenkins-ci

Copy link
Copy Markdown

Build & test report

Report for commit 176ba1d92556b64985d3bdc373df9c7a33d1c479:
Jenkins on fire


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@sphenix-jenkins-ci

Copy link
Copy Markdown

Build & test report

Report for commit cbf93806fb70d149f66ba55bc4285dce35cb6779:
Jenkins passed


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

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