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 NonPileUpRate [MaxNChannels]; /// Hz
|
||||
unsigned long TotNumNonPileUpEvents[MaxNChannels]; /// also exclude overthrow
|
||||
unsigned short NumEventsDecoded [MaxNChannels]; /// reset at every decode
|
||||
unsigned short NumNonPileUpDecoded [MaxNChannels]; /// reset at every decode
|
||||
unsigned short NumEventsDecoded [MaxNChannels]; /// reset after trig-rate calculation
|
||||
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
|
||||
|
||||
int GetLoopIndex(unsigned short ch) const {return LoopIndex[ch];}
|
||||
|
@ -278,17 +280,17 @@ inline void Data::ClearNumEventsDecoded(){
|
|||
NumEventsDecoded[i] = 0;
|
||||
NumNonPileUpDecoded[i] = 0;
|
||||
}
|
||||
AggCount = 0;
|
||||
}
|
||||
|
||||
inline void Data::ClearData(){
|
||||
nByte = 0;
|
||||
AllocatedSize = 0;
|
||||
TotalAggCount = 0;
|
||||
for( int ch = 0 ; ch < MaxNChannels; ch++){
|
||||
LoopIndex[ch] = 0;
|
||||
DataIndex[ch] = -1;
|
||||
NumEventsDecoded[ch] = 0;
|
||||
NumNonPileUpDecoded[ch] = 0;
|
||||
|
||||
|
||||
TotNumNonPileUpEvents[ch] = 0 ;
|
||||
|
||||
calIndexes[ch][0] = -1;
|
||||
|
@ -317,6 +319,9 @@ inline void Data::ClearData(){
|
|||
tempDigiWaveform3.clear();
|
||||
tempDigiWaveform4.clear();
|
||||
|
||||
ClearNumEventsDecoded();
|
||||
ClearTriggerRate();
|
||||
|
||||
}
|
||||
|
||||
inline void Data::ClearBuffer(){
|
||||
|
@ -340,6 +345,7 @@ inline void Data::CalTriggerRate(){
|
|||
unsigned long long dTime = 0;
|
||||
double sec = -999;
|
||||
|
||||
|
||||
for( int ch = 0; ch < numInputCh; ch ++ ){
|
||||
if( t0[ch] == 0 ) {
|
||||
TriggerRate[ch] = 0;
|
||||
|
@ -347,6 +353,7 @@ inline void Data::CalTriggerRate(){
|
|||
continue;
|
||||
}
|
||||
|
||||
|
||||
if( NumEventsDecoded[ch] < dataSize ){
|
||||
|
||||
dTime = Timestamp[ch][DataIndex[ch]] - t0[ch];
|
||||
|
@ -379,6 +386,7 @@ inline void Data::CalTriggerRate(){
|
|||
NumNonPileUpDecoded[ch] = 0;
|
||||
}
|
||||
|
||||
AggCount = 0;
|
||||
}
|
||||
|
||||
//^###############################################
|
||||
|
@ -458,7 +466,7 @@ inline void Data::CloseSaveFile(){
|
|||
//^####################################################### Print
|
||||
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("---+--------+-----------+-----------+----------\n");
|
||||
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
|
||||
unsigned int nWord = word & 0x0FFFFFFF ;
|
||||
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);
|
||||
unsigned int BoardID = ((word >> 27) & 0x1F);
|
||||
unsigned short pattern = ((word >> 8 ) & 0x7FFF );
|
||||
|
|
|
@ -27,27 +27,15 @@ public:
|
|||
void SetSaveData(bool onOff) {this->isSaveData = onOff;}
|
||||
void SetScopeMode(bool onOff) {this->isScope = onOff;}
|
||||
|
||||
// void go(){
|
||||
// mutex.lock();
|
||||
// condition.wakeAll();
|
||||
// mutex.unlock();
|
||||
// }
|
||||
void SetReadCountZero() {readCount = 0;}
|
||||
unsigned long GetReadCount() const {return readCount;}
|
||||
|
||||
void run(){
|
||||
|
||||
stop = false;
|
||||
|
||||
// mutex.lock();
|
||||
// condition.wait(&mutex);
|
||||
// mutex.unlock();
|
||||
|
||||
readCount = 0;
|
||||
clock_gettime(CLOCK_REALTIME, &t0);
|
||||
//printf("--- %d, %ld nsec \n", ID, t0.tv_nsec);
|
||||
ta = t0;
|
||||
// clock_gettime(CLOCK_REALTIME, &t1);
|
||||
|
||||
// digi->StartACQ();
|
||||
// usleep(1000); // wait for some data;
|
||||
|
||||
printf("ReadDataThread for digi-%d running.\n", digi->GetSerialNumber());
|
||||
do{
|
||||
|
@ -66,13 +54,6 @@ public:
|
|||
digi->GetData()->DecodeBuffer(!isScope, 0);
|
||||
if( isSaveData ) digi->GetData()->SaveData();
|
||||
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{
|
||||
printf("ReadDataThread::%s------------ ret : %d \n", __func__, ret);
|
||||
|
@ -93,10 +74,10 @@ public:
|
|||
clock_gettime(CLOCK_REALTIME, &tb);
|
||||
if( tb.tv_sec - ta.tv_sec > 2 ) {
|
||||
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]");
|
||||
//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();
|
||||
// readCount = 0;
|
||||
ta = tb;
|
||||
}
|
||||
}
|
||||
|
@ -115,8 +96,6 @@ private:
|
|||
bool isScope;
|
||||
unsigned long readCount;
|
||||
|
||||
// QMutex mutex;
|
||||
// QWaitCondition condition;
|
||||
};
|
||||
|
||||
//^#======================================================= Timing Thread
|
||||
|
|
17
FSUDAQ.cpp
17
FSUDAQ.cpp
|
@ -838,7 +838,7 @@ void MainWindow::SetupScalar(){
|
|||
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 ){
|
||||
lbLastUpdateTime = new QLabel("Last update : NA", scalar);
|
||||
|
@ -884,6 +884,10 @@ void MainWindow::SetupScalar(){
|
|||
QHBoxLayout * hBoxLayout = new QHBoxLayout(hBox);
|
||||
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);
|
||||
lbDigi->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||
hBoxLayout->addWidget(lbDigi);
|
||||
|
@ -988,9 +992,13 @@ void MainWindow::UpdateScalar(){
|
|||
if(digiSettings && digiSettings->isVisible() && digiSettings->GetTabID() == iDigi) digiSettings->UpdateACQStatus(acqStatus);
|
||||
|
||||
digiMTX[iDigi].lock();
|
||||
digi[iDigi]->GetData()->CalTriggerRate();
|
||||
// printf("### %d ", iDigi);
|
||||
// digi[iDigi]->GetData()->PrintAllData(true, 10);
|
||||
|
||||
QString blockCountStr = QString::number(digi[iDigi]->GetData()->AggCount);
|
||||
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();
|
||||
for( int i = 0; i < digi[iDigi]->GetNumInputCh(); i++){
|
||||
QString a = "";
|
||||
|
@ -1009,6 +1017,7 @@ void MainWindow::UpdateScalar(){
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
digiMTX[iDigi].unlock();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user