An eightfold equivalence-preserving speedup of the JUNO OMILREC vertex and energy reconstruction
The Jiangmen Underground Neutrino Observatory (JUNO) reconstructs each event's vertex and energy with OMILREC, a maximum-likelihood fit that scans all $17{,}612$ large photomultiplier tubes (LPMTs) in every Minuit function evaluation, about $470$ times per event. This inner loop dominates the reconstruction CPU cost. Profiling shows that the production algorithm is latency-bound, sustaining only $9.9%$ of scalar floating-point peak because of virtual-function dispatch, ROOT-histogram pointer chasing, and repeated computation. We apply staged \emph{equivalence-preserving} optimizations: flattened data layouts, vectorizable geometry, hoisting of Minuit-invariant work, per-event precomputation, fit-phase loop splitting and indexing, and reduced-precision fast paths. Each stage is checked against a frozen reference from the unmodified code. The optimized implementation achieves single-thread speedups of $8.06\times$ ($1524.8 \rightarrow 189.2$~ms/event) on an Intel Xeon Platinum~8358P and $5.22\times$ ($705.1 \rightarrow 134.9$~ms/event) on an AMD~EPYC~9654, increasing to $8.6\times$ ($177.7$~ms/event) after further optimization. The likelihood remains bit-identical through the first seven releases and later agrees within a relative drift of $1.3\times10^{-14}$, below the $10^{-13}$ contract. For typical events, reconstructed vertex and energy agree with the baseline within $4$~mm and $7$~keV; a few boundary cases reach different valid minima owing to an improved minimizer seed. An eight-metric physics-acceptance test also passes on about $861{,}000$ $^{68}$Ge calibration events. Developed with assistance from an AI coding agent operating under these verification gates, this workflow offers a transferable template for accelerating likelihood-based reconstruction in large neutrino and collider detectors without changing physics output.