Skip to content

auto-hunt: ANALYSIS - open-ended reactions (no beam particle), 4 fixes (S1 4): R7-53 R7-32 R7-54 R7-58 - #1273

Open
DraTeots wants to merge 4 commits into
masterfrom
auto-hunt/analysis-open-ended
Open

DraTeots wants to merge 4 commits into
masterfrom
auto-hunt/analysis-open-ended

Conversation

@DraTeots

@DraTeots DraTeots commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

As the analysis maintainer asked in #1223, this pull request puts together the four analysis-library fixes that matter only for open-ended reactions (a reaction written without a beam particle, such as Lambda -> p pi-; the user opts in by writing it that way in the job options). It replaces #1202, #1219, #1220 and #1223, which will be closed with a link here.

These fixes come from the Hall D bug hunt, an autonomous campaign that read the GlueX software, built a test for every suspect line, and kept only findings confirmed by a measurement. Each commit fixes one finding and is named by its finding id and grade (S1 most serious, S4 least). Full cards with plots are on the campaign pages (JLab login): https://pages.jlab.org/halld/auto-hunt/index.html

What it fixes

For a user the four are one failure: a fitted beamless reaction crashes, and once the crashes are repaired its tree has no usable fitted Lambda. Only all fixes together give a usable tree.

finding grade what was wrong the fix
R7-53 S1 After the kinematic fit the code rebuilds the fitted Lambda at the vertex of the step that produced it. There is none, the lookup returns nothing, and the job crashes. Use the step's own vertex when there is no production step (DParticleComboCreator.cc).
R7-32 S1 The fit set-up never recognises the open-ended decaying particle of step 0 (the empty-initial-state test is always false), and the ReactionFilter missing-mass histogram reads a beam that is not there. Both crash the job. DKinFitUtils_GlueX.cc tests Get_InitialParticle(0) == nullptr; Create_MissingMassSquaredHistogram returns early when step 0 has no beam.
R7-54 S1 With the crashes repaired, the ROOT tree writer books beam branches for the Lambda, which nothing fills, and no Lambda branches ("CANNOT FILL DATA, BRANCH DecayingLambda__P4_KinFit DOES NOT EXIST" in every event). One condition in DEventWriterROOT.cc; it restores the Lambda branches and vertex.
R7-58 S1 The fitted Lambda is then written with zero momentum, (0, 0, 0, 1.115683 GeV) in 146 of 146 candidates: the code asks for it at its production point, which the fit never determined, and ignores the refusal. Keep the fitted values when the move to the other vertex is refused (DParticleComboCreator.cc).

By reading the code: R7-53, R7-32 and R7-54 act only when step 0 has no beam or no production step, so reactions with a beam are unchanged. R7-58 acts in any reaction where moving a fitted particle to the other vertex is refused; today that leaves its momentum at zero, and with the fix the fitted values are kept. The tests met that refusal only for the open-ended particle.

The plugins pull request #1252 carries R7-51, the ReactionFilter crash. Its changes are the same lines as R7-53 and R7-32 here, so whichever of the two pull requests is merged first, the other one adds nothing new to these files. We can take R7-51 out of #1252 if you prefer it only here.

How it was tested

Each card says how its finding was confirmed (simulated bggen, Lambda -> p pi- without a beam, a run before and after the fix on the same events). The four commits were applied on the current default branch in the order above, and every changed file passes a compile check against the release headers. A full build and run of this combination on the new base has not been done.


Created by Autonomous HallD "auto-hunt" campaign (executed by Claude)

🤖 Generated with Claude Code

DraTeots and others added 4 commits December 4, 2026 08:42
…DParticleComboCreator.cc:540) reads the vertex of the production step of step 0, which is NULL for an open-ended reaction

`libraries/ANALYSIS/DParticleComboCreator.cc:540`: when `locFromStepIndex` is negative (a step-0 decaying particle
with no production step), take the step's own spacetime vertex instead of dereferencing `Get_ParticleComboStep(-1)`.
One line; `:543` and `:551` of the same function already treat this case.
Card: https://pages.jlab.org/halld/auto-hunt/cards/r7-53-open-ended-fit-null-production-step/index.html
Evidence folder: https://code.jlab.org/halld/auto-hunt/-/tree/main/bughunt/confirmed/halld_recon/ANALYSIS/r7-53-open-ended-fit-null-production-step

