From d6ef283eeb46555e758654631b61a2af0ae162c6 Mon Sep 17 00:00:00 2001 From: Mathieu Ouillon Date: Thu, 23 Jul 2026 11:08:07 -0400 Subject: [PATCH] fix: guard fADC pulse fitting against channels missing from CCDB /daq/fadc config PR #1323 replaced the per-detector `fitterTables` loop in `DetectorEventDecoder.fitPulses` with a direct table lookup and, in doing so, dropped the `hasEntryByHash(hash)` guard that previously protected the `nsa`/`nsb`/`tet`/`pedestal` reads. Because `IndexedTable.getIntValueByHash` does not null-check its internal map lookup, a decoded ADC hit whose `(crate,slot,channel)` is present in `/daq/tt/` but absent from the corresponding `/daq/fadc/` table now unboxes a null `Integer` and throws `NullPointerException` on every such hit. Restore the guard: skip channels that have no FADC config entry, matching the pre-#1323 (14.1.1) behavior. Reproduced on RG-L run 23061: `/daq/tt/ltcc` maps ADC channel (crate 19, slot 18, chan 150) to LTCC sector 4, but `/daq/fadc/ltcc` has no row for it, so 1999/2000 decoded events threw NPE with 14.1.2. With the guard restored the same 2000 events decode cleanly (0 NPE). --- .../java/org/jlab/detector/decode/DetectorEventDecoder.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common-tools/clas-detector/src/main/java/org/jlab/detector/decode/DetectorEventDecoder.java b/common-tools/clas-detector/src/main/java/org/jlab/detector/decode/DetectorEventDecoder.java index ff2d6f2ad8..20a2a64739 100644 --- a/common-tools/clas-detector/src/main/java/org/jlab/detector/decode/DetectorEventDecoder.java +++ b/common-tools/clas-detector/src/main/java/org/jlab/detector/decode/DetectorEventDecoder.java @@ -207,6 +207,9 @@ public void translate(List detectorData){ private void fitPulses(DetectorDataDgtz data, IndexedTable cfg) { final DetectorDescriptor dd = data.getDescriptor(); final long hash = IndexedTable.DEFAULT_GENERATOR.hashCode(dd.getCrate(), dd.getSlot(), dd.getChannel()); + // Guard re-added (was removed in PR #1323): skip channels with no FADC config entry, + // otherwise getIntValueByHash returns null and NPEs (e.g. LTCC crate 19 / slot 18 / chan 150). + if (!cfg.hasEntryByHash(hash)) return; final int nsa = cfg.getIntValueByHash("nsa", hash); final int nsb = cfg.getIntValueByHash("nsb", hash); final int tet = cfg.getIntValueByHash("tet", hash);