2026-03-26 17:35:58 +08:00
|
|
|
|
#ifndef PARTICLEDATASTATISTICS_H
|
|
|
|
|
|
#define PARTICLEDATASTATISTICS_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
#include "DetectorStatusSummary.h"
|
2026-05-09 16:50:34 +08:00
|
|
|
|
//#include "CoincidenceSpectrumProcess.h"
|
2026-03-26 17:35:58 +08:00
|
|
|
|
#include <QMap>
|
2026-05-09 16:50:34 +08:00
|
|
|
|
//using namespace CoincidenceSpectrum;
|
2026-03-26 17:35:58 +08:00
|
|
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
|
|
class ParticleDataStatistics;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-09 16:50:34 +08:00
|
|
|
|
// 二次符合事件处理
|
|
|
|
|
|
namespace F2t9Order {
|
|
|
|
|
|
|
|
|
|
|
|
// 能谱数据结构
|
|
|
|
|
|
struct SpectrumData {
|
|
|
|
|
|
int board_id; // 板卡号
|
|
|
|
|
|
int channel_id; // 通道号
|
|
|
|
|
|
double energy; // 能量
|
|
|
|
|
|
unsigned long long timestamp; // 时间戳(纳秒)
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 符合事件结果结构
|
|
|
|
|
|
struct CoincidenceEvent {
|
|
|
|
|
|
int coincidence_order; // 符合次数(2-9)
|
|
|
|
|
|
std::vector<SpectrumData> events; // 符合的事件集合
|
|
|
|
|
|
unsigned int time_window; // 使用的时间窗口(秒)
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
// 定义板卡和通道的最大数量
|
|
|
|
|
|
static constexpr int MAX_BOARD = 8;
|
|
|
|
|
|
static constexpr int MAX_CHANNEL = 4;
|
2026-03-26 17:35:58 +08:00
|
|
|
|
class ParticleDataStatistics : public QWidget
|
|
|
|
|
|
{
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
explicit ParticleDataStatistics(QWidget *parent = nullptr);
|
|
|
|
|
|
~ParticleDataStatistics();
|
|
|
|
|
|
void setWidgetData(int board, int channel, int countNum, int secondNum);
|
|
|
|
|
|
|
|
|
|
|
|
void setInitWidgetData(int board, int channel, int countNum, int secondNum);
|
|
|
|
|
|
|
|
|
|
|
|
//处理板卡信息
|
|
|
|
|
|
void handleBoard(std::vector<F2t9Order::SpectrumData> eventData);
|
|
|
|
|
|
//设置数据
|
|
|
|
|
|
void setCoincidenceEvent(const F2t9Order::CoincidenceEvent &CoincidenceEvent);
|
2026-05-20 17:53:49 +08:00
|
|
|
|
void setAllWidgetColorMaxValue(int maxValue);
|
2026-03-26 17:35:58 +08:00
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
// 初始化映射表
|
|
|
|
|
|
void InitUi();
|
|
|
|
|
|
//统计每个板卡的初级粒子计数
|
|
|
|
|
|
QMap<QString, int> statisticsFirstParticleQuantity();
|
|
|
|
|
|
//处理初级粒子信息
|
|
|
|
|
|
std::vector<F2t9Order::SpectrumData> handleBasicSubordinate(std::vector<F2t9Order::SpectrumData> dataList,int Board, int Channel);
|
|
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
//点击板卡探测器时触发的函数 区分初级粒子和次级粒子计数
|
|
|
|
|
|
void _slotClickedBoard(QString board);
|
|
|
|
|
|
void _slotClickedTwoBoard(QString board);
|
|
|
|
|
|
signals:
|
|
|
|
|
|
void Signal_InitialState();
|
|
|
|
|
|
void Signal_ClickedBoard(int board,int channel);
|
|
|
|
|
|
private:
|
|
|
|
|
|
Ui::ParticleDataStatistics *ui;
|
|
|
|
|
|
// 存储所有 DetectorStatusSummary 指针的二维数组(索引从0开始)
|
|
|
|
|
|
DetectorStatusSummary* m_widgetMap[MAX_BOARD][MAX_CHANNEL];
|
|
|
|
|
|
//初级粒子板卡号
|
|
|
|
|
|
int m_bd;
|
|
|
|
|
|
//初级粒子通道号
|
|
|
|
|
|
int m_ch;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // PARTICLEDATASTATISTICS_H
|