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 long TotNumNonPileUpEvents[MaxNChannels]; /// also exclude overthrow
|
||||||
unsigned short NumEventsDecoded [MaxNChannels]; /// reset after trig-rate calculation
|
unsigned short NumEventsDecoded [MaxNChannels]; /// reset after trig-rate calculation
|
||||||
unsigned short NumNonPileUpDecoded [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 int TotalAggCount ;
|
||||||
unsigned short AggCount ; /// reset after trig-rate calculation
|
unsigned short AggCount ; /// reset after trig-rate calculation
|
||||||
|
@ -72,6 +73,7 @@ class Data{
|
||||||
std::vector<bool> ** DigiWaveform3;
|
std::vector<bool> ** DigiWaveform3;
|
||||||
std::vector<bool> ** DigiWaveform4;
|
std::vector<bool> ** DigiWaveform4;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Data(unsigned short numCh, uInt dataSize = DefaultDataSize);
|
Data(unsigned short numCh, uInt dataSize = DefaultDataSize);
|
||||||
~Data();
|
~Data();
|
||||||
|
@ -108,7 +110,7 @@ class Data{
|
||||||
uint64_t GetTotalFileSize() const {return FinishedOutFilesSize + outFileSize;}
|
uint64_t GetTotalFileSize() const {return FinishedOutFilesSize + outFileSize;}
|
||||||
void ZeroTotalFileSize() { FinishedOutFilesSize = 0; }
|
void ZeroTotalFileSize() { FinishedOutFilesSize = 0; }
|
||||||
|
|
||||||
void CalTriggerRate();
|
void CalTriggerRate(); // this method is called by FSUDAQ::UpdateScalar()
|
||||||
void ClearReferenceTime();
|
void ClearReferenceTime();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -167,6 +169,7 @@ inline Data::Data(unsigned short numCh, uInt dataSize): numInputCh(numCh){
|
||||||
for ( int i = 0; i < MaxNChannels; i++) {
|
for ( int i = 0; i < MaxNChannels; i++) {
|
||||||
TotNumNonPileUpEvents[i] = 0;
|
TotNumNonPileUpEvents[i] = 0;
|
||||||
t0[i] = 0;
|
t0[i] = 0;
|
||||||
|
countNumEventDecodeZero[i] = 0;
|
||||||
}
|
}
|
||||||
ClearData();
|
ClearData();
|
||||||
ClearTriggerRate();
|
ClearTriggerRate();
|
||||||
|
@ -286,6 +289,7 @@ inline void Data::ClearNumEventsDecoded(){
|
||||||
for( int i = 0 ; i < MaxNChannels; i++) {
|
for( int i = 0 ; i < MaxNChannels; i++) {
|
||||||
NumEventsDecoded[i] = 0;
|
NumEventsDecoded[i] = 0;
|
||||||
NumNonPileUpDecoded[i] = 0;
|
NumNonPileUpDecoded[i] = 0;
|
||||||
|
countNumEventDecodeZero[i] = 0;
|
||||||
}
|
}
|
||||||
AggCount = 0;
|
AggCount = 0;
|
||||||
}
|
}
|
||||||
|
@ -347,19 +351,23 @@ inline void Data::ClearReferenceTime(){
|
||||||
for( int ch = 0; ch < numInputCh; ch ++ ) t0[ch] = 0;
|
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;
|
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 || countNumEventDecodeZero[ch] > 3) {
|
||||||
TriggerRate[ch] = 0;
|
TriggerRate[ch] = 0;
|
||||||
NonPileUpRate[ch] = 0;
|
NonPileUpRate[ch] = 0;
|
||||||
|
countNumEventDecodeZero[ch] = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( NumEventsDecoded[ch] == 0 ) {
|
||||||
|
countNumEventDecodeZero[ch] ++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if( NumEventsDecoded[ch] < dataSize ){
|
if( NumEventsDecoded[ch] < dataSize ){
|
||||||
|
|
||||||
|
@ -369,6 +377,8 @@ inline void Data::CalTriggerRate(){
|
||||||
TriggerRate[ch] = (NumEventsDecoded[ch])/sec;
|
TriggerRate[ch] = (NumEventsDecoded[ch])/sec;
|
||||||
NonPileUpRate[ch] = (NumNonPileUpDecoded[ch])/sec;
|
NonPileUpRate[ch] = (NumNonPileUpDecoded[ch])/sec;
|
||||||
|
|
||||||
|
// printf("%2d | %d | %f %f \n", ch, NumEventsDecoded[ch], sec, TriggerRate[ch]);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
uShort nEvent = 100;
|
uShort nEvent = 100;
|
||||||
|
|
|
@ -339,11 +339,18 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QStr
|
||||||
|
|
||||||
enableSignalSlot = true;
|
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(){
|
DigiSettingsPanel::~DigiSettingsPanel(){
|
||||||
printf("%s \n", __func__);
|
printf("%s \n", __func__);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//*================================================================
|
//*================================================================
|
||||||
|
|
|
@ -766,6 +766,7 @@ void MainWindow::CloseDigitizers(){
|
||||||
readDataThread = nullptr;
|
readDataThread = nullptr;
|
||||||
|
|
||||||
for(unsigned int i = 0; i < nDigi; i ++){
|
for(unsigned int i = 0; i < nDigi; i ++){
|
||||||
|
digi[i]->StopACQ();
|
||||||
digi[i]->CloseDigitizer();
|
digi[i]->CloseDigitizer();
|
||||||
delete digi[i];
|
delete digi[i];
|
||||||
}
|
}
|
||||||
|
@ -1120,6 +1121,7 @@ void MainWindow::StartACQ(){
|
||||||
}
|
}
|
||||||
|
|
||||||
chkSaveData->setEnabled(false);
|
chkSaveData->setEnabled(false);
|
||||||
|
bnDigiSettings->setEnabled(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1211,6 +1213,7 @@ void MainWindow::StopACQ(){
|
||||||
}
|
}
|
||||||
|
|
||||||
chkSaveData->setEnabled(true);
|
chkSaveData->setEnabled(true);
|
||||||
|
bnDigiSettings->setEnabled(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user