many improvement from Encore experiment

This commit is contained in:
carina@hades 2023-08-22 14:38:37 -04:00
parent 31eefc2d92
commit 20c9a8b63d
7 changed files with 55 additions and 34 deletions

1
.gitignore vendored
View File

@ -6,6 +6,7 @@ test
test_indep test_indep
programSettings.txt programSettings.txt
EventKenshikushi EventKenshikushi
EventBuilder
DataGenerator DataGenerator
DataReaderScript DataReaderScript
pid.dat pid.dat

View File

@ -256,14 +256,15 @@ inline void Data::CloseSaveFile(){
//^####################################################### Print //^####################################################### Print
inline void Data::PrintStat() const{ inline void Data::PrintStat() const{
printf("============================= Print Stat. Digi-%d\n", boardSN);
if( !IsNotRollOverFakeAgg ) { if( !IsNotRollOverFakeAgg ) {
printf(" this is roll-over fake event or no events.\n"); printf(" this is roll-over fake event or no events.\n");
return; return;
} }
printf("%2s | %6s | %9s | %9s | %6s\n", "ch", "# Evt.", "Rate [Hz]", "N-PileUp", "Tot. Evt."); printf("%2s | %6s | %9s | %9s | %6s | %6s(%4s)\n", "ch", "# Evt.", "Rate [Hz]", "N-PileUp", "Tot. Evt.", "index", "loop");
printf("---+--------+-----------+-----------+----------\n"); printf("---+--------+-----------+-----------+----------\n");
for(int ch = 0; ch < MaxNChannels; ch++){ for(int ch = 0; ch < MaxNChannels; ch++){
printf("%2d | %6d | %9.2f | %9.2f | %6lu\n", ch, NumEventsDecoded[ch], TriggerRate[ch], NonPileUpRate[ch], TotNumEvents[ch]); printf("%2d | %6d | %9.2f | %9.2f | %6lu | %6d(%2d)\n", ch, NumEventsDecoded[ch], TriggerRate[ch], NonPileUpRate[ch], TotNumEvents[ch], DataIndex[ch], LoopIndex[ch]);
} }
printf("---+--------+-----------+-----------+----------\n"); printf("---+--------+-----------+-----------+----------\n");
} }
@ -415,13 +416,12 @@ inline void Data::DecodeBuffer(bool fastDecode, int verbose){
int indexStart = DataIndex[ch] - NumEventsDecoded[ch] + 1; int indexStart = DataIndex[ch] - NumEventsDecoded[ch] + 1;
if( indexStart < 0 ) indexStart += MaxNData; if( indexStart < 0 ) indexStart += MaxNData;
//printf("%d %d| %d %d \n", DataIndex[ch], NumEventsDecoded[ch], indexStart, DataIndex[ch] );
unsigned long long dTime = Timestamp[ch][DataIndex[ch]] - Timestamp[ch][indexStart]; unsigned long long dTime = Timestamp[ch][DataIndex[ch]] - Timestamp[ch][indexStart];
double sec = dTime * tick2ns / 1e9; double sec = dTime * tick2ns / 1e9;
TriggerRate[ch] = NumEventsDecoded[ch]/sec; TriggerRate[ch] = (NumEventsDecoded[ch]-1)/sec;
NonPileUpRate[ch] = NumNonPileUpDecoded[ch]/sec; //printf("%d %d| %d | %llu, %.3e | %.2f\n", indexStart, DataIndex[ch], NumEventsDecoded[ch], dTime, sec , TriggerRate[ch]);
NonPileUpRate[ch] = (NumNonPileUpDecoded[ch]-1)/sec;
}else{ // look in to the data in the memory, not just this agg. }else{ // look in to the data in the memory, not just this agg.

View File

@ -391,8 +391,8 @@ void Digitizer::StartACQ(){
unsigned int bufferSize = CalByteForBuffer(); unsigned int bufferSize = CalByteForBuffer();
if( bufferSize > 160 * 1024 * 1024 ){ if( bufferSize > 160 * 1024 * 1024 ){
printf("============= buffer size bigger than 160 MB"); printf("============= buffer size bigger than 160 MB (%u)\n", bufferSize );
return; //return;
} }
if( DPPType == V1730_DPP_PSD_CODE) bufferSize = 80 * 1024 * 1024; //TODO allocate 80 MB for PSD if( DPPType == V1730_DPP_PSD_CODE) bufferSize = 80 * 1024 * 1024; //TODO allocate 80 MB for PSD
@ -435,6 +435,7 @@ void Digitizer::StopACQ(){
if( ret != 0 ) ErrorMsg("something wrong when try to stop ACQ and clear buffer"); if( ret != 0 ) ErrorMsg("something wrong when try to stop ACQ and clear buffer");
printf("\n\e[1m\e[33m====== Acquisition STOPPED for %d | Board %d, Port %d\e[0m\n", BoardInfo.SerialNumber, boardID, portID); printf("\n\e[1m\e[33m====== Acquisition STOPPED for %d | Board %d, Port %d\e[0m\n", BoardInfo.SerialNumber, boardID, portID);
AcqRun = false; AcqRun = false;
data->PrintStat();
data->ClearTriggerRate(); data->ClearTriggerRate();
data->ClearBuffer(); data->ClearBuffer();
data->ZeroTotalFileSize(); data->ZeroTotalFileSize();

View File

@ -190,6 +190,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QStr
usleep(1000*500); // wait for 0.2 sec usleep(1000*500); // wait for 0.2 sec
ReadSettingsFromBoard(); ReadSettingsFromBoard();
emit UpdateOtherPanels();
}); });
bnClearBuffer = new QPushButton("Clear Buffer/FIFO", this); bnClearBuffer = new QPushButton("Clear Buffer/FIFO", this);

