Skip to content

Fix merge conflicts.#43

Open
LucasEhinger wants to merge 16 commits into
JeffersonLab:mainfrom
LucasEhinger:main
Open

Fix merge conflicts.#43
LucasEhinger wants to merge 16 commits into
JeffersonLab:mainfrom
LucasEhinger:main

Conversation

@LucasEhinger

Copy link
Copy Markdown
Contributor

Restructure Ladhodo and lad kin
--Rather than copying the goodladhits from lad hodo and having almost an exact duplicate for ladkin, the ladkin variables are removed, and ladkin only modifies the ladhod variables. All final variables now live in ladhod. Added a chi-quare and is_proton variable to the goodladhit.

Accidentally auto-formatted LADKine in this commit, hence the large diff. Will attempt to break into two commits later.

TODO:
--Add a proton cut to ladkin.
--Add GEM timing cut (need to be careful with background subtraction, to not just kill sidebands)
--Other todo's in Ching Him's tracking PR

LucasEhinger and others added 16 commits May 21, 2026 16:05
Restructure Ladhodo and lad kin
--Rather than copying the goodladhits from lad hodo and having almost an exact duplicate for ladkin, the ladkin variables are removed, and ladkin only modifies the ladhod variables. Added a chi-quare and is_proton variable to the goodladhit.

Accidentally auto-formatted LADKine in this commit, hence the large diff. Will attempt to break into two commits later.

TODO:
--Add a proton cut to ladkin.
--Clean up once functionality is verified (beyond just compiling)
--Other todo's in Ching Him's tracking PR
Didn't cause errors with gcc, but stricter clang threw errors.
… in MeV and add corresponding getters/setters
--Front plane uses a minimum edep cut. We don't want to use time information, as it introduces a non-flat random cooincidence background, which makes it difficult to subtract sidebands
--Back plane isolates top right part of "banana"
Normalize formatting of the files touched by the tracking work so that the
subsequent bug-fix and feature commits contain only logical changes. No
behavior change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The D0 range check assigned `isGood && true` (a no-op), so d0_cut_wVertex /
d0_cut_noVertex never rejected any track. Set is_good=false when D0 falls
outside the allowed range.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The within-paddle chi2 zeroing used `i > 2`, skipping the first hodo hit
(index 2) and applying only to the second. Use `i >= 2` so both hodoscope
hits are treated consistently.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fVertexModule is only set when a vertex-module name is configured; guard the
HasVertex() dereference so an empty vertex_module argument cannot segfault.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Prevents a never-written entry from being read as uninitialized memory if the
hypothesis-selection invariants ever change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The track-constraint keys were prefixed 'ladkin.', which combined with the 'l'
database prefix produced 'lladkin.*' and never matched. Use clean names
(z_cell_min, theta_min, ...) and add sigma_gem/sigma_hodo to the DB request.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Bundle the RF-timing integrity fixes:
- Guard the RF-offset table lookup against out-of-bounds indices (runs before
  the first offset row, or n_rf_offsets==0) and default to a safe run number
  when gen_run_number is unavailable.
- Stop Clear() from zeroing the DB-loaded rf_offset table every event, which
  corrupted the per-run offset lookup.
- Wrap the RF phase with std::remainder (range [-period/2, +period/2]) instead
  of fmod plus a hardcoded threshold.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
FitTrack created and destroyed a Minuit2 minimizer on every call (once per
hodoscope hit, per track). Keep one reusable fMinimizer member instead:
Clear() it between fits, allocate lazily, and delete it in the destructor.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The per-track loops leave the vertex member in a track-dependent state, so the
hit ToF RF correction used a stale/arbitrary vertex z. Refresh vertex from the
reaction point before the ToF loop, and reset it in Clear().

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Reconstruct proton tracks from GEM1, GEM2 and the hodoscope hit(s) WITHOUT
constraining the track to the target vertex, in parallel to the existing
vertex-constrained tracking.

- FitTrack_noTrackVertex: free 3D-line fit (4 DOF), anchored at the GEM1
  x-plane (single-valued over the LAD acceptance); all points weighted.
- Second track loop in Process(): requires >=1 hodoscope hit, selects the best
  hodo hypothesis, reprojects to the beamline (proj vertex + impact-parameter
  D0), and flags good tracks.
- THcLADGEMTrack: parallel *_noTrackVertex track quantities + accessors.
- THcGoodLADHit: per-hit track_id / trk_chiSqr _noTrackVertex associations.
- Tree branches: trk.*_noTrackVertex (GEM) and goodhit_*_noTrackVertex (hodo).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add two tracking passes that fit only the x and z coordinates, dropping the y residual from the chi-square. These parallel the existing 3D fits:

  vertex-constrained, x-z   -> _xz
  no-vertex,          x-z   -> _noTrackVertex_xz

FitTrack and FitTrack_noTrackVertex gain a `use_y` parameter (default
true). When false, the (dy)^2 term is dropped and the no-vertex
GEM-pointing pre-check uses the x-z separation; the 3D closest-approach
and paddle-width zeroing are unchanged. Existing call sites use the
default, so the current 3D code paths are unaffected.

Process() gains two loops (clones of the vertex and no-vertex loops)
that call the fits with use_y=false and store the _xz results, including
per-hit track_id/trk_chiSqr associations. No new database parameters --
the existing D0/chisq/dt cuts are reused.

New tree variables: trk.*_xz, trk.*_noTrackVertex_xz (THcLADGEM) and
goodhit_*_xz (THcLADHodoscope).

Note: in the no-vertex x-z fit y0/phi are only weakly constrained, so
D0_noTrackVertex_xz (and the is_good cut using it) still carries the
GEM-seeded y via the reprojection formula.

Files: THcLADKine.{h,cxx}, THcLADGEMTrack.{h,cxx}, THcGoodLADHit.h,
THcLADGEM.cxx, THcLADHodoscope.cxx

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
LAD tracking: vertex-independent tracking and bug fixes
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