Created by Autonomous HallD "auto-hunt" campaign (executed by Claude)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n-ended decaying initial particle (the empty-initial-state test is always false), so its step is left without a decaying particle

Three changes, run together:
- `DReaction_factory_ReactionFilter.cc`: return early from `Create_MissingMassSquaredHistogram` when the first step has
  no beam.
- `DKinFitUtils_GlueX.cc`: test `Get_InitialParticle(0) == nullptr` for the open-ended step-0 particle.
- `DParticleComboCreator.cc`: for a step-0 decaying particle (no production step) take the step's own vertex.

Effect, simulated bggen, 1000 events per job, Lambda -> p pi- without a beam: fitted jobs end in 4 of 4 (today 8 of 8
crash); 146 candidates written to the tree. Reactions with a beam are unchanged by reading. The tree writer still has no branch for
the fitted open-ended particle.
Card: https://pages.jlab.org/halld/auto-hunt/cards/r7-51-reactionfilter-open-ended-reaction-crash/index.html
Evidence folder: https://code.jlab.org/halld/auto-hunt/-/tree/main/bughunt/confirmed/halld_recon/plugins/r7-51-reactionfilter-open-ended-reaction-crash

Created by Autonomous HallD "auto-hunt" campaign (executed by Claude)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…icle of an open-ended reaction, so its fitted four-vector is lost ("CANNOT FILL DATA, BRANCH DecayingLambda__P4_KinFit DOES NOT EXIST" in every event)

`libraries/ANALYSIS/DEventWriterROOT.cc`, `Create_Branches_Combo`: step 0 takes the beam branches only when its
particle is a photon, electron or positron, the same test `Create_UserInfoMaps` uses to name it `ComboBeam`. Any other
step-0 particle (the decaying particle of an open-ended reaction) is booked as a decaying particle, so the branches
booked are the branches the filler fills. One condition; no other line. Reactions with a beam in step 0 take the same
branch as before.

This depends on the three crash fixes of the open-ended form (submitted separately): without them no fitted
open-ended tree is written and this line is not reached; without a fit the first of them is enough. The master patch applies at release 5.9.0
with an offset of -51 lines; `patches/r5.9.0.patch` is that form.
Card: https://pages.jlab.org/halld/auto-hunt/cards/r7-54-open-ended-step0-booked-as-beam/index.html
Evidence folder: https://code.jlab.org/halld/auto-hunt/-/tree/main/bughunt/confirmed/halld_recon/ANALYSIS/r7-54-open-ended-step0-booked-as-beam

Created by Autonomous HallD "auto-hunt" campaign (executed by Claude)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…le is written to the tree with zero momentum: DecayingLambda__P4_KinFit is (0, 0, 0, 1.115683 GeV) in 146 of 146 combos

`libraries/ANALYSIS/DParticleComboCreator.cc`, `Build_KinematicData`: the propagation to the other vertex is tried
only where it was tried before, and its return value is read; when it is not tried or is refused, the object takes the
fitted values as they are (the first branch, unchanged). Before, a refused propagation left the object from the
resource pool with momentum zero. Six lines added (two of them a comment), three removed; the branch that runs when
the propagation succeeds is unchanged.

This depends on the fixes of the open-ended form: packages `r7-51-reactionfilter-open-ended-reaction-crash` (R7-51,
R7-32), `r7-53-open-ended-fit-null-production-step` and `r7-54-open-ended-step0-booked-as-beam`. Without them no
open-ended combo is fitted and written. The patch itself applies at master alone; it is written against master
115209d (the measured step carried it one line lower, below a line the R7-53 fix adds in the same file). The file is
identical in release 5.9.0; `patches/r5.9.0.patch` is the same patch.
Card: https://pages.jlab.org/halld/auto-hunt/cards/r7-58-open-ended-step0-fit-momentum-zero/index.html
Evidence folder: https://code.jlab.org/halld/auto-hunt/-/tree/main/bughunt/confirmed/halld_recon/ANALYSIS/r7-58-open-ended-step0-fit-momentum-zero

Created by Autonomous HallD "auto-hunt" campaign (executed by Claude)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gluex

gluex commented Dec 4, 2026

Copy link
Copy Markdown

Test status for this pull request: SUCCESS

Summary: summary.txt
Logs: results/log

Build log: make_auto-hunt_analysis-open-ended.log
Build report: report_auto-hunt_analysis-open-ended.txt

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