We present a pipeline for fast GRB source localization for the Advanced Particle-astrophysics Telescope. APT records multiple Compton scatterings of incoming photons across 20 CsI detector layers, from which we infer the incident angle of each photon's first scattering to localize its source direction to a circle centered on the vector formed by its first two scatterings. Circles from multiple photons are then intersected to identify their common source direction. Our pipeline, which runs in real time on low-power hardware, uses an efficient tree search to determine the most likely ordering of scatterings for each photon (which cannot be measured due to the coarse time-scale of detection), followed by likelihood-weighted averaging and iterative least-squares refinement to combine all circles into an estimated source direction. Uncertainties in the scattering locations and energy deposits require that our pipeline be robust to high levels of noise.
To test our methods, we reconstructed GRB events produced by a Geant4 simulation of APT's detectors paired with a second simulator that models measurement noise induced by the detector hardware. Our methods proved robust against noise and the effects of pair production, producing sub-degree localization for GRBs with fluence 0.3 MeV/cm^2. GRBs with fluence 0.03 MeV/cm^2 provided fewer photons for analysis but could still be localized within 2.5 degrees 68% of the time. Localization time for a 1-second 1.0 MeV/cm^2 GRB, measured on a quad-core, 1.4 GHz ARMv8 processor (Raspberry Pi 3B+), was consistently under 0.2 seconds — fast enough to permit real-time redirection of other instruments for follow-up observations.