View File

@ -19,7 +19,7 @@ void quickSort(int arr[], int kaka[], TString file[], int start, int end);
int main(int argc, char **argv) { int main(int argc, char **argv) {
printf("=========================================\n"); printf("=========================================\n");
printf("=== *.fsu Events Kenshikushi ===\n"); printf("=== *.fsu Events Builder ===\n");
printf("=========================================\n"); printf("=========================================\n");
if (argc <= 3) { if (argc <= 3) {
printf("Incorrect number of arguments:\n"); printf("Incorrect number of arguments:\n");

View File

@ -223,19 +223,15 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
connect( bnStartACQ, &QPushButton::clicked, this, &MainWindow::AutoRun); connect( bnStartACQ, &QPushButton::clicked, this, &MainWindow::AutoRun);
bnStopACQ = new QPushButton("Stop ACQ", this); bnStopACQ = new QPushButton("Stop ACQ", this);
connect( bnStopACQ, &QPushButton::clicked, this, [=](){ connect( bnStopACQ, &QPushButton::clicked, this, [=](){
if( chkSaveData->isChecked() ){
if( runTimer->isActive() ){ if( runTimer->isActive() ){
runTimer->stop(); runTimer->stop();
runTimer->disconnect(runTimerConnection); runTimer->disconnect(runTimerConnection);
StopACQ();
}else{ }else{
breakAutoRepeat = true; breakAutoRepeat = true;
runTimer->disconnect(runTimerConnection); runTimer->disconnect(runTimerConnection);
} }
needManualComment = true; needManualComment = true;
}else{
StopACQ(); StopACQ();
}
}); });
layout->addWidget(lbPrefix, rowID, 0); layout->addWidget(lbPrefix, rowID, 0);
@ -630,13 +626,13 @@ void MainWindow::OpenDigitizers(){
}else{ }else{
LogMsg("Found <b>" + fileName + "</b> for digitizer settings."); LogMsg("Found <b>" + fileName + "</b> for digitizer settings.");
if( digi[i]->LoadSettingBinaryToMemory(fileName.toStdString().c_str()) == 0 ){ // if( digi[i]->LoadSettingBinaryToMemory(fileName.toStdString().c_str()) == 0 ){
LogMsg("Loaded settings file <b>" + fileName + "</b> for Digi-" + QString::number(digi[i]->GetSerialNumber())); // LogMsg("Loaded settings file <b>" + fileName + "</b> for Digi-" + QString::number(digi[i]->GetSerialNumber()));
digi[i]->ProgramSettingsToBoard(); // digi[i]->ProgramSettingsToBoard();
//
}else{ // }else{
LogMsg("Fail to Loaded settings file " + fileName + " for Digi-" + QString::number(digi[i]->GetSerialNumber())); // LogMsg("Fail to Loaded settings file " + fileName + " for Digi-" + QString::number(digi[i]->GetSerialNumber()));
} // }
} }
digi[i]->ReadAllSettingsFromBoard(true); digi[i]->ReadAllSettingsFromBoard(true);
@ -1352,14 +1348,16 @@ void MainWindow::OpenScope(){
if( scope ) { if( scope ) {
if( onOff ) { if( onOff ) {
lbScalarACQStatus->setText("<font style=\"color: green;\"><b>ACQ On</b></font>"); lbScalarACQStatus->setText("<font style=\"color: green;\"><b>ACQ On</b></font>");
influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=1"); if( influx ) influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=1");
}else{ }else{
lbScalarACQStatus->setText("<font style=\"color: red;\"><b>ACQ Off</b></font>"); lbScalarACQStatus->setText("<font style=\"color: red;\"><b>ACQ Off</b></font>");
influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=0"); if( influx ) influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=0");
} }
if( influx ){
influx->WriteData(dataBaseName.toStdString()); influx->WriteData(dataBaseName.toStdString());
influx->ClearDataPointsBuffer(); influx->ClearDataPointsBuffer();
} }
}
if( canvas ){ if( canvas ){
if( onOff) { if( onOff) {

View File

@ -116,6 +116,7 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh
tick2ns = digi[ID]->GetTick2ns(); tick2ns = digi[ID]->GetTick2ns();
factor = digi[ID]->IsDualTrace_PHA() ? 2 : 1; factor = digi[ID]->IsDualTrace_PHA() ? 2 : 1;
enableSignalSlot = false;
//---setup cbScopeCh //---setup cbScopeCh
cbScopeCh->clear(); cbScopeCh->clear();
for( int i = 0; i < digi[ID]->GetNChannels(); i++) cbScopeCh->addItem("Ch-" + QString::number(i)); for( int i = 0; i < digi[ID]->GetNChannels(); i++) cbScopeCh->addItem("Ch-" + QString::number(i));
@ -156,6 +157,11 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh
digiMTX[ID].unlock(); digiMTX[ID].unlock();
}); });
QPushButton * bnClearBuffer = new QPushButton("Clear Buffer/FIFO", this);
layout->addWidget(bnClearBuffer, rowID, 4);
connect(bnClearBuffer, &QPushButton::clicked, this, [=](){ digi[ID]->WriteRegister(DPP::SoftwareClear_W, 1);});
//================ Trace settings //================ Trace settings
rowID ++; rowID ++;
{ {
@ -308,6 +314,7 @@ void Scope::StopScope(){
} }
digiMTX[iDigi].lock(); digiMTX[iDigi].lock();
digi[iDigi]->StopACQ(); digi[iDigi]->StopACQ();
//digi[iDigi]->GetData()->PrintAllData();
digiMTX[iDigi].unlock(); digiMTX[iDigi].unlock();
digi[iDigi]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, traceOn[iDigi], -1); digi[iDigi]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, traceOn[iDigi], -1);
@ -691,13 +698,25 @@ void Scope::EnableControl(bool enable){
if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ){ if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ){
sbReordLength->setEnabled(enable);
sbPreTrigger->setEnabled(enable); sbPreTrigger->setEnabled(enable);
sbDCOffset->setEnabled(enable);
cbDynamicRange->setEnabled(enable);
sbInputRiseTime->setEnabled(enable);
//sbThreshold->setEnabled(enable);
sbTriggerHoldOff->setEnabled(enable);
cbSmoothingFactor->setEnabled(enable);
sbTrapRiseTime->setEnabled(enable); sbTrapRiseTime->setEnabled(enable);
sbTrapFlatTop->setEnabled(enable); sbTrapFlatTop->setEnabled(enable);
sbDecayTime->setEnabled(enable); sbDecayTime->setEnabled(enable);
sbPeakingTime->setEnabled(enable);
sbInputRiseTime->setEnabled(enable); cbPolarity->setEnabled(enable);
cbSmoothingFactor->setEnabled(enable); cbBaselineAvg->setEnabled(enable);
cbPeakAvg->setEnabled(enable);
sbPeakHoldOff->setEnabled(enable);
} }