diff --git a/SOLARISpanel.cpp b/SOLARISpanel.cpp index 84427e9..7e68a8c 100644 --- a/SOLARISpanel.cpp +++ b/SOLARISpanel.cpp @@ -1,6 +1,8 @@ #include "SOLARISpanel.h" #include +#include +#include SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi, std::vector> mapping, @@ -11,6 +13,8 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi, setWindowTitle("SOLARIS Settings"); setGeometry(0, 0, 1850, 1000); + printf("%s\n", __func__); + this->digi = digi; this->nDigi = nDigi; this->mapping = mapping; @@ -23,15 +27,27 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi, int nDet[nDetType]; for( int k = 0 ; k < nDetType; k++) nDet[k] = 0; + QList detIDList; //consolidated + for( int i = 0; i < (int) mapping.size() ; i++){ for( int j = 0; j < (int) mapping[i].size(); j++ ){ + printf("%3d,", mapping[i][j]); + if( mapping[i][j] >= 0 ) detIDList << mapping[i][j]; for( int k = 0 ; k < nDetType; k++){ int lowID = (k == 0 ? 0 : detMaxID[k-1]); if( lowID <= mapping[i][j] && mapping[i][j] < detMaxID[k] ) nDet[k] ++ ; } + if( j % 16 == 0 ) printf("\n"); } + printf("------------------ \n"); } + //----- consolidate detIDList; + QSet mySet(detIDList.begin(), detIDList.end()); + detIDList = mySet.values(); + + for( int i = 0 ; i < detIDList.size(); i++) printf("%d\n", detIDList[i]); + QVBoxLayout * mainLayout = new QVBoxLayout(this); this->setLayout(mainLayout); QTabWidget * tabWidget = new QTabWidget(this); mainLayout->addWidget(tabWidget); @@ -41,11 +57,19 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi, tabWidget->addTab(tab, detType[detTypeID]); QGridLayout * layout = new QGridLayout(tab); + layout->setAlignment(Qt::AlignLeft|Qt::AlignTop); + layout->setSpacing(0); //QLineEdit * leNDet = new QLineEdit(QString::number(nDet[detTypeID]), tab); //layout->addWidget(leNDet, 0, 0); - ///Create threshold tab + //ranege of detID + int lowID = (detTypeID == 0 ? 0 : detMaxID[detTypeID-1]); + + for(int i = 0; i < detIDList.size(); i++){ + if( detIDList[i] < lowID || detIDList[i] > detMaxID[detTypeID]) continue; + CreateSpinBoxGroup(PHA::CH::TriggerThreshold, i, layout, i/20, i%20); + } } @@ -59,9 +83,31 @@ SOLARISpanel::~SOLARISpanel(){ void SOLARISpanel::CreateSpinBoxGroup(const Reg para, int detID, QGridLayout * &layout, int row, int col){ - //QLineEdit * leTrigRate + //find all chID = (iDigi << 8 + ch) for detID + std::vector chID; + for( int i = 0; i < (int) mapping.size() ; i++){ + for( int j = 0; j < (int) mapping[i].size(); j++ ){ + if( mapping[i][j] == detID ) chID.push_back((i << 8) + j); + } + } + QGroupBox * groupbox = new QGroupBox("det-" + QString::number(detID), this); + groupbox->setFixedWidth(80); + QVBoxLayout * layout0 = new QVBoxLayout(groupbox); + for( int i = 0; i < (int) chID.size(); i ++){ + QLineEdit * leTrigRate = new QLineEdit(this); + leTrigRate->setFixedWidth(50); + layout0->addWidget(leTrigRate); + + RSpinBox * sbThre = new RSpinBox(this); + sbThre->setToolTip( "Digi-,Ch-" + QString::number(chID[i])); + sbThre->setToolTipDuration(-1); + sbThre->setFixedWidth(50); + layout0->addWidget(sbThre); + } + + layout->addWidget(groupbox, row, col); } diff --git a/mainwindow.cpp b/mainwindow.cpp index 2847973..fc42e61 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -816,11 +816,20 @@ bool MainWindow::CheckSOLARISpanelOK(){ } file.close(); + //if( (int) mapping.size() > nDigi){ + // LogMsg("Num. of Digitizer in the Mapping is more than Opened DIgitizer."); + // return false; + //} + LogMsg("Mapping.h | Num. Digi : " + QString::number(mapping.size())); for( int i = 0 ; i < (int) mapping.size(); i ++){ - LogMsg(" Digi-" + QString::number(i) + " : " + QString::number(mapping[i].size()) + " Ch. | Digi-" + if( i < nDigi ){ + LogMsg(" Digi-" + QString::number(i) + " : " + QString::number(mapping[i].size()) + " Ch. | Digi-" + QString::number(digi[i]->GetSerialNumber()) + " : " - + QString::number(digi[i]->GetNChannels()) + " Ch."); + + QString::number(digi[i]->GetNChannels()) + " Ch."); + }else{ + LogMsg(" Digi-" + QString::number(i) + " : " + QString::number(mapping[i].size()) + " Ch. | No Conneted Digitizer" ); + } }