From 255272e0edbcdb0fdb179605d9b11ecd9577d426 Mon Sep 17 00:00:00 2001 From: Gianluca Petrillo Date: Tue, 25 Apr 2023 13:38:05 -0500 Subject: [PATCH] Fix a bug in PMT digitization The algorithm creating readout buffers (future `raw::OpDetWaveform`) from the continuous readout was written expecting (and asserting) that a trigger primitive can't be at the first tick of the enable gate. This was a reasonable assumption when the trigger algorithm looked for a transition from the previous tick from below to above threshold. Now an alternative algorithm is also available which considers just the value of the sample compared to the threshold, so that expectation is violated and the assertion failed. A small change in the algorithm makes it robust to that rare occurrence. --- icaruscode/PMT/Algorithms/PMTsimulationAlg.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/icaruscode/PMT/Algorithms/PMTsimulationAlg.cxx b/icaruscode/PMT/Algorithms/PMTsimulationAlg.cxx index 2ca5e229c..f318fcf94 100644 --- a/icaruscode/PMT/Algorithms/PMTsimulationAlg.cxx +++ b/icaruscode/PMT/Algorithms/PMTsimulationAlg.cxx @@ -560,7 +560,7 @@ icarus::opdet::PMTsimulationAlg::CreateFixedSizeOpDetWaveforms std::vector buffers; buffers.reserve(std::distance(iNextTrigger, tend)); // worst case - auto lastBufferEnd { firstTick }; + auto lastBufferEnd{ firstTick - detinfo::timescales::optical_time_ticks{ 1 }}; while (iNextTrigger != tend) { BufferRange_t const buffer = makeBuffer(*iNextTrigger);