Compare commits
2 Commits
a024d001ff
...
a65d7ffa94
Author | SHA1 | Date | |
---|---|---|---|
|
a65d7ffa94 | ||
|
259bc9d244 |
|
@ -231,7 +231,6 @@ int Digitizer2Gen::OpenDigitizer(const char * url){
|
|||
printf(" Model name : %s\n", ModelName.c_str());
|
||||
printf(" CUP version : %s\n", GetSettingValue(PHA::DIG::CupVer).c_str());
|
||||
printf(" DPP Type : %s\n", GetSettingValue(PHA::DIG::FirmwareType).c_str());
|
||||
printf(" DPP Version : %s\n", FPGAType.c_str());
|
||||
printf("Serial number : %d\n", serialNumber);
|
||||
printf(" ADC bits : %s\n", GetSettingValue(PHA::DIG::ADC_bit).c_str());
|
||||
printf(" ADC rate : %d Msps, ch2ns : %d ns\n", adcRate, ch2ns);
|
||||
|
|
318
SOLARISpanel.cpp
318
SOLARISpanel.cpp
|
@ -1,9 +1,15 @@
|
|||
#include "SOLARISpanel.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QLabel>
|
||||
#include <QSet>
|
||||
#include <QList>
|
||||
|
||||
#define NCOL 10 // number of column
|
||||
|
||||
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,
|
||||
std::vector<std::vector<int>> mapping,
|
||||
QStringList detType,
|
||||
|
@ -11,7 +17,7 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
|||
QWidget *parent) : QWidget(parent){
|
||||
|
||||
setWindowTitle("SOLARIS Settings");
|
||||
setGeometry(0, 0, 1850, 1000);
|
||||
setGeometry(0, 0, 1400, 800);
|
||||
|
||||
printf("%s\n", __func__);
|
||||
|
||||
|
@ -21,59 +27,130 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
|||
this->detType = detType;
|
||||
this->detMaxID = detMaxID;
|
||||
|
||||
nDigiMapping = mapping.size();
|
||||
for( int i = 0; i < nDigiMapping; i++) {
|
||||
int count = 0;
|
||||
for( int j = 0; j < (int )mapping[i].size(); j++) if( mapping[i][j] >= 0) count ++;
|
||||
nChMapping.push_back(count);
|
||||
}
|
||||
|
||||
//Check number of detector type; Array 0-199, Recoil 200-299, other 300-
|
||||
int nDetType = detType.size();
|
||||
for( int k = 0 ; k < nDetType; k++) nDet.push_back(0);
|
||||
|
||||
int nDet[nDetType];
|
||||
for( int k = 0 ; k < nDetType; k++) nDet[k] = 0;
|
||||
QList<QList<int>> detIDListTemp; // store { detID, (Digi << 8 ) + ch}, making mapping into 1-D array to be consolidated
|
||||
|
||||
QList<int> detIDList; //consolidated
|
||||
|
||||
for( int i = 0; i < (int) mapping.size() ; i++){
|
||||
printf("################################# \n");
|
||||
for( int i = 0; i < nDigiMapping ; 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];
|
||||
QList<int> haha ;
|
||||
haha << mapping[i][j] << ((i << 8 ) + j);
|
||||
if( mapping[i][j] >= 0 ) detIDListTemp << haha;
|
||||
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");
|
||||
if( j % 16 == 15 ) printf("\n");
|
||||
}
|
||||
printf("------------------ \n");
|
||||
}
|
||||
|
||||
//----- consolidate detIDList;
|
||||
QSet<int> mySet(detIDList.begin(), detIDList.end());
|
||||
detIDList = mySet.values();
|
||||
detIDList.clear();
|
||||
QList<int> haha;
|
||||
haha << detIDListTemp[0][0];
|
||||
detIDList << haha;
|
||||
bool repeated = false;
|
||||
for( int i = 0; i < detIDListTemp.size(); i++ ){
|
||||
repeated = false;
|
||||
for( int j = 0; j < detIDList.size() ; j++){
|
||||
if( detIDList[j][0] == detIDListTemp[i][0] ) {
|
||||
repeated = true;
|
||||
detIDList[j] << detIDListTemp[i][1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( !repeated ) detIDList << detIDListTemp[i];
|
||||
}
|
||||
|
||||
for( int i = 0 ; i < detIDList.size(); i++) printf("%d\n", detIDList[i]);
|
||||
//---- sort detIDList;
|
||||
std::sort(detIDList.begin(), detIDList.end(), [](const QList<int>& a, const QList<int>& b) {
|
||||
return a.at(0) < b.at(0);
|
||||
});
|
||||
|
||||
//qDebug() << detIDList;
|
||||
|
||||
//------------ create Widgets
|
||||
leDisplay = new QLineEdit ***[(int) SettingItems.size()];
|
||||
sbSetting = new RSpinBox ***[(int) SettingItems.size()];
|
||||
chkOnOff = new QCheckBox ***[(int) SettingItems.size()];
|
||||
for( int k = 0; k < (int) SettingItems.size() ; k ++){
|
||||
leDisplay[k] = new QLineEdit **[nDigiMapping];
|
||||
sbSetting[k] = new RSpinBox **[nDigiMapping];
|
||||
chkOnOff[k] = new QCheckBox **[nDigiMapping];
|
||||
for( int i = 0; i < nDigiMapping; i++){
|
||||
leDisplay[k][i] = new QLineEdit *[(int) mapping[i].size()];
|
||||
sbSetting[k][i] = new RSpinBox *[(int) mapping[i].size()];
|
||||
chkOnOff[k][i] = new QCheckBox *[(int) mapping[i].size()];
|
||||
}
|
||||
}
|
||||
|
||||
cbTrigger = new RComboBox *[nDet[0]]; /// nDet[0] store the number of det. for the Array
|
||||
|
||||
//---------- Set Panel
|
||||
QVBoxLayout * mainLayout = new QVBoxLayout(this); this->setLayout(mainLayout);
|
||||
QTabWidget * tabWidget = new QTabWidget(this); mainLayout->addWidget(tabWidget);
|
||||
|
||||
for( int detTypeID = 0; detTypeID < nDetType; detTypeID ++ ){
|
||||
|
||||
QWidget * tab = new QWidget(this);
|
||||
tabWidget->addTab(tab, detType[detTypeID]);
|
||||
QTabWidget * tab2 = new QTabWidget(tabWidget);
|
||||
tabWidget->addTab(tab2, detType[detTypeID]);
|
||||
|
||||
QGridLayout * layout = new QGridLayout(tab);
|
||||
layout->setAlignment(Qt::AlignLeft|Qt::AlignTop);
|
||||
layout->setSpacing(0);
|
||||
for( int SettingID = 0; SettingID < (int) SettingItems.size(); SettingID ++){
|
||||
|
||||
//QLineEdit * leNDet = new QLineEdit(QString::number(nDet[detTypeID]), tab);
|
||||
//layout->addWidget(leNDet, 0, 0);
|
||||
QScrollArea * scrollArea = new QScrollArea(this);
|
||||
scrollArea->setWidgetResizable(true);
|
||||
scrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
tab2->addTab(scrollArea, QString::fromStdString(SettingItems[SettingID]));
|
||||
|
||||
//ranege of detID
|
||||
int lowID = (detTypeID == 0 ? 0 : detMaxID[detTypeID-1]);
|
||||
QWidget * tab = new QWidget(tab2);
|
||||
scrollArea->setWidget(tab);
|
||||
|
||||
QGridLayout * layout = new QGridLayout(tab);
|
||||
layout->setAlignment(Qt::AlignLeft|Qt::AlignTop);
|
||||
layout->setSpacing(0);
|
||||
|
||||
//TODO======= check all
|
||||
chkAll = new QCheckBox("Set for all", tab);
|
||||
layout->addWidget(chkAll, 0, 0);
|
||||
|
||||
if( SettingItems[SettingID].GetPara() == PHA::CH::TriggerThreshold.GetPara() ){
|
||||
chkAlle = new QCheckBox("Set for all e", tab);
|
||||
layout->addWidget(chkAlle, 0, 1);
|
||||
|
||||
chkAllxf = new QCheckBox("Set for all xf", tab);
|
||||
layout->addWidget(chkAllxf, 0, 2);
|
||||
|
||||
chkAllxn = new QCheckBox("Set for all xn", tab);
|
||||
layout->addWidget(chkAllxn, 0, 3);
|
||||
|
||||
}
|
||||
|
||||
//range of detID
|
||||
int lowID = (detTypeID == 0 ? 0 : detMaxID[detTypeID-1]);
|
||||
|
||||
for(int i = 0; i < detIDList.size(); i++){
|
||||
if( detIDList[i][0] >= detMaxID[detTypeID] || lowID > detIDList[i][0] ) continue;
|
||||
CreateDetGroup(SettingID, detIDList[i], layout, i/NCOL + 1, i%NCOL);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//TODO ========== when digiSettingPanel or Scope change setting, reflect in solarisPanel
|
||||
|
||||
//TODO ========== when tab change, update panel
|
||||
|
||||
}
|
||||
|
||||
|
@ -81,37 +158,188 @@ SOLARISpanel::~SOLARISpanel(){
|
|||
|
||||
}
|
||||
|
||||
void SOLARISpanel::CreateSpinBoxGroup(const Reg para, int detID, QGridLayout * &layout, int row, int col){
|
||||
void SOLARISpanel::CreateDetGroup(int SettingID, QList<int> detID, QGridLayout * &layout, int row, int col){
|
||||
|
||||
//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[0]), this);
|
||||
groupbox->setFixedWidth(130);
|
||||
groupbox->setAlignment(Qt::AlignCenter);
|
||||
QGridLayout * layout0 = new QGridLayout(groupbox);
|
||||
layout0->setSpacing(0);
|
||||
layout0->setAlignment(Qt::AlignLeft);
|
||||
|
||||
for( int i = 1; i < (int) detID.size(); i ++){
|
||||
|
||||
QLabel * lb = new QLabel(arrayLabel[i-1], this);
|
||||
layout0->addWidget(lb, 2*i, 0, 2, 1);
|
||||
|
||||
int digiID = (detID[i] >> 8 );
|
||||
int chID = (detID[i] & 0xFF);
|
||||
|
||||
chkOnOff[SettingID][digiID][chID] = new QCheckBox(this);
|
||||
layout0->addWidget(chkOnOff[SettingID][digiID][chID], 2*i, 1, 2, 1);
|
||||
|
||||
leDisplay[SettingID][digiID][chID] = new QLineEdit(this);
|
||||
leDisplay[SettingID][digiID][chID]->setFixedWidth(70);
|
||||
layout0->addWidget(leDisplay[SettingID][digiID][chID], 2*i, 2);
|
||||
|
||||
sbSetting[SettingID][digiID][chID] = new RSpinBox(this);
|
||||
if( digiID < nDigi ) sbSetting[SettingID][digiID][chID]->setToolTip( "Digi-" + QString::number(digi[digiID]->GetSerialNumber()) + ", Ch-" + QString::number(chID));
|
||||
sbSetting[SettingID][digiID][chID]->setToolTipDuration(-1);
|
||||
sbSetting[SettingID][digiID][chID]->setFixedWidth(70);
|
||||
|
||||
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]->setSingleStep(atoi(SettingItems[SettingID].GetAnswers()[2].first.c_str()));
|
||||
|
||||
layout0->addWidget(sbSetting[SettingID][digiID][chID], 2*i+1, 2);
|
||||
|
||||
if( digiID >= nDigi || chID >= digi[digiID]->GetNChannels() ) {
|
||||
leDisplay[SettingID][digiID][chID]->setEnabled(false);
|
||||
sbSetting[SettingID][digiID][chID]->setEnabled(false);
|
||||
chkOnOff[SettingID][digiID][chID]->setEnabled(false);
|
||||
}
|
||||
|
||||
RSpinBox * spb = sbSetting[SettingID][digiID][chID];
|
||||
const Reg para = SettingItems[SettingID];
|
||||
|
||||
connect(spb, &RSpinBox::valueChanged, this, [=](){
|
||||
if( !enableSignalSlot ) return;
|
||||
spb->setStyleSheet("color:blue;");
|
||||
});
|
||||
|
||||
connect(spb, &RSpinBox::returnPressed, this, [=](){
|
||||
if( !enableSignalSlot ) return;
|
||||
//printf("%s %d %d \n", para.GetPara().c_str(), index, spb->value());
|
||||
if( spb->decimals() == 0 && spb->singleStep() != 1) {
|
||||
double step = spb->singleStep();
|
||||
double value = spb->value();
|
||||
spb->setValue( (std::round(value/step) * step) );
|
||||
}
|
||||
QString msg;
|
||||
msg = QString::fromStdString(para.GetPara()) + "|DIG:"+ QString::number(digi[digiID]->GetSerialNumber());
|
||||
if( para.GetType() == TYPE::CH ) msg += ",CH:" + QString::number(chID);
|
||||
msg += " = " + QString::number(spb->value());
|
||||
if( digi[digiID]->WriteValue(para, std::to_string(spb->value()), chID)){
|
||||
SendLogMsg(msg + "|OK.");
|
||||
spb->setStyleSheet("");
|
||||
}else{
|
||||
SendLogMsg(msg + "|Fail.");
|
||||
spb->setStyleSheet("color:red;");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
connect(chkOnOff[SettingID][digiID][chID], &QCheckBox::stateChanged, this, [=](){
|
||||
if( !enableSignalSlot ) return;
|
||||
|
||||
bool haha = chkOnOff[SettingID][digiID][chID]->isChecked();
|
||||
|
||||
if( haha ) {
|
||||
digi[digiID]->WriteValue(PHA::CH::ChannelEnable, "True", chID);
|
||||
}else{
|
||||
digi[digiID]->WriteValue(PHA::CH::ChannelEnable, "False", chID);
|
||||
}
|
||||
leDisplay[SettingID][digiID][chID]->setEnabled(haha);
|
||||
sbSetting[SettingID][digiID][chID]->setEnabled(haha);
|
||||
});
|
||||
|
||||
layout0->setColumnStretch(0, 1);
|
||||
layout0->setColumnStretch(1, 1);
|
||||
layout0->setColumnStretch(2, 5);
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
//TODO ==== detMaxID[0] should belong to Array
|
||||
if( 0 <= detID[0] && detID[0] < detMaxID[0] && SettingItems[SettingID].GetPara() == PHA::CH::TriggerThreshold.GetPara()){
|
||||
cbTrigger[detID[0]] = new RComboBox(this);
|
||||
cbTrigger[detID[0]]->addItem("Non-Trigger", 0x0);
|
||||
cbTrigger[detID[0]]->addItem("Self Trigger", -1);
|
||||
cbTrigger[detID[0]]->addItem("Trigger all", 0x7);
|
||||
cbTrigger[detID[0]]->addItem("Trigger (e)", 0x1);
|
||||
cbTrigger[detID[0]]->addItem("Trigger (xf)", 0x2);
|
||||
cbTrigger[detID[0]]->addItem("Trigger (xn)", 0x4);
|
||||
cbTrigger[detID[0]]->addItem("Trigger 011", 0x3);
|
||||
cbTrigger[detID[0]]->addItem("Trigger 110", 0x6);
|
||||
cbTrigger[detID[0]]->addItem("Trigger 101", 0x5);
|
||||
cbTrigger[detID[0]]->addItem("Oops....", -999);
|
||||
layout0->addWidget(cbTrigger[detID[0]], 8, 0, 1, 3);
|
||||
}
|
||||
|
||||
layout->addWidget(groupbox, row, col);
|
||||
|
||||
}
|
||||
|
||||
void SOLARISpanel::CreateTab(const Reg para){
|
||||
|
||||
void SOLARISpanel::UpdatePanel(){
|
||||
enableSignalSlot = false;
|
||||
|
||||
for( int SettingID = 0; SettingID < (int) SettingItems.size() ; SettingID ++){
|
||||
for( int DigiID = 0; DigiID < (int) mapping.size(); DigiID ++){
|
||||
if( DigiID >= nDigi ) continue;;
|
||||
|
||||
for( int chID = 0; chID < (int) mapping[DigiID].size(); chID++){
|
||||
|
||||
if( mapping[DigiID][chID] < 0 ) continue;
|
||||
|
||||
std::string haha = digi[DigiID]->GetSettingValue(SettingItems[SettingID], chID);
|
||||
sbSetting[SettingID][DigiID][chID]->setValue( atof(haha.c_str()));
|
||||
|
||||
if( SettingItems[SettingID].GetPara() == PHA::CH::TriggerThreshold.GetPara() ){
|
||||
std::string haha = digi[DigiID]->GetSettingValue(PHA::CH::SelfTrgRate, chID);
|
||||
leDisplay[SettingID][DigiID][chID]->setText(QString::fromStdString(haha));
|
||||
}else{
|
||||
leDisplay[SettingID][DigiID][chID]->setText(QString::fromStdString(haha));
|
||||
}
|
||||
|
||||
haha = digi[DigiID]->GetSettingValue(PHA::CH::ChannelEnable, chID);
|
||||
chkOnOff[SettingID][DigiID][chID]->setChecked( haha == "True" ? true : false);
|
||||
|
||||
///printf("====== %d %d %d |%s|\n", SettingID, DigiID, chID, haha.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for( int k = 0; k < detIDList.size() ; k++){
|
||||
if( detIDList[k][0] >= detMaxID[0] || 0 > detIDList[k][0]) continue;
|
||||
|
||||
//if( detIDList[k].size() <= 2) continue;
|
||||
std::vector<unsigned long> triggerMap;
|
||||
std::vector<std::string> coincidentMask;
|
||||
std::vector<std::string> eventTriggerSource;
|
||||
|
||||
for( int h = 1; h < detIDList[k].size(); h++){
|
||||
int digiID = detIDList[k][h] >> 8;
|
||||
int chID = (detIDList[k][h] & 0xFF);
|
||||
triggerMap.push_back(std::stoul(digi[digiID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, chID).c_str()));
|
||||
coincidentMask.push_back(digi[digiID]->GetSettingValue(PHA::CH::CoincidenceMask, chID));
|
||||
eventTriggerSource.push_back(digi[digiID]->GetSettingValue(PHA::CH::EventTriggerSource, chID));
|
||||
}
|
||||
|
||||
//====== only acceptable condition is eventTriggerSource are all ChSelfTrigger
|
||||
// and coincidentMask for e, xf, xn, are at least one for Ch64Trigger
|
||||
|
||||
}
|
||||
|
||||
enableSignalSlot = true;
|
||||
}
|
||||
|
||||
void SOLARISpanel::UpdateThreshold(){
|
||||
|
||||
for( int SettingID = 0; SettingID < (int) SettingItems.size() ; SettingID ++){
|
||||
if( SettingItems[SettingID].GetPara() != PHA::CH::TriggerThreshold.GetPara() ) continue;
|
||||
|
||||
for( int DigiID = 0; DigiID < (int) mapping.size(); DigiID ++){
|
||||
if( DigiID >= nDigi ) continue;;
|
||||
|
||||
for( int chID = 0; chID < (int) mapping[DigiID].size(); chID++){
|
||||
|
||||
if( mapping[DigiID][chID] < 0 ) continue;
|
||||
|
||||
std::string haha = digi[DigiID]->GetSettingValue(PHA::CH::SelfTrgRate, chID);
|
||||
leDisplay[SettingID][DigiID][chID]->setText(QString::fromStdString(haha));
|
||||
|
||||
///printf("====== %d %d %d |%s|\n", SettingID, DigiID, chID, haha.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -36,19 +36,42 @@ public:
|
|||
|
||||
private slots:
|
||||
|
||||
void CreateSpinBoxGroup(const Reg para, int detID, QGridLayout * &layout, int row, int col);
|
||||
void CreateTab(const Reg para);
|
||||
|
||||
public slots:
|
||||
void UpdatePanel();
|
||||
void UpdateThreshold();
|
||||
|
||||
signals:
|
||||
|
||||
void SendLogMsg(const QString str);
|
||||
|
||||
private:
|
||||
void CreateDetGroup(int SettingID, QList<int> detID, QGridLayout * &layout, int row, int col);
|
||||
|
||||
Digitizer2Gen ** digi;
|
||||
unsigned short nDigi;
|
||||
std::vector<std::vector<int>> mapping;
|
||||
QStringList detType;
|
||||
std::vector<int> detMaxID;
|
||||
QList<QList<int>> detIDList; // 1-D array of { detID, (Digi << 8 ) + ch}
|
||||
std::vector<int> nDet;
|
||||
|
||||
int nDigiMapping; /// mapping.size()
|
||||
std::vector<int> nChMapping; /// mapping[i].size(), NON -1
|
||||
|
||||
QCheckBox * chkAll; // checkBox for all setting on that tab;
|
||||
QCheckBox * chkAlle;
|
||||
QCheckBox * chkAllxf;
|
||||
QCheckBox * chkAllxn;
|
||||
|
||||
QLineEdit **** leDisplay; // [SettingID][DigiID][ChID]
|
||||
RSpinBox **** sbSetting;
|
||||
QCheckBox **** chkOnOff;
|
||||
|
||||
RComboBox ** cbTrigger; //[detID] for array only
|
||||
|
||||
bool enableSignalSlot;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1604,6 +1604,8 @@ void DigiSettingsPanel::LoadSettings(){
|
|||
fileDialog.setNameFilter("Data file (*.dat);;Text file (*.txt);;All file (*.*)");
|
||||
fileDialog.exec();
|
||||
|
||||
if( fileDialog.selectedFiles().size() == 0 ) return; // when no file selected.
|
||||
|
||||
QString fileName = fileDialog.selectedFiles().at(0);
|
||||
|
||||
leSettingFile[ID]->setText(fileName);
|
||||
|
@ -1611,11 +1613,11 @@ void DigiSettingsPanel::LoadSettings(){
|
|||
|
||||
if( digi[ID]->LoadSettingsFromFile(fileName.toStdString().c_str()) ){
|
||||
SendLogMsg("Loaded settings file " + fileName + " for Digi-" + QString::number(digi[ID]->GetSerialNumber()));
|
||||
ShowSettingsToPanel();
|
||||
}else{
|
||||
SendLogMsg("Fail to Loaded settings file " + fileName + " for Digi-" + QString::number(digi[ID]->GetSerialNumber()));
|
||||
}
|
||||
|
||||
ShowSettingsToPanel();
|
||||
}
|
||||
|
||||
void DigiSettingsPanel::SetDefaultPHASettigns(){
|
||||
|
|
|
@ -109,6 +109,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
|||
bnSOLSettings->setEnabled(false);
|
||||
connect(bnSOLSettings, SIGNAL(clicked()), this, SLOT(OpenSOLARISpanel()));
|
||||
|
||||
QPushButton * bnEventBuilder = new QPushButton("Event Builder", this);
|
||||
bnEventBuilder->setEnabled(false);
|
||||
|
||||
layout1->addWidget(bnProgramSettings, 0, 0);
|
||||
layout1->addWidget(bnNewExp, 0, 1);
|
||||
layout1->addWidget(lExpName, 0, 2);
|
||||
|
@ -121,6 +124,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
|||
layout1->addWidget(bnDigiSettings, 2, 1);
|
||||
layout1->addWidget(bnSOLSettings, 2, 2, 1, 2);
|
||||
|
||||
layout1->addWidget(bnEventBuilder, 3, 0);
|
||||
|
||||
layout1->setColumnStretch(0, 2);
|
||||
layout1->setColumnStretch(1, 2);
|
||||
layout1->setColumnStretch(2, 1);
|
||||
|
@ -746,6 +751,7 @@ void MainWindow::OpenDigitizersSettings(){
|
|||
//^###################################################################### Open SOLARIS setting panel
|
||||
void MainWindow::OpenSOLARISpanel(){
|
||||
solarisSetting->show();
|
||||
solarisSetting->UpdatePanel();
|
||||
}
|
||||
|
||||
bool MainWindow::CheckSOLARISpanelOK(){
|
||||
|
@ -767,6 +773,7 @@ bool MainWindow::CheckSOLARISpanelOK(){
|
|||
QTextStream in(&file);
|
||||
while (!in.atEnd()) {
|
||||
QString line = in.readLine();
|
||||
if( line.contains("//^")) continue;
|
||||
if( line.contains("//*=")){
|
||||
int in1 = line.indexOf("{");
|
||||
int in2 = line.lastIndexOf("}");
|
||||
|
@ -840,6 +847,7 @@ bool MainWindow::CheckSOLARISpanelOK(){
|
|||
|
||||
//@============= Create SOLAIRS panel
|
||||
solarisSetting = new SOLARISpanel(digi, nDigi, mapping, detType, detMaxID);
|
||||
connect(solarisSetting, &SOLARISpanel::SendLogMsg, this, &MainWindow::LogMsg);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -969,12 +977,12 @@ void MainWindow::UpdateScalar(){
|
|||
leTrigger[iDigi][ch]->setText(QString::fromStdString(haha[ch]));
|
||||
|
||||
|
||||
if( oldTimeStamp[iDigi][ch] > 0 && time - oldTimeStamp[iDigi][ch] > 1e9){
|
||||
if( oldTimeStamp[iDigi][ch] > 0 && time - oldTimeStamp[iDigi][ch] > 1e9 && kaka > oldSavedCount[iDigi][ch]){
|
||||
acceptRate[ch] = (kaka - oldSavedCount[iDigi][ch]) * 1e9 *1.0 / (time - oldTimeStamp[iDigi][ch]);
|
||||
}else{
|
||||
acceptRate[ch] = 0;
|
||||
}
|
||||
if( acceptRate[ch] > 10000 ) printf("%d-%2d | old (%lu, %lu), new (%lu, %lu)\n", iDigi, ch, oldTimeStamp[iDigi][ch], oldSavedCount[iDigi][ch], time, kaka);
|
||||
//if( acceptRate[ch] > 10000 ) printf("%d-%2d | old (%lu, %lu), new (%lu, %lu)\n", iDigi, ch, oldTimeStamp[iDigi][ch], oldSavedCount[iDigi][ch], time, kaka);
|
||||
|
||||
oldSavedCount[iDigi][ch] = kaka;
|
||||
oldTimeStamp[iDigi][ch] = time;
|
||||
|
@ -998,6 +1006,9 @@ void MainWindow::UpdateScalar(){
|
|||
influx->WriteData(DatabaseName.toStdString());
|
||||
influx->ClearDataPointsBuffer();
|
||||
}
|
||||
|
||||
if( solarisSetting && solarisSetting->isVisible() ) solarisSetting->UpdateThreshold();
|
||||
|
||||
}
|
||||
|
||||
//^###################################################################### Program Settings
|
||||
|
|
|
@ -273,7 +273,7 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
|
|||
plotView->setRenderHints(QPainter::Antialiasing);
|
||||
layout->addWidget(plotView, rowID, 0, 1, 6);
|
||||
|
||||
//------------- Ketbinding
|
||||
//------------- Key binding
|
||||
rowID ++;
|
||||
QLabel * lbhints = new QLabel("Type 'r' to restore view.", this);
|
||||
layout->addWidget(lbhints, rowID, 0, 1, 3);
|
||||
|
|
Loading…
Reference in New Issue
Block a user