various fixes

This commit is contained in:
splitPoleDAQ 2023-08-28 15:02:56 -04:00
parent 2171d03246
commit 1bbfeff571
8 changed files with 54 additions and 19 deletions

View File

@ -177,6 +177,8 @@ inline void Data::ClearData(){
NumEventsDecoded[ch] = 0;
NumNonPileUpDecoded[ch] = 0;
TotNumEvents[ch] = 0 ;
calIndexes[ch][0] = -1;
calIndexes[ch][1] = -1;
}
@ -262,7 +264,7 @@ inline void Data::PrintStat() const{
printf(" this is roll-over fake event or no events.\n");
return;
}
printf("%2s | %6s | %9s | %9s | %6s | %6s(%4s)\n", "ch", "# Evt.", "Rate [Hz]", "N-PileUp", "Tot. Evt.", "index", "loop");
printf("%2s | %6s | %9s | %9s | %6s | %6s(%4s)\n", "ch", "# Evt.", "Rate [Hz]", "Accept", "Tot. Evt.", "index", "loop");
printf("---+--------+-----------+-----------+----------\n");
for(int ch = 0; ch < MaxNChannels; 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]);
@ -422,7 +424,7 @@ inline void Data::DecodeBuffer(bool fastDecode, int verbose){
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;
NonPileUpRate[ch] = (NumNonPileUpDecoded[ch])/sec;
}else{ // look in to the data in the memory, not just this agg.
@ -437,7 +439,6 @@ inline void Data::DecodeBuffer(bool fastDecode, int verbose){
unsigned long long dTime = Timestamp[ch][calIndexes[ch][1]] - Timestamp[ch][calIndexes[ch][0]];
double sec = dTime * tick2ns / 1e9;
//printf(" %10llu %10llu, %f = %f sec, rate = %f \n", Timestamp[ch][calIndexes[ch][0]], Timestamp[ch][calIndexes[ch][1]], tick2ns, sec, nEvent / sec);
TriggerRate[ch] = nEvent / sec;
@ -445,6 +446,7 @@ inline void Data::DecodeBuffer(bool fastDecode, int verbose){
for( int i = calIndexes[ch][0] ; i <= calIndexes[ch][0] + nEvent; i++ ) {
if( PileUp[ch][i % MaxNData] ) pileUpCount ++;
}
//printf("%2d | %10llu %10llu, %.0f = %f sec, rate = %f, nEvent %d pileUp %d \n", ch, Timestamp[ch][calIndexes[ch][0]], Timestamp[ch][calIndexes[ch][1]], tick2ns, sec, nEvent / sec, nEvent, pileUpCount);
NonPileUpRate[ch] = (nEvent - pileUpCount)/sec;

View File

@ -63,9 +63,12 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
layout->addWidget(bnOpenScope, 1, 1);
connect(bnOpenScope, &QPushButton::clicked, this, &MainWindow::OpenScope);
bnAnalyzer = new QPushButton("Online Analyzer", this);
layout->addWidget(bnAnalyzer, 0, 2);
connect(bnAnalyzer, &QPushButton::clicked, this, &MainWindow::OpenAnalyzer);
cbAnalyzer = new RComboBox(this);
layout->addWidget(cbAnalyzer, 0, 2);
cbAnalyzer->addItem("Choose Online Analyzer", -1);
cbAnalyzer->addItem("Split-Pole", 0);
cbAnalyzer->addItem("Encore", 1);
connect(cbAnalyzer, &RComboBox::currentIndexChanged, this, &MainWindow::OpenAnalyzer);
bnCanvas = new QPushButton("Online 1D Histograms", this);
layout->addWidget(bnCanvas, 1, 2);
@ -735,7 +738,7 @@ void MainWindow::WaitForDigitizersOpen(bool onOff){
bnStopACQ->setStyleSheet("");
chkSaveData->setEnabled(!onOff);
bnCanvas->setEnabled(!onOff);
bnAnalyzer->setEnabled(!onOff);
cbAnalyzer->setEnabled(!onOff);
cbAutoRun->setEnabled(chkSaveData->isChecked());
bnSync->setEnabled(false);
@ -1427,17 +1430,30 @@ void MainWindow::OpenCanvas(){
//***************************************************************
//***************************************************************
void MainWindow::OpenAnalyzer(){
int id = cbAnalyzer->currentData().toInt();
if( id < 0 ) return;
if( onlineAnalyzer == nullptr ) {
//onlineAnalyzer = new Analyzer(digi, nDigi);
//onlineAnalyzer = new SplitPole(digi, nDigi);
onlineAnalyzer = new Encore(digi, nDigi);
onlineAnalyzer->show();
if( id == 0 ) onlineAnalyzer = new SplitPole(digi, nDigi);
if( id == 1 ) onlineAnalyzer = new Encore(digi, nDigi);
if( id >= 0 ) onlineAnalyzer->show();
}else{
onlineAnalyzer->show();
onlineAnalyzer->activateWindow();
delete onlineAnalyzer;
if( id == 0 ) onlineAnalyzer = new SplitPole(digi, nDigi);
if( id == 1 ) onlineAnalyzer = new Encore(digi, nDigi);
if( id >= 0 ){
onlineAnalyzer->show();
onlineAnalyzer->activateWindow();
}
}
cbAnalyzer->setCurrentIndex(0);
}
//***************************************************************

View File

@ -94,7 +94,9 @@ private:
QPushButton * bnCloseDigitizers;
QPushButton * bnOpenScope;
QPushButton * bnDigiSettings;
QPushButton * bnAnalyzer;
//QPushButton * bnAnalyzer;
RComboBox * cbAnalyzer;
QPushButton * bnOpenScaler;
QPushButton * bnStartACQ;

View File

@ -17,7 +17,6 @@ An online analyzer class is created as a template for online analysis. An exampl
<span style="color:red;">Notice that, when the FSUDAQ is started, the online analyzer is a null pointer, no event will be built. Once the online anlyzer is created and opened, event will be built, event the window is closed. </span>
# Operation
When programSettings.txt is presented in the same folder as the FSUDAQ_Qt, the program will load it can config the following
@ -39,6 +38,12 @@ the following additional functions are planned and I am working on them
- support V1740 DPP-QDC
# ToDo
- Gaussians fitting for 1D Histogram
- log scale for 1D and 2D Histogram
- Improve the color scheme for 2D histogram
# Required / Development enviroment
Ubuntu 22.04
@ -100,6 +105,7 @@ Those file can be compiled using
# Known Issues
* DC offset issue. When porgram default settings, the DC offset is not the same for all channels.
* for PHA firmware, when the peak average changed, the Events per Agg need to be changed.
# Known Bugs

View File

@ -624,8 +624,8 @@ namespace DPP {
{"OR", 7}};
const std::vector<std::pair<std::string, unsigned int>> ListLocalTrigValidMode = {{"Disabled", 0},
{"Crossed", 4},
{"Equal", 5},
{"Crossed Trigger", 4},
{"Both from Mother board", 5},
{"AND", 6},
{"OR", 7}};
@ -699,8 +699,8 @@ namespace DPP {
{"OR", 7}};
const std::vector<std::pair<std::string, unsigned int>> ListLocalTrigValidMode = {{"Disabled", 0},
{"Crossed", 4},
{"Equal", 5},
{"Crossed Trigger", 4},
{"Both from Mother board", 5},
{"AND", 6},
{"OR", 7}};

View File

@ -92,6 +92,7 @@ inline void Encore::SetUpCanvas(){
inline void Encore::UpdateHistograms(){
if( this->isVisible() == false ) return;
if( runAnalyzer->isChecked() == false ) return;
BuildEvents(); // call the event builder to build events

View File

@ -25,7 +25,7 @@ const double mp = 938.2720813; // MeV/c^2
const double mn = 939.56542052; // MeV/c^2
const double amu = 931.0;
const string massData="mass20.txt";
const string massData="analyzers/mass20.txt";
// about the mass**.txt
// Mass Excess = (ATOMIC MASS - A)*amu | e.g. n : (1.088664.91585E-6-1)*amu

View File

@ -249,6 +249,8 @@ private:
RSpinBox * sbEnergy;
RSpinBox * sbAngle;
QCheckBox * runAnalyzer;
};
@ -334,6 +336,9 @@ inline void SplitPole::SetUpCanvas(){
hit.CalZoffset(leTarget->text(), leBeam->text(), leRecoil->text(), sbBfield->value(), sbAngle->value(), sbEnergy->value());
});
runAnalyzer = new QCheckBox("Run Analyzer", this);
boxLayout->addWidget(runAnalyzer, 4, 1);
}
//============ histograms
@ -403,6 +408,9 @@ inline void SplitPole::SetUpCanvas(){
inline void SplitPole::UpdateHistograms(){
if( this->isVisible() == false ) return;
if( runAnalyzer->isChecked() == false ) return;
BuildEvents(); // call the event builder to build events
//============ Get events, and do analysis