found that thereshold, onOff, and DC offset can be set during ACQ ON

This commit is contained in:
Ryan Tang 2023-03-17 17:08:56 -04:00
parent ac81be92f7
commit 70ad421fbd
8 changed files with 305 additions and 58 deletions

View File

@ -18,5 +18,5 @@ LIBS += -lcurl -lCAEN_FELib -lX11
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
# Input # Input
HEADERS += ClassDigitizer2Gen.h Event.h influxdb.h mainwindow.h digiSettingsPanel.h Digiparameters.h scope.h manyThread.h CustomWidgets.h macro.h HEADERS += ClassDigitizer2Gen.h Event.h influxdb.h mainwindow.h digiSettingsPanel.h Digiparameters.h scope.h manyThread.h CustomWidgets.h macro.h SOLARISpanel.h
SOURCES += ClassDigitizer2Gen.cpp influxdb.cpp main.cpp mainwindow.cpp digiSettingsPanel.cpp scope.cpp SOURCES += ClassDigitizer2Gen.cpp influxdb.cpp main.cpp mainwindow.cpp digiSettingsPanel.cpp scope.cpp SOLARISpanel.cpp

71
SOLARISpanel.cpp Normal file
View File

@ -0,0 +1,71 @@
#include "SOLARISpanel.h"
#include <QFile>
SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
std::vector<std::vector<int>> mapping,
QStringList detType,
std::vector<int> detMaxID,
QWidget *parent) : QWidget(parent){
setWindowTitle("SOLARIS Settings");
setGeometry(0, 0, 1850, 1000);
this->digi = digi;
this->nDigi = nDigi;
this->mapping = mapping;
this->detType = detType;
this->detMaxID = detMaxID;
//Check number of detector type; Array 0-199, Recoil 200-299, other 300-
int nDetType = detType.size();
int nDet[nDetType];
for( int k = 0 ; k < nDetType; k++) nDet[k] = 0;
for( int i = 0; i < (int) mapping.size() ; i++){
for( int j = 0; j < (int) mapping[i].size(); j++ ){
for( int k = 0 ; k < nDetType; k++){
int lowID = (k == 0 ? 0 : detMaxID[k-1]);
if( lowID <= mapping[i][j] && mapping[i][j] < detMaxID[k] ) nDet[k] ++ ;
}
}
}
QVBoxLayout * mainLayout = new QVBoxLayout(this); this->setLayout(mainLayout);
QTabWidget * tabWidget = new QTabWidget(this); mainLayout->addWidget(tabWidget);
for( int detTypeID = 0; detTypeID < nDetType; detTypeID ++ ){
QWidget * tab = new QWidget(this);
tabWidget->addTab(tab, detType[detTypeID]);
QGridLayout * layout = new QGridLayout(tab);
//QLineEdit * leNDet = new QLineEdit(QString::number(nDet[detTypeID]), tab);
//layout->addWidget(leNDet, 0, 0);
///Create threshold tab
}
}
SOLARISpanel::~SOLARISpanel(){
}
void SOLARISpanel::CreateSpinBoxGroup(const Reg para, int detID, QGridLayout * &layout, int row, int col){
//QLineEdit * leTrigRate
}
void SOLARISpanel::CreateTab(const Reg para){
}

54
SOLARISpanel.h Normal file
View File

@ -0,0 +1,54 @@
#ifndef SOLARIS_PANEL_H
#define SOLARIS_PANEL_H
#include <QWidget>
#include <QLineEdit>
#include <QSpinBox>
#include <QDoubleSpinBox>
#include <QGridLayout>
#include <QScrollArea>
#include <QTabWidget>
#include <QGroupBox>
#include <QRadioButton>
#include <QCheckBox>
#include <QComboBox>
#include <QTableWidget>
#include <QDebug>
#include <QPushButton>
#include <QFrame>
#include <QSignalMapper>
#include "ClassDigitizer2Gen.h"
#include "CustomWidgets.h"
#include "macro.h"
class SOLARISpanel : public QWidget{
Q_OBJECT
public:
SOLARISpanel(Digitizer2Gen ** digi,
unsigned short nDigi,
std::vector<std::vector<int>> mapping,
QStringList detType,
std::vector<int> detMaxID,
QWidget * parent = nullptr);
~SOLARISpanel();
private slots:
void CreateSpinBoxGroup(const Reg para, int detID, QGridLayout * &layout, int row, int col);
void CreateTab(const Reg para);
signals:
private:
Digitizer2Gen ** digi;
unsigned short nDigi;
std::vector<std::vector<int>> mapping;
QStringList detType;
std::vector<int> detMaxID;
};
#endif

