From b3c78ad0d302ecd5d2a3e058fcbb50c0649b62ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B5=B7?= Date: Wed, 13 May 2026 10:37:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AC=A6=E5=90=88=E8=83=BD?= =?UTF-8?q?=E8=B0=B1=E5=8A=A0=E8=BD=BD=E5=8A=A8=E7=94=BB=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ConformToTheEnergySpectrum.cpp | 36 ++++++------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/src/ConformToTheEnergySpectrum/ConformToTheEnergySpectrum.cpp b/src/ConformToTheEnergySpectrum/ConformToTheEnergySpectrum.cpp index 6216766..6ff9bcf 100644 --- a/src/ConformToTheEnergySpectrum/ConformToTheEnergySpectrum.cpp +++ b/src/ConformToTheEnergySpectrum/ConformToTheEnergySpectrum.cpp @@ -86,10 +86,10 @@ void ConformToTheEnergySpectrum::SetAnalyzeDataFilename(const QMapStart(); auto functionToRun = [this]() { - if (_data_filename.isEmpty()) return; - - _busy_indicator->Start(); + if (_data_filename.isEmpty()) + return; std::vector rawData; io::CSVReader<4> in(QStrToSysPath(_data_filename)); @@ -112,34 +112,16 @@ void ConformToTheEnergySpectrum::loadAndProcess() } if (rawData.empty()) { - _busy_indicator->Stop(); + QMetaObject::invokeMethod(this, [this]() { + _busy_indicator->Stop(); + }, Qt::QueuedConnection); return; } - // const uint64_t TIME_WINDOW_NS = 50; - // const int MIN_ORDER = 2; - // const int MAX_ORDER = 9; - // std::vector coincidences = processCoincidence(rawData, TIME_WINDOW_NS, MIN_ORDER, MAX_ORDER); - - // if (coincidences.empty()) { - // _busy_indicator->Stop(); - // return; - // } - - // const int STEP = 1; - // std::map hist; - - // for (const auto& ev : coincidences) { - // for (const auto& spdt : ev.events) { - // int idx = static_cast(spdt.energy) / STEP; - // hist[idx] += 1.0; - // } - // } - const int STEP = 1; std::map hist; - for (const auto& spdt : rawData) { + for (const SpectrumData& spdt : rawData) { int idx = static_cast(spdt.energy) / STEP; hist[idx] += 1.0; } @@ -151,7 +133,9 @@ void ConformToTheEnergySpectrum::loadAndProcess() } if (vx.isEmpty()) { - _busy_indicator->Stop(); + QMetaObject::invokeMethod(this, [this]() { + _busy_indicator->Stop(); + }, Qt::QueuedConnection); return; }