added trigger map
This commit is contained in:
parent
40391ef044
commit
9fbc64d749
|
@ -568,17 +568,27 @@ void Digitizer2Gen::ProgramPHA(bool testPulse){
|
|||
//WriteValue("/ch/0..63/par/WaveTriggerSource" , "ChSelfTrigger");
|
||||
|
||||
//======== One (or more) slef-trigger can trigger whole board, ??? depend on Channel Trigger mask
|
||||
WriteValue("/ch/0..63/par/EventTriggerSource", "Ch64Trigger");
|
||||
WriteValue("/ch/0..63/par/WaveTriggerSource" , "Ch64Trigger");
|
||||
//WriteValue("/ch/0..63/par/EventTriggerSource", "Ch64Trigger");
|
||||
//WriteValue("/ch/0..63/par/WaveTriggerSource" , "Ch64Trigger");
|
||||
|
||||
//WriteValue("/ch/0..63/par/ChannelsTriggerMask", "0x0000FFFF000F000F");
|
||||
|
||||
//WriteValue("/ch/0..3/par/ChannelsTriggerMask", "0x1");
|
||||
//WriteValue("/ch/4..7/par/ChannelsTriggerMask", "0x10");
|
||||
|
||||
WriteValue("/ch/0..63/par/ChannelsTriggerMask", "0x0000FFFF000F000F");
|
||||
//WriteValue("/ch/0/par/ChannelsTriggerMask", "0x000F");
|
||||
//WriteValue("/ch/12/par/ChannelsTriggerMask", "0x000F");
|
||||
//WriteValue("/ch/38/par/ChannelsTriggerMask", "0x000F"); // when channel has no input, it still record.
|
||||
|
||||
//WriteValue("/ch/0..63/par/CoincidenceMask", "Ch64Trigger");
|
||||
//WriteValue("/ch/0..63/par/CoincidenceLength", "100"); //ns
|
||||
//----------- coincident trigger to ch-4n
|
||||
WriteValue("/ch/0..63/par/EventTriggerSource", "ChSelfTrigger");
|
||||
WriteValue("/ch/0..63/par/WaveTriggerSource" , "ChSelfTrigger");
|
||||
|
||||
for(int i = 0 ; i < 16; i++){
|
||||
WriteValue(("/ch/"+ std::to_string(4*i+1) + ".." + std::to_string(4*i+3) + "/par/ChannelsTriggerMask").c_str(), "0x1");
|
||||
WriteValue(("/ch/"+ std::to_string(4*i+1) + ".." + std::to_string(4*i+3) + "/par/CoincidenceMask").c_str(), "Ch64Trigger");
|
||||
WriteValue(("/ch/"+ std::to_string(4*i+1) + ".." + std::to_string(4*i+3) + "/par/CoincidenceLengthT").c_str(), "100"); // ns
|
||||
}
|
||||
//======== ACQ trigger?
|
||||
//WriteValue("/ch/0..63/par/EventTriggerSource", "GlobalTriggerSource");
|
||||
//WriteValue("/ch/0..63/par/WaveTriggerSource" , "GlobalTriggerSource");
|
||||
|
|
121
digiSettings.cpp
121
digiSettings.cpp
|
@ -1,16 +1,6 @@
|
|||
#include "digiSettings.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QSpinBox>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QGridLayout>
|
||||
#include <QScrollArea>
|
||||
#include <QTabWidget>
|
||||
#include <QGroupBox>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QDebug>
|
||||
|
||||
DigiSettings::DigiSettings(Digitizer2Gen * digi, unsigned short nDigi, QWidget * parent) : QWidget(parent){
|
||||
|
||||
|
@ -24,6 +14,8 @@ DigiSettings::DigiSettings(Digitizer2Gen * digi, unsigned short nDigi, QWidget *
|
|||
this->digi = digi;
|
||||
this->nDigi = nDigi;
|
||||
|
||||
this->nDigi = 1;
|
||||
|
||||
|
||||
std::vector<std::vector<std::string>> info = {{"Serial Num : ", "/par/SerialNum"},
|
||||
{"IP : ", "/par/IPAddress"},
|
||||
|
@ -41,8 +33,10 @@ DigiSettings::DigiSettings(Digitizer2Gen * digi, unsigned short nDigi, QWidget *
|
|||
QTabWidget * tabWidget = new QTabWidget(this);
|
||||
mainLayout->addWidget(tabWidget);
|
||||
|
||||
|
||||
|
||||
//============ Tab for each digitizer
|
||||
for(unsigned short i = 0; i < nDigi; i++){
|
||||
for(unsigned short i = 0; i < this->nDigi; i++){
|
||||
|
||||
|
||||
QWidget * tab = new QWidget(tabWidget);
|
||||
|
@ -52,7 +46,8 @@ DigiSettings::DigiSettings(Digitizer2Gen * digi, unsigned short nDigi, QWidget *
|
|||
scrollArea->setWidgetResizable(true);
|
||||
scrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
||||
tabWidget->addTab(scrollArea, "Digi-" + QString::number(digi->GetSerialNumber()));
|
||||
//tabWidget->addTab(scrollArea, "Digi-" + QString::number(digi->GetSerialNumber()));
|
||||
tabWidget->addTab(scrollArea, "Digi-dummy");
|
||||
|
||||
QGridLayout *tabLayout = new QGridLayout(tab);
|
||||
tab->setLayout(tabLayout);
|
||||
|
@ -68,22 +63,35 @@ DigiSettings::DigiSettings(Digitizer2Gen * digi, unsigned short nDigi, QWidget *
|
|||
lab->setAlignment(Qt::AlignRight);
|
||||
QLineEdit * txt = new QLineEdit(tab);
|
||||
txt->setReadOnly(true);
|
||||
txt->setText(QString::fromStdString(digi->ReadValue(info[j][1].c_str())));
|
||||
//txt->setText(QString::fromStdString(digi->ReadValue(info[j][1].c_str())));
|
||||
//txt->setStyleSheet("color: black;");
|
||||
infoLayout->addWidget(lab, j%3, 2*(j/3));
|
||||
infoLayout->addWidget(txt, j%3, 2*(j/3) +1);
|
||||
}
|
||||
|
||||
//------- Group Board status
|
||||
QGroupBox * statusBox = new QGroupBox("Board Status", tab);
|
||||
QGridLayout * statusLayout = new QGridLayout(statusBox);
|
||||
statusBox->setLayout(statusLayout);
|
||||
tabLayout->addWidget(statusBox, 1, 0);
|
||||
|
||||
//------- Group digitizer settings
|
||||
QGroupBox * digiBox = new QGroupBox("Board Settings", tab);
|
||||
QGridLayout * boardLayout = new QGridLayout(digiBox);
|
||||
digiBox->setLayout(boardLayout);
|
||||
tabLayout->addWidget(digiBox, 1, 0, 2, 1);
|
||||
tabLayout->addWidget(digiBox, 2, 0);
|
||||
|
||||
{
|
||||
int rowId = 0;
|
||||
//-------------------------------------
|
||||
QPushButton * bnResetBd = new QPushButton("Reset Board", tab);
|
||||
boardLayout->addWidget(bnResetBd, rowId, 0, 1, 2);
|
||||
|
||||
QPushButton * bnDefaultSetting = new QPushButton("Set Default Settings", tab);
|
||||
boardLayout->addWidget(bnDefaultSetting, rowId, 2, 1, 2);
|
||||
|
||||
//-------------------------------------
|
||||
rowId ++;
|
||||
QLabel * lbStartSource = new QLabel("Start Source :", tab);
|
||||
lbStartSource->setAlignment(Qt::AlignRight);
|
||||
boardLayout->addWidget(lbStartSource, rowId, 0);
|
||||
|
@ -265,32 +273,99 @@ DigiSettings::DigiSettings(Digitizer2Gen * digi, unsigned short nDigi, QWidget *
|
|||
QGridLayout * chLayout = new QGridLayout(chBox);
|
||||
chBox->setLayout(chLayout);
|
||||
tabLayout->addWidget(chBox, 0, 1, 10, 1);
|
||||
chLayout->setVerticalSpacing(0);
|
||||
|
||||
for( unsigned short ch = 0; ch < digi->GetNChannels(); ch++){
|
||||
//for( unsigned short ch = 0; ch < digi->GetNChannels(); ch++){
|
||||
for( unsigned short ch = 0; ch < 64; ch++){
|
||||
QLabel * labCh = new QLabel(QString::number(ch), tab);
|
||||
labCh->setAlignment(Qt::AlignRight);
|
||||
chLayout->addWidget(labCh, ch, 0);
|
||||
|
||||
QCheckBox * cbCh = new QCheckBox(tab);
|
||||
std::string onOff = digi->ReadValue(("/ch/" + std::to_string(ch)+ "/par/ChEnable").c_str());
|
||||
//std::string onOff = digi->ReadValue(("/ch/" + std::to_string(ch)+ "/par/ChEnable").c_str());
|
||||
//qDebug() << QString::fromStdString(std::to_string(ch) + ", " + onOff);
|
||||
if( onOff == "True"){
|
||||
cbCh->setChecked(true);
|
||||
}else{
|
||||
cbCh->setChecked(false);
|
||||
}
|
||||
//if( onOff == "True"){
|
||||
// cbCh->setChecked(true);
|
||||
//}else{
|
||||
// cbCh->setChecked(false);
|
||||
//}
|
||||
|
||||
chLayout->addWidget(cbCh, ch, 1);
|
||||
|
||||
}
|
||||
|
||||
//------- Group trigger settings
|
||||
QGroupBox * triggerBox = new QGroupBox("Trigger Map", tab);
|
||||
QGridLayout * triggerLayout = new QGridLayout(triggerBox);
|
||||
triggerBox->setLayout(triggerLayout);
|
||||
tabLayout->addWidget(triggerBox, 3, 0);
|
||||
{
|
||||
|
||||
}
|
||||
triggerLayout->setHorizontalSpacing(0);
|
||||
triggerLayout->setVerticalSpacing(0);
|
||||
|
||||
QLabel * instr = new QLabel("Reading: Column (C) represents a trigger channel for Row (R) channel.\nFor example, R3C1 = ch-3 trigger source is ch-1.\n", tab);
|
||||
triggerLayout->addWidget(instr, 0, 0, 1, 64+15);
|
||||
|
||||
QSignalMapper * triggerMapper = new QSignalMapper(tab);
|
||||
|
||||
int count = 0;
|
||||
int rowID = 1;
|
||||
int colID = 0;
|
||||
for(int i = 0; i < 64; i++){
|
||||
colID = 0;
|
||||
for(int j = 0; j < 64; j++){
|
||||
|
||||
bn[i][j] = new QPushButton(tab);
|
||||
bn[i][j]->setFixedSize(QSize(10,10));
|
||||
bnClickStatus[i][j] = false;
|
||||
|
||||
if( i%4 != 0 && j == (i/4)*4) {
|
||||
bn[i][j]->setStyleSheet("background-color: red;");
|
||||
bnClickStatus[i][j] = true;
|
||||
}
|
||||
|
||||
triggerMapper->setMapping(bn[i][j], 100*i+j);
|
||||
|
||||
connect(bn[i][j], SIGNAL(clicked()), triggerMapper, SLOT(map()));
|
||||
|
||||
count++;
|
||||
|
||||
triggerLayout->addWidget(bn[i][j], rowID, colID);
|
||||
|
||||
colID ++;
|
||||
|
||||
if( j%4 == 3 && j!= 63){
|
||||
QFrame * vSeparator = new QFrame(tab);
|
||||
vSeparator->setFrameShape(QFrame::VLine);
|
||||
triggerLayout->addWidget(vSeparator, rowID, colID);
|
||||
colID++;
|
||||
}
|
||||
}
|
||||
|
||||
rowID++;
|
||||
|
||||
if( i%4 == 3 && i != 63){
|
||||
QFrame * hSeparator = new QFrame(tab);
|
||||
hSeparator->setFrameShape(QFrame::HLine);
|
||||
triggerLayout->addWidget(hSeparator, rowID, 0, 1, 64 + 15);
|
||||
rowID++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//connect(triggerMapper, &QSignalMapper::mappedString, this, &DigiSettings::onTriggerClick);
|
||||
|
||||
connect(triggerMapper, SIGNAL(mappedInt(int)), this, SLOT(onTriggerClick(int)));
|
||||
}
|
||||
|
||||
|
||||
} //=== end of tab
|
||||
|
||||
|
||||
}
|
||||
|
||||
DigiSettings::~DigiSettings(){
|
||||
|
||||
|
||||
}
|
|
@ -2,6 +2,21 @@
|
|||
#define DigiSettings_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLineEdit>
|
||||
#include <QSpinBox>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QGridLayout>
|
||||
#include <QScrollArea>
|
||||
#include <QTabWidget>
|
||||
#include <QGroupBox>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QTableWidget>
|
||||
#include <QDebug>
|
||||
#include <QPushButton>
|
||||
#include <QFrame>
|
||||
#include <QSignalMapper>
|
||||
|
||||
#include "ClassDigitizer2Gen.h"
|
||||
|
||||
class DigiSettings : public QWidget{
|
||||
|
@ -12,6 +27,19 @@ public:
|
|||
~DigiSettings();
|
||||
|
||||
private slots:
|
||||
void onTriggerClick(int haha){
|
||||
|
||||
unsigned short ch = haha/100;
|
||||
unsigned short ch2 = haha - ch*100;
|
||||
|
||||
if(bnClickStatus[ch][ch2]){
|
||||
bn[ch][ch2]->setStyleSheet("");
|
||||
bnClickStatus[ch][ch2] = false;
|
||||
}else{
|
||||
bn[ch][ch2]->setStyleSheet("background-color: red;");
|
||||
bnClickStatus[ch][ch2] = true;
|
||||
}
|
||||
}
|
||||
|
||||
signals:
|
||||
|
||||
|
@ -20,6 +48,8 @@ private:
|
|||
Digitizer2Gen * digi;
|
||||
unsigned short nDigi;
|
||||
|
||||
QPushButton *bn[64][64];
|
||||
bool bnClickStatus[64][64];
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
|||
layout->addWidget(bnCloseDigitizers, 0, 2);
|
||||
layout->addWidget(bnDigiSettings, 1, 1);
|
||||
|
||||
QFrame * separator = new QFrame();
|
||||
QFrame * separator = new QFrame(this);
|
||||
separator->setFrameShape(QFrame::HLine);
|
||||
layout->addWidget(separator, 2, 0, 1, 3);
|
||||
|
||||
|
@ -72,7 +72,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
|||
|
||||
LogMsg("Welcome to SOLARIS DAQ.");
|
||||
|
||||
bnOpenDigitizers_clicked();
|
||||
//bnOpenDigitizers_clicked();
|
||||
OpenDigitizersSettings();
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user