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; }