Skip to content

feat(reco): make SecondaryVerticesHelix variadic and add far-forward-inclusive output - #2928

Draft
wdconinc with Copilot wants to merge 5 commits into
mainfrom
copilot/modify-secondaryverticeshelix-algorithm
Draft

feat(reco): make SecondaryVerticesHelix variadic and add far-forward-inclusive output#2928
wdconinc with Copilot wants to merge 5 commits into
mainfrom
copilot/modify-secondaryverticeshelix-algorithm

Conversation

Copilot AI commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Briefly, what does this PR introduce? Please link to any relevant presentations or discussions.

This updates SecondaryVerticesHelix to consume a positional primary-vertex input plus a variadic set of reconstructed-particle collections, then adds SecondaryVerticesHelixInclFarForward to include B0-adjacent forward detectors (Roman pot and off-momentum) with zero-field treatment in forward inputs.

  • Algorithm contract

    • SecondaryVerticesHelix input signature changed from one particle collection to variadic particle collections.
    • Primary vertex input remains positional and unchanged.
  • Factory wiring

    • SecondaryVerticesHelix_factory now uses variadic PODIO input for reconstructed particles.
    • The factory forwards all reconstructed-particle collections to the algorithm.
  • Forward-field handling

    • Tracks from the first (central) particle collection use the vertex-sampled magnetic field.
    • Tracks from additional far-forward collections use B=0 to match forward-region conditions.
  • New collection

    • Added SecondaryVerticesHelixInclFarForward in src/global/reco/reco.cc with inputs:
      • PrimaryVertices
      • ReconstructedParticles
      • ForwardRomanPotRecParticles
      • ForwardOffMRecParticles
app->Add(new JOmniFactoryGeneratorT<SecondaryVerticesHelix_factory>(
    "SecondaryVerticesHelixInclFarForward",
    {"PrimaryVertices", "ReconstructedParticles", "ForwardRomanPotRecParticles",
     "ForwardOffMRecParticles"},
    {"SecondaryVerticesHelixInclFarForward"}, {}, app));

What is the urgency of this PR?

  • High (please describe reason below)
  • Medium
  • Low

What kind of change does this PR introduce?

  • Bug fix (issue #__)
  • New feature (issue #__)
  • Optimization (issue #__)
  • Updated parameters, constants (issue #__)
  • Updated documentation
  • other: __

Please check if any of the following apply

  • This PR requires changes to geometry (epic PR: __)
  • This PR requires changes to EDM4eic (EDM PR: __)
  • This PR introduces breaking changes. Please describe changes users need to make below.
  • This PR changes default behavior. Please describe changes below.
  • AI was used in preparing this PR. Please describe usage below.
    AI assistance was used to implement the factory/algorithm interface update and plugin wiring.

Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com>
Copilot AI changed the title feat(reco): add far-forward-inclusive SecondaryVerticesHelix inputs feat(reco): make SecondaryVerticesHelix variadic and add far-forward-inclusive output Aug 31, 2026
Copilot AI requested a review from wdconinc August 31, 2026 17:36

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

⚠️ Clang-Tidy found issue(s) with the introduced code (1/1)

const auto& p1 = candidates[i1].particle;
const auto& p2 = candidates[i2].particle;

if (!(m_cfg.unlikesign && p1.getCharge() + p2.getCharge() == 0))

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.

⚠️ readability-simplify-boolean-expr ⚠️
boolean expression can be simplified by DeMorgan's theorem

Suggested change
if (!(m_cfg.unlikesign && p1.getCharge() + p2.getCharge() == 0))
if (!m_cfg.unlikesign || p1.getCharge() + p2.getCharge() != 0)

Comment thread src/algorithms/reco/SecondaryVerticesHelix.cc Outdated
Comment thread src/algorithms/reco/SecondaryVerticesHelix.cc
@@ -110,8 +115,8 @@
continue;
edm4hep::Vector3f pairPos = 0.5 * (h1AtDcaTo2 + h2AtDcaTo1);

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.

⚠️ readability-braces-around-statements ⚠️
statement should be inside braces

Suggested change
edm4hep::Vector3f pairPos = 0.5 * (h1AtDcaTo2 + h2AtDcaTo1);
}
edm4hep::Vector3f pairPos = 0.5 * (h1AtDcaTo2 + h2AtDcaTo1);

Comment on lines 55 to 58
auto field = fieldObj.magneticField(
{pVtxPos4f.x / edm4eic::unit::mm * dd4hep::mm, pVtxPos4f.y / edm4eic::unit::mm * dd4hep::mm,
pVtxPos4f.z / edm4eic::unit::mm * dd4hep::mm}); // in unit of dd4hep::tesla
float b_field = field.z();

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.

Hmm, I see, so this picks the field at the primary vertex, and uses that as an approximation for the field for the secondary vertex as well, not ideal, and certainly won't use the correct field at the far forward vertices without the index shenanigans below.

wdconinc and others added 2 commits August 31, 2026 13:00
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

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

⚠️ Clang-Tidy found issue(s) with the introduced code (1/1)

const auto& p2 = candidates[i2].particle;

if (!(m_cfg.unlikesign && p1.getCharge() + p2.getCharge() == 0))
if (!(m_cfg.unlikesign && p1.getCharge() + p2.getCharge() == 0)) {

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.

⚠️ readability-simplify-boolean-expr ⚠️
boolean expression can be simplified by DeMorgan's theorem

Suggested change
if (!(m_cfg.unlikesign && p1.getCharge() + p2.getCharge() == 0)) {
if (!m_cfg.unlikesign || p1.getCharge() + p2.getCharge() != 0) {

…inclusive output (fix: iwyu) (#2929)

This PR applies the include-what-you-use fixes as suggested by
https://github.com/eic/EICrecon/actions/runs/33422690879.
Please merge this PR into the branch
`copilot/modify-secondaryverticeshelix-algorithm`
to resolve failures in PR #2928.

Auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

4 participants