FSUDAQ_Qt6/analyzers/Analyser.h

95 lines
2.4 KiB
C
Raw Normal View History

#ifndef ANALYZER_H
#define ANALYZER_H
2023-05-26 18:06:37 -04:00
#include <QMainWindow>
#include <QChart>
#include <QChartView>
#include <QLabel>
#include <QPushButton>
#include <QCheckBox>
#include <QLineEdit>
#include <QGridLayout>
#include <QGroupBox>
#include "macro.h"
#include "ClassDigitizer.h"
#include "CustomThreads.h"
#include "CustomWidgets.h"
#include "MultiBuilder.h"
#include "ClassInfluxDB.h"
2023-05-26 18:06:37 -04:00
/**************************************
This class is for, obviously, Online analysis.
It provides essential event building, histograms, and filling.
This is the mother of all other derivative analysis class.
derivative class should define the SetUpCanvas() and UpdateHistogram();
2024-08-21 13:40:11 -04:00
After creating a new class based on the Analyzer class,
users need to add the class files to the FSUDAQ_Qt6.pro project file,
include the header file in FSUDAQ.cpp,
modify the MainWindow::OpenAnalyzer() method,
and recompile FSUDAQ to incorporate the changes and activate the custom analyzer.
2023-05-26 18:06:37 -04:00
***************************************/
#include "Histogram1D.h"
#include "Histogram2D.h"
2023-05-26 18:06:37 -04:00
//^==============================================
//^==============================================
class Analyzer : public QMainWindow{
2023-05-26 18:06:37 -04:00
Q_OBJECT
public:
Analyzer(Digitizer ** digi, unsigned int nDigi, QMainWindow * parent = nullptr);
virtual ~Analyzer();
2023-05-26 18:06:37 -04:00
MultiBuilder * GetEventBuilder() { return mb;}
void RedefineEventBuilder(std::vector<int> idList);
void SetBackwardBuild(bool TF, int maxNumEvent = 100) { isBuildBackward = TF; maxNumEventBuilt = maxNumEvent;}
void SetDatabase(QString IP, QString Name, QString Token);
2023-06-12 16:32:01 -04:00
double RandomGauss(double mean, double sigma);
2023-05-26 18:06:37 -04:00
public slots:
void StartThread();
void StopThread();
void SetDatabaseButton();
virtual void SetUpCanvas();
2023-06-12 16:32:01 -04:00
virtual void UpdateHistograms(); // where event-building, analysis, and ploting
2023-05-26 18:06:37 -04:00
private slots:
2023-06-12 16:32:01 -04:00
protected:
QGridLayout * layout;
void BuildEvents(bool verbose = false);
2023-06-12 16:32:01 -04:00
void SetUpdateTimeInSec(double sec = 1.0) {waitTimeinSec = sec; buildTimerThread->SetWaitTimeinSec(waitTimeinSec);}
2023-05-26 18:06:37 -04:00
InfluxDB * influx;
QString dataBaseIP;
QString dataBaseName;
QString dataBaseToken;
2023-06-12 16:32:01 -04:00
private:
2023-05-26 18:06:37 -04:00
Digitizer ** digi;
unsigned short nDigi;
Data ** dataList;
std::vector<int> typeList;
std::vector<int> snList;
2023-06-12 16:32:01 -04:00
double waitTimeinSec;
MultiBuilder * mb;
bool isBuildBackward;
int maxNumEventBuilt;
2023-05-26 18:06:37 -04:00
TimingThread * buildTimerThread;
2023-05-26 18:06:37 -04:00
};
#endif