Skip to content

fix: improved charge sign determination#4130

Merged
osbornjd merged 1 commit intosPHENIX-Collaboration:masterfrom
osbornjd:improve_charge_sign
Jan 21, 2026
Merged

fix: improved charge sign determination#4130
osbornjd merged 1 commit intosPHENIX-Collaboration:masterfrom
osbornjd:improve_charge_sign

Conversation

@osbornjd
Copy link
Copy Markdown
Contributor

@osbornjd osbornjd commented Jan 20, 2026

This PR changes the charge sign determination in the track seed track parameter determination by taking the first and last cluster in the seed instead of the first and second cluster. That maximizes the lever arm and decreases the wrong charge sign assignment.

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, ...)

TODOs (if applicable)

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

Pull Request Summary: Improved Charge Sign Determination

Motivation / Context

This PR addresses a bug in the charge sign determination logic for track seed parameter estimation. The original implementation used the first and second clusters in a seed to determine the charge sign. However, this approach has a limited lever arm and can lead to incorrect charge sign assignments, particularly for seeds with limited spatial resolution or close cluster separations. By using the first and last clusters instead, the implementation maximizes the lever arm and improves the robustness of charge sign determination.

Key Changes

  • Modified charge sign calculation: In TrackSeedHelper::circleFitByTaubin(), replaced the selection of the first two clusters with the first and last clusters from the seed trajectory
    • Changed from: second position = *(positions_2d.begin() + 1)
    • Changed to: second position = *(positions_2d.rbegin())
  • This modification affects the computed azimuthal angles (firstphi and secondphi) based on the radial position vectors from the circle center
  • The delta phi (dphi) computation between first and last cluster angles now has maximum separation, improving charge sign determination accuracy
  • All other circle fitting logic and algorithms remain unchanged

Lines changed: +2/-2

Potential Risk Areas

  • Reconstruction behavior: This change directly affects track charge sign assignment, which is fundamental to track reconstruction. Seeds with incorrect charge assignments from using close clusters may now receive correct assignments, but edge cases with very few clusters (<3) will not be affected due to the existing size check
  • Kinematic properties: Tracks with incorrect charge signs will now be corrected, affecting downstream analyses that depend on charge-sensitive parameters (e.g., momentum measurements, curvature interpretation)
  • Performance: Minimal expected impact; the change only affects array access patterns (using reverse iterator instead of index-based access)
  • Data format/IO: No changes to data storage formats or serialization; only affects runtime charge sign computation

Possible Future Improvements

  • Add comprehensive validation studies comparing charge sign accuracy before and after this change, particularly for low-momentum tracks or seeds with limited cluster coverage
  • Consider alternative charge sign determination strategies that use all available clusters with spatial-separation-weighted contributions
  • Add physics QA histograms to monitor charge sign assignment efficiency and misidentification rates in reconstructed track samples
  • Investigate potential correlations between charge sign determination robustness and cluster multiplicity

Note: AI summary analysis is provided as reference. Please review the actual code changes and conduct appropriate physics validation given the critical nature of charge sign determination in track reconstruction.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 20, 2026

📝 Walkthrough

Walkthrough

The circleFitByTaubin function in TrackSeedHelper now selects the first and last 2D positions from the input array to define reference angles, replacing the previous logic that used the first two elements. This modification cascades through subsequent phi and dphi calculations, ultimately affecting the sign determination of the charge-to-momentum ratio.

Changes

Cohort / File(s) Summary
Circle Fit Geometry
offline/packages/trackbase_historic/TrackSeedHelper.cc
Modified position selection strategy in circleFitByTaubin: now uses endpoints (first and last) instead of adjacent initial elements to compute reference angles firstphi and secondphi, impacting downstream dphi and qOverR sign logic
✨ Finishing touches
  • 📝 Generate docstrings

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 7c3201954d3f506ad240cb3af4004d9e3e31be08:
Jenkins passed


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@osbornjd osbornjd merged commit ab0c1db into sPHENIX-Collaboration:master Jan 21, 2026
22 checks passed
@osbornjd osbornjd deleted the improve_charge_sign branch January 21, 2026 12:14
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.

1 participant