diff --git a/ClassDigitizer.cpp b/ClassDigitizer.cpp index 26e2959..712b222 100644 --- a/ClassDigitizer.cpp +++ b/ClassDigitizer.cpp @@ -802,6 +802,8 @@ void Digitizer::ProgramSettingsToBoard(){ printf("========== %s \n", __func__); + const short pauseMilliSec = 10; + Reg haha; if( DPPType == DPPType::DPP_PHA_CODE || DPPType == DPPType::DPP_PSD_CODE ){ @@ -811,7 +813,7 @@ void Digitizer::ProgramSettingsToBoard(){ if( RegisterBoardList_PHAPSD[p].GetRWType() == RW::ReadWrite) { haha = RegisterBoardList_PHAPSD[p]; WriteRegister(haha, GetSettingFromMemory(haha), -1, false); - usleep(1 * 1000); + usleep(pauseMilliSec * 1000); } } /// Channels Setting @@ -821,7 +823,7 @@ void Digitizer::ProgramSettingsToBoard(){ if( RegisterChannelList_PHA[p].GetRWType() == RW::ReadWrite ){ haha = RegisterChannelList_PHA[p]; WriteRegister(haha, GetSettingFromMemory(haha, ch), ch, false); - usleep(1 * 1000); + usleep(pauseMilliSec * 1000); } } } @@ -830,7 +832,7 @@ void Digitizer::ProgramSettingsToBoard(){ if( RegisterChannelList_PSD[p].GetRWType() == RW::ReadWrite){ haha = RegisterChannelList_PSD[p]; WriteRegister(haha, GetSettingFromMemory(haha, ch), ch, false); - usleep(1 * 1000); + usleep(pauseMilliSec * 1000); } } } @@ -842,7 +844,7 @@ void Digitizer::ProgramSettingsToBoard(){ if( RegisterBoardList_QDC[p].GetRWType() == RW::ReadWrite) { haha = RegisterBoardList_QDC[p]; WriteRegister(haha, GetSettingFromMemory(haha), -1, false); - usleep(1 * 1000); + usleep(pauseMilliSec * 1000); } } /// Channels Setting @@ -851,7 +853,7 @@ void Digitizer::ProgramSettingsToBoard(){ if( RegisterChannelList_QDC[p].GetRWType() == RW::ReadWrite ){ haha = RegisterChannelList_QDC[p]; WriteRegister(haha, GetSettingFromMemory(haha, ch), ch, false); - usleep(1 * 1000); + usleep(pauseMilliSec * 1000); } } } diff --git a/analyzers/CoincidentAnalyzer.h b/analyzers/CoincidentAnalyzer.h index 1c6263e..fef4eb7 100644 --- a/analyzers/CoincidentAnalyzer.h +++ b/analyzers/CoincidentAnalyzer.h @@ -46,10 +46,10 @@ private: Histogram1D * h1g; Histogram1D * hMulti; - QCheckBox * runAnalyzer; + QCheckBox * chkRunAnalyzer; RSpinBox * sbUpdateTime; - QCheckBox * backWardBuilding; + QCheckBox * chkBackWardBuilding; RSpinBox * sbBackwardCount; RSpinBox * sbBuildWindow; @@ -78,8 +78,8 @@ inline void CoincidentAnalyzer::SetUpCanvas(){ boxLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft); box->setLayout(boxLayout); - runAnalyzer = new QCheckBox("Run Analyzer", this); - boxLayout->addWidget(runAnalyzer, 0, 0); + chkRunAnalyzer = new QCheckBox("Run Analyzer", this); + boxLayout->addWidget(chkRunAnalyzer, 0, 0); QLabel * lbUpdateTime = new QLabel("Update Period [s]", this); lbUpdateTime->setAlignment(Qt::AlignRight | Qt::AlignCenter); @@ -90,8 +90,10 @@ inline void CoincidentAnalyzer::SetUpCanvas(){ sbUpdateTime->setValue(1); boxLayout->addWidget(sbUpdateTime, 0, 2); - backWardBuilding = new QCheckBox("Use Backward builder", this); - boxLayout->addWidget(backWardBuilding, 1, 0); + connect(sbUpdateTime, &RSpinBox::valueChanged, this, [=](double sec){ SetUpdateTimeInSec(sec); }); + + chkBackWardBuilding = new QCheckBox("Use Backward builder", this); + boxLayout->addWidget(chkBackWardBuilding, 1, 0); QLabel * lbBKWindow = new QLabel("No. Backward Event", this); lbBKWindow->setAlignment(Qt::AlignRight | Qt::AlignCenter); @@ -102,9 +104,18 @@ inline void CoincidentAnalyzer::SetUpCanvas(){ sbBackwardCount->setValue(100); boxLayout->addWidget(sbBackwardCount, 1, 2); - backWardBuilding->setChecked(false); + chkBackWardBuilding->setChecked(false); sbBackwardCount->setEnabled(false); + connect(chkBackWardBuilding, &QCheckBox::stateChanged, this, [=](int status){ + SetBackwardBuild(status, sbBackwardCount->value()); + sbBackwardCount->setEnabled(status); + }); + + connect(sbBackwardCount, &RSpinBox::valueChanged, this, [=](double value){ + SetBackwardBuild(true, value); + }); + QLabel * lbBuildWindow = new QLabel("Event Window [tick]", this); lbBuildWindow->setAlignment(Qt::AlignRight | Qt::AlignCenter); boxLayout->addWidget(lbBuildWindow, 2, 1); @@ -113,6 +124,10 @@ inline void CoincidentAnalyzer::SetUpCanvas(){ sbBuildWindow->setMaximum(9999999999); boxLayout->addWidget(sbBuildWindow, 2, 2); + connect(sbBuildWindow, &RSpinBox::valueChanged, this, [=](double value){ + evtbder->SetTimeWindow((int)value); + }); + QFrame *separator = new QFrame(box); separator->setFrameShape(QFrame::HLine); separator->setFrameShadow(QFrame::Sunken); @@ -172,6 +187,7 @@ inline void CoincidentAnalyzer::SetUpCanvas(){ for( int i = 0; i < digi[0]->GetNumInputCh(); i++) aCh->addItem("Ch-" + QString::number(i)); boxLayout->addWidget(aCh, 7, 3); + } //============ histograms @@ -199,7 +215,7 @@ inline void CoincidentAnalyzer::SetUpCanvas(){ inline void CoincidentAnalyzer::UpdateHistograms(){ if( this->isVisible() == false ) return; - if( runAnalyzer->isChecked() == false ) return; + if( chkRunAnalyzer->isChecked() == false ) return; BuildEvents(); // call the event builder to build events diff --git a/analyzers/EncoreAnalyzer.h b/analyzers/EncoreAnalyzer.h index bb0b299..63c3509 100644 --- a/analyzers/EncoreAnalyzer.h +++ b/analyzers/EncoreAnalyzer.h @@ -67,7 +67,7 @@ private: Histogram1D * hMulti; - QCheckBox * runAnalyzer; + QCheckBox * chkRunAnalyzer; }; @@ -76,8 +76,8 @@ inline void Encore::SetUpCanvas(){ setGeometry(0, 0, 1600, 1600); - runAnalyzer = new QCheckBox("Run Analyzer", this); - layout->addWidget(runAnalyzer, 0, 0); + chkRunAnalyzer = new QCheckBox("Run Analyzer", this); + layout->addWidget(chkRunAnalyzer, 0, 0); hLeft = new Histogram2D("Left", "Ch", "Energy", 17, 0, 16, 200, 0, 20000, this); layout->addWidget(hLeft, 1, 0); @@ -93,7 +93,7 @@ inline void Encore::SetUpCanvas(){ inline void Encore::UpdateHistograms(){ if( this->isVisible() == false ) return; - if( runAnalyzer->isChecked() == false ) return; + if( chkRunAnalyzer->isChecked() == false ) return; BuildEvents(); // call the event builder to build events diff --git a/analyzers/SplitPoleAnalyzer.h b/analyzers/SplitPoleAnalyzer.h index 43fe029..16b0c10 100644 --- a/analyzers/SplitPoleAnalyzer.h +++ b/analyzers/SplitPoleAnalyzer.h @@ -87,7 +87,7 @@ private: RSpinBox * sbEnergy; RSpinBox * sbAngle; - QCheckBox * runAnalyzer; + QCheckBox * chkRunAnalyzer; QLineEdit * leMassTablePath; QLineEdit * leQValue; @@ -212,8 +212,8 @@ inline void SplitPole::SetUpCanvas(){ FillConstants(); }); - runAnalyzer = new QCheckBox("Run Analyzer", this); - boxLayout->addWidget(runAnalyzer, 4, 1); + chkRunAnalyzer = new QCheckBox("Run Analyzer", this); + boxLayout->addWidget(chkRunAnalyzer, 4, 1); QFrame *separator = new QFrame(box); @@ -303,7 +303,7 @@ inline void SplitPole::SetUpCanvas(){ inline void SplitPole::UpdateHistograms(){ if( this->isVisible() == false ) return; - if( runAnalyzer->isChecked() == false ) return; + if( chkRunAnalyzer->isChecked() == false ) return; BuildEvents(); // call the event builder to build events