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
programSettings.txt
EventKenshikushi
EventBuilder
DataGenerator
DataReaderScript
pid.dat

View File

@ -256,14 +256,15 @@ inline void Data::CloseSaveFile(){
//^####################################################### Print
inline void Data::PrintStat() const{
printf("============================= Print Stat. Digi-%d\n", boardSN);
if( !IsNotRollOverFakeAgg ) {
printf(" this is roll-over fake event or no events.\n");
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");
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");
}
@ -415,13 +416,12 @@ inline void Data::DecodeBuffer(bool fastDecode, int verbose){
int indexStart = DataIndex[ch] - NumEventsDecoded[ch] + 1;
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];
double sec = dTime * tick2ns / 1e9;
TriggerRate[ch] = NumEventsDecoded[ch]/sec;
NonPileUpRate[ch] = NumNonPileUpDecoded[ch]/sec;
TriggerRate[ch] = (NumEventsDecoded[ch]-1)/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.

View File

@ -391,8 +391,8 @@ void Digitizer::StartACQ(){
unsigned int bufferSize = CalByteForBuffer();
if( bufferSize > 160 * 1024 * 1024 ){
printf("============= buffer size bigger than 160 MB");
return;
printf("============= buffer size bigger than 160 MB (%u)\n", bufferSize );
//return;
}
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");
printf("\n\e[1m\e[33m====== Acquisition STOPPED for %d | Board %d, Port %d\e[0m\n", BoardInfo.SerialNumber, boardID, portID);
AcqRun = false;
data->PrintStat();
data->ClearTriggerRate();
data->ClearBuffer();
data->ZeroTotalFileSize();

View File

@ -190,6 +190,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QStr
usleep(1000*500); // wait for 0.2 sec
ReadSettingsFromBoard();
emit UpdateOtherPanels();
});
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) {
printf("=========================================\n");
printf("=== *.fsu Events Kenshikushi ===\n");
printf("=== *.fsu Events Builder ===\n");
printf("=========================================\n");
if (argc <= 3) {
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);
bnStopACQ = new QPushButton("Stop ACQ", this);
connect( bnStopACQ, &QPushButton::clicked, this, [=](){
if( chkSaveData->isChecked() ){
if( runTimer->isActive() ){
runTimer->stop();
runTimer->disconnect(runTimerConnection);
StopACQ();
}else{
breakAutoRepeat = true;
runTimer->disconnect(runTimerConnection);
}
needManualComment = true;
}else{
StopACQ();
}
});
layout->addWidget(lbPrefix, rowID, 0);
@ -630,13 +626,13 @@ void MainWindow::OpenDigitizers(){
}else{
LogMsg("Found <b>" + fileName + "</b> for digitizer settings.");
if( digi[i]->LoadSettingBinaryToMemory(fileName.toStdString().c_str()) == 0 ){
LogMsg("Loaded settings file <b>" + fileName + "</b> for Digi-" + QString::number(digi[i]->GetSerialNumber()));
digi[i]->ProgramSettingsToBoard();
}else{
LogMsg("Fail to Loaded settings file " + fileName + " for Digi-" + QString::number(digi[i]->GetSerialNumber()));
}
// if( digi[i]->LoadSettingBinaryToMemory(fileName.toStdString().c_str()) == 0 ){
// LogMsg("Loaded settings file <b>" + fileName + "</b> for Digi-" + QString::number(digi[i]->GetSerialNumber()));
// digi[i]->ProgramSettingsToBoard();
//
// }else{
// LogMsg("Fail to Loaded settings file " + fileName + " for Digi-" + QString::number(digi[i]->GetSerialNumber()));
// }
}
digi[i]->ReadAllSettingsFromBoard(true);
@ -1352,14 +1348,16 @@ void MainWindow::OpenScope(){
if( scope ) {
if( onOff ) {
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{
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->ClearDataPointsBuffer();
}
}
if( canvas ){
if( onOff) {

View File

@ -116,6 +116,7 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh
tick2ns = digi[ID]->GetTick2ns();
factor = digi[ID]->IsDualTrace_PHA() ? 2 : 1;
enableSignalSlot = false;
//---setup cbScopeCh
cbScopeCh->clear();
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();
});
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
rowID ++;
{
@ -308,6 +314,7 @@ void Scope::StopScope(){
}
digiMTX[iDigi].lock();
digi[iDigi]->StopACQ();
//digi[iDigi]->GetData()->PrintAllData();
digiMTX[iDigi].unlock();
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 ){
sbReordLength->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);
sbTrapFlatTop->setEnabled(enable);
sbDecayTime->setEnabled(enable);
sbPeakingTime->setEnabled(enable);
sbInputRiseTime->setEnabled(enable);
cbSmoothingFactor->setEnabled(enable);
cbPolarity->setEnabled(enable);
cbBaselineAvg->setEnabled(enable);
cbPeakAvg->setEnabled(enable);
sbPeakHoldOff->setEnabled(enable);
}