bug fix on MultiBuilder for multiple boards
This commit is contained in:
parent
407924f863
commit
ccd23065dd
18
FSUDAQ.cpp
18
FSUDAQ.cpp
|
@ -199,6 +199,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
|||
cbAutoRun->addItem("Single 30 mins", 30);
|
||||
cbAutoRun->addItem("Single 60 mins", 60);
|
||||
cbAutoRun->addItem("Repeat 60 mins", -60);
|
||||
cbAutoRun->addItem("Repeat 120 mins", -120);
|
||||
cbAutoRun->setEnabled(false);
|
||||
|
||||
bnStartACQ = new QPushButton("Start ACQ", this);
|
||||
|
@ -790,8 +791,8 @@ void MainWindow::UpdateScalar(){
|
|||
for( unsigned int iDigi = 0; iDigi < nDigi; iDigi++){
|
||||
digiMTX[iDigi].lock();
|
||||
|
||||
printf("### %d ", iDigi);
|
||||
digi[iDigi]->GetData()->PrintAllData(true, 10);
|
||||
// printf("### %d ", iDigi);
|
||||
// digi[iDigi]->GetData()->PrintAllData(true, 10);
|
||||
if( chkSaveData->isChecked() ) totalFileSize += digi[iDigi]->GetData()->GetTotalFileSize();
|
||||
for( int i = 0; i < digi[iDigi]->GetNChannels(); i++){
|
||||
if( digi[iDigi]->GetChannelOnOff(i) == true ) {
|
||||
|
@ -972,6 +973,13 @@ void MainWindow::StopACQ(){
|
|||
|
||||
void MainWindow::AutoRun(){ //TODO
|
||||
|
||||
if( chkSaveData->isChecked() == false){
|
||||
StartACQ();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::SetSyncMode(){
|
||||
|
@ -981,12 +989,12 @@ void MainWindow::SetSyncMode(){
|
|||
|
||||
QVBoxLayout * layout = new QVBoxLayout(&dialog);
|
||||
|
||||
QLabel * lbInfo1 = new QLabel("This will reset 0x8100 and 0x811C \nMaster must be the 1st board.", &dialog);
|
||||
QLabel * lbInfo1 = new QLabel("This will reset 0x8100 and 0x811C \nMaster must be the 1st board.\n (could be 100 ticks offset)", &dialog);
|
||||
lbInfo1->setStyleSheet("color : red;");
|
||||
|
||||
QPushButton * bnNoSync = new QPushButton("No Sync");
|
||||
QPushButton * bnMethod1 = new QPushButton("Software TRG-OUT --> TRG-IN (within 100 ticks)");
|
||||
QPushButton * bnMethod2 = new QPushButton("Software TRG-OUT --> S-IN (within 20 ticks)");
|
||||
QPushButton * bnMethod1 = new QPushButton("Software TRG-OUT --> TRG-IN ");
|
||||
QPushButton * bnMethod2 = new QPushButton("Software TRG-OUT --> S-IN ");
|
||||
QPushButton * bnMethod3 = new QPushButton("External TRG-OUT --> S-IN ");
|
||||
|
||||
layout->addWidget(lbInfo1, 0);
|
||||
|
|
|
@ -220,35 +220,40 @@ void MultiBuilder::BuildEvents(bool isFinal, bool skipTrace, bool verbose){
|
|||
em.Clear();
|
||||
|
||||
for( int k = 0; k < nData; k++){
|
||||
int bd = (k + earlistDigi) % nData;
|
||||
|
||||
// printf("##### %d/%d | ", k, nData);
|
||||
// data[k]->PrintAllData(true, 10);
|
||||
|
||||
for( unsigned int i = 0; i < MaxNChannels; i++){
|
||||
int ch = (i + earlistCh ) % MaxNChannels;
|
||||
if( chExhaused[k][ch] ) continue;
|
||||
if( loopIndex[k][ch] * MaxNData + nextIndex[k][ch] > data[k]->LoopIndex[ch] * MaxNData + data[k]->DataIndex[ch]) {
|
||||
if( chExhaused[bd][ch] ) continue;
|
||||
if( loopIndex[bd][ch] * MaxNData + nextIndex[bd][ch] > data[bd]->LoopIndex[ch] * MaxNData + data[bd]->DataIndex[ch]) {
|
||||
nExhaushedCh ++;
|
||||
chExhaused[k][ch] = true;
|
||||
chExhaused[bd][ch] = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
do {
|
||||
|
||||
unsigned long long time = data[k]->Timestamp[ch][nextIndex[k][ch]];
|
||||
unsigned long long time = data[bd]->Timestamp[ch][nextIndex[bd][ch]];
|
||||
|
||||
if( time >= earlistTime && (time - earlistTime <= timeWindow) ){
|
||||
em.sn = snList[k];
|
||||
em.bd = k;
|
||||
em.sn = snList[bd];
|
||||
em.bd = bd;
|
||||
em.ch = ch;
|
||||
em.energy = data[k]->Energy[ch][nextIndex[k][ch]];
|
||||
em.energy = data[bd]->Energy[ch][nextIndex[bd][ch]];
|
||||
em.timestamp = time;
|
||||
em.fineTime = data[k]->fineTime[ch][nextIndex[k][ch]];
|
||||
em.fineTime = data[bd]->fineTime[ch][nextIndex[bd][ch]];
|
||||
|
||||
if( !skipTrace ) em.trace = data[k]->Waveform1[ch][nextIndex[k][ch]];
|
||||
if( typeList[k] == V1730_DPP_PSD_CODE ) em.energy2 = data[k]->Energy2[ch][nextIndex[k][ch]];
|
||||
if( !skipTrace ) em.trace = data[bd]->Waveform1[ch][nextIndex[bd][ch]];
|
||||
if( typeList[bd] == V1730_DPP_PSD_CODE ) em.energy2 = data[bd]->Energy2[ch][nextIndex[bd][ch]];
|
||||
|
||||
events[eventIndex].push_back(em);
|
||||
nextIndex[k][ch]++;
|
||||
if( nextIndex[k][ch] >= MaxNData) {
|
||||
loopIndex[k][ch] ++;
|
||||
nextIndex[k][ch] = 0;
|
||||
nextIndex[bd][ch]++;
|
||||
if( nextIndex[bd][ch] >= MaxNData) {
|
||||
loopIndex[bd][ch] ++;
|
||||
nextIndex[bd][ch] = 0;
|
||||
}
|
||||
}else{
|
||||
break;
|
||||
|
@ -258,12 +263,13 @@ void MultiBuilder::BuildEvents(bool isFinal, bool skipTrace, bool verbose){
|
|||
if( timeWindow == 0 ) break;
|
||||
}
|
||||
if( timeWindow == 0 ) break;
|
||||
|
||||
}
|
||||
|
||||
std::sort(events[eventIndex].begin(), events[eventIndex].end(), [](const Hit& a, const Hit& b) {
|
||||
return a.timestamp < b.timestamp;
|
||||
});
|
||||
if( timeWindow > 0 ) {
|
||||
std::sort(events[eventIndex].begin(), events[eventIndex].end(), [](const Hit& a, const Hit& b) {
|
||||
return a.timestamp < b.timestamp;
|
||||
});
|
||||
}
|
||||
|
||||
///Find the next earlist
|
||||
FindEarlistTimeAndCh(verbose);
|
||||
|
@ -280,7 +286,7 @@ void MultiBuilder::BuildEvents(bool isFinal, bool skipTrace, bool verbose){
|
|||
printf("######################### no more event to be built\n");
|
||||
break;
|
||||
}
|
||||
printf("----- next ch : %d, next earlist Time : %llu.\n", earlistCh, earlistTime);
|
||||
printf("----- next bd : %d, ch : %d, next earlist Time : %llu.\n", earlistDigi, earlistCh, earlistTime);
|
||||
|
||||
}
|
||||
|
||||
|
@ -321,30 +327,32 @@ void MultiBuilder::BuildEventsBackWard(int maxNumEvent, bool verbose){
|
|||
em.Clear();
|
||||
|
||||
for( int k = 0; k < nData; k++){
|
||||
int bd = (k + latestDigi) % nData;
|
||||
|
||||
for( unsigned int i = 0; i < MaxNChannels; i++){
|
||||
int ch = (i + latestCh) % MaxNChannels;
|
||||
if( chExhaused[k][ch] ) continue;
|
||||
//if( nextIndex[k][ch] <= lastBackWardIndex[k][ch] || nextIndex[k][ch] < 0){
|
||||
if( nextIndex[k][ch] < 0){
|
||||
chExhaused[k][ch] = true;
|
||||
if( chExhaused[bd][ch] ) continue;
|
||||
//if( nextIndex[bd][ch] <= lastBackWardIndex[bd][ch] || nextIndex[bd][ch] < 0){
|
||||
if( nextIndex[bd][ch] < 0){
|
||||
chExhaused[bd][ch] = true;
|
||||
nExhaushedCh ++;
|
||||
continue;
|
||||
}
|
||||
|
||||
do{
|
||||
|
||||
unsigned long long time = data[k]->Timestamp[ch][nextIndex[k][ch]];
|
||||
unsigned long long time = data[bd]->Timestamp[ch][nextIndex[bd][ch]];
|
||||
if( time <= latestTime && (latestTime - time <= timeWindow)){
|
||||
em.sn = snList[k];
|
||||
em.bd = k;
|
||||
em.sn = snList[bd];
|
||||
em.bd = bd;
|
||||
em.ch = ch;
|
||||
em.energy = data[k]->Energy[ch][nextIndex[k][ch]];
|
||||
em.energy = data[bd]->Energy[ch][nextIndex[bd][ch]];
|
||||
em.timestamp = time;
|
||||
if( typeList[k] == V1730_DPP_PSD_CODE ) em.energy2 = data[k]->Energy2[ch][nextIndex[k][ch]];
|
||||
if( typeList[bd] == V1730_DPP_PSD_CODE ) em.energy2 = data[bd]->Energy2[ch][nextIndex[bd][ch]];
|
||||
|
||||
events[eventIndex].push_back(em);
|
||||
nextIndex[k][ch]--;
|
||||
if( nextIndex[k][ch] < 0 && data[k]->LoopIndex[ch] > 0 ) nextIndex[k][ch] = MaxNData - 1;
|
||||
nextIndex[bd][ch]--;
|
||||
if( nextIndex[bd][ch] < 0 && data[bd]->LoopIndex[ch] > 0 ) nextIndex[bd][ch] = MaxNData - 1;
|
||||
|
||||
}else{
|
||||
break;
|
||||
|
@ -374,7 +382,7 @@ void MultiBuilder::BuildEventsBackWard(int maxNumEvent, bool verbose){
|
|||
printf("######################### no more event to be built\n");
|
||||
break;
|
||||
}
|
||||
printf("----- next ch : %d, next latest Time : %llu.\n", latestCh, latestTime);
|
||||
printf("----- next bd: %d, ch : %d, next latest Time : %llu.\n", latestDigi, latestCh, latestTime);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user