when the trigger rate is small and Event/Agg is large, the trigger rate would be 0/0 = nan, fixed this. disable digiPlanel button when ACQ started
This commit is contained in:
parent
405b255344
commit
55ec7995c7
18
ClassData.h
18
ClassData.h
|
@ -47,6 +47,7 @@ class Data{
|
|||
unsigned long TotNumNonPileUpEvents[MaxNChannels]; /// also exclude overthrow
|
||||
unsigned short NumEventsDecoded [MaxNChannels]; /// reset after trig-rate calculation
|
||||
unsigned short NumNonPileUpDecoded [MaxNChannels]; /// reset after trig-rate calculation
|
||||
uShort countNumEventDecodeZero[MaxNChannels]; /// when > 3, set trigger rate to be zero;
|
||||
|
||||
unsigned int TotalAggCount ;
|
||||
unsigned short AggCount ; /// reset after trig-rate calculation
|
||||
|
@ -72,6 +73,7 @@ class Data{
|
|||
std::vector<bool> ** DigiWaveform3;
|
||||
std::vector<bool> ** DigiWaveform4;
|
||||
|
||||
|
||||
public:
|
||||
Data(unsigned short numCh, uInt dataSize = DefaultDataSize);
|
||||
~Data();
|
||||
|
@ -108,7 +110,7 @@ class Data{
|
|||
uint64_t GetTotalFileSize() const {return FinishedOutFilesSize + outFileSize;}
|
||||
void ZeroTotalFileSize() { FinishedOutFilesSize = 0; }
|
||||
|
||||
void CalTriggerRate();
|
||||
void CalTriggerRate(); // this method is called by FSUDAQ::UpdateScalar()
|
||||
void ClearReferenceTime();
|
||||
|
||||
protected:
|
||||
|
@ -167,6 +169,7 @@ inline Data::Data(unsigned short numCh, uInt dataSize): numInputCh(numCh){
|
|||
for ( int i = 0; i < MaxNChannels; i++) {
|
||||
TotNumNonPileUpEvents[i] = 0;
|
||||
t0[i] = 0;
|
||||
countNumEventDecodeZero[i] = 0;
|
||||
}
|
||||
ClearData();
|
||||
ClearTriggerRate();
|
||||
|
@ -286,6 +289,7 @@ inline void Data::ClearNumEventsDecoded(){
|
|||
for( int i = 0 ; i < MaxNChannels; i++) {
|
||||
NumEventsDecoded[i] = 0;
|
||||
NumNonPileUpDecoded[i] = 0;
|
||||
countNumEventDecodeZero[i] = 0;
|
||||
}
|
||||
AggCount = 0;
|
||||
}
|
||||
|
@ -347,19 +351,23 @@ inline void Data::ClearReferenceTime(){
|
|||
for( int ch = 0; ch < numInputCh; ch ++ ) t0[ch] = 0;
|
||||
}
|
||||
|
||||
inline void Data::CalTriggerRate(){
|
||||
inline void Data::CalTriggerRate(){ // this method is called by FSUDAQ::UpdateScalar()
|
||||
|
||||
unsigned long long dTime = 0;
|
||||
double sec = -999;
|
||||
|
||||
|
||||
for( int ch = 0; ch < numInputCh; ch ++ ){
|
||||
if( t0[ch] == 0 ) {
|
||||
if( t0[ch] == 0 || countNumEventDecodeZero[ch] > 3) {
|
||||
TriggerRate[ch] = 0;
|
||||
NonPileUpRate[ch] = 0;
|
||||
countNumEventDecodeZero[ch] = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if( NumEventsDecoded[ch] == 0 ) {
|
||||
countNumEventDecodeZero[ch] ++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if( NumEventsDecoded[ch] < dataSize ){
|
||||
|
||||
|
@ -369,6 +377,8 @@ inline void Data::CalTriggerRate(){
|
|||
TriggerRate[ch] = (NumEventsDecoded[ch])/sec;
|
||||
NonPileUpRate[ch] = (NumNonPileUpDecoded[ch])/sec;
|
||||
|
||||
// printf("%2d | %d | %f %f \n", ch, NumEventsDecoded[ch], sec, TriggerRate[ch]);
|
||||
|
||||
}else{
|
||||
|
||||
uShort nEvent = 100;
|
||||
|
|
|
@ -339,11 +339,18 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QStr
|
|||
|
||||
enableSignalSlot = true;
|
||||
|
||||
//If any digitizer is running ACQ, disable the panel.
|
||||
for( unsigned int iDigi = 0; iDigi < nDigi; iDigi ++){
|
||||
if( digi[iDigi]->IsRunning() ) {
|
||||
this->setEnabled(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DigiSettingsPanel::~DigiSettingsPanel(){
|
||||
printf("%s \n", __func__);
|
||||
|
||||
}
|
||||
|
||||
//*================================================================
|
||||
|
|
|
@ -766,6 +766,7 @@ void MainWindow::CloseDigitizers(){
|
|||
readDataThread = nullptr;
|
||||
|
||||
for(unsigned int i = 0; i < nDigi; i ++){
|
||||
digi[i]->StopACQ();
|
||||
digi[i]->CloseDigitizer();
|
||||
delete digi[i];
|
||||
}
|
||||
|
@ -1120,6 +1121,7 @@ void MainWindow::StartACQ(){
|
|||
}
|
||||
|
||||
chkSaveData->setEnabled(false);
|
||||
bnDigiSettings->setEnabled(false);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1211,6 +1213,7 @@ void MainWindow::StopACQ(){
|
|||
}
|
||||
|
||||
chkSaveData->setEnabled(true);
|
||||
bnDigiSettings->setEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user