comment out some useless codes
This commit is contained in:
parent
17657d7d7e
commit
04a877fc51
|
@ -19,15 +19,15 @@ public:
|
||||||
this->ID = digiID;
|
this->ID = digiID;
|
||||||
isSaveData = false;
|
isSaveData = false;
|
||||||
stop = false;
|
stop = false;
|
||||||
canSendMsg = true;
|
// canSendMsg = true;
|
||||||
}
|
}
|
||||||
void SuppressFileSizeMsg() {canSendMsg = false;}
|
// void SuppressFileSizeMsg() {canSendMsg = false;}
|
||||||
void Stop(){ this->stop = true;}
|
void Stop(){ this->stop = true;}
|
||||||
void SetSaveData(bool onOff) {this->isSaveData = onOff;}
|
void SetSaveData(bool onOff) {this->isSaveData = onOff;}
|
||||||
void run(){
|
void run(){
|
||||||
canSendMsg = true;
|
// canSendMsg = true;
|
||||||
stop = false;
|
stop = false;
|
||||||
clock_gettime(CLOCK_REALTIME, &ta);
|
// clock_gettime(CLOCK_REALTIME, &ta);
|
||||||
emit sendMsg("Digi-" + QString::number(digi->GetSerialNumber()) + " ReadDataThread started.");
|
emit sendMsg("Digi-" + QString::number(digi->GetSerialNumber()) + " ReadDataThread started.");
|
||||||
|
|
||||||
while(!stop){
|
while(!stop){
|
||||||
|
@ -45,17 +45,17 @@ public:
|
||||||
//digi->ErrorMsg("ReadDataLoop()");
|
//digi->ErrorMsg("ReadDataLoop()");
|
||||||
digi->hit->ClearTrace();
|
digi->hit->ClearTrace();
|
||||||
}
|
}
|
||||||
|
//
|
||||||
if( isSaveData && canSendMsg ){
|
// if( isSaveData && canSendMsg ){
|
||||||
clock_gettime(CLOCK_REALTIME, &tb);
|
// clock_gettime(CLOCK_REALTIME, &tb);
|
||||||
if( tb.tv_sec - ta.tv_sec > 2 ) {
|
// if( tb.tv_sec - ta.tv_sec > 2 ) {
|
||||||
emit sendMsg("FileSize ("+ QString::number(digi->GetSerialNumber()) +"): " + QString::number(digi->GetTotalFilesSize()/1024./1024.) + " MB");
|
// emit sendMsg("FileSize ("+ QString::number(digi->GetSerialNumber()) +"): " + QString::number(digi->GetTotalFilesSize()/1024./1024.) + " MB");
|
||||||
//emit checkFileSize();
|
// //emit checkFileSize();
|
||||||
//double duration = tb.tv_nsec-ta.tv_nsec + tb.tv_sec*1e+9 - ta.tv_sec*1e+9;
|
// //double duration = tb.tv_nsec-ta.tv_nsec + tb.tv_sec*1e+9 - ta.tv_sec*1e+9;
|
||||||
//printf("%4d, duration : %10.0f, %6.1f\n", readCount, duration, 1e9/duration);
|
// //printf("%4d, duration : %10.0f, %6.1f\n", readCount, duration, 1e9/duration);
|
||||||
ta = tb;
|
// ta = tb;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
emit sendMsg("Digi-" + QString::number(digi->GetSerialNumber()) + " ReadDataThread stopped.");
|
emit sendMsg("Digi-" + QString::number(digi->GetSerialNumber()) + " ReadDataThread stopped.");
|
||||||
|
@ -69,7 +69,8 @@ private:
|
||||||
Digitizer2Gen * digi;
|
Digitizer2Gen * digi;
|
||||||
int ID;
|
int ID;
|
||||||
timespec ta, tb;
|
timespec ta, tb;
|
||||||
bool isSaveData, stop, canSendMsg;
|
// bool isSaveData, stop, canSendMsg;
|
||||||
|
bool isSaveData, stop;
|
||||||
};
|
};
|
||||||
|
|
||||||
//^#======================================================= Timing Thread, for some action need to be done periodically
|
//^#======================================================= Timing Thread, for some action need to be done periodically
|
||||||
|
|
|
@ -65,6 +65,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
||||||
|
|
||||||
leTrigger = nullptr;
|
leTrigger = nullptr;
|
||||||
leAccept = nullptr;
|
leAccept = nullptr;
|
||||||
|
lbFileSize = nullptr;
|
||||||
|
|
||||||
scalarThread = new TimingThread();
|
scalarThread = new TimingThread();
|
||||||
connect(scalarThread, &TimingThread::TimeUp, this, &MainWindow::UpdateScalar);
|
connect(scalarThread, &TimingThread::TimeUp, this, &MainWindow::UpdateScalar);
|
||||||
|
@ -549,9 +550,11 @@ void MainWindow::StopACQ(){
|
||||||
//=============== Stop digitizer
|
//=============== Stop digitizer
|
||||||
for( int i = nDigi - 1; i >= 0; i--){
|
for( int i = nDigi - 1; i >= 0; i--){
|
||||||
if( digi[i]->IsDummy () ) continue;
|
if( digi[i]->IsDummy () ) continue;
|
||||||
|
digiMTX[i].lock();
|
||||||
digi[i]->StopACQ();
|
digi[i]->StopACQ();
|
||||||
readDataThread[i]->SuppressFileSizeMsg();
|
// readDataThread[i]->SuppressFileSizeMsg();
|
||||||
digi[i]->WriteValue(PHA::CH::WaveSaving, "OnRequest", -1);
|
digi[i]->WriteValue(PHA::CH::WaveSaving, "OnRequest", -1);
|
||||||
|
digiMTX[i].unlock();
|
||||||
}
|
}
|
||||||
isACQRunning = false;
|
isACQRunning = false;
|
||||||
lbScalarACQStatus->setText("<font style=\"color: red;\"><b>ACQ Off</b></font>");
|
lbScalarACQStatus->setText("<font style=\"color: red;\"><b>ACQ Off</b></font>");
|
||||||
|
@ -587,10 +590,10 @@ void MainWindow::StopACQ(){
|
||||||
influx->WriteData(DatabaseName.toStdString());
|
influx->WriteData(DatabaseName.toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !chkSaveRun->isChecked() ) LogMsg("Collecting remaining data from the digitizers... ");
|
if( chkSaveRun->isChecked() ) LogMsg("Collecting remaining data from the digitizers... ");
|
||||||
for( int i = nDigi -1; i >=0; i--){
|
for( int i = nDigi -1; i >=0; i--){
|
||||||
if( readDataThread[i]->isRunning()){
|
if( readDataThread[i]->isRunning()){
|
||||||
if( !chkSaveRun->isChecked() ) readDataThread[i]->Stop();
|
if( !chkSaveRun->isChecked() ) readDataThread[i]->Stop(); // if it is a save run, don't force stop the readDataThread, wait for it.
|
||||||
readDataThread[i]->quit();
|
readDataThread[i]->quit();
|
||||||
readDataThread[i]->wait();
|
readDataThread[i]->wait();
|
||||||
}
|
}
|
||||||
|
@ -1160,7 +1163,7 @@ void MainWindow::SetUpScalar(){
|
||||||
// connect(bnUpdateScaler, &QPushButton::clicked, this, &MainWindow::UpdateScalar);
|
// connect(bnUpdateScaler, &QPushButton::clicked, this, &MainWindow::UpdateScalar);
|
||||||
|
|
||||||
///==== create the 1st row
|
///==== create the 1st row
|
||||||
int rowID = 4;
|
int rowID = 5;
|
||||||
for( int ch = 0; ch < MaxNumberOfChannel; ch++){
|
for( int ch = 0; ch < MaxNumberOfChannel; ch++){
|
||||||
|
|
||||||
if( ch == 0 ){
|
if( ch == 0 ){
|
||||||
|
@ -1177,8 +1180,11 @@ void MainWindow::SetUpScalar(){
|
||||||
///===== create the trigger and accept
|
///===== create the trigger and accept
|
||||||
leTrigger = new QLineEdit**[nDigi];
|
leTrigger = new QLineEdit**[nDigi];
|
||||||
leAccept = new QLineEdit**[nDigi];
|
leAccept = new QLineEdit**[nDigi];
|
||||||
|
lbFileSize = new QLabel *[nDigi];
|
||||||
for( int iDigi = 0; iDigi < nDigi; iDigi++){
|
for( int iDigi = 0; iDigi < nDigi; iDigi++){
|
||||||
rowID = 3;
|
rowID = 3;
|
||||||
|
lbFileSize[iDigi] = new QLabel("file Size", scalar);
|
||||||
|
lbFileSize[iDigi]->setAlignment(Qt::AlignCenter);
|
||||||
leTrigger[iDigi] = new QLineEdit *[digi[iDigi]->GetNChannels()];
|
leTrigger[iDigi] = new QLineEdit *[digi[iDigi]->GetNChannels()];
|
||||||
leAccept[iDigi] = new QLineEdit *[digi[iDigi]->GetNChannels()];
|
leAccept[iDigi] = new QLineEdit *[digi[iDigi]->GetNChannels()];
|
||||||
for( int ch = 0; ch < MaxNumberOfChannel; ch++){
|
for( int ch = 0; ch < MaxNumberOfChannel; ch++){
|
||||||
|
@ -1187,7 +1193,9 @@ void MainWindow::SetUpScalar(){
|
||||||
QLabel * lbDigi = new QLabel("Digi-" + QString::number(digi[iDigi]->GetSerialNumber()), scalar);
|
QLabel * lbDigi = new QLabel("Digi-" + QString::number(digi[iDigi]->GetSerialNumber()), scalar);
|
||||||
lbDigi->setAlignment(Qt::AlignCenter);
|
lbDigi->setAlignment(Qt::AlignCenter);
|
||||||
scalarLayout->addWidget(lbDigi, rowID, 2*iDigi+1, 1, 2);
|
scalarLayout->addWidget(lbDigi, rowID, 2*iDigi+1, 1, 2);
|
||||||
|
rowID ++;
|
||||||
|
|
||||||
|
scalarLayout->addWidget(lbFileSize[iDigi], rowID, 2*iDigi+1, 1, 2);
|
||||||
rowID ++;
|
rowID ++;
|
||||||
|
|
||||||
QLabel * lbA = new QLabel("Input [Hz]", scalar);
|
QLabel * lbA = new QLabel("Input [Hz]", scalar);
|
||||||
|
@ -1225,10 +1233,14 @@ void MainWindow::CleanUpScalar(){
|
||||||
delete leTrigger[i][ch];
|
delete leTrigger[i][ch];
|
||||||
delete leAccept[i][ch];
|
delete leAccept[i][ch];
|
||||||
}
|
}
|
||||||
|
delete lbFileSize[i];
|
||||||
delete [] leTrigger[i];
|
delete [] leTrigger[i];
|
||||||
delete [] leAccept[i];
|
delete [] leAccept[i];
|
||||||
}
|
}
|
||||||
|
delete [] lbFileSize;
|
||||||
delete [] leTrigger;
|
delete [] leTrigger;
|
||||||
|
delete [] leAccept;
|
||||||
|
lbFileSize = nullptr;
|
||||||
leTrigger = nullptr;
|
leTrigger = nullptr;
|
||||||
leAccept = nullptr;
|
leAccept = nullptr;
|
||||||
|
|
||||||
|
@ -1252,14 +1264,6 @@ void MainWindow::UpdateScalar(){
|
||||||
for( int iDigi = 0; iDigi < nDigi; iDigi ++ ){
|
for( int iDigi = 0; iDigi < nDigi; iDigi ++ ){
|
||||||
if( digi[iDigi]->IsDummy() ) return;
|
if( digi[iDigi]->IsDummy() ) return;
|
||||||
|
|
||||||
//=========== use ReadStat to get the trigger rate
|
|
||||||
//digiMTX.lock();
|
|
||||||
//digi[iDigi]->ReadStat(); // digitizer update it every 500 msec;
|
|
||||||
//digiMTX.unlock();
|
|
||||||
//for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++){
|
|
||||||
// leTrigger[iDigi][ch]->setText(QString::number(digi[iDigi]->GetTriggerCount(ch)*1e9*1.0/ digi[iDigi]->GetRealTime(ch)));
|
|
||||||
//}
|
|
||||||
|
|
||||||
//=========== another method, directly readValue
|
//=========== another method, directly readValue
|
||||||
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++){
|
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++){
|
||||||
digiMTX[iDigi].lock();
|
digiMTX[iDigi].lock();
|
||||||
|
@ -1272,7 +1276,6 @@ void MainWindow::UpdateScalar(){
|
||||||
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 && kaka > oldSavedCount[iDigi][ch]){
|
if( oldTimeStamp[iDigi][ch] > 0 && time - oldTimeStamp[iDigi][ch] > 1e9 && kaka > oldSavedCount[iDigi][ch]){
|
||||||
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{
|
||||||
|
@ -1284,6 +1287,9 @@ void MainWindow::UpdateScalar(){
|
||||||
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);
|
||||||
leAccept[iDigi][ch]->setText(QString::number(acceptRate[ch],'f', 1));
|
leAccept[iDigi][ch]->setText(QString::number(acceptRate[ch],'f', 1));
|
||||||
|
|
||||||
|
lbFileSize[iDigi]->setText(QString::number(digi[iDigi]->GetTotalFilesSize()/1024./1024.) + " MB");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///============== push the trigger, acceptRate rate database
|
///============== push the trigger, acceptRate rate database
|
||||||
|
|
|
@ -122,6 +122,7 @@ private:
|
||||||
QGridLayout * scalarLayout;
|
QGridLayout * scalarLayout;
|
||||||
TimingThread * scalarThread;
|
TimingThread * scalarThread;
|
||||||
QPushButton * bnOpenScalar;
|
QPushButton * bnOpenScalar;
|
||||||
|
QLabel ** lbFileSize;// need to delete manually
|
||||||
QLineEdit *** leTrigger; // need to delete manually
|
QLineEdit *** leTrigger; // need to delete manually
|
||||||
QLineEdit *** leAccept; // need to delete manually
|
QLineEdit *** leAccept; // need to delete manually
|
||||||
QLabel * lbLastUpdateTime;
|
QLabel * lbLastUpdateTime;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user