charge_reco in workflow.py, followed by charge_reco_whole for cross-module steps. The key modules are hit_finder.py, track_2d.py, track_3d.py, stitch_tracks.py, and single_hits.py.
Hit Finding
mask_daq) defines candidate regions. Only regions with at least dt_min = 10 samples are considered.
Algorithm per channel:
- Identify contiguous ROI intervals using
np.diffon the boolean mask. - For induction channels, adjacent positive and negative ROI intervals separated by fewer than
merge_tdc_thr = 10samples are merged into a single candidate. - The ADC excerpt is passed to
hit_search, which dispatches to eitherhit_search_collection_nborhit_search_induction_nbdepending on the view type. - Padding is added to each found hit:
- Left: up to
pad_left = 10samples (stops at another hit boundary) - Right: up to
pad_right = 20samples
- Left: up to
- Collection view: two thresholds used by the algorithm —
thr1 = 2.5 × RMS(lower, starts the hit) andthr2 = 5.5 × RMS(used to split overlapping pulses). - Induction view: single threshold
thr3 = 2.0 × RMSfor bipolar hit detection. min_thr = 0.5ADC sets an absolute floor so that thresholds cannot go below this value even on very quiet channels.
R-Tree Spatial Index
(module, view, X-position, Z-position). This index is queried throughout 2D tracking and single-hit finding for fast range searches.
2D Track Finding (Hough Transform)
hough_win_X = 10 cm in X and hough_win_Z = 20 cm in Z using the R-tree. At least hough_n_min = 5 hits must be present to proceed.
The Hough transform is computed over these neighbouring hits:
hough_min_score = 4 are rejected.
Phase 2: Kalman-style extension
Once a seed is found, hits are added one at a time in order of proximity. A hit is accepted if:
- Its Kalman
chi2improvement is belowchi2cut = 8.0 - It is not further than
max_gap = 2.0 cmfrom the predicted position - Its direction is consistent with the current track slope
refilter_and_find_drays runs a spline fit on the assembled hits and identifies delta-ray candidates using:
- A minimum spanning tree (MST) to find branching points
- Distance from the spline (
dray_thr = 2.0 cmtodray_dmax = 6.0 cm) to classify hits as delta rays
min_nb_hits = 5 hits or slopes exceeding slope_max = 50 are discarded.
Default parameters:
2D Track Stitching (Within Module)
- Alignment: The dot product of the direction vectors must exceed
align_thr = 0.98. - Distance of minimum approach (DMA): All four endpoint-to-segment distances must be below
dma_thr = 3.0 cm(for overlapping tracks). - Endpoint distance: Track endpoints must be within
dist_thr = 10.0 cm(for non-overlapping tracks).
tracks2D_compatibility, and connected components in the compatibility graph are merged together.
from_3d) is also available with relaxed thresholds (align_thr = 0.96, dma_thr = 8.0, dist_thr = 15.0) and is invoked from inside the 3D builder when two same-view tracks appear to belong to the same 3D track.
3D Track Reconstruction
trk_ztol = 3.0 cm. Only tracks satisfying minimum quality cuts are considered:
- Straight-line length ≥
len_min = 2.0 cm - Z extent ≥
trk_min_dz = 15.0 cm - X extent ≥
trk_min_dx = 8.0 cm
complete_trajectories)
For each matched set of three 2D tracks, 3D positions are computed iteratively: each point on one track is combined with the splined position of the other tracks at the same Z, solving the 2×2 linear system from wire view geometry:
check_track_3D)
DBSCAN is applied to all 3D points (with eps = 10, min_samples = 1). Tracks with more than 2 significant clusters are rejected. Outlier hits from small clusters are removed.
Step 5: Track finalisation (finalize_3d_track)
Splines are fitted to the 3D trajectory in Z slices, and the average cross-view point spread d_match is computed. Tracks exceeding d_slice_max = 20 cm are rejected.
3D Track Reconstruction with Missing View
None view are considered.
Additional quality requirements specific to this mode:
r_z_thr = 0.8: the ratio of Z overlap to total Z extent must exceed this value.q_thr = 0.15: each track must contribute at least 15% of the total charge in the overlap region.
Cross-Module Track Stitching
After all individual modules have been processed,charge_reco_whole performs detector-level 3D stitching.
Module-to-module stitching (stitch3D_across_modules):
Tracks near module boundaries (within boundary_tol = 5.0 cm) are tested for pairwise compatibility:
- Endpoint distance: at least one pair of endpoints within
dist_thr = 8.0 cm - Alignment: direction vector dot product above
align_thr = 0.98
module_crosser flag set at the crossing point.
Cathode stitching (stitch3D_across_cathode):
Tracks from opposite drift volumes are tested as cathode-crossers. The test checks alignment plus two cases:
- Early/on-time: The absolute Z distance between endpoints is within
dz_thresh = 10.0 cm, and the X/Y offsets are withindx_thresh = 10.0 cmanddy_thresh = 10.0 cm. - Late: Both endpoints are near the cathode plane (maximum drift distance), and the X/Y displacement ratio matches the expected geometric relationship from the track angle.
cathode_crosser_ID.
| Detector | Module stitching | Cathode stitching |
|---|---|---|
| PDHD | [0,1] then [2,3] | [[0,1], [2,3]] |
| PDVD | [0,1] then [2,3] | [[2,3], [0,1]] |
Track Timing
t0.
Single-Hit (Blip) Finder
cluster_eps = 2.0 cm. Clusters with more than max_per_view = 3 hits are discarded as being too large to be a point-like deposition.
Step 2: Cross-view time matching
For each clustered free hit, an R-tree search finds hits in the other two views that overlap in time. View-level compatibility checks filter the candidates.
Step 3: 3D position resolution
Compatible hits from all three views are passed to h3d.compute_xy to solve for the 3D intersection point. Combinations where any view hit is more than outlier_dmax = 2.5 cm from the median position are rejected.
Step 4: Veto and storage
A spatial veto checks for other activity within dist_veto = 5.0 cm of the candidate blip using the R-tree. Single hits with a barycentric spread exceeding max_bary = 20.0 cm are discarded. Passing candidates are stored as singleHits objects with their 3D position, charge, and distances to the nearest 3D track.