Major Change. The Mapping.h changed.
This commit is contained in:
parent
23367d5ac4
commit
69955a863d
290
SOLARISpanel.cpp
290
SOLARISpanel.cpp
|
@ -9,13 +9,16 @@
|
||||||
|
|
||||||
#define NCOL 10 // number of column
|
#define NCOL 10 // number of column
|
||||||
|
|
||||||
|
#define ChStartIndex 2 // the index of detIDList for channel
|
||||||
|
|
||||||
std::vector<Reg> SettingItems = {PHA::CH::TriggerThreshold, PHA::CH::DC_Offset};
|
std::vector<Reg> SettingItems = {PHA::CH::TriggerThreshold, PHA::CH::DC_Offset};
|
||||||
const std::vector<QString> arrayLabel = {"e", "xf", "xn"};
|
|
||||||
|
|
||||||
SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
||||||
QString analysisPath,
|
QString analysisPath,
|
||||||
std::vector<std::vector<int>> mapping,
|
std::vector<std::vector<int>> mapping,
|
||||||
QStringList detType,
|
QStringList detType,
|
||||||
|
QStringList detGroupName,
|
||||||
|
std::vector<int> detGroupID,
|
||||||
std::vector<int> detMaxID,
|
std::vector<int> detMaxID,
|
||||||
QWidget *parent) : QWidget(parent){
|
QWidget *parent) : QWidget(parent){
|
||||||
|
|
||||||
|
@ -31,66 +34,91 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
||||||
this->mapping = mapping;
|
this->mapping = mapping;
|
||||||
this->detType = detType;
|
this->detType = detType;
|
||||||
this->detMaxID = detMaxID;
|
this->detMaxID = detMaxID;
|
||||||
|
this->detGroupID = detGroupID;
|
||||||
|
this->detGroupName = detGroupName;
|
||||||
this->digiSettingPath = analysisPath + "/working/Settings/";
|
this->digiSettingPath = analysisPath + "/working/Settings/";
|
||||||
|
|
||||||
//Check number of detector type; Array 0-199, Recoil 200-299, other 300-
|
//Check number of detector type; Array 0-199, Recoil 200-299, other 300-
|
||||||
int nDetType = detType.size();
|
int nDetType = detType.size();
|
||||||
for( int k = 0 ; k < nDetType; k++) nDet.push_back(0);
|
for( int k = 0 ; k < nDetType; k++) nDetinType.push_back(0);
|
||||||
|
|
||||||
QList<QList<int>> detIDListTemp; // store { detID, (Digi << 8 ) + ch}, making mapping into 1-D array to be consolidated
|
std::vector<int> condenGroupID = detGroupID;
|
||||||
|
std::sort(condenGroupID.begin(), condenGroupID.end()); // sort the detGroupID
|
||||||
|
auto last = std::unique(condenGroupID.begin(), condenGroupID.end());
|
||||||
|
condenGroupID.erase(last, condenGroupID.end());
|
||||||
|
int nDetGroup = condenGroupID.size();
|
||||||
|
for( int k = 0 ; k < nDetGroup; k++) nDetinGroup.push_back(0);
|
||||||
|
|
||||||
|
|
||||||
|
QList<QList<int>> detIDListTemp; // store { detGroup, detID, (Digi << 8 ) + ch}, making mapping into 1-D array to be consolidated
|
||||||
printf("################################# \n");
|
printf("################################# \n");
|
||||||
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("%4d,", mapping[i][j]);
|
printf("%4d,", mapping[i][j]);
|
||||||
QList<int> haha ;
|
if( mapping[i][j] >= 0 ) {
|
||||||
haha << mapping[i][j] << ((i << 8 ) + j);
|
int groupID = FindDetGroup(mapping[i][j]);
|
||||||
if( mapping[i][j] >= 0 ) detIDListTemp << haha;
|
int typeID = FindDetTypeID(mapping[i][j]);
|
||||||
|
QList<int> haha ;
|
||||||
|
haha << groupID << mapping[i][j] << ((i << 8 ) + j);
|
||||||
|
detIDListTemp << haha;
|
||||||
|
nDetinType[typeID] ++;
|
||||||
|
nDetinGroup[groupID] ++;
|
||||||
|
}
|
||||||
if( j % 16 == 15 ) printf("\n");
|
if( j % 16 == 15 ) printf("\n");
|
||||||
}
|
}
|
||||||
printf("------------------ \n");
|
printf("------------------ \n");
|
||||||
}
|
}
|
||||||
|
|
||||||
//----- consolidate detIDList;
|
//consolidate detIDListTemp --> 2D array of (detID, (Digi << 8) + ch, +.... )
|
||||||
|
//for example, {2, 0, 0}, {2, 100, 1}, {2, 200, 2}--> {2, 0, 0, 1, 2};
|
||||||
|
//for example, {2, 1, 3}, {2, 101, 4}, {2, 201, 5}--> {2, 0, 3, 4, 5};
|
||||||
detIDList.clear();
|
detIDList.clear();
|
||||||
bool repeated = false;
|
bool repeated = false;
|
||||||
for( int i = 0; i < detIDListTemp.size(); i++ ){
|
for( int i = 0; i < detIDListTemp.size(); i++ ){
|
||||||
repeated = false;
|
repeated = false;
|
||||||
if( detIDList.size() == 0 ){
|
if( detIDList.size() == 0 ){
|
||||||
detIDList << detIDListTemp[i];
|
detIDList << detIDListTemp[i];
|
||||||
|
|
||||||
for( int k = 0 ; k < nDetType; k++){
|
|
||||||
int lowID = (k == 0 ? 0 : detMaxID[k-1]);
|
|
||||||
if( lowID <= detIDListTemp[i][0] && detIDListTemp[i][0] < detMaxID[k] ) nDet[k] ++ ;
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for( int j = 0; j < detIDList.size() ; j++){
|
for( int j = 0; j < detIDList.size() ; j++){
|
||||||
if( detIDList[j][0] == detIDListTemp[i][0] ) {
|
if( detIDList[j][0] == detIDListTemp[i][0] ) { // same group
|
||||||
repeated = true;
|
|
||||||
detIDList[j] << detIDListTemp[i][1];
|
int type1 = FindDetTypeID(detIDList[j][1]);
|
||||||
break;
|
int type2 = FindDetTypeID(detIDListTemp[i][1]);
|
||||||
|
|
||||||
|
int low1 = (type1 == 0 ? 0 : detMaxID[type1-1]);
|
||||||
|
int low2 = (type2 == 0 ? 0 : detMaxID[type2-1]);
|
||||||
|
|
||||||
|
int detID1 = detIDList[j][1] - low1;
|
||||||
|
int detID2 = detIDListTemp[i][1] - low2;
|
||||||
|
|
||||||
|
if( detID1 == detID2) {
|
||||||
|
repeated = true;
|
||||||
|
detIDList[j] << detIDListTemp[i][2];
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( !repeated ) {
|
if( !repeated ) {
|
||||||
detIDList << detIDListTemp[i];
|
detIDList << detIDListTemp[i];
|
||||||
for( int k = 0 ; k < nDetType; k++){
|
|
||||||
int lowID = (k == 0 ? 0 : detMaxID[k-1]);
|
|
||||||
if( lowID <= detIDListTemp[i][0] && detIDListTemp[i][0] < detMaxID[k] ) nDet[k] ++ ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---- sort detIDList;
|
//---- sort detIDList;
|
||||||
std::sort(detIDList.begin(), detIDList.end(), [](const QList<int>& a, const QList<int>& b) {
|
std::sort(detIDList.begin(), detIDList.end(), [](const QList<int>& a, const QList<int>& b) {
|
||||||
return a.at(0) < b.at(0);
|
return a.at(1) < b.at(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
//------------- display detector summary
|
//------------- display detector summary
|
||||||
//qDebug() << detIDList;
|
//qDebug() << detIDList;
|
||||||
printf("---------- num. of det. Type : %d\n", nDetType);
|
printf("---------- num. of det. Type : %d\n", nDetType);
|
||||||
for( int i =0; i < nDetType; i ++ ) {
|
for( int i =0; i < nDetType; i ++ ) {
|
||||||
printf(" Type-%d (%6s) : %3d det. (%3d - %3d)\n", i, detType[i].toStdString().c_str(), nDet[i], (i==0 ? 0 : detMaxID[i-1]), detMaxID[i]-1);
|
detType[i].remove(' ');
|
||||||
|
printf(" Type-%d (%6s) : %3d det. (%3d - %3d)\n", i, detType[i].toStdString().c_str(), nDetinType[i], (i==0 ? 0 : detMaxID[i-1]), detMaxID[i]-1);
|
||||||
|
}
|
||||||
|
printf("---------- num. of det. Group : %d\n", nDetGroup);
|
||||||
|
for( int i =0; i < nDetGroup; i++){
|
||||||
|
printf(" Group-%d (%10s) : %3d det.\n", i, detGroupName[i].toStdString().c_str(), nDetinGroup[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------- Set Panel
|
//---------- Set Panel
|
||||||
|
@ -122,6 +150,7 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
||||||
sbCoinTime->SetToolTip(atof(PHA::CH::CoincidenceLength.GetAnswers()[1].first.c_str()));
|
sbCoinTime->SetToolTip(atof(PHA::CH::CoincidenceLength.GetAnswers()[1].first.c_str()));
|
||||||
mainLayout->addWidget(sbCoinTime, rowIndex, 8, 1, 2);
|
mainLayout->addWidget(sbCoinTime, rowIndex, 8, 1, 2);
|
||||||
|
|
||||||
|
|
||||||
connect(sbCoinTime, &RSpinBox::valueChanged, this, [=](){
|
connect(sbCoinTime, &RSpinBox::valueChanged, this, [=](){
|
||||||
if( !enableSignalSlot ) return;
|
if( !enableSignalSlot ) return;
|
||||||
sbCoinTime->setStyleSheet("color:blue;");
|
sbCoinTime->setStyleSheet("color:blue;");
|
||||||
|
@ -151,7 +180,7 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
||||||
}
|
}
|
||||||
UpdatePanelFromMemory();
|
UpdatePanelFromMemory();
|
||||||
});
|
});
|
||||||
|
|
||||||
///=================================
|
///=================================
|
||||||
rowIndex ++;
|
rowIndex ++;
|
||||||
QLabel * info = new QLabel("Only simple trigger is avalible. For complex trigger scheme, please use the setting panel.", this);
|
QLabel * info = new QLabel("Only simple trigger is avalible. For complex trigger scheme, please use the setting panel.", this);
|
||||||
|
@ -160,10 +189,10 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
||||||
///=================================
|
///=================================
|
||||||
rowIndex ++;
|
rowIndex ++;
|
||||||
QTabWidget * tabWidget = new QTabWidget(this); mainLayout->addWidget(tabWidget, rowIndex, 0, 1, 10);
|
QTabWidget * tabWidget = new QTabWidget(this); mainLayout->addWidget(tabWidget, rowIndex, 0, 1, 10);
|
||||||
for( int detTypeID = 0; detTypeID < nDetType; detTypeID ++ ){
|
for( int detGroup = 0; detGroup < nDetGroup; detGroup ++ ){
|
||||||
|
|
||||||
QTabWidget * tabSetting = new QTabWidget(tabWidget);
|
QTabWidget * tabSetting = new QTabWidget(tabWidget);
|
||||||
tabWidget->addTab(tabSetting, detType[detTypeID]);
|
tabWidget->addTab(tabSetting, detGroupName[detGroup]);
|
||||||
|
|
||||||
for( int SettingID = 0; SettingID < (int) SettingItems.size(); SettingID ++){
|
for( int SettingID = 0; SettingID < (int) SettingItems.size(); SettingID ++){
|
||||||
|
|
||||||
|
@ -179,35 +208,38 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
||||||
layout->setAlignment(Qt::AlignLeft|Qt::AlignTop);
|
layout->setAlignment(Qt::AlignLeft|Qt::AlignTop);
|
||||||
layout->setSpacing(0);
|
layout->setSpacing(0);
|
||||||
|
|
||||||
chkAll[detTypeID][SettingID] = new QCheckBox("Set for all", tab);
|
chkAll[detGroup][SettingID] = new QCheckBox("Set for all", tab);
|
||||||
layout->addWidget(chkAll[detTypeID][SettingID], 0, 0);
|
layout->addWidget(chkAll[detGroup][SettingID], 0, 0);
|
||||||
connect(chkAll[detTypeID][SettingID], &QCheckBox::stateChanged, this, [=](bool state){
|
|
||||||
int lowID = (detTypeID == 0 ? 0 : detMaxID[detTypeID-1]);
|
connect(chkAll[detGroup][SettingID], &QCheckBox::stateChanged, this, [=](bool state){
|
||||||
for(int i = 1; i < detIDList.size(); i++){
|
bool found = false;
|
||||||
if( detIDList[i][0] >= detMaxID[detTypeID] || lowID > detIDList[i][0] ) continue;
|
for(int i = 0; i < detIDList.size(); i++){
|
||||||
groupBox[detTypeID][SettingID][detIDList[i][0]]->setEnabled(!state);
|
if( detIDList[i][0] != detGroup ) continue;
|
||||||
|
if( found == false ){
|
||||||
|
found = true;
|
||||||
|
continue;
|
||||||
|
}else{
|
||||||
|
groupBox[detGroup][SettingID][detIDList[i][1]]->setEnabled(!state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
QFrame *line = new QFrame(tab);
|
QFrame *line = new QFrame(tab);
|
||||||
line->setFrameShape(QFrame::HLine);
|
line->setFrameShape(QFrame::HLine);
|
||||||
line->setFrameShadow(QFrame::Sunken);
|
line->setFrameShadow(QFrame::Sunken);
|
||||||
line->setFixedHeight(10);
|
line->setFixedHeight(10);
|
||||||
layout->addWidget(line, 1, 0, 1, NCOL);
|
layout->addWidget(line, 1, 0, 1, NCOL);
|
||||||
|
|
||||||
//range of detID
|
|
||||||
int lowID = (detTypeID == 0 ? 0 : detMaxID[detTypeID-1]);
|
|
||||||
|
|
||||||
for(int i = 0; i < detIDList.size(); i++){
|
for(int i = 0; i < detIDList.size(); i++){
|
||||||
|
if( detIDList[i][0] != detGroup ) continue;
|
||||||
if( detIDList[i][0] >= detMaxID[detTypeID] || lowID > detIDList[i][0] ) continue;
|
CreateDetGroup(SettingID, detIDList[i], layout, i/NCOL + 2, i%NCOL);
|
||||||
CreateDetGroup(detTypeID, SettingID, detIDList[i], layout, i/NCOL + 2, i%NCOL);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enableSignalSlot = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SOLARISpanel::~SOLARISpanel(){
|
SOLARISpanel::~SOLARISpanel(){
|
||||||
|
@ -215,38 +247,52 @@ SOLARISpanel::~SOLARISpanel(){
|
||||||
}
|
}
|
||||||
|
|
||||||
//^######################################################################
|
//^######################################################################
|
||||||
int SOLARISpanel::FindDetTypeID(QList<int> detIDListElement){
|
int SOLARISpanel::FindDetTypeID(int detID){
|
||||||
for( int i = 0; i < (int) detType.size(); i++){
|
for( int i = 0; i < (int) detType.size(); i++){
|
||||||
int lowID = (i == 0) ? 0 : detMaxID[i-1];
|
int lowID = (i == 0) ? 0 : detMaxID[i-1];
|
||||||
if( lowID <= detIDListElement[0] && detIDListElement[0] < detMaxID[i]) {
|
if( lowID <= detID && detID < detMaxID[i]) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SOLARISpanel::CreateDetGroup(int detTypeID, int SettingID, QList<int> detID, QGridLayout * &layout, int row, int col){
|
int SOLARISpanel::FindDetGroup(int detID){
|
||||||
|
int typeID = FindDetTypeID(detID);
|
||||||
|
if( typeID == -1) return -999;
|
||||||
|
return detGroupID[typeID];
|
||||||
|
}
|
||||||
|
|
||||||
//QGroupBox * groupbox = new QGroupBox("Det-" + QString::number(detID[0]), this);
|
void SOLARISpanel::CreateDetGroup(int SettingID, QList<int> detIDArray, QGridLayout * &layout, int row, int col){
|
||||||
groupBox[detTypeID][SettingID][detID[0]] = new QGroupBox("Det-" + QString::number(detID[0]), this);
|
|
||||||
groupBox[detTypeID][SettingID][detID[0]]->setFixedWidth(130);
|
int detGroup = detIDArray[0];
|
||||||
groupBox[detTypeID][SettingID][detID[0]]->setAlignment(Qt::AlignCenter);
|
int detID = detIDArray[1];
|
||||||
QGridLayout * layout0 = new QGridLayout(groupBox[detTypeID][SettingID][detID[0]]);
|
|
||||||
|
groupBox[detGroup][SettingID][detID] = new QGroupBox("Det-" + QString::number(detID), this);
|
||||||
|
groupBox[detGroup][SettingID][detID]->setFixedWidth(130);
|
||||||
|
groupBox[detGroup][SettingID][detID]->setAlignment(Qt::AlignCenter);
|
||||||
|
QGridLayout * layout0 = new QGridLayout(groupBox[detGroup][SettingID][detID]);
|
||||||
layout0->setSpacing(0);
|
layout0->setSpacing(0);
|
||||||
layout0->setAlignment(Qt::AlignLeft);
|
layout0->setAlignment(Qt::AlignLeft);
|
||||||
|
|
||||||
//@======================================== SpinBox and Display
|
//@======================================== SpinBox and Display
|
||||||
bool isDisableDetector = false;
|
bool isDisableDetector = false;
|
||||||
for( int chIndex = 1; chIndex < (int) detID.size(); chIndex ++){
|
|
||||||
|
|
||||||
|
int nChInGroupBox = 0;
|
||||||
|
for( int ppp = ChStartIndex; ppp < detIDArray.size(); ppp ++){
|
||||||
|
|
||||||
|
int chIndex = ppp - ChStartIndex;
|
||||||
isDisableDetector = false;
|
isDisableDetector = false;
|
||||||
|
nChInGroupBox ++;
|
||||||
|
|
||||||
QLabel * lb = new QLabel(arrayLabel[chIndex-1], this);
|
int digiID = (detIDArray[ppp] >> 8 );
|
||||||
|
int chID = (detIDArray[ppp] & 0xFF);
|
||||||
|
|
||||||
|
int typeID = FindDetTypeID(mapping[digiID][chID]);
|
||||||
|
|
||||||
|
QLabel * lb = new QLabel(detType[typeID].remove(' '), this);
|
||||||
layout0->addWidget(lb, 2*chIndex, 0, 2, 1);
|
layout0->addWidget(lb, 2*chIndex, 0, 2, 1);
|
||||||
|
|
||||||
int digiID = (detID[chIndex] >> 8 );
|
|
||||||
int chID = (detID[chIndex] & 0xFF);
|
|
||||||
|
|
||||||
chkOnOff[SettingID][digiID][chID] = new QCheckBox(this);
|
chkOnOff[SettingID][digiID][chID] = new QCheckBox(this);
|
||||||
layout0->addWidget(chkOnOff[SettingID][digiID][chID], 2*chIndex, 1, 2, 1);
|
layout0->addWidget(chkOnOff[SettingID][digiID][chID], 2*chIndex, 1, 2, 1);
|
||||||
|
|
||||||
|
@ -262,7 +308,6 @@ void SOLARISpanel::CreateDetGroup(int detTypeID, int SettingID, QList<int> detID
|
||||||
sbSetting[SettingID][digiID][chID]->setMinimum(atoi(SettingItems[SettingID].GetAnswers()[0].first.c_str()));
|
sbSetting[SettingID][digiID][chID]->setMinimum(atoi(SettingItems[SettingID].GetAnswers()[0].first.c_str()));
|
||||||
sbSetting[SettingID][digiID][chID]->setMaximum(atoi(SettingItems[SettingID].GetAnswers()[1].first.c_str()));
|
sbSetting[SettingID][digiID][chID]->setMaximum(atoi(SettingItems[SettingID].GetAnswers()[1].first.c_str()));
|
||||||
sbSetting[SettingID][digiID][chID]->setSingleStep(atoi(SettingItems[SettingID].GetAnswers()[2].first.c_str()));
|
sbSetting[SettingID][digiID][chID]->setSingleStep(atoi(SettingItems[SettingID].GetAnswers()[2].first.c_str()));
|
||||||
sbSetting[SettingID][digiID][chID]->SetToolTip();
|
|
||||||
|
|
||||||
layout0->addWidget(sbSetting[SettingID][digiID][chID], 2*chIndex+1, 2);
|
layout0->addWidget(sbSetting[SettingID][digiID][chID], 2*chIndex+1, 2);
|
||||||
|
|
||||||
|
@ -291,19 +336,21 @@ void SOLARISpanel::CreateDetGroup(int detTypeID, int SettingID, QList<int> detID
|
||||||
spb->setValue( (std::round(value/step) * step) );
|
spb->setValue( (std::round(value/step) * step) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( chkAll[detTypeID][SettingID]->isChecked() ){
|
if( chkAll[detGroup][SettingID]->isChecked() ){
|
||||||
for(int k = 0; k < detIDList.size() ; k++){
|
for(int k = 0; k < detIDList.size() ; k++){
|
||||||
if( detTypeID == FindDetTypeID(detIDList[k]) ){
|
if( detGroup == detIDList[k][0] ){
|
||||||
for( int h = 1; h < detIDList[k].size() ; h++){
|
for( int h = ChStartIndex; h < detIDList[k].size() ; h++){
|
||||||
if( h != chIndex) continue;
|
if( h != chIndex + ChStartIndex) continue;
|
||||||
|
int digiK = (detIDList[k][h] >> 8);
|
||||||
|
if( digiK >= nDigi ) continue;
|
||||||
int index = (detIDList[k][h] & 0xFF);
|
int index = (detIDList[k][h] & 0xFF);
|
||||||
|
|
||||||
QString msg;
|
QString msg;
|
||||||
msg = QString::fromStdString(para.GetPara()) + "|DIG:"+ QString::number(digi[digiID]->GetSerialNumber());
|
msg = QString::fromStdString(para.GetPara()) + "|DIG:"+ QString::number(digi[digiK]->GetSerialNumber());
|
||||||
msg += ",CH:" + QString::number(index) + "(" + arrayLabel[chIndex-1] + ")";
|
msg += ",CH:" + QString::number(index) + "(" + detType[typeID] + ")";
|
||||||
msg += " = " + QString::number(spb->value());
|
msg += " = " + QString::number(spb->value());
|
||||||
|
|
||||||
if( digi[digiID]->WriteValue(para, std::to_string(spb->value()), index)){
|
if( digi[digiK]->WriteValue(para, std::to_string(spb->value()), index)){
|
||||||
SendLogMsg(msg + "|OK.");
|
SendLogMsg(msg + "|OK.");
|
||||||
spb->setStyleSheet("");
|
spb->setStyleSheet("");
|
||||||
}else{
|
}else{
|
||||||
|
@ -316,7 +363,7 @@ void SOLARISpanel::CreateDetGroup(int detTypeID, int SettingID, QList<int> detID
|
||||||
}else{
|
}else{
|
||||||
QString msg;
|
QString msg;
|
||||||
msg = QString::fromStdString(para.GetPara()) + "|DIG:"+ QString::number(digi[digiID]->GetSerialNumber());
|
msg = QString::fromStdString(para.GetPara()) + "|DIG:"+ QString::number(digi[digiID]->GetSerialNumber());
|
||||||
msg += ",CH:" + QString::number(chID) + "(" + arrayLabel[chIndex-1] + ")";
|
msg += ",CH:" + QString::number(chID) + "(" + detType[typeID] + ")";
|
||||||
msg += " = " + QString::number(spb->value());
|
msg += " = " + QString::number(spb->value());
|
||||||
if( digi[digiID]->WriteValue(para, std::to_string(spb->value()), chID)){
|
if( digi[digiID]->WriteValue(para, std::to_string(spb->value()), chID)){
|
||||||
SendLogMsg(msg + "|OK.");
|
SendLogMsg(msg + "|OK.");
|
||||||
|
@ -334,26 +381,28 @@ void SOLARISpanel::CreateDetGroup(int detTypeID, int SettingID, QList<int> detID
|
||||||
connect(chkOnOff[SettingID][digiID][chID], &QCheckBox::stateChanged, this, [=](int state){
|
connect(chkOnOff[SettingID][digiID][chID], &QCheckBox::stateChanged, this, [=](int state){
|
||||||
if( !enableSignalSlot ) return;
|
if( !enableSignalSlot ) return;
|
||||||
|
|
||||||
if( chkAll[detTypeID][SettingID]->isChecked() ){
|
if( chkAll[detGroup][SettingID]->isChecked() ){
|
||||||
for(int k = 0; k < detIDList.size() ; k++){
|
|
||||||
if( detTypeID == FindDetTypeID(detIDList[k]) ){
|
|
||||||
for( int h = 1; h < detIDList[k].size() ; h++){
|
|
||||||
if( h != chIndex) continue;
|
|
||||||
int index = (detIDList[k][h] & 0xFF);
|
|
||||||
|
|
||||||
|
for(int k = 0; k < detIDList.size() ; k++){
|
||||||
|
if( detGroup == detIDList[k][0] ){
|
||||||
|
|
||||||
|
for( int h = ChStartIndex; h < detIDList[k].size() ; h++){
|
||||||
|
if( h != chIndex + ChStartIndex) continue;
|
||||||
|
int digiK = (detIDList[k][h] >> 8);
|
||||||
|
if( digiK >= nDigi ) continue;
|
||||||
|
int index = (detIDList[k][h] & 0xFF);
|
||||||
QString msg;
|
QString msg;
|
||||||
msg = QString::fromStdString(PHA::CH::ChannelEnable.GetPara()) + "|DIG:"+ QString::number(digi[digiID]->GetSerialNumber());
|
msg = QString::fromStdString(PHA::CH::ChannelEnable.GetPara()) + "|DIG:"+ QString::number(digi[digiK]->GetSerialNumber());
|
||||||
msg += ",CH:" + QString::number(index) + "(" + arrayLabel[chIndex-1] + ")";
|
msg += ",CH:" + QString::number(index) + "(" + detType[typeID] + ")";
|
||||||
msg += ( state ? " = True" : " = False");
|
msg += ( state ? " = True" : " = False");
|
||||||
|
|
||||||
if( digi[digiID]->WriteValue(PHA::CH::ChannelEnable, state ? "True" : "False", index)){
|
if( digi[digiK]->WriteValue(PHA::CH::ChannelEnable, state ? "True" : "False", index)){
|
||||||
SendLogMsg(msg + "|OK.");
|
SendLogMsg(msg + "|OK.");
|
||||||
enableSignalSlot = false;
|
enableSignalSlot = false;
|
||||||
for( int k = 0; k < (int) detType.size(); k++){
|
|
||||||
leDisplay[k][digiID][index]->setEnabled(state);
|
leDisplay[detGroup][digiK][index]->setEnabled(state);
|
||||||
sbSetting[k][digiID][index]->setEnabled(state);
|
sbSetting[detGroup][digiK][index]->setEnabled(state);
|
||||||
chkOnOff[k][digiID][index]->setChecked(state);
|
chkOnOff [detGroup][digiK][index]->setChecked(state);
|
||||||
}
|
|
||||||
enableSignalSlot = true;
|
enableSignalSlot = true;
|
||||||
}else{
|
}else{
|
||||||
SendLogMsg(msg + "|Fail.");
|
SendLogMsg(msg + "|Fail.");
|
||||||
|
@ -361,20 +410,22 @@ void SOLARISpanel::CreateDetGroup(int detTypeID, int SettingID, QList<int> detID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
QString msg;
|
QString msg;
|
||||||
msg = QString::fromStdString(PHA::CH::ChannelEnable.GetPara()) + "|DIG:"+ QString::number(digi[digiID]->GetSerialNumber());
|
msg = QString::fromStdString(PHA::CH::ChannelEnable.GetPara()) + "|DIG:"+ QString::number(digi[digiID]->GetSerialNumber());
|
||||||
msg += ",CH:" + QString::number(chID) + "(" + arrayLabel[chIndex-1] + ")";
|
|
||||||
|
msg += ",CH:" + QString::number(chID) + "(" + detType[typeID] + ")";
|
||||||
msg += ( state ? " = True" : " = False");
|
msg += ( state ? " = True" : " = False");
|
||||||
|
|
||||||
|
qDebug() << msg;
|
||||||
|
|
||||||
if( digi[digiID]->WriteValue(PHA::CH::ChannelEnable, state ? "True" : "False", chID)){
|
if( digi[digiID]->WriteValue(PHA::CH::ChannelEnable, state ? "True" : "False", chID)){
|
||||||
SendLogMsg(msg + "|OK.");
|
SendLogMsg(msg + "|OK.");
|
||||||
enableSignalSlot = false;
|
enableSignalSlot = false;
|
||||||
for( int k = 0; k < (int) detType.size(); k++){
|
leDisplay[detGroup][digiID][chID]->setEnabled(state);
|
||||||
leDisplay[k][digiID][chID]->setEnabled(state);
|
sbSetting[detGroup][digiID][chID]->setEnabled(state);
|
||||||
sbSetting[k][digiID][chID]->setEnabled(state);
|
chkOnOff [detGroup][digiID][chID]->setChecked(state);
|
||||||
chkOnOff[k][digiID][chID]->setChecked(state);
|
|
||||||
}
|
|
||||||
enableSignalSlot = true;
|
enableSignalSlot = true;
|
||||||
}else{
|
}else{
|
||||||
SendLogMsg(msg + "|Fail.");
|
SendLogMsg(msg + "|Fail.");
|
||||||
|
@ -402,33 +453,39 @@ void SOLARISpanel::CreateDetGroup(int detTypeID, int SettingID, QList<int> detID
|
||||||
// 6, CoincidenceLengthT in ns, set to be 100 ns.
|
// 6, CoincidenceLengthT in ns, set to be 100 ns.
|
||||||
|
|
||||||
if( SettingItems[SettingID].GetPara() == PHA::CH::TriggerThreshold.GetPara()){
|
if( SettingItems[SettingID].GetPara() == PHA::CH::TriggerThreshold.GetPara()){
|
||||||
cbTrigger[detTypeID][detID[0]] = new RComboBox(this);
|
cbTrigger[detGroup][detID] = new RComboBox(this);
|
||||||
cbTrigger[detTypeID][detID[0]]->addItem("Self Trigger", "ChSelfTrigger"); /// no coincident
|
cbTrigger[detGroup][detID]->addItem("Self Trigger", "ChSelfTrigger"); /// no coincident
|
||||||
cbTrigger[detTypeID][detID[0]]->addItem("Trigger e", 0x1); // Self-trigger and coincient Ch64Trigger
|
cbTrigger[detGroup][detID]->addItem("Trigger e", 0x1); // Self-trigger and coincient Ch64Trigger
|
||||||
cbTrigger[detTypeID][detID[0]]->addItem("Ext. Trigger", "TRGIN"); // with coincident with TRGIN.
|
cbTrigger[detGroup][detID]->addItem("Ext. Trigger", "TRGIN"); // with coincident with TRGIN.
|
||||||
cbTrigger[detTypeID][detID[0]]->addItem("Disabled", "Disabled"); // no Trigger, no coincident, basically channel still alive, but no recording
|
cbTrigger[detGroup][detID]->addItem("Disabled", "Disabled"); // no Trigger, no coincident, basically channel still alive, but no recording
|
||||||
cbTrigger[detTypeID][detID[0]]->addItem("Others", -999); // other settings
|
cbTrigger[detGroup][detID]->addItem("Others", -999); // other settings
|
||||||
|
|
||||||
layout0->addWidget(cbTrigger[detTypeID][detID[0]], 8, 0, 1, 3);
|
layout0->addWidget(cbTrigger[detGroup][detID], 2*nChInGroupBox, 0, 1, 3);
|
||||||
|
|
||||||
if( isDisableDetector ) cbTrigger[detTypeID][detID[0]]->setEnabled(false);
|
if( isDisableDetector ) cbTrigger[detGroup][detID]->setEnabled(false);
|
||||||
|
|
||||||
//*========== connection
|
//*========== connection
|
||||||
connect(cbTrigger[detTypeID][detID[0]], &RComboBox::currentIndexChanged, this , [=](int index){
|
connect(cbTrigger[detGroup][detID], &RComboBox::currentIndexChanged, this , [=](int index){
|
||||||
if( !enableSignalSlot) return;
|
if( !enableSignalSlot) return;
|
||||||
|
|
||||||
if( chkAll[detTypeID][SettingID]->isChecked() ){
|
if( chkAll[detGroup][SettingID]->isChecked() ){
|
||||||
for( int gg = 0; gg < nDet[detTypeID]; gg++){
|
|
||||||
if( gg == detID[0] ) continue;
|
|
||||||
cbTrigger[detTypeID][gg]->setCurrentIndex(index);
|
//TODO if( detIDList[k][1] >= detMaxID[0] || 0 > detIDList[k][1]) continue; //! only for array
|
||||||
|
|
||||||
|
for( int gg = 0; gg < nDetinGroup[detGroup]; gg++){
|
||||||
|
//TODO -==== if( gg >= )
|
||||||
|
if( gg == detID ) continue;
|
||||||
|
cbTrigger[detGroup][gg]->setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///----------- single
|
///----------- single
|
||||||
for( int i = 1; i < detID.size(); i++){
|
for( int i = ChStartIndex ; i < detIDArray.size(); i++){
|
||||||
|
|
||||||
int digiID = (detID[i] >> 8 );
|
int digiID = (detIDArray[i] >> 8 );
|
||||||
int chID = (detID[i] & 0xFF);
|
if( digiID >= nDigi) continue;
|
||||||
|
int chID = (detIDArray[i] & 0xFF);
|
||||||
|
|
||||||
if( digi[digiID]->IsDummy() || !digi[digiID]->IsConnected() ) continue;
|
if( digi[digiID]->IsDummy() || !digi[digiID]->IsConnected() ) continue;
|
||||||
|
|
||||||
|
@ -444,14 +501,14 @@ void SOLARISpanel::CreateDetGroup(int detTypeID, int SettingID, QList<int> detID
|
||||||
digi[digiID]->WriteValue(PHA::CH::EventTriggerSource, "ChSelfTrigger", chID);
|
digi[digiID]->WriteValue(PHA::CH::EventTriggerSource, "ChSelfTrigger", chID);
|
||||||
digi[digiID]->WriteValue(PHA::CH::WaveTriggerSource, "ChSelfTrigger", chID);
|
digi[digiID]->WriteValue(PHA::CH::WaveTriggerSource, "ChSelfTrigger", chID);
|
||||||
|
|
||||||
if( i == 1 ){
|
if( i == ChStartIndex ){
|
||||||
digi[digiID]->WriteValue(PHA::CH::CoincidenceMask, "Disabled", chID);
|
digi[digiID]->WriteValue(PHA::CH::CoincidenceMask, "Disabled", chID);
|
||||||
}else {
|
}else {
|
||||||
digi[digiID]->WriteValue(PHA::CH::CoincidenceMask, "Ch64Trigger", chID);
|
digi[digiID]->WriteValue(PHA::CH::CoincidenceMask, "Ch64Trigger", chID);
|
||||||
digi[digiID]->WriteValue(PHA::CH::CoincidenceLength, "100");
|
digi[digiID]->WriteValue(PHA::CH::CoincidenceLength, "100");
|
||||||
|
|
||||||
//Form the trigger bit
|
//Form the trigger bit
|
||||||
unsigned long mask = 1ULL << (detID[1] & 0xFF ); // trigger by energy
|
unsigned long mask = 1ULL << (detIDArray[ChStartIndex] & 0xFF ); // trigger by energy
|
||||||
QString maskStr = QString::number(mask);
|
QString maskStr = QString::number(mask);
|
||||||
digi[digiID]->WriteValue(PHA::CH::ChannelsTriggerMask, maskStr.toStdString() , chID);
|
digi[digiID]->WriteValue(PHA::CH::ChannelsTriggerMask, maskStr.toStdString() , chID);
|
||||||
}
|
}
|
||||||
|
@ -470,7 +527,7 @@ void SOLARISpanel::CreateDetGroup(int detTypeID, int SettingID, QList<int> detID
|
||||||
}; break;
|
}; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SendLogMsg("SOLARIS panel : Set Trigger = " + cbTrigger[detTypeID][detID[0]]->itemText(index) + "|Digi:" + QString::number(digi[digiID]->GetSerialNumber()) + ",Det:" + QString::number(detID[0]));
|
SendLogMsg("SOLARIS panel : Set Trigger = " + cbTrigger[detGroup][detID]->itemText(index) + "|Digi:" + QString::number(digi[digiID]->GetSerialNumber()) + ",Det:" + QString::number(detID));
|
||||||
|
|
||||||
}
|
}
|
||||||
UpdatePanelFromMemory();
|
UpdatePanelFromMemory();
|
||||||
|
@ -480,7 +537,7 @@ void SOLARISpanel::CreateDetGroup(int detTypeID, int SettingID, QList<int> detID
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
layout->addWidget(groupBox[detTypeID][SettingID][detID[0]], row, col);
|
layout->addWidget(groupBox[detGroup][SettingID][detID], row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
//^##############################################################
|
//^##############################################################
|
||||||
|
@ -505,9 +562,7 @@ void SOLARISpanel::UpdatePanelFromMemory(){
|
||||||
for( int SettingID = 0; SettingID < (int) SettingItems.size() ; SettingID ++){
|
for( int SettingID = 0; SettingID < (int) SettingItems.size() ; SettingID ++){
|
||||||
for( int DigiID = 0; DigiID < (int) mapping.size(); DigiID ++){
|
for( int DigiID = 0; DigiID < (int) mapping.size(); DigiID ++){
|
||||||
if( DigiID >= nDigi ) continue;;
|
if( DigiID >= nDigi ) continue;;
|
||||||
|
|
||||||
for( int chID = 0; chID < (int) mapping[DigiID].size(); chID++){
|
for( int chID = 0; chID < (int) mapping[DigiID].size(); chID++){
|
||||||
|
|
||||||
if( mapping[DigiID][chID] < 0 ) continue;
|
if( mapping[DigiID][chID] < 0 ) continue;
|
||||||
|
|
||||||
std::string haha = digi[DigiID]->GetSettingValue(SettingItems[SettingID], chID);
|
std::string haha = digi[DigiID]->GetSettingValue(SettingItems[SettingID], chID);
|
||||||
|
@ -515,9 +570,9 @@ void SOLARISpanel::UpdatePanelFromMemory(){
|
||||||
|
|
||||||
if( SettingItems[SettingID].GetPara() == PHA::CH::TriggerThreshold.GetPara() ){
|
if( SettingItems[SettingID].GetPara() == PHA::CH::TriggerThreshold.GetPara() ){
|
||||||
std::string haha = digi[DigiID]->GetSettingValue(PHA::CH::SelfTrgRate, chID);
|
std::string haha = digi[DigiID]->GetSettingValue(PHA::CH::SelfTrgRate, chID);
|
||||||
leDisplay[SettingID][DigiID][chID]->setText(QString::fromStdString(haha));
|
leDisplay[SettingID][DigiID][chID]->setText(QString::number(atof(haha.c_str()), 'f', 2) );
|
||||||
}else{
|
}else{
|
||||||
leDisplay[SettingID][DigiID][chID]->setText(QString::fromStdString(haha));
|
leDisplay[SettingID][DigiID][chID]->setText(QString::number(atof(haha.c_str()), 'f', 2) );
|
||||||
}
|
}
|
||||||
|
|
||||||
haha = digi[DigiID]->GetSettingValue(PHA::CH::ChannelEnable, chID);
|
haha = digi[DigiID]->GetSettingValue(PHA::CH::ChannelEnable, chID);
|
||||||
|
@ -525,15 +580,17 @@ void SOLARISpanel::UpdatePanelFromMemory(){
|
||||||
leDisplay[SettingID][DigiID][chID]->setEnabled(haha == "True" ? true : false);
|
leDisplay[SettingID][DigiID][chID]->setEnabled(haha == "True" ? true : false);
|
||||||
sbSetting[SettingID][DigiID][chID]->setEnabled(haha == "True" ? true : false);
|
sbSetting[SettingID][DigiID][chID]->setEnabled(haha == "True" ? true : false);
|
||||||
|
|
||||||
///printf("====== %d %d %d |%s|\n", SettingID, DigiID, chID, haha.c_str());
|
//printf("====== %d %d %d |%s|\n", SettingID, DigiID, chID, haha.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//@===================== Trigger
|
//@===================== Trigger
|
||||||
for( int k = 0; k < detIDList.size() ; k++){
|
for( int k = 0; k < detIDList.size() ; k++){
|
||||||
if( detIDList[k][0] >= detMaxID[0] || 0 > detIDList[k][0]) continue; //! only for array
|
if( detIDList[k][1] >= detMaxID[0] || 0 > detIDList[k][1]) continue; //! only for array
|
||||||
|
|
||||||
|
if( detIDList[k][0] != 0 ) continue;
|
||||||
|
|
||||||
//if( detIDList[k].size() <= 2) continue;
|
//if( detIDList[k].size() <= 2) continue;
|
||||||
std::vector<unsigned long> triggerMap;
|
std::vector<unsigned long> triggerMap;
|
||||||
std::vector<std::string> coincidentMask;
|
std::vector<std::string> coincidentMask;
|
||||||
|
@ -541,10 +598,12 @@ void SOLARISpanel::UpdatePanelFromMemory(){
|
||||||
std::vector<std::string> eventTriggerSource;
|
std::vector<std::string> eventTriggerSource;
|
||||||
std::vector<std::string> waveTriggerSource;
|
std::vector<std::string> waveTriggerSource;
|
||||||
|
|
||||||
for( int h = 1; h < detIDList[k].size(); h++){
|
for( int h = ChStartIndex; h < detIDList[k].size(); h++){
|
||||||
int digiID = detIDList[k][h] >> 8;
|
int chIndex = h - ChStartIndex;
|
||||||
int chID = (detIDList[k][h] & 0xFF);
|
int digiID = detIDList[k][chIndex] >> 8;
|
||||||
|
if( digiID >= nDigi) continue;
|
||||||
|
|
||||||
|
int chID = (detIDList[k][h] & 0xFF);
|
||||||
triggerMap.push_back(Utility::TenBase(digi[digiID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, chID)));
|
triggerMap.push_back(Utility::TenBase(digi[digiID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, chID)));
|
||||||
coincidentMask.push_back(digi[digiID]->GetSettingValue(PHA::CH::CoincidenceMask, chID));
|
coincidentMask.push_back(digi[digiID]->GetSettingValue(PHA::CH::CoincidenceMask, chID));
|
||||||
antiCoincidentMask.push_back(digi[digiID]->GetSettingValue(PHA::CH::AntiCoincidenceMask, chID));
|
antiCoincidentMask.push_back(digi[digiID]->GetSettingValue(PHA::CH::AntiCoincidenceMask, chID));
|
||||||
|
@ -556,7 +615,8 @@ void SOLARISpanel::UpdatePanelFromMemory(){
|
||||||
// and coincidentMask for e, xf, xn, are at least one for Ch64Trigger
|
// and coincidentMask for e, xf, xn, are at least one for Ch64Trigger
|
||||||
// and waveTriggerSource are all ChSelfTrigger
|
// and waveTriggerSource are all ChSelfTrigger
|
||||||
|
|
||||||
int detTypeID = FindDetTypeID(detIDList[k]);
|
|
||||||
|
int detTypeID = FindDetTypeID(detIDList[k][1]);
|
||||||
|
|
||||||
//====== a stupid way
|
//====== a stupid way
|
||||||
// triggerSource : Other = 0x0, Disabled = 0x1, ChSelfTrigger = 0x2, TRGIN = 0x3
|
// triggerSource : Other = 0x0, Disabled = 0x1, ChSelfTrigger = 0x2, TRGIN = 0x3
|
||||||
|
@ -617,14 +677,14 @@ void SOLARISpanel::UpdatePanelFromMemory(){
|
||||||
|
|
||||||
// if Trigger e, need to check the trigger mask;
|
// if Trigger e, need to check the trigger mask;
|
||||||
if( comboxIndex == 3){
|
if( comboxIndex == 3){
|
||||||
unsigned long ShouldBeMask = 1ULL << (detIDList[k][1] & 0xFF);
|
unsigned long ShouldBeMask = 1ULL << (detIDList[k][ChStartIndex] & 0xFF);
|
||||||
for( int i = 1; i < (int) triggerMap.size(); i ++){
|
for( int i = 1; i < (int) triggerMap.size(); i ++){
|
||||||
//printf(" %d | %lu =? %lu \n", i, triggerMap[i], ShouldBeMask);
|
//printf(" %d | %lu =? %lu \n", i, triggerMap[i], ShouldBeMask);
|
||||||
if( triggerMap[i] != ShouldBeMask) comboxIndex = 4;
|
if( triggerMap[i] != ShouldBeMask) comboxIndex = 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cbTrigger[detTypeID][detIDList[k][0]]->setCurrentIndex(comboxIndex);
|
cbTrigger[detTypeID][detIDList[k][1]]->setCurrentIndex(comboxIndex);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,7 +692,7 @@ void SOLARISpanel::UpdatePanelFromMemory(){
|
||||||
std::vector<int> coinTime;
|
std::vector<int> coinTime;
|
||||||
|
|
||||||
for( int i = 0; i < detIDList.size(); i++){
|
for( int i = 0; i < detIDList.size(); i++){
|
||||||
for( int j = 1; j < detIDList[i].size(); j++){
|
for( int j = ChStartIndex; j < detIDList[i].size(); j++){
|
||||||
int digiID = detIDList[i][j] >> 8;
|
int digiID = detIDList[i][j] >> 8;
|
||||||
int chID = (detIDList[i][j] & 0xFF);
|
int chID = (detIDList[i][j] & 0xFF);
|
||||||
if( digiID >= nDigi ) continue;
|
if( digiID >= nDigi ) continue;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "CustomWidgets.h"
|
#include "CustomWidgets.h"
|
||||||
#include "macro.h"
|
#include "macro.h"
|
||||||
|
|
||||||
#define MaxDetType 10
|
#define MaxDetGroup 10
|
||||||
#define MaxDetID 60
|
#define MaxDetID 60
|
||||||
#define MaxSettingItem 3
|
#define MaxSettingItem 3
|
||||||
|
|
||||||
|
@ -35,6 +35,8 @@ public:
|
||||||
QString analysisPath,
|
QString analysisPath,
|
||||||
std::vector<std::vector<int>> mapping,
|
std::vector<std::vector<int>> mapping,
|
||||||
QStringList detType,
|
QStringList detType,
|
||||||
|
QStringList detGroupName,
|
||||||
|
std::vector<int> detGroupID,
|
||||||
std::vector<int> detMaxID,
|
std::vector<int> detMaxID,
|
||||||
QWidget * parent = nullptr);
|
QWidget * parent = nullptr);
|
||||||
~SOLARISpanel();
|
~SOLARISpanel();
|
||||||
|
@ -55,31 +57,35 @@ signals:
|
||||||
void SendLogMsg(const QString str);
|
void SendLogMsg(const QString str);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CreateDetGroup(int detTypeID, int SettingID, QList<int> detID, QGridLayout * &layout, int row, int col);
|
void CreateDetGroup(int SettingID, QList<int> detIDArray, QGridLayout * &layout, int row, int col);
|
||||||
|
|
||||||
Digitizer2Gen ** digi;
|
Digitizer2Gen ** digi;
|
||||||
unsigned short nDigi;
|
unsigned short nDigi;
|
||||||
std::vector<std::vector<int>> mapping;
|
std::vector<std::vector<int>> mapping;
|
||||||
QStringList detType;
|
QStringList detType;
|
||||||
std::vector<int> nDet; // number of distgish detector
|
std::vector<int> nDetinType;
|
||||||
std::vector<int> detMaxID;
|
std::vector<int> detMaxID;
|
||||||
|
QStringList detGroupName;
|
||||||
|
std::vector<int> detGroupID;
|
||||||
|
std::vector<int> nDetinGroup;
|
||||||
QList<QList<int>> detIDList; // 1-D array of { detID, (Digi << 8 ) + ch}
|
QList<QList<int>> detIDList; // 1-D array of { detID, (Digi << 8 ) + ch}
|
||||||
|
|
||||||
QString digiSettingPath;
|
QString digiSettingPath;
|
||||||
|
|
||||||
int FindDetTypeID(QList<int> detIDListElement);
|
int FindDetTypeID(int detID);
|
||||||
|
int FindDetGroup(int detID);
|
||||||
|
|
||||||
RSpinBox * sbCoinTime;
|
RSpinBox * sbCoinTime;
|
||||||
|
|
||||||
QCheckBox * chkAll[MaxDetType][MaxSettingItem]; // checkBox for all setting on that tab;
|
QCheckBox * chkAll[MaxDetGroup][MaxSettingItem]; // checkBox for all setting on that tab;
|
||||||
|
|
||||||
QGroupBox * groupBox[MaxDetType][MaxSettingItem][MaxDetID];
|
QGroupBox * groupBox[MaxDetGroup][MaxSettingItem][MaxDetID];
|
||||||
|
|
||||||
QLineEdit * leDisplay[MaxSettingItem][MaxNumberOfDigitizer][MaxNumberOfChannel]; // [SettingID][DigiID][ChID]
|
QLineEdit * leDisplay[MaxSettingItem][MaxNumberOfDigitizer][MaxNumberOfChannel]; // [SettingID][DigiID][ChID]
|
||||||
RSpinBox * sbSetting[MaxSettingItem][MaxNumberOfDigitizer][MaxNumberOfChannel];
|
RSpinBox * sbSetting[MaxSettingItem][MaxNumberOfDigitizer][MaxNumberOfChannel];
|
||||||
QCheckBox * chkOnOff[MaxSettingItem][MaxNumberOfDigitizer][MaxNumberOfChannel];
|
QCheckBox * chkOnOff[MaxSettingItem][MaxNumberOfDigitizer][MaxNumberOfChannel];
|
||||||
|
|
||||||
RComboBox * cbTrigger[MaxDetType][MaxDetID]; //[detTypeID][detID] for array only
|
RComboBox * cbTrigger[MaxDetGroup][MaxDetID]; //[detTypeID][detID] for array only
|
||||||
|
|
||||||
bool enableSignalSlot;
|
bool enableSignalSlot;
|
||||||
|
|
||||||
|
|
|
@ -673,7 +673,7 @@ void MainWindow::OpenDigitizers(){
|
||||||
bnProgramSettings->setEnabled(false);
|
bnProgramSettings->setEnabled(false);
|
||||||
bnNewExp->setEnabled(false);
|
bnNewExp->setEnabled(false);
|
||||||
|
|
||||||
if( nDigiConnected > 0 ) bnSOLSettings->setEnabled(CheckSOLARISpanelOK());
|
bnSOLSettings->setEnabled(CheckSOLARISpanelOK());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -815,7 +815,9 @@ bool MainWindow::CheckSOLARISpanelOK(){
|
||||||
mapping.clear();
|
mapping.clear();
|
||||||
std::vector<int> singleDigiMap;
|
std::vector<int> singleDigiMap;
|
||||||
detType.clear();
|
detType.clear();
|
||||||
|
detGroupID.clear();
|
||||||
detMaxID.clear();
|
detMaxID.clear();
|
||||||
|
detGroupName.clear();
|
||||||
|
|
||||||
bool startRecord = false;
|
bool startRecord = false;
|
||||||
QTextStream in(&file);
|
QTextStream in(&file);
|
||||||
|
@ -833,6 +835,29 @@ bool MainWindow::CheckSOLARISpanelOK(){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if( line.contains("//C%")){
|
||||||
|
int in1 = line.indexOf("{");
|
||||||
|
int in2 = line.lastIndexOf("}");
|
||||||
|
if( in2 > in1){
|
||||||
|
QString subLine = line.mid(in1+1, in2 - in1 -1).trimmed().remove(QRegularExpression("[\"\\\\]"));
|
||||||
|
detGroupName = subLine.split(",");
|
||||||
|
}else{
|
||||||
|
LogMsg("Problem Found for the Mapping.h.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( line.contains("//C&")){
|
||||||
|
int in1 = line.indexOf("{");
|
||||||
|
int in2 = line.lastIndexOf("}");
|
||||||
|
if( in2 > in1){
|
||||||
|
QString subLine = line.mid(in1+1, in2 - in1 -1).trimmed().remove(QRegularExpression("[\"\\\\]"));
|
||||||
|
QStringList haha = subLine.split(",");
|
||||||
|
for( int i = 0; i < haha.size(); i++) detGroupID.push_back(haha[i].toInt());
|
||||||
|
}else{
|
||||||
|
LogMsg("Problem Found for the Mapping.h.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
if( line.contains("//C#")){
|
if( line.contains("//C#")){
|
||||||
int in1 = line.indexOf("{");
|
int in1 = line.indexOf("{");
|
||||||
int in2 = line.lastIndexOf("}");
|
int in2 = line.lastIndexOf("}");
|
||||||
|
@ -882,14 +907,15 @@ bool MainWindow::CheckSOLARISpanelOK(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( (int) detMaxID.size() != detType.size() ){
|
if( (int) detMaxID.size() != detType.size() ){
|
||||||
LogMsg("Size of detector Name and detctor max ID does not match.");
|
LogMsg("Size of detector Name and detctor max ID does not match.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( nDigiConnected == 0 ) return false;
|
||||||
|
|
||||||
//@============= Create SOLAIRS panel
|
//@============= Create SOLAIRS panel
|
||||||
solarisSetting = new SOLARISpanel(digi, nDigi, analysisPath, mapping, detType, detMaxID);
|
solarisSetting = new SOLARISpanel(digi, nDigi, analysisPath, mapping, detType, detGroupName, detGroupID, detMaxID);
|
||||||
connect(solarisSetting, &SOLARISpanel::SendLogMsg, this, &MainWindow::LogMsg);
|
connect(solarisSetting, &SOLARISpanel::SendLogMsg, this, &MainWindow::LogMsg);
|
||||||
connect(solarisSetting, &SOLARISpanel::UpdateOtherPanels, this, [=](){ UpdateAllPanel(2);});
|
connect(solarisSetting, &SOLARISpanel::UpdateOtherPanels, this, [=](){ UpdateAllPanel(2);});
|
||||||
|
|
||||||
|
|
|
@ -152,6 +152,8 @@ private:
|
||||||
std::vector<std::vector<int>> mapping;
|
std::vector<std::vector<int>> mapping;
|
||||||
QStringList detType;
|
QStringList detType;
|
||||||
std::vector<int> detMaxID;
|
std::vector<int> detMaxID;
|
||||||
|
std::vector<int> detGroupID;
|
||||||
|
QStringList detGroupName;
|
||||||
|
|
||||||
//@----- Program settings
|
//@----- Program settings
|
||||||
QLineEdit * lSaveSettingPath; // only live in ProgramSettigns()
|
QLineEdit * lSaveSettingPath; // only live in ProgramSettigns()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user