added AggCount and ReadCount in Scalar. AggCount is the agg decoded. readcount is the number of read attemp
This commit is contained in:
parent
257874c822
commit
661aa5f928
24
ClassData.h
24
ClassData.h
|
@ -40,9 +40,11 @@ class Data{
|
||||||
float TriggerRate [MaxNChannels]; /// Hz
|
float TriggerRate [MaxNChannels]; /// Hz
|
||||||
float NonPileUpRate [MaxNChannels]; /// Hz
|
float NonPileUpRate [MaxNChannels]; /// Hz
|
||||||
unsigned long TotNumNonPileUpEvents[MaxNChannels]; /// also exclude overthrow
|
unsigned long TotNumNonPileUpEvents[MaxNChannels]; /// also exclude overthrow
|
||||||
unsigned short NumEventsDecoded [MaxNChannels]; /// reset at every decode
|
unsigned short NumEventsDecoded [MaxNChannels]; /// reset after trig-rate calculation
|
||||||
unsigned short NumNonPileUpDecoded [MaxNChannels]; /// reset at every decode
|
unsigned short NumNonPileUpDecoded [MaxNChannels]; /// reset after trig-rate calculation
|
||||||
|
|
||||||
|
unsigned int TotalAggCount ;
|
||||||
|
unsigned short AggCount ; /// reset after trig-rate calculation
|
||||||
unsigned int aggTime; /// update every decode
|
unsigned int aggTime; /// update every decode
|
||||||
|
|
||||||
int GetLoopIndex(unsigned short ch) const {return LoopIndex[ch];}
|
int GetLoopIndex(unsigned short ch) const {return LoopIndex[ch];}
|
||||||
|
@ -278,17 +280,17 @@ inline void Data::ClearNumEventsDecoded(){
|
||||||
NumEventsDecoded[i] = 0;
|
NumEventsDecoded[i] = 0;
|
||||||
NumNonPileUpDecoded[i] = 0;
|
NumNonPileUpDecoded[i] = 0;
|
||||||
}
|
}
|
||||||
|
AggCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Data::ClearData(){
|
inline void Data::ClearData(){
|
||||||
nByte = 0;
|
nByte = 0;
|
||||||
AllocatedSize = 0;
|
AllocatedSize = 0;
|
||||||
|
TotalAggCount = 0;
|
||||||
for( int ch = 0 ; ch < MaxNChannels; ch++){
|
for( int ch = 0 ; ch < MaxNChannels; ch++){
|
||||||
LoopIndex[ch] = 0;
|
LoopIndex[ch] = 0;
|
||||||
DataIndex[ch] = -1;
|
DataIndex[ch] = -1;
|
||||||
NumEventsDecoded[ch] = 0;
|
|
||||||
NumNonPileUpDecoded[ch] = 0;
|
|
||||||
|
|
||||||
TotNumNonPileUpEvents[ch] = 0 ;
|
TotNumNonPileUpEvents[ch] = 0 ;
|
||||||
|
|
||||||
calIndexes[ch][0] = -1;
|
calIndexes[ch][0] = -1;
|
||||||
|
@ -317,6 +319,9 @@ inline void Data::ClearData(){
|
||||||
tempDigiWaveform3.clear();
|
tempDigiWaveform3.clear();
|
||||||
tempDigiWaveform4.clear();
|
tempDigiWaveform4.clear();
|
||||||
|
|
||||||
|
ClearNumEventsDecoded();
|
||||||
|
ClearTriggerRate();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Data::ClearBuffer(){
|
inline void Data::ClearBuffer(){
|
||||||
|
@ -340,6 +345,7 @@ inline void Data::CalTriggerRate(){
|
||||||
unsigned long long dTime = 0;
|
unsigned long long dTime = 0;
|
||||||
double sec = -999;
|
double sec = -999;
|
||||||
|
|
||||||
|
|
||||||
for( int ch = 0; ch < numInputCh; ch ++ ){
|
for( int ch = 0; ch < numInputCh; ch ++ ){
|
||||||
if( t0[ch] == 0 ) {
|
if( t0[ch] == 0 ) {
|
||||||
TriggerRate[ch] = 0;
|
TriggerRate[ch] = 0;
|
||||||
|
@ -347,6 +353,7 @@ inline void Data::CalTriggerRate(){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( NumEventsDecoded[ch] < dataSize ){
|
if( NumEventsDecoded[ch] < dataSize ){
|
||||||
|
|
||||||
dTime = Timestamp[ch][DataIndex[ch]] - t0[ch];
|
dTime = Timestamp[ch][DataIndex[ch]] - t0[ch];
|
||||||
|
@ -379,6 +386,7 @@ inline void Data::CalTriggerRate(){
|
||||||
NumNonPileUpDecoded[ch] = 0;
|
NumNonPileUpDecoded[ch] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AggCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//^###############################################
|
//^###############################################
|
||||||
|
@ -458,7 +466,7 @@ inline void Data::CloseSaveFile(){
|
||||||
//^####################################################### Print
|
//^####################################################### Print
|
||||||
inline void Data::PrintStat(bool skipEmpty) {
|
inline void Data::PrintStat(bool skipEmpty) {
|
||||||
|
|
||||||
printf("============================= Print Stat. Digi-%d\n", boardSN);
|
printf("============================= Print Stat. Digi-%d, TotalAggCount = %d\n", boardSN, TotalAggCount);
|
||||||
printf("%2s | %6s | %9s | %9s | %6s | %6s(%4s)\n", "ch", "# Evt.", "Rate [Hz]", "Accept", "Tot. Evt.", "index", "loop");
|
printf("%2s | %6s | %9s | %9s | %6s | %6s(%4s)\n", "ch", "# Evt.", "Rate [Hz]", "Accept", "Tot. Evt.", "index", "loop");
|
||||||
printf("---+--------+-----------+-----------+----------\n");
|
printf("---+--------+-----------+-----------+----------\n");
|
||||||
for(int ch = 0; ch < numInputCh; ch++){
|
for(int ch = 0; ch < numInputCh; ch++){
|
||||||
|
@ -573,7 +581,9 @@ inline void Data::DecodeBuffer(bool fastDecode, int verbose){
|
||||||
if( ( (word >> 28) & 0xF ) == 0xA ) { /// start of Board Agg
|
if( ( (word >> 28) & 0xF ) == 0xA ) { /// start of Board Agg
|
||||||
unsigned int nWord = word & 0x0FFFFFFF ;
|
unsigned int nWord = word & 0x0FFFFFFF ;
|
||||||
if( verbose >= 1 ) printf("Number of words in this Agg : %u = %u Byte\n", nWord, nWord * 4);
|
if( verbose >= 1 ) printf("Number of words in this Agg : %u = %u Byte\n", nWord, nWord * 4);
|
||||||
|
AggCount ++;
|
||||||
|
TotalAggCount ++;
|
||||||
|
|
||||||
nw = nw + 1; word = ReadBuffer(nw, verbose);
|
nw = nw + 1; word = ReadBuffer(nw, verbose);
|
||||||
unsigned int BoardID = ((word >> 27) & 0x1F);
|
unsigned int BoardID = ((word >> 27) & 0x1F);
|
||||||
unsigned short pattern = ((word >> 8 ) & 0x7FFF );
|
unsigned short pattern = ((word >> 8 ) & 0x7FFF );
|
||||||
|
|
|
@ -27,27 +27,15 @@ public:
|
||||||
void SetSaveData(bool onOff) {this->isSaveData = onOff;}
|
void SetSaveData(bool onOff) {this->isSaveData = onOff;}
|
||||||
void SetScopeMode(bool onOff) {this->isScope = onOff;}
|
void SetScopeMode(bool onOff) {this->isScope = onOff;}
|
||||||
|
|
||||||
// void go(){
|
void SetReadCountZero() {readCount = 0;}
|
||||||
// mutex.lock();
|
unsigned long GetReadCount() const {return readCount;}
|
||||||
// condition.wakeAll();
|
|
||||||
// mutex.unlock();
|
|
||||||
// }
|
|
||||||
|
|
||||||
void run(){
|
void run(){
|
||||||
|
|
||||||
stop = false;
|
stop = false;
|
||||||
|
readCount = 0;
|
||||||
// mutex.lock();
|
|
||||||
// condition.wait(&mutex);
|
|
||||||
// mutex.unlock();
|
|
||||||
|
|
||||||
clock_gettime(CLOCK_REALTIME, &t0);
|
clock_gettime(CLOCK_REALTIME, &t0);
|
||||||
//printf("--- %d, %ld nsec \n", ID, t0.tv_nsec);
|
|
||||||
ta = t0;
|
ta = t0;
|
||||||
// clock_gettime(CLOCK_REALTIME, &t1);
|
|
||||||
|
|
||||||
// digi->StartACQ();
|
|
||||||
// usleep(1000); // wait for some data;
|
|
||||||
|
|
||||||
printf("ReadDataThread for digi-%d running.\n", digi->GetSerialNumber());
|
printf("ReadDataThread for digi-%d running.\n", digi->GetSerialNumber());
|
||||||
do{
|
do{
|
||||||
|
@ -66,13 +54,6 @@ public:
|
||||||
digi->GetData()->DecodeBuffer(!isScope, 0);
|
digi->GetData()->DecodeBuffer(!isScope, 0);
|
||||||
if( isSaveData ) digi->GetData()->SaveData();
|
if( isSaveData ) digi->GetData()->SaveData();
|
||||||
digiMTX[ID].unlock();
|
digiMTX[ID].unlock();
|
||||||
|
|
||||||
// clock_gettime(CLOCK_REALTIME, &t2);
|
|
||||||
// if( t2.tv_sec - t1.tv_sec > 2 ) {
|
|
||||||
// printf("----Digi-%d read %ld / sec.\n", ID, readCount / 3);
|
|
||||||
// readCount = 0;
|
|
||||||
// t1 = t2;
|
|
||||||
// }
|
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
printf("ReadDataThread::%s------------ ret : %d \n", __func__, ret);
|
printf("ReadDataThread::%s------------ ret : %d \n", __func__, ret);
|
||||||
|
@ -93,10 +74,10 @@ public:
|
||||||
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 ) {
|
||||||
digiMTX[ID].lock();
|
digiMTX[ID].lock();
|
||||||
|
|
||||||
emit sendMsg("FileSize ("+ QString::number(digi->GetSerialNumber()) +"): " + QString::number(digi->GetData()->GetTotalFileSize()/1024./1024., 'f', 4) + " MB [" + QString::number(tb.tv_sec-t0.tv_sec) + " sec]");
|
emit sendMsg("FileSize ("+ QString::number(digi->GetSerialNumber()) +"): " + QString::number(digi->GetData()->GetTotalFileSize()/1024./1024., 'f', 4) + " MB [" + QString::number(tb.tv_sec-t0.tv_sec) + " sec]");
|
||||||
//digi->GetData()->PrintStat();
|
//emit sendMsg("FileSize ("+ QString::number(digi->GetSerialNumber()) +"): " + QString::number(digi->GetData()->GetTotalFileSize()/1024./1024., 'f', 4) + " MB [" + QString::number(tb.tv_sec-t0.tv_sec) + " sec] (" + QString::number(readCount) + ")");
|
||||||
digiMTX[ID].unlock();
|
digiMTX[ID].unlock();
|
||||||
|
// readCount = 0;
|
||||||
ta = tb;
|
ta = tb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,8 +96,6 @@ private:
|
||||||
bool isScope;
|
bool isScope;
|
||||||
unsigned long readCount;
|
unsigned long readCount;
|
||||||
|
|
||||||
// QMutex mutex;
|
|
||||||
// QWaitCondition condition;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//^#======================================================= Timing Thread
|
//^#======================================================= Timing Thread
|
||||||
|
|
17
FSUDAQ.cpp
17
FSUDAQ.cpp
|
@ -838,7 +838,7 @@ void MainWindow::SetupScalar(){
|
||||||
if( digi[k]->GetNumInputCh() > maxNChannel ) maxNChannel = digi[k]->GetNumInputCh();
|
if( digi[k]->GetNumInputCh() > maxNChannel ) maxNChannel = digi[k]->GetNumInputCh();
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar->setGeometry(0, 0, 10 + nDigi * 200, 110 + maxNChannel * 20);
|
scalar->setGeometry(0, 0, 100 + nDigi * 200, 200 + maxNChannel * 20);
|
||||||
|
|
||||||
if( lbLastUpdateTime == nullptr ){
|
if( lbLastUpdateTime == nullptr ){
|
||||||
lbLastUpdateTime = new QLabel("Last update : NA", scalar);
|
lbLastUpdateTime = new QLabel("Last update : NA", scalar);
|
||||||
|
@ -884,6 +884,10 @@ void MainWindow::SetupScalar(){
|
||||||
QHBoxLayout * hBoxLayout = new QHBoxLayout(hBox);
|
QHBoxLayout * hBoxLayout = new QHBoxLayout(hBox);
|
||||||
scalarLayout->addWidget(hBox, rowID, 2*iDigi+1, 1, 2);
|
scalarLayout->addWidget(hBox, rowID, 2*iDigi+1, 1, 2);
|
||||||
|
|
||||||
|
lbAggCount[iDigi] = new QLabel("AggCount/ReadCount", scalar);
|
||||||
|
lbAggCount[iDigi]->setAlignment(Qt::AlignLeft | Qt::AlignCenter);
|
||||||
|
hBoxLayout->addWidget(lbAggCount[iDigi]);
|
||||||
|
|
||||||
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::AlignRight | Qt::AlignCenter);
|
lbDigi->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||||
hBoxLayout->addWidget(lbDigi);
|
hBoxLayout->addWidget(lbDigi);
|
||||||
|
@ -988,9 +992,13 @@ void MainWindow::UpdateScalar(){
|
||||||
if(digiSettings && digiSettings->isVisible() && digiSettings->GetTabID() == iDigi) digiSettings->UpdateACQStatus(acqStatus);
|
if(digiSettings && digiSettings->isVisible() && digiSettings->GetTabID() == iDigi) digiSettings->UpdateACQStatus(acqStatus);
|
||||||
|
|
||||||
digiMTX[iDigi].lock();
|
digiMTX[iDigi].lock();
|
||||||
digi[iDigi]->GetData()->CalTriggerRate();
|
|
||||||
// printf("### %d ", iDigi);
|
QString blockCountStr = QString::number(digi[iDigi]->GetData()->AggCount);
|
||||||
// digi[iDigi]->GetData()->PrintAllData(true, 10);
|
blockCountStr += "/" + QString::number(readDataThread[iDigi]->GetReadCount());
|
||||||
|
readDataThread[iDigi]->SetReadCountZero();
|
||||||
|
lbAggCount[iDigi]->setText(blockCountStr);
|
||||||
|
|
||||||
|
digi[iDigi]->GetData()->CalTriggerRate(); //this will reset NumEventDecode & AggCount
|
||||||
if( chkSaveData->isChecked() ) totalFileSize += digi[iDigi]->GetData()->GetTotalFileSize();
|
if( chkSaveData->isChecked() ) totalFileSize += digi[iDigi]->GetData()->GetTotalFileSize();
|
||||||
for( int i = 0; i < digi[iDigi]->GetNumInputCh(); i++){
|
for( int i = 0; i < digi[iDigi]->GetNumInputCh(); i++){
|
||||||
QString a = "";
|
QString a = "";
|
||||||
|
@ -1009,6 +1017,7 @@ void MainWindow::UpdateScalar(){
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
digiMTX[iDigi].unlock();
|
digiMTX[iDigi].unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
FSUDAQ.h
1
FSUDAQ.h
|
@ -169,6 +169,7 @@ private:
|
||||||
QPushButton * runStatus[MaxNDigitizer];
|
QPushButton * runStatus[MaxNDigitizer];
|
||||||
QLabel * lbLastUpdateTime;
|
QLabel * lbLastUpdateTime;
|
||||||
QLabel * lbScalarACQStatus;
|
QLabel * lbScalarACQStatus;
|
||||||
|
QLabel * lbAggCount[MaxNDigitizer];
|
||||||
|
|
||||||
//@----- Run Record
|
//@----- Run Record
|
||||||
QMainWindow * runRecord;
|
QMainWindow * runRecord;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user