consolidation problem
This commit is contained in:
parent
70ad421fbd
commit
a024d001ff
|
@ -1,6 +1,8 @@
|
||||||
#include "SOLARISpanel.h"
|
#include "SOLARISpanel.h"
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QSet>
|
||||||
|
#include <QList>
|
||||||
|
|
||||||
SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
||||||
std::vector<std::vector<int>> mapping,
|
std::vector<std::vector<int>> mapping,
|
||||||
|
@ -11,6 +13,8 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
||||||
setWindowTitle("SOLARIS Settings");
|
setWindowTitle("SOLARIS Settings");
|
||||||
setGeometry(0, 0, 1850, 1000);
|
setGeometry(0, 0, 1850, 1000);
|
||||||
|
|
||||||
|
printf("%s\n", __func__);
|
||||||
|
|
||||||
this->digi = digi;
|
this->digi = digi;
|
||||||
this->nDigi = nDigi;
|
this->nDigi = nDigi;
|
||||||
this->mapping = mapping;
|
this->mapping = mapping;
|
||||||
|
@ -23,15 +27,27 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
||||||
int nDet[nDetType];
|
int nDet[nDetType];
|
||||||
for( int k = 0 ; k < nDetType; k++) nDet[k] = 0;
|
for( int k = 0 ; k < nDetType; k++) nDet[k] = 0;
|
||||||
|
|
||||||
|
QList<int> detIDList; //consolidated
|
||||||
|
|
||||||
for( int i = 0; i < (int) mapping.size() ; i++){
|
for( int i = 0; i < (int) mapping.size() ; i++){
|
||||||
for( int j = 0; j < (int) mapping[i].size(); j++ ){
|
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++){
|
for( int k = 0 ; k < nDetType; k++){
|
||||||
int lowID = (k == 0 ? 0 : detMaxID[k-1]);
|
int lowID = (k == 0 ? 0 : detMaxID[k-1]);
|
||||||
if( lowID <= mapping[i][j] && mapping[i][j] < detMaxID[k] ) nDet[k] ++ ;
|
if( lowID <= mapping[i][j] && mapping[i][j] < detMaxID[k] ) nDet[k] ++ ;
|
||||||
}
|
}
|
||||||
|
if( j % 16 == 0 ) printf("\n");
|
||||||
}
|
}
|
||||||
|
printf("------------------ \n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----- consolidate detIDList;
|
||||||
|
QSet<int> 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);
|
QVBoxLayout * mainLayout = new QVBoxLayout(this); this->setLayout(mainLayout);
|
||||||
QTabWidget * tabWidget = new QTabWidget(this); mainLayout->addWidget(tabWidget);
|
QTabWidget * tabWidget = new QTabWidget(this); mainLayout->addWidget(tabWidget);
|
||||||
|
|
||||||
|
@ -41,11 +57,19 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
||||||
tabWidget->addTab(tab, detType[detTypeID]);
|
tabWidget->addTab(tab, detType[detTypeID]);
|
||||||
|
|
||||||
QGridLayout * layout = new QGridLayout(tab);
|
QGridLayout * layout = new QGridLayout(tab);
|
||||||
|
layout->setAlignment(Qt::AlignLeft|Qt::AlignTop);
|
||||||
|
layout->setSpacing(0);
|
||||||
|
|
||||||
//QLineEdit * leNDet = new QLineEdit(QString::number(nDet[detTypeID]), tab);
|
//QLineEdit * leNDet = new QLineEdit(QString::number(nDet[detTypeID]), tab);
|
||||||
//layout->addWidget(leNDet, 0, 0);
|
//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){
|
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<int> 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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -816,11 +816,20 @@ bool MainWindow::CheckSOLARISpanelOK(){
|
||||||
}
|
}
|
||||||
file.close();
|
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()));
|
LogMsg("Mapping.h | Num. Digi : " + QString::number(mapping.size()));
|
||||||
for( int i = 0 ; i < (int) mapping.size(); i ++){
|
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]->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" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user