2023-06-02 15:41:26 -04:00
|
|
|
#ifndef SINGLE_SPECTR_H
|
|
|
|
#define SINGLE_SPECTR_H
|
2023-05-17 17:40:32 -04:00
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QChart>
|
|
|
|
#include <QChartView>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QGridLayout>
|
|
|
|
#include <QGroupBox>
|
2024-04-05 22:33:05 -04:00
|
|
|
#include <QVector>
|
|
|
|
#include <QRandomGenerator>
|
2023-05-17 17:40:32 -04:00
|
|
|
|
|
|
|
#include "macro.h"
|
|
|
|
#include "ClassDigitizer.h"
|
|
|
|
#include "CustomThreads.h"
|
|
|
|
#include "CustomWidgets.h"
|
2023-06-02 18:13:47 -04:00
|
|
|
#include "Histogram1D.h"
|
2023-11-06 17:46:43 -05:00
|
|
|
#include "Histogram2D.h"
|
2023-05-17 17:40:32 -04:00
|
|
|
|
2024-08-28 16:45:23 -04:00
|
|
|
class HistWorker; //Forward decalration
|
2023-05-17 17:40:32 -04:00
|
|
|
|
|
|
|
//^====================================================
|
|
|
|
//^====================================================
|
2023-06-02 15:41:26 -04:00
|
|
|
class SingleSpectra : public QMainWindow{
|
2023-05-17 17:40:32 -04:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2023-06-02 15:41:26 -04:00
|
|
|
SingleSpectra(Digitizer ** digi, unsigned int nDigi, QString rawDataPath, QMainWindow * parent = nullptr);
|
|
|
|
~SingleSpectra();
|
|
|
|
|
2023-08-16 17:54:35 -04:00
|
|
|
void ClearInternalDataCount();
|
2024-08-28 16:45:23 -04:00
|
|
|
// void SetFillHistograms(bool onOff) { fillHistograms = onOff;}
|
|
|
|
// bool IsFillHistograms() const {return fillHistograms;}
|
2023-06-02 15:41:26 -04:00
|
|
|
|
|
|
|
void LoadSetting();
|
|
|
|
void SaveSetting();
|
2023-05-17 17:40:32 -04:00
|
|
|
|
2024-03-22 12:43:17 -04:00
|
|
|
void SetMaxFillTime(unsigned short milliSec) { maxFillTimeinMilliSec = milliSec;}
|
|
|
|
unsigned short GetMaxFillTime() const {return maxFillTimeinMilliSec;};
|
|
|
|
|
2024-04-05 22:33:05 -04:00
|
|
|
QVector<int> generateNonRepeatedCombination(int size);
|
|
|
|
|
2024-09-23 11:20:31 -04:00
|
|
|
void ReplotHistograms();
|
|
|
|
|
2024-08-28 17:58:12 -04:00
|
|
|
public slots:
|
|
|
|
void FillHistograms();
|
|
|
|
void ChangeHistView();
|
2024-08-30 12:27:24 -04:00
|
|
|
void startTimer(){
|
2024-08-28 16:53:25 -04:00
|
|
|
// printf("timer start\n");
|
2024-08-28 16:45:23 -04:00
|
|
|
timer->start(maxFillTimeinMilliSec);
|
|
|
|
}
|
2024-08-30 12:27:24 -04:00
|
|
|
void stopTimer(){
|
2024-08-28 16:53:25 -04:00
|
|
|
// printf("timer stop\n");
|
2024-08-28 16:45:23 -04:00
|
|
|
timer->stop();
|
|
|
|
ClearInternalDataCount();
|
|
|
|
}
|
|
|
|
|
2024-08-28 17:58:12 -04:00
|
|
|
private:
|
2024-08-28 16:45:23 -04:00
|
|
|
|
2024-08-28 17:58:12 -04:00
|
|
|
Digitizer ** digi;
|
|
|
|
unsigned short nDigi;
|
2024-08-28 16:45:23 -04:00
|
|
|
|
2024-08-28 17:58:12 -04:00
|
|
|
int lastFilledIndex[MaxNDigitizer][MaxNChannels];
|
|
|
|
int loopFilledIndex[MaxNDigitizer][MaxNChannels];
|
|
|
|
bool histVisibility[MaxNDigitizer][MaxNChannels];
|
|
|
|
bool hist2DVisibility[MaxNDigitizer];
|
|
|
|
unsigned short maxFillTimePerDigi;
|
|
|
|
|
|
|
|
bool isFillingHistograms;
|
|
|
|
Histogram1D * hist[MaxNDigitizer][MaxNChannels];
|
|
|
|
Histogram2D * hist2D[MaxNDigitizer];
|
2023-11-06 17:46:43 -05:00
|
|
|
|
2023-05-19 16:23:04 -04:00
|
|
|
|
2024-08-28 17:58:12 -04:00
|
|
|
QCheckBox * chkIsFillHistogram;
|
|
|
|
|
2023-05-19 16:23:04 -04:00
|
|
|
RComboBox * cbDivision;
|
|
|
|
|
|
|
|
RComboBox * cbDigi;
|
|
|
|
RComboBox * cbCh;
|
|
|
|
|
|
|
|
QGroupBox * histBox;
|
|
|
|
QGridLayout * histLayout;
|
|
|
|
int oldBd, oldCh;
|
2023-05-17 17:40:32 -04:00
|
|
|
|
2024-06-17 17:44:31 -04:00
|
|
|
QString settingPath;
|
2023-06-02 15:41:26 -04:00
|
|
|
|
2024-03-22 12:43:17 -04:00
|
|
|
unsigned short maxFillTimeinMilliSec;
|
|
|
|
|
2023-10-26 17:57:06 -04:00
|
|
|
bool isSignalSlotActive;
|
|
|
|
|
2024-08-28 16:45:23 -04:00
|
|
|
QThread * workerThread;
|
|
|
|
HistWorker * histWorker;
|
|
|
|
QTimer * timer;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
//^#======================================================== HistWorker
|
|
|
|
class HistWorker : public QObject{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
HistWorker(SingleSpectra * parent): SS(parent){}
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void FillHistograms(){
|
2024-08-28 17:58:12 -04:00
|
|
|
SS->FillHistograms();
|
2024-08-28 16:45:23 -04:00
|
|
|
emit workDone();
|
|
|
|
}
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void workDone();
|
|
|
|
|
|
|
|
private:
|
|
|
|
SingleSpectra * SS;
|
2023-05-17 17:40:32 -04:00
|
|
|
};
|
2024-08-28 16:45:23 -04:00
|
|
|
|
2023-05-17 17:40:32 -04:00
|
|
|
#endif
|