View File

@ -60,13 +60,10 @@ QStringList chToolTip = { "Channel signal delay initialization status (1 = initi
DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi, QWidget * parent) : QWidget(parent){ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi, QWidget * parent) : QWidget(parent){
qDebug() << "DigiSettingsPanel constructor";
setWindowTitle("Digitizers Settings"); setWindowTitle("Digitizers Settings");
setGeometry(0, 0, 1850, 1000); setGeometry(0, 0, 1850, 1000);
//setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); //setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
this->digi = digi; this->digi = digi;
this->nDigi = nDigi; this->nDigi = nDigi;
if( nDigi > MaxNumberOfDigitizer ) { if( nDigi > MaxNumberOfDigitizer ) {
@ -1215,12 +1212,12 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
leChSettingsUnit->setReadOnly(true); leChSettingsUnit->setReadOnly(true);
inquiryLayout->addWidget(leChSettingsUnit, rowID, 4); inquiryLayout->addWidget(leChSettingsUnit, rowID, 4);
cbChAns = new RComboBox(ICTab); cbChSettingsWrite = new RComboBox(ICTab);
cbChAns->setFixedWidth(200); cbChSettingsWrite->setFixedWidth(200);
inquiryLayout->addWidget(cbChAns, rowID, 6); inquiryLayout->addWidget(cbChSettingsWrite, rowID, 6);
connect(cbChAns, &RComboBox::currentIndexChanged, this, [=](){ connect(cbChSettingsWrite, &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return; if( !enableSignalSlot ) return;
std::string value = cbChAns->currentData().toString().toStdString(); std::string value = cbChSettingsWrite->currentData().toString().toStdString();
leChSettingsWrite->setText(QString::fromStdString(value)); leChSettingsWrite->setText(QString::fromStdString(value));
leChSettingsWrite->setStyleSheet(""); leChSettingsWrite->setStyleSheet("");
@ -1230,16 +1227,16 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
QString msg; QString msg;
msg = QString::fromStdString(para.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber()); msg = QString::fromStdString(para.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber());
msg += ",CH:" + QString::number(ch_index); msg += ",CH:" + QString::number(ch_index);
msg += " = " + cbChAns->currentData().toString(); msg += " = " + cbChSettingsWrite->currentData().toString();
if( digi[ID]->WriteValue(para, value, ch_index) ){ if( digi[ID]->WriteValue(para, value, ch_index) ){
leChSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValue(para))); leChSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValue(para)));
SendLogMsg(msg + "|OK."); SendLogMsg(msg + "|OK.");
cbChAns->setStyleSheet(""); cbChSettingsWrite->setStyleSheet("");
ShowSettingsToPanel(); ShowSettingsToPanel();
}else{ }else{
leChSettingsRead->setText("fail write value"); leChSettingsRead->setText("fail write value");
SendLogMsg(msg + "|Fail."); SendLogMsg(msg + "|Fail.");
cbChAns->setStyleSheet("color:red;"); cbChSettingsWrite->setStyleSheet("color:red;");
} }
}); });
@ -1255,7 +1252,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
sbChSettingsWrite->setValue( (std::round(value/step) * step) ); sbChSettingsWrite->setValue( (std::round(value/step) * step) );
} }
Reg para = PHA::CH::AllSettings[cbBdSettings->currentIndex()]; Reg para = PHA::CH::AllSettings[cbChSettings->currentIndex()];
ID = cbIQDigi->currentIndex(); ID = cbIQDigi->currentIndex();
int ch_index = cbIQCh->currentIndex(); int ch_index = cbIQCh->currentIndex();
QString msg; QString msg;
@ -1551,6 +1548,7 @@ void DigiSettingsPanel::EnableControl(){
for( int k = 0; k < tempArray.size(); k++){ for( int k = 0; k < tempArray.size(); k++){
for( int i = 0; i < tempArray[k]->count(); i++) { for( int i = 0; i < tempArray[k]->count(); i++) {
if( k == 0 && (i == 0 || i == 1 || i == 2 ) ) continue;
QWidget* currentTab = tempArray[k]->widget(i); QWidget* currentTab = tempArray[k]->widget(i);
if( currentTab ){ if( currentTab ){
QList<QWidget*> childWidgets = currentTab->findChildren<QWidget*>(); QList<QWidget*> childWidgets = currentTab->findChildren<QWidget*>();
@ -2170,25 +2168,25 @@ void DigiSettingsPanel::ReadChannelSetting(int cbIndex){
if( PHA::CH::AllSettings[cbIndex].ReadWrite() != RW::ReadOnly && haha != ANSTYPE::NONE ){ if( PHA::CH::AllSettings[cbIndex].ReadWrite() != RW::ReadOnly && haha != ANSTYPE::NONE ){
if( haha == ANSTYPE::FLOAT || haha == ANSTYPE::INTEGER ){ if( haha == ANSTYPE::FLOAT || haha == ANSTYPE::INTEGER ){
cbChAns->clear(); cbChSettingsWrite->clear();
cbChAns->setEnabled(false); cbChSettingsWrite->setEnabled(false);
leChSettingsWrite->setEnabled(false); leChSettingsWrite->setEnabled(false);
leChSettingsWrite->clear(); leChSettingsWrite->clear();
sbChSettingsWrite->setEnabled(true); sbChSettingsWrite->setEnabled(true);
sbChSettingsWrite->setMinimum(atof(PHA::CH::AllSettings[cbIndex].GetAnswers()[0].first.c_str())); sbChSettingsWrite->setMinimum(atof(PHA::CH::AllSettings[cbIndex].GetAnswers()[0].first.c_str()));
sbChSettingsWrite->setMaximum(atof(PHA::CH::AllSettings[cbIndex].GetAnswers()[1].first.c_str())); sbChSettingsWrite->setMaximum(atof(PHA::CH::AllSettings[cbIndex].GetAnswers()[1].first.c_str()));
sbChSettingsWrite->setSingleStep(atof(PHA::CH::AllSettings[cbIndex].GetAnswers()[2].first.c_str())); sbChSettingsWrite->setSingleStep(atof(PHA::CH::AllSettings[cbIndex].GetAnswers()[2].first.c_str()));
sbChSettingsWrite->setValue(00); sbChSettingsWrite->setValue(ans.toFloat());
sbChSettingsWrite->setDecimals(0); sbChSettingsWrite->setDecimals(3);
} }
if( haha == ANSTYPE::FLOAT) sbBdSettingsWrite->setDecimals(3); if( haha == ANSTYPE::INTEGER) sbBdSettingsWrite->setDecimals(0);
if( haha == ANSTYPE::LIST){ if( haha == ANSTYPE::LIST){
cbChAns->setEnabled(true); cbChSettingsWrite->setEnabled(true);
cbChAns->clear(); cbChSettingsWrite->clear();
int ansIndex = -1; int ansIndex = -1;
QString ans2 = ""; QString ans2 = "";
for( int i = 0; i < (int) PHA::CH::AllSettings[cbIndex].GetAnswers().size(); i++){ for( int i = 0; i < (int) PHA::CH::AllSettings[cbIndex].GetAnswers().size(); i++){
cbChAns->addItem(QString::fromStdString(PHA::CH::AllSettings[cbIndex].GetAnswers()[i].second), cbChSettingsWrite->addItem(QString::fromStdString(PHA::CH::AllSettings[cbIndex].GetAnswers()[i].second),
QString::fromStdString(PHA::CH::AllSettings[cbIndex].GetAnswers()[i].first)); QString::fromStdString(PHA::CH::AllSettings[cbIndex].GetAnswers()[i].first));
if( ans == QString::fromStdString(PHA::CH::AllSettings[cbIndex].GetAnswers()[i].first)) { if( ans == QString::fromStdString(PHA::CH::AllSettings[cbIndex].GetAnswers()[i].first)) {
@ -2196,7 +2194,7 @@ void DigiSettingsPanel::ReadChannelSetting(int cbIndex){
ans2 = QString::fromStdString(PHA::CH::AllSettings[cbIndex].GetAnswers()[i].second); ans2 = QString::fromStdString(PHA::CH::AllSettings[cbIndex].GetAnswers()[i].second);
} }
} }
cbChAns->setCurrentIndex(ansIndex); cbChSettingsWrite->setCurrentIndex(ansIndex);
leChSettingsRead->setText( ans + " [ " + ans2 + " ]"); leChSettingsRead->setText( ans + " [ " + ans2 + " ]");
sbChSettingsWrite->setEnabled(false); sbChSettingsWrite->setEnabled(false);
sbChSettingsWrite->setStyleSheet(""); sbChSettingsWrite->setStyleSheet("");
@ -2205,8 +2203,8 @@ void DigiSettingsPanel::ReadChannelSetting(int cbIndex){
leChSettingsWrite->setText(ans2); leChSettingsWrite->setText(ans2);
} }
if( haha == ANSTYPE::STR || haha == ANSTYPE::BYTE || haha == ANSTYPE::BINARY){ if( haha == ANSTYPE::STR || haha == ANSTYPE::BYTE || haha == ANSTYPE::BINARY){
cbChAns->clear(); cbChSettingsWrite->clear();
cbChAns->setEnabled(false); cbChSettingsWrite->setEnabled(false);
leChSettingsWrite->setEnabled(true); leChSettingsWrite->setEnabled(true);
leChSettingsWrite->clear(); leChSettingsWrite->clear();
sbChSettingsWrite->setEnabled(false); sbChSettingsWrite->setEnabled(false);
@ -2214,8 +2212,8 @@ void DigiSettingsPanel::ReadChannelSetting(int cbIndex){
sbChSettingsWrite->setValue(0); sbChSettingsWrite->setValue(0);
} }
}else{ }else{
cbChAns->clear(); cbChSettingsWrite->clear();
cbChAns->setEnabled(false); cbChSettingsWrite->setEnabled(false);
sbChSettingsWrite->setEnabled(false); sbChSettingsWrite->setEnabled(false);
sbChSettingsWrite->setStyleSheet(""); sbChSettingsWrite->setStyleSheet("");
sbChSettingsWrite->cleanText(); sbChSettingsWrite->cleanText();

View File

@ -97,7 +97,7 @@ private:
QLineEdit * leChSettingsType; QLineEdit * leChSettingsType;
QLineEdit * leChSettingsRead; QLineEdit * leChSettingsRead;
QLineEdit * leChSettingsUnit; QLineEdit * leChSettingsUnit;
RComboBox * cbChAns; RComboBox * cbChSettingsWrite;
RSpinBox * sbChSettingsWrite; RSpinBox * sbChSettingsWrite;
QLineEdit * leChSettingsWrite; QLineEdit * leChSettingsWrite;

View File

@ -107,6 +107,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
bnSOLSettings = new QPushButton("SOLARIS Settings", this); bnSOLSettings = new QPushButton("SOLARIS Settings", this);
bnSOLSettings->setEnabled(false); bnSOLSettings->setEnabled(false);
connect(bnSOLSettings, SIGNAL(clicked()), this, SLOT(OpenSOLARISpanel()));
layout1->addWidget(bnProgramSettings, 0, 0); layout1->addWidget(bnProgramSettings, 0, 0);
layout1->addWidget(bnNewExp, 0, 1); layout1->addWidget(bnNewExp, 0, 1);
@ -127,7 +128,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
} }
{//====================== ACD control {//====================== ACD control
QGroupBox * box2 = new QGroupBox("ACQ control", mainLayoutWidget); QGroupBox * box2 = new QGroupBox("ACQ control", mainLayoutWidget);
layoutMain->addWidget(box2); layoutMain->addWidget(box2);
@ -279,6 +279,9 @@ MainWindow::~MainWindow(){
printf("-------- delete digiSetting\n"); printf("-------- delete digiSetting\n");
if( digiSetting != NULL ) delete digiSetting; if( digiSetting != NULL ) delete digiSetting;
printf("-------- delete Solaris panel\n");
if( solarisSetting != NULL ) delete solarisSetting;
printf("-------- delete influx\n"); printf("-------- delete influx\n");
if( influx != NULL ) { if( influx != NULL ) {
influx->ClearDataPointsBuffer(); influx->ClearDataPointsBuffer();
@ -287,6 +290,7 @@ MainWindow::~MainWindow(){
delete influx; delete influx;
} }
} }
//^################################################################ ACQ control //^################################################################ ACQ control
@ -613,6 +617,8 @@ void MainWindow::OpenDigitizers(){
bnProgramSettings->setEnabled(false); bnProgramSettings->setEnabled(false);
bnNewExp->setEnabled(false); bnNewExp->setEnabled(false);
bnSOLSettings->setEnabled(CheckSOLARISpanelOK());
} }
void MainWindow::CloseDigitizers(){ void MainWindow::CloseDigitizers(){
@ -644,7 +650,7 @@ void MainWindow::CloseDigitizers(){
if( digiSetting != NULL ) digiSetting->close(); if( digiSetting != NULL ) digiSetting->close();
if( readDataThread[i] != NULL ){ if( readDataThread[i] != NULL ){
LogMsg("Waiting for digitizer ....."); LogMsg("Waiting for readData Thread .....");
readDataThread[i]->quit(); readDataThread[i]->quit();
readDataThread[i]->wait(); readDataThread[i]->wait();
delete readDataThread[i]; delete readDataThread[i];
@ -655,10 +661,17 @@ void MainWindow::CloseDigitizers(){
digi = NULL; digi = NULL;
readDataThread = NULL; readDataThread = NULL;
if( solarisSetting ){
solarisSetting->close();
delete solarisSetting;
solarisSetting = NULL;
}
bnOpenDigitizers->setEnabled(true); bnOpenDigitizers->setEnabled(true);
bnOpenDigitizers->setFocus(); bnOpenDigitizers->setFocus();
bnCloseDigitizers->setEnabled(false); bnCloseDigitizers->setEnabled(false);
bnDigiSettings->setEnabled(false); bnDigiSettings->setEnabled(false);
bnSOLSettings->setEnabled(false);
bnStartACQ->setEnabled(false); bnStartACQ->setEnabled(false);
bnStopACQ->setEnabled(false); bnStopACQ->setEnabled(false);
bnOpenScope->setEnabled(false); bnOpenScope->setEnabled(false);
@ -669,6 +682,8 @@ void MainWindow::CloseDigitizers(){
bnProgramSettings->setEnabled(true); bnProgramSettings->setEnabled(true);
bnNewExp->setEnabled(true); bnNewExp->setEnabled(true);
LogMsg("Closed all digitizers and readData Threads.");
} }
//^###################################################################### Open Scope //^###################################################################### Open Scope
@ -728,6 +743,98 @@ void MainWindow::OpenDigitizersSettings(){
} }
} }
//^###################################################################### Open SOLARIS setting panel
void MainWindow::OpenSOLARISpanel(){
solarisSetting->show();
}
bool MainWindow::CheckSOLARISpanelOK(){
QFile file(analysisPath + "/Mapping.h");
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
LogMsg("Fail to open <b>" + analysisPath + "/Mapping.h </b>. SOLARIS panel disabled.");
//TODO ----- Create a template of the mapping
return false;
}
mapping.clear();
std::vector<int> singleDigiMap;
detType.clear();
detMaxID.clear();
bool startRecord = false;
QTextStream in(&file);
while (!in.atEnd()) {
QString line = in.readLine();
if( line.contains("//*=")){
int in1 = line.indexOf("{");
int in2 = line.lastIndexOf("}");
if( in2 > in1){
QString subLine = line.mid(in1+1, in2 - in1 -1).trimmed().remove(QRegularExpression("[\"\\\\]"));
detType = subLine.split(",");
}else{
LogMsg("Problem Found for the Mapping.h.");
return false;
}
}
if( line.contains("//*#")){
int in1 = line.indexOf("{");
int in2 = line.lastIndexOf("}");
if( in2 > in1){
QString subLine = line.mid(in1+1, in2 - in1 -1).trimmed().remove(QRegularExpression("[\"\\\\]"));
QStringList haha = subLine.split(",");
for( int i = 0; i < haha.size(); i++) detMaxID.push_back(haha[i].toInt());
}else{
LogMsg("Problem Found for the Mapping.h.");
return false;
}
}
if( line.contains("//* ") ) {
startRecord = true;
singleDigiMap.clear();
continue;
}
if( startRecord && line.contains("//*----")){
startRecord = false;
mapping.push_back(singleDigiMap);
continue;
}
if( startRecord ){
int index = line.lastIndexOf("///");
if( index != -1 ) {
line = line.left(index).trimmed();
if( line.endsWith(",") ){
line.remove( line.length() -1, 1);
}
}
QStringList list = line.replace(' ', "").split(",");
for( int i = 0; i < list.size() ; i ++){
singleDigiMap.push_back(list[i].toInt());
}
}
}
file.close();
LogMsg("Mapping.h | Num. Digi : " + QString::number(mapping.size()));
for( int i = 0 ; i < (int) mapping.size(); i ++){
LogMsg(" Digi-" + QString::number(i) + " : " + QString::number(mapping[i].size()) + " Ch. | Digi-"
+ QString::number(digi[i]->GetSerialNumber()) + " : "
+ QString::number(digi[i]->GetNChannels()) + " Ch.");
}
if( (int) detMaxID.size() != detType.size() ){
LogMsg("Size of detector Name and detctor max ID does not match.");
return false;
}
//@============= Create SOLAIRS panel
solarisSetting = new SOLARISpanel(digi, nDigi, mapping, detType, detMaxID);
return true;
}
//^###################################################################### Open Scaler, when DAQ is running //^###################################################################### Open Scaler, when DAQ is running
void MainWindow::OpenScaler(){ void MainWindow::OpenScaler(){
scalar->show(); scalar->show();
@ -735,7 +842,7 @@ void MainWindow::OpenScaler(){
void MainWindow::SetUpScalar(){ void MainWindow::SetUpScalar(){
scalar->setGeometry(0, 0, 10 + nDigi * 230, 800); scalar->setGeometry(0, 0, 10 + nDigi * 230, 1500);
lbLastUpdateTime = new QLabel("Last update : "); lbLastUpdateTime = new QLabel("Last update : ");
lbLastUpdateTime->setAlignment(Qt::AlignCenter); lbLastUpdateTime->setAlignment(Qt::AlignCenter);
@ -851,11 +958,15 @@ void MainWindow::UpdateScalar(){
unsigned long kaka = std::stoul(kakaStr.c_str()) ; unsigned long kaka = std::stoul(kakaStr.c_str()) ;
unsigned long time = std::stoul(timeStr.c_str()) ; unsigned long time = std::stoul(timeStr.c_str()) ;
leTrigger[iDigi][ch]->setText(QString::fromStdString(haha[ch])); leTrigger[iDigi][ch]->setText(QString::fromStdString(haha[ch]));
if( oldTimeStamp[iDigi][ch] > 0 && time - oldTimeStamp[iDigi][ch] > 1e9){ if( oldTimeStamp[iDigi][ch] > 0 && time - oldTimeStamp[iDigi][ch] > 1e9){
acceptRate[ch] = (kaka - oldSavedCount[iDigi][ch]) * 1e9 *1.0 / (time - oldTimeStamp[iDigi][ch]); acceptRate[ch] = (kaka - oldSavedCount[iDigi][ch]) * 1e9 *1.0 / (time - oldTimeStamp[iDigi][ch]);
}else{ }else{
acceptRate[ch] = 0; acceptRate[ch] = 0;
} }
if( acceptRate[ch] > 10000 ) printf("%d-%2d | old (%lu, %lu), new (%lu, %lu)\n", iDigi, ch, oldTimeStamp[iDigi][ch], oldSavedCount[iDigi][ch], time, kaka);
oldSavedCount[iDigi][ch] = kaka; oldSavedCount[iDigi][ch] = kaka;
oldTimeStamp[iDigi][ch] = time; oldTimeStamp[iDigi][ch] = time;
//if( kaka != "0" ) printf("%s, %s | %.2f\n", time.c_str(), kaka.c_str(), acceptRate); //if( kaka != "0" ) printf("%s, %s | %.2f\n", time.c_str(), kaka.c_str(), acceptRate);
@ -1082,7 +1193,7 @@ void MainWindow::DecodeIPList(){
//------- decode IPListStr //------- decode IPListStr
nDigi = 0; nDigi = 0;
IPList.clear(); IPList.clear();
QStringList parts = IPListStr.split("."); QStringList parts = IPListStr.replace(' ', "").split(".");
QString IPDomain = parts[0] + "." + parts[1] + "." + parts[2] + "."; QString IPDomain = parts[0] + "." + parts[1] + "." + parts[2] + ".";
parts = parts[3].split(","); parts = parts[3].split(",");
for(int i = 0; i < parts.size(); i++){ for(int i = 0; i < parts.size(); i++){
@ -1623,6 +1734,7 @@ void MainWindow::CreateRawDataFolderAndLink(){
} }
//^###################################################################### log msg //^###################################################################### log msg
void MainWindow::LogMsg(QString msg){ void MainWindow::LogMsg(QString msg){
QString outputStr = QStringLiteral("[%1] %2").arg(QDateTime::currentDateTime().toString("MM.dd hh:mm:ss"), msg); QString outputStr = QStringLiteral("[%1] %2").arg(QDateTime::currentDateTime().toString("MM.dd hh:mm:ss"), msg);
@ -1639,7 +1751,7 @@ void MainWindow::LogMsg(QString msg){
void MainWindow::WriteElog(QString htmlText, QString subject, QString category, int runNumber){ void MainWindow::WriteElog(QString htmlText, QString subject, QString category, int runNumber){
if( elogID < 0 ) return; //if( elogID < 0 ) return;
if( expName == "" ) return; if( expName == "" ) return;
//TODO ===== user name and pwd load from a file. //TODO ===== user name and pwd load from a file.

View File

@ -27,6 +27,7 @@
#include "digiSettingsPanel.h" #include "digiSettingsPanel.h"
#include "scope.h" #include "scope.h"
#include "SOLARISpanel.h"
const int chromeWindowID = -1; // disable capture screenshot const int chromeWindowID = -1; // disable capture screenshot
@ -47,6 +48,11 @@ private slots:
void OpenScope(); void OpenScope();
void OpenDigitizersSettings(); void OpenDigitizersSettings();
void OpenSOLARISpanel();
bool CheckSOLARISpanelOK();
void StartACQ();
void StopACQ();
void AutoRun(); void AutoRun();
void OpenScaler(); void OpenScaler();
@ -70,8 +76,9 @@ private slots:
void CreateRawDataFolderAndLink(); void CreateRawDataFolderAndLink();
void closeEvent(QCloseEvent * event){ void closeEvent(QCloseEvent * event){
if( digiSetting != NULL ) digiSetting->close(); if( digiSetting ) digiSetting->close();
if( scope != NULL ) scope->close(); if( scope ) scope->close();
if( solarisSetting ) solarisSetting->close();
event->accept(); event->accept();
} }
@ -84,6 +91,15 @@ signals :
private: private:
static Digitizer2Gen ** digi;
unsigned short nDigi;
//@----- log msg
QPlainTextEdit * logInfo;
void LogMsg(QString msg);
bool logMsgHTMLMode = true;
//@----- buttons
QPushButton * bnProgramSettings; QPushButton * bnProgramSettings;
QPushButton * bnNewExp; QPushButton * bnNewExp;
QLineEdit * leExpName; QLineEdit * leExpName;
@ -94,7 +110,7 @@ private:
QPushButton * bnDigiSettings; QPushButton * bnDigiSettings;
QPushButton * bnSOLSettings; QPushButton * bnSOLSettings;
//@--- new scope //@----- scope
Scope * scope; Scope * scope;
QPushButton * bnOpenScope; QPushButton * bnOpenScope;
@ -118,24 +134,23 @@ private:
QLineEdit * leRawDataPath; QLineEdit * leRawDataPath;
QLineEdit * leRunComment; QLineEdit * leRunComment;
ReadDataThread ** readDataThread; ReadDataThread ** readDataThread;
void StartACQ();
void StopACQ();
QString startComment; QString startComment;
QString stopComment; QString stopComment;
bool needManualComment; bool needManualComment;
bool isRunning; bool isRunning;
QTimer * runTimer;
unsigned int autoRunStartRunID;
//@----- digi Setting panel
DigiSettingsPanel * digiSetting; DigiSettingsPanel * digiSetting;
QPlainTextEdit * logInfo; //@----- SOLARIS setting panel
SOLARISpanel * solarisSetting;
std::vector<std::vector<int>> mapping;
QStringList detType;
std::vector<int> detMaxID;
static Digitizer2Gen ** digi; //@----- Program settings
unsigned short nDigi;
void LogMsg(QString msg);
bool logMsgHTMLMode = true;
//---------------- Program settings
QLineEdit * lSaveSettingPath; // only live in ProgramSettigns() QLineEdit * lSaveSettingPath; // only live in ProgramSettigns()
QLineEdit * lAnalysisPath; // only live in ProgramSettigns() QLineEdit * lAnalysisPath; // only live in ProgramSettigns()
QLineEdit * lDataPath; // only live in ProgramSettigns() QLineEdit * lDataPath; // only live in ProgramSettigns()
@ -154,7 +169,7 @@ private:
QString DatabaseName; QString DatabaseName;
QString ElogIP; QString ElogIP;
//------------- experiment settings //@------ experiment settings
bool isGitExist; bool isGitExist;
bool useGit; bool useGit;
QString expName; QString expName;
@ -163,10 +178,7 @@ private:
QString runIDStr; QString runIDStr;
int elogID; // 0 = ready, -1 = disable, >1 = elogID int elogID; // 0 = ready, -1 = disable, >1 = elogID
QTimer * runTimer; //@------ calculate instant accept Rate
unsigned int autoRunStartRunID;
//-------------- calculate instant accept Rate
unsigned long oldSavedCount[MaxNumberOfDigitizer][MaxNumberOfChannel]; unsigned long oldSavedCount[MaxNumberOfDigitizer][MaxNumberOfChannel];
unsigned long oldTimeStamp[MaxNumberOfDigitizer][MaxNumberOfChannel]; unsigned long oldTimeStamp[MaxNumberOfDigitizer][MaxNumberOfChannel];

View File

@ -529,8 +529,6 @@ void Scope::ScopeControlOnOff(bool on){
sbRL->setEnabled(on); sbRL->setEnabled(on);
sbPT->setEnabled(on); sbPT->setEnabled(on);
sbDCOffset->setEnabled(on);
sbThreshold->setEnabled(on);
sbTimeRiseTime->setEnabled(on); sbTimeRiseTime->setEnabled(on);
sbTimeGuard->setEnabled(on); sbTimeGuard->setEnabled(on);
sbTrapRiseTime->setEnabled(on); sbTrapRiseTime->setEnabled(on);
@ -541,11 +539,13 @@ void Scope::ScopeControlOnOff(bool on){
cbPolarity->setEnabled(on); cbPolarity->setEnabled(on);
cbWaveRes->setEnabled(on); cbWaveRes->setEnabled(on);
cbTrapPeakAvg->setEnabled(on); cbTrapPeakAvg->setEnabled(on);
sbBaselineGuard->setEnabled(on);
sbPileUpGuard->setEnabled(on);
cbBaselineAvg->setEnabled(on); cbBaselineAvg->setEnabled(on);
cbLowFreqFilter->setEnabled(on);
//sbDCOffset->setEnabled(on);
//sbThreshold->setEnabled(on);
//sbBaselineGuard->setEnabled(on);
//sbPileUpGuard->setEnabled(on);
//cbLowFreqFilter->setEnabled(on);
} }