added save and load settings in text file

This commit is contained in:
Ryan Tang 2023-02-22 20:07:39 -05:00
parent 08dd0cb4f4
commit 26ddde7ec7
10 changed files with 353 additions and 412 deletions

1
.gitignore vendored
View File

@ -6,6 +6,7 @@ programSettings.txt
test test
windowID windowID
screenshot.* screenshot.*
*settings*.txt
*~ *~
*.autosave *.autosave

View File

@ -68,7 +68,8 @@
"typeinfo": "cpp", "typeinfo": "cpp",
"variant": "cpp", "variant": "cpp",
"qdatetime": "cpp", "qdatetime": "cpp",
"fstream": "cpp" "fstream": "cpp",
"allocator": "cpp"
}, },
"better-comments.multilineComments": true, "better-comments.multilineComments": true,

View File

@ -1,5 +1,8 @@
#include "ClassDigitizer2Gen.h" #include "ClassDigitizer2Gen.h"
#include <cstring>
#include <algorithm>
Digitizer2Gen::Digitizer2Gen(){ Digitizer2Gen::Digitizer2Gen(){
printf("======== %s \n",__func__); printf("======== %s \n",__func__);
Initialization(); Initialization();
@ -92,6 +95,7 @@ std::string Digitizer2Gen::ReadValue(const char * parameter, bool verbose){
//printf(" %s|%s \n", __func__, parameter); //printf(" %s|%s \n", __func__, parameter);
ret = CAEN_FELib_GetValue(handle, parameter, retValue); ret = CAEN_FELib_GetValue(handle, parameter, retValue);
if (ret != CAEN_FELib_Success) { if (ret != CAEN_FELib_Success) {
printf("%-45s\n", parameter);
return ErrorMsg(__func__); return ErrorMsg(__func__);
}else{ }else{
if( verbose ) printf("%-45s : %s\n", parameter, retValue); if( verbose ) printf("%-45s : %s\n", parameter, retValue);
@ -111,9 +115,10 @@ std::string Digitizer2Gen::ReadChValue(std::string ch, std::string shortPara, bo
void Digitizer2Gen::WriteValue(const char * parameter, std::string value){ void Digitizer2Gen::WriteValue(const char * parameter, std::string value){
if( !isConnected ) return; if( !isConnected ) return;
printf(" %s| %-45s : %s\n", __func__, parameter, value.c_str()); printf(" %s|%-45s|%s|\n", __func__, parameter, value.c_str());
ret = CAEN_FELib_SetValue(handle, parameter, value.c_str()); ret = CAEN_FELib_SetValue(handle, parameter, value.c_str());
if (ret != CAEN_FELib_Success) { if (ret != CAEN_FELib_Success) {
printf("|%s||%s|\n", parameter, value.c_str());
ErrorMsg(__func__); ErrorMsg(__func__);
return; return;
} }
@ -509,7 +514,7 @@ void Digitizer2Gen::SaveDataToFile(){
fclose(outFile); fclose(outFile);
outFileIndex ++; outFileIndex ++;
sprintf(outFileName, "%s_%03d.sol", outFileNameBase.c_str(), outFileIndex); sprintf(outFileName, "%s_%03d.sol", outFileNameBase.c_str(), outFileIndex);
outFile = fopen(outFileName, "a+"); outFile = fopen(outFileName, "a+b");
} }
if( evt->dataType == 0){ if( evt->dataType == 0){
@ -713,3 +718,82 @@ std::string Digitizer2Gen::ErrorMsg(const char * funcName){
printf("Error msg (%d): %s\n", ret, msg); printf("Error msg (%d): %s\n", ret, msg);
return msg; return msg;
} }
void Digitizer2Gen::SaveSettingsToFile(const char * saveFileName){
printf("Saving settings....\n");
FILE * saveFile = fopen(saveFileName, "w");
if( saveFile ){
std::string para, value;
for(int i = 0; i < (int) DIGIPARA::DIG::AllSettings.size(); i++){
if( DIGIPARA::DIG::AllSettings[i].ReadWrite() == RW::WriteOnly) continue;
para = DIGIPARA::DIG::AllSettings[i].GetFullPara();
value = ReadValue(para.c_str());
fprintf(saveFile, "%-45s|%d|%s\n", para.c_str(), DIGIPARA::DIG::AllSettings[i].ReadWrite(), value.c_str());
}
for(int i = 0; i < 4 ; i ++){
para = DIGIPARA::VGA::VGAGain.GetFullPara(i);
value = ReadValue(para.c_str());
fprintf(saveFile, "%-45s|%d|%s\n", para.c_str(), DIGIPARA::DIG::AllSettings[i].ReadWrite(), value.c_str());
}
for(int ch = 0; ch < nChannels ; ch++ ){
for( int i = 0; i < (int) DIGIPARA::CH::AllSettings.size(); i++){
if( DIGIPARA::CH::AllSettings[i].ReadWrite() == RW::WriteOnly) continue;
para = DIGIPARA::CH::AllSettings[i].GetFullPara(ch);
value = ReadValue(para.c_str());
fprintf(saveFile, "%-45s|%d|%s\n",para.c_str(), DIGIPARA::DIG::AllSettings[i].ReadWrite(),value.c_str());
}
}
fclose(saveFile);
printf("Saved setting files to %s\n", saveFileName);
}else{
printf("Save file accessing error.");
}
}
void Digitizer2Gen::LoadSettingsFromFile(const char * loadFileName){
FILE * loadFile = fopen(loadFileName, "r");
char * para = new char[100];
char * readWrite = new char[100];
char * value = new char[100];
if( loadFile ){
char line[100];
while(fgets(line, sizeof(line), loadFile) != NULL){
//printf("%s", line);
char* token = std::strtok(line, "|");
int count = 0;
while( token != nullptr){
char * end = std::remove_if(token, token + std::strlen(token), [](char c) {
return std::isspace(c);
});
*end = '\0';
size_t len = std::strcspn(token, "\n");
if( len > 0 ) token[len] = '\0';
if( count == 0 ) std::strcpy(para, token);
if( count == 1 ) std::strcpy(readWrite, token);
if( count == 2 ) std::strcpy(value, token);
if( count > 2) break;
count ++;
token = std::strtok(nullptr, "|");
}
//printf("%s|%s|%s|\n", para, readWrite, value);
if( std::strcmp(readWrite, "2") == 0 ) WriteValue(para, value);
}
}else{
printf("Fail to load file %s\n", loadFileName);
}
}

View File

@ -122,6 +122,9 @@ class Digitizer2Gen {
unsigned int GetFileSize() const {return outFileSize;} unsigned int GetFileSize() const {return outFileSize;}
uint64_t GetTotalFilesSize() const {return FinishedOutFilesSize + outFileSize;} uint64_t GetTotalFilesSize() const {return FinishedOutFilesSize + outFileSize;}
void SaveSettingsToFile(const char * saveFileName); // text file
void LoadSettingsFromFile(const char * loadFileName);
}; };
#endif #endif

View File

@ -4,23 +4,67 @@
#include <cstdlib> #include <cstdlib>
#include <vector> #include <vector>
enum TYPE {CH, DIG, LVDS, VGA};
enum RW { ReadOnly, WriteOnly, ReadWrite}; enum RW { ReadOnly, WriteOnly, ReadWrite};
//^==================== Register Class //^==================== Register Class
class Reg { class Reg {
private: private:
std::string name; std::string name;
TYPE type;
RW readWrite; // true for read/write, false for read-only RW readWrite; // true for read/write, false for read-only
bool isCmd;
public: public:
Reg(std::string para, RW readwrite){ Reg(std::string para, RW readwrite, TYPE type = TYPE::CH, bool isCmd = false){
this->name = para; this->name = para;
this->readWrite = readwrite; this->readWrite = readwrite;
this->type = type;
this->isCmd = isCmd;
} }
~Reg(){}; ~Reg(){};
std::string GetPara() const {return name;} std::string GetPara() const {return name;}
RW ReadWrite() const {return readWrite;} std::string GetFullPara(int ch_index = -1) const {
switch (type){
case TYPE::DIG:{
if( isCmd){
return "/cmd/" + name;
}else{
return "/par/" + name;
}
}; break;
case TYPE::CH:{
std::string haha = "/par/";
if( isCmd ){
haha = "/cmd/";
}
if( ch_index == -1 ){
return "/ch/0..63" + haha + name;
}else{
return "/ch/" + std::to_string(ch_index) + haha + name;
}
}; break;
case TYPE::LVDS:{
if( ch_index == -1 ){
return "/lvds/0..3/par/" + name;
}else{
return "/lvds/" + std::to_string(ch_index) + "/par/"+ name;
}
}; break;
case TYPE::VGA: {
if( ch_index == -1 ){
return "/vga/0..3/par/" + name;
}else{
return "/vga/" + std::to_string(ch_index) + "/par/"+ name;
}
}; break;
default:
return "invalid"; break;
}
}
RW ReadWrite() const {return readWrite;}
TYPE GetType() const {return type;}
operator std::string () const {return name;} // this allow Reg kaka("XYZ", true); std::string haha = kaka; operator std::string () const {return name;} // this allow Reg kaka("XYZ", true); std::string haha = kaka;
@ -38,101 +82,101 @@ namespace DIGIPARA{
namespace DIG{ namespace DIG{
///============== read only ///============== read only
const Reg CupVer ("CupVer", RW::ReadOnly); const Reg CupVer ("CupVer", RW::ReadOnly, TYPE::DIG);
const Reg FPGA_firmwareVersion ("FPGA_FwVer", RW::ReadOnly); const Reg FPGA_firmwareVersion ("FPGA_FwVer", RW::ReadOnly, TYPE::DIG);
const Reg FirmwareType ("FwType", RW::ReadOnly); const Reg FirmwareType ("FwType", RW::ReadOnly, TYPE::DIG);
const Reg ModelCode ("ModelCode", RW::ReadOnly); const Reg ModelCode ("ModelCode", RW::ReadOnly, TYPE::DIG);
const Reg PBCode ("PBCode", RW::ReadOnly); const Reg PBCode ("PBCode", RW::ReadOnly, TYPE::DIG);
const Reg ModelName ("ModelName", RW::ReadOnly); const Reg ModelName ("ModelName", RW::ReadOnly, TYPE::DIG);
const Reg FromFactor ("FormFactor", RW::ReadOnly); const Reg FromFactor ("FormFactor", RW::ReadOnly, TYPE::DIG);
const Reg FamilyCode ("FamilyCode", RW::ReadOnly); const Reg FamilyCode ("FamilyCode", RW::ReadOnly, TYPE::DIG);
const Reg SerialNumber ("SerialNum", RW::ReadOnly); const Reg SerialNumber ("SerialNum", RW::ReadOnly, TYPE::DIG);
const Reg PCBrev_MB ("PCBrev_MB", RW::ReadOnly); const Reg PCBrev_MB ("PCBrev_MB", RW::ReadOnly, TYPE::DIG);
const Reg PCBrev_PB ("PCBrev_PB", RW::ReadOnly); const Reg PCBrev_PB ("PCBrev_PB", RW::ReadOnly, TYPE::DIG);
const Reg DPP_License ("License", RW::ReadOnly); const Reg DPP_License ("License", RW::ReadOnly, TYPE::DIG);
const Reg DPP_LicenseStatus ("LicenseStatus", RW::ReadOnly); const Reg DPP_LicenseStatus ("LicenseStatus", RW::ReadOnly, TYPE::DIG);
const Reg DPP_LicenseRemainingTime ("LicenseRemainingTime", RW::ReadOnly); const Reg DPP_LicenseRemainingTime ("LicenseRemainingTime", RW::ReadOnly, TYPE::DIG);
const Reg NumberOfChannel ("NumCh", RW::ReadOnly); const Reg NumberOfChannel ("NumCh", RW::ReadOnly, TYPE::DIG);
const Reg ADC_SampleRate ("ADC_SamplRate", RW::ReadOnly); const Reg ADC_SampleRate ("ADC_SamplRate", RW::ReadOnly, TYPE::DIG);
const Reg InputDynamicRange ("InputRange", RW::ReadOnly); const Reg InputDynamicRange ("InputRange", RW::ReadOnly, TYPE::DIG);
const Reg InputType ("InputType", RW::ReadOnly); const Reg InputType ("InputType", RW::ReadOnly, TYPE::DIG);
const Reg InputImpedance ("Zin", RW::ReadOnly); const Reg InputImpedance ("Zin", RW::ReadOnly, TYPE::DIG);
const Reg IPAddress ("IPAddress", RW::ReadOnly); const Reg IPAddress ("IPAddress", RW::ReadOnly, TYPE::DIG);
const Reg NetMask ("Netmask", RW::ReadOnly); const Reg NetMask ("Netmask", RW::ReadOnly, TYPE::DIG);
const Reg Gateway ("Gateway", RW::ReadOnly); const Reg Gateway ("Gateway", RW::ReadOnly, TYPE::DIG);
const Reg LED_status ("LedStatus", RW::ReadOnly); const Reg LED_status ("LedStatus", RW::ReadOnly, TYPE::DIG);
const Reg ACQ_status ("AcquistionStatus", RW::ReadOnly); const Reg ACQ_status ("AcquisitionStatus", RW::ReadOnly, TYPE::DIG);
const Reg MaxRawDataSize ("MaxRawDataSize", RW::ReadOnly); const Reg MaxRawDataSize ("MaxRawDataSize", RW::ReadOnly, TYPE::DIG);
const Reg TempSensAirIn ("TempSensAirIn", RW::ReadOnly); const Reg TempSensAirIn ("TempSensAirIn", RW::ReadOnly, TYPE::DIG);
const Reg TempSensAirOut ("TempSensAirOut", RW::ReadOnly); const Reg TempSensAirOut ("TempSensAirOut", RW::ReadOnly, TYPE::DIG);
const Reg TempSensCore ("TempSensCore", RW::ReadOnly); const Reg TempSensCore ("TempSensCore", RW::ReadOnly, TYPE::DIG);
const Reg TempSensFirstADC ("TempSensFirstADC", RW::ReadOnly); const Reg TempSensFirstADC ("TempSensFirstADC", RW::ReadOnly, TYPE::DIG);
const Reg TempSensLastADC ("TempSensLastADC", RW::ReadOnly); const Reg TempSensLastADC ("TempSensLastADC", RW::ReadOnly, TYPE::DIG);
const Reg TempSensHottestADC ("TempSensHottestADC", RW::ReadOnly); const Reg TempSensHottestADC ("TempSensHottestADC", RW::ReadOnly, TYPE::DIG);
const Reg TempSensADC0 ("TempSensADC0", RW::ReadOnly); const Reg TempSensADC0 ("TempSensADC0", RW::ReadOnly, TYPE::DIG);
const Reg TempSensADC1 ("TempSensADC1", RW::ReadOnly); const Reg TempSensADC1 ("TempSensADC1", RW::ReadOnly, TYPE::DIG);
const Reg TempSensADC2 ("TempSensADC2", RW::ReadOnly); const Reg TempSensADC2 ("TempSensADC2", RW::ReadOnly, TYPE::DIG);
const Reg TempSensADC3 ("TempSensADC3", RW::ReadOnly); const Reg TempSensADC3 ("TempSensADC3", RW::ReadOnly, TYPE::DIG);
const Reg TempSensADC4 ("TempSensADC4", RW::ReadOnly); const Reg TempSensADC4 ("TempSensADC4", RW::ReadOnly, TYPE::DIG);
const Reg TempSensADC5 ("TempSensADC5", RW::ReadOnly); const Reg TempSensADC5 ("TempSensADC5", RW::ReadOnly, TYPE::DIG);
const Reg TempSensADC6 ("TempSensADC6", RW::ReadOnly); const Reg TempSensADC6 ("TempSensADC6", RW::ReadOnly, TYPE::DIG);
const Reg TempSensADC7 ("TempSensADC7", RW::ReadOnly); const Reg TempSensADC7 ("TempSensADC7", RW::ReadOnly, TYPE::DIG);
const std::vector<Reg> TempSenseADC = {TempSensADC0,TempSensADC1,TempSensADC2,TempSensADC3,TempSensADC4,TempSensADC5,TempSensADC6,TempSensADC7}; const std::vector<Reg> TempSensADC = {TempSensADC0,TempSensADC1,TempSensADC2,TempSensADC3,TempSensADC4,TempSensADC5,TempSensADC6,TempSensADC7};
const Reg TempSensDCDC ("TempSensDCDC", RW::ReadOnly); const Reg TempSensDCDC ("TempSensDCDC", RW::ReadOnly, TYPE::DIG);
const Reg VInSensDCDC ("VInSensDCDC", RW::ReadOnly); const Reg VInSensDCDC ("VInSensDCDC", RW::ReadOnly, TYPE::DIG);
const Reg VOutSensDCDC ("VOutSensDCDC", RW::ReadOnly); const Reg VOutSensDCDC ("VOutSensDCDC", RW::ReadOnly, TYPE::DIG);
const Reg IOutSensDCDC ("IOutSensDCDC", RW::ReadOnly); const Reg IOutSensDCDC ("IOutSensDCDC", RW::ReadOnly, TYPE::DIG);
const Reg FreqSensCore ("FreqSensCore", RW::ReadOnly); const Reg FreqSensCore ("FreqSensCore", RW::ReadOnly, TYPE::DIG);
const Reg DutyCycleSensDCDC ("DutyCycleSensDCDC", RW::ReadOnly); const Reg DutyCycleSensDCDC ("DutyCycleSensDCDC", RW::ReadOnly, TYPE::DIG);
const Reg SpeedSensFan1 ("SpeedSensFan1", RW::ReadOnly); const Reg SpeedSensFan1 ("SpeedSensFan1", RW::ReadOnly, TYPE::DIG);
const Reg SpeedSensFan2 ("SpeedSensFan2", RW::ReadOnly); const Reg SpeedSensFan2 ("SpeedSensFan2", RW::ReadOnly, TYPE::DIG);
const Reg ErrorFlags ("ErrorFlags", RW::ReadOnly); const Reg ErrorFlags ("ErrorFlags", RW::ReadOnly, TYPE::DIG);
const Reg BoardReady ("BoardReady", RW::ReadOnly); const Reg BoardReady ("BoardReady", RW::ReadOnly, TYPE::DIG);
///============= read write ///============= read write
const Reg ClockSource ("ClockSource", RW::ReadWrite); const Reg ClockSource ("ClockSource", RW::ReadWrite, TYPE::DIG);
const Reg IO_Level ("IOlevel", RW::ReadWrite); const Reg IO_Level ("IOlevel", RW::ReadWrite, TYPE::DIG);
const Reg StartSource ("StartSource", RW::ReadWrite); const Reg StartSource ("StartSource", RW::ReadWrite, TYPE::DIG);
const Reg GlobalTriggerSource ("GlobalTriggerSource", RW::ReadWrite); const Reg GlobalTriggerSource ("GlobalTriggerSource", RW::ReadWrite, TYPE::DIG);
const Reg BusyInSource ("BusyInSource", RW::ReadWrite); const Reg BusyInSource ("BusyInSource", RW::ReadWrite, TYPE::DIG);
const Reg EnableClockOutBackplane ("EnClockOutP0", RW::ReadWrite); //const Reg EnableClockOutBackplane ("EnClockOutP0", RW::ReadWrite, TYPE::DIG);
const Reg EnableClockOutFrontPanel ("EnClockOutFP", RW::ReadWrite); const Reg EnableClockOutFrontPanel ("EnClockOutFP", RW::ReadWrite, TYPE::DIG);
const Reg TrgOutMode ("TrgOutMode", RW::ReadWrite); const Reg TrgOutMode ("TrgOutMode", RW::ReadWrite, TYPE::DIG);
const Reg GPIOMode ("GPIOMode", RW::ReadWrite); const Reg GPIOMode ("GPIOMode", RW::ReadWrite, TYPE::DIG);
const Reg SyncOutMode ("SyncOutMode", RW::ReadWrite); const Reg SyncOutMode ("SyncOutMode", RW::ReadWrite, TYPE::DIG);
const Reg BoardVetoSource ("BoardVetoSource", RW::ReadWrite); const Reg BoardVetoSource ("BoardVetoSource", RW::ReadWrite, TYPE::DIG);
const Reg BoardVetoWidth ("BoardVetoWidth", RW::ReadWrite); const Reg BoardVetoWidth ("BoardVetoWidth", RW::ReadWrite, TYPE::DIG);
const Reg BoardVetoPolarity ("BoardVetoPolarity", RW::ReadWrite); const Reg BoardVetoPolarity ("BoardVetoPolarity", RW::ReadWrite, TYPE::DIG);
const Reg RunDelay ("RunDelay", RW::ReadWrite); const Reg RunDelay ("RunDelay", RW::ReadWrite, TYPE::DIG);
const Reg EnableAutoDisarmACQ ("EnAutoDisarmAcq", RW::ReadWrite); const Reg EnableAutoDisarmACQ ("EnAutoDisarmAcq", RW::ReadWrite, TYPE::DIG);
const Reg EnableDataReduction ("EnDataReduction", RW::ReadWrite); const Reg EnableDataReduction ("EnDataReduction", RW::ReadWrite, TYPE::DIG);
const Reg EnableStatisticEvents ("EnStatEvents", RW::ReadWrite); const Reg EnableStatisticEvents ("EnStatEvents", RW::ReadWrite, TYPE::DIG);
const Reg VolatileClockOutDelay ("VolatileClockOutDelay", RW::ReadWrite); const Reg VolatileClockOutDelay ("VolatileClockOutDelay", RW::ReadWrite, TYPE::DIG);
const Reg PermanentClockOutDelay ("PermanentClockOutDelay", RW::ReadWrite); const Reg PermanentClockOutDelay ("PermanentClockOutDelay", RW::ReadWrite, TYPE::DIG);
const Reg TestPulsePeriod ("TestPulsePeriod", RW::ReadWrite); const Reg TestPulsePeriod ("TestPulsePeriod", RW::ReadWrite, TYPE::DIG);
const Reg TestPulseWidth ("TestPulseWidth", RW::ReadWrite); const Reg TestPulseWidth ("TestPulseWidth", RW::ReadWrite, TYPE::DIG);
const Reg TestPulseLowLevel ("TestPulseLowLevel", RW::ReadWrite); const Reg TestPulseLowLevel ("TestPulseLowLevel", RW::ReadWrite, TYPE::DIG);
const Reg TestPulseHighLevel ("TestPulseHighLevel", RW::ReadWrite); const Reg TestPulseHighLevel ("TestPulseHighLevel", RW::ReadWrite, TYPE::DIG);
const Reg ErrorFlagMask ("ErrorFlagMask", RW::ReadWrite); const Reg ErrorFlagMask ("ErrorFlagMask", RW::ReadWrite, TYPE::DIG);
const Reg ErrorFlagDataMask ("ErrorFlagDataMask", RW::ReadWrite); const Reg ErrorFlagDataMask ("ErrorFlagDataMask", RW::ReadWrite, TYPE::DIG);
const Reg DACoutMode ("DACoutMode", RW::ReadWrite); const Reg DACoutMode ("DACoutMode", RW::ReadWrite, TYPE::DIG);
const Reg DACoutStaticLevel ("DACoutStaticLevel", RW::ReadWrite); const Reg DACoutStaticLevel ("DACoutStaticLevel", RW::ReadWrite, TYPE::DIG);
const Reg DACoutChSelect ("DACoutChSelect", RW::ReadWrite); const Reg DACoutChSelect ("DACoutChSelect", RW::ReadWrite, TYPE::DIG);
const Reg EnableOffsetCalibration ("EnOffsetCalibration", RW::ReadWrite); const Reg EnableOffsetCalibration ("EnOffsetCalibration", RW::ReadWrite, TYPE::DIG);
/// ========== command /// ========== command
const Reg Reset ("Reset", RW::WriteOnly); const Reg Reset ("Reset", RW::WriteOnly, TYPE::DIG, true);
const Reg ClearData ("ClearData", RW::WriteOnly); // clear memory, setting not affected const Reg ClearData ("ClearData", RW::WriteOnly, TYPE::DIG, true); // clear memory, setting not affected
const Reg ArmACQ ("ArmAcquisition", RW::WriteOnly); const Reg ArmACQ ("ArmAcquisition", RW::WriteOnly, TYPE::DIG, true);
const Reg DisarmACQ ("DisarmAcquisition", RW::WriteOnly); const Reg DisarmACQ ("DisarmAcquisition", RW::WriteOnly, TYPE::DIG, true);
const Reg SoftwareStartACQ ("SwStartAcquisition", RW::WriteOnly); // only when SwStart in StartSource const Reg SoftwareStartACQ ("SwStartAcquisition", RW::WriteOnly, TYPE::DIG, true); // only when SwStart in StartSource
const Reg SoftwareStopACQ ("SwStopAcquisition", RW::WriteOnly); // stop ACQ, whatever start source const Reg SoftwareStopACQ ("SwStopAcquisition", RW::WriteOnly, TYPE::DIG, true); // stop ACQ, whatever start source
const Reg SendSoftwareTrigger ("SendSWTrigger", RW::WriteOnly); // only work when Swtrg in the GlobalTriggerSource const Reg SendSoftwareTrigger ("SendSWTrigger", RW::WriteOnly, TYPE::DIG, true); // only work when Swtrg in the GlobalTriggerSource
const Reg ReloadCalibration ("ReloadCalibration", RW::WriteOnly); const Reg ReloadCalibration ("ReloadCalibration", RW::WriteOnly, TYPE::DIG, true);
const std::vector<Reg> AllSettings = { const std::vector<Reg> AllSettings = {
@ -190,7 +234,7 @@ namespace DIGIPARA{
StartSource , StartSource ,
GlobalTriggerSource , GlobalTriggerSource ,
BusyInSource , BusyInSource ,
EnableClockOutBackplane , //EnableClockOutBackplane ,
EnableClockOutFrontPanel , EnableClockOutFrontPanel ,
TrgOutMode , TrgOutMode ,
GPIOMode , GPIOMode ,
@ -220,7 +264,7 @@ namespace DIGIPARA{
} }
namespace VGA{ namespace VGA{
const Reg VGAGain ("VGAGain", RW::ReadWrite); // VX2745 only const Reg VGAGain ("VGAGain", RW::ReadWrite, TYPE::VGA); // VX2745 only
} }
namespace CH{ namespace CH{
@ -243,7 +287,7 @@ namespace DIGIPARA{
const Reg TriggerThreshold ("TriggerThr", RW::ReadWrite); const Reg TriggerThreshold ("TriggerThr", RW::ReadWrite);
const Reg Polarity ("PulsePolarity", RW::ReadWrite); const Reg Polarity ("PulsePolarity", RW::ReadWrite);
const Reg WaveDataSource ("WaveDataSouce", RW::ReadWrite); const Reg WaveDataSource ("WaveDataSource", RW::ReadWrite);
const Reg RecordLength ("ChRecordLengthT", RW::ReadWrite); const Reg RecordLength ("ChRecordLengthT", RW::ReadWrite);
const Reg PreTrigger ("ChPreTriggerT", RW::ReadWrite); const Reg PreTrigger ("ChPreTriggerT", RW::ReadWrite);
const Reg WaveSaving ("WaveSaving", RW::ReadWrite); const Reg WaveSaving ("WaveSaving", RW::ReadWrite);

View File

@ -31,7 +31,7 @@ DigiSettings::DigiSettings(Digitizer2Gen ** digi, unsigned short nDigi, QWidget
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);
//============ Tab for each digitizer //@========================== Tab for each digitizer
for(unsigned short iDigi = 0; iDigi < this->nDigi; iDigi++){ for(unsigned short iDigi = 0; iDigi < this->nDigi; iDigi++){
QWidget * tab = new QWidget(tabWidget); QWidget * tab = new QWidget(tabWidget);
@ -43,7 +43,7 @@ DigiSettings::DigiSettings(Digitizer2Gen ** digi, unsigned short nDigi, QWidget
QGridLayout *tabLayout = new QGridLayout(tab); tab->setLayout(tabLayout); QGridLayout *tabLayout = new QGridLayout(tab); tab->setLayout(tabLayout);
{//-------- Group of Digitizer Info {//^====================== Group of Digitizer Info
QGroupBox * infoBox = new QGroupBox("Board Info", tab); QGroupBox * infoBox = new QGroupBox("Board Info", tab);
QGridLayout * infoLayout = new QGridLayout(infoBox); QGridLayout * infoLayout = new QGridLayout(infoBox);
tabLayout->addWidget(infoBox, 0, 0); tabLayout->addWidget(infoBox, 0, 0);
@ -60,13 +60,59 @@ DigiSettings::DigiSettings(Digitizer2Gen ** digi, unsigned short nDigi, QWidget
} }
} }
{//------- Group Board status {//^====================== Group Board status
QGroupBox * statusBox = new QGroupBox("Board Status", tab); QGroupBox * statusBox = new QGroupBox("Board Status", tab);
QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
statusBox->setSizePolicy(sizePolicy);
QGridLayout * statusLayout = new QGridLayout(statusBox); QGridLayout * statusLayout = new QGridLayout(statusBox);
statusLayout->setHorizontalSpacing(0);
tabLayout->addWidget(statusBox, 0, 1); tabLayout->addWidget(statusBox, 0, 1);
//------- LED Status
QLabel * lbLED = new QLabel("LED status : ");
lbLED->setAlignment(Qt::AlignRight | Qt::AlignCenter);
statusLayout->addWidget(lbLED, 0, 0);
QPushButton ** LEDStatus = new QPushButton *[19];
for( int i = 0; i < 19; i++){
LEDStatus[i] = new QPushButton(tab);
LEDStatus[i]->setEnabled(false);
LEDStatus[i]->setFixedSize(QSize(30,30));
statusLayout->addWidget(LEDStatus[i], 0, 1 + i);
}
//------- ACD Status
QLabel * lbACQ = new QLabel("ACQ status : ");
lbACQ->setAlignment(Qt::AlignRight | Qt::AlignCenter);
statusLayout->addWidget(lbACQ, 1, 0);
QPushButton ** ACQStatus = new QPushButton *[7];
for( int i = 0; i < 7; i++){
ACQStatus[i] = new QPushButton(tab);
ACQStatus[i]->setEnabled(false);
ACQStatus[i]->setFixedSize(QSize(30,30));
statusLayout->addWidget(ACQStatus[i], 1, 1 + i);
}
//------- Temperatures
QLabel * lbTemp = new QLabel("ADC Temperature [C] : ");
lbTemp->setAlignment(Qt::AlignRight | Qt::AlignCenter);
statusLayout->addWidget(lbTemp, 2, 0);
const int nTemp = (int) DIGIPARA::DIG::TempSensADC.size();
QLineEdit ** leTemp = new QLineEdit* [nTemp];
for( int i = 0; i < nTemp; i++){
leTemp[i] = new QLineEdit(tab);
leTemp[i]->setEnabled(false);
statusLayout->addWidget(leTemp[i], 2, 1 + 2*i, 1, 2);
}
} }
{//------- Group digitizer settings {//^====================== Group Board settings
QGroupBox * digiBox = new QGroupBox("Board Settings", tab); QGroupBox * digiBox = new QGroupBox("Board Settings", tab);
QGridLayout * boardLayout = new QGridLayout(digiBox); QGridLayout * boardLayout = new QGridLayout(digiBox);
tabLayout->addWidget(digiBox, 1, 0); tabLayout->addWidget(digiBox, 1, 0);
@ -81,6 +127,12 @@ DigiSettings::DigiSettings(Digitizer2Gen ** digi, unsigned short nDigi, QWidget
boardLayout->addWidget(bnDefaultSetting, rowId, 2, 1, 2); boardLayout->addWidget(bnDefaultSetting, rowId, 2, 1, 2);
connect(bnDefaultSetting, &QPushButton::clicked, this, &DigiSettings::onDefault); connect(bnDefaultSetting, &QPushButton::clicked, this, &DigiSettings::onDefault);
QPushButton * bnSaveSettings = new QPushButton("Save Settings", tab);
boardLayout->addWidget(bnSaveSettings, rowId, 4, 1, 2);
QPushButton * bnLoadSettings = new QPushButton("Load Settings", tab);
boardLayout->addWidget(bnLoadSettings, rowId, 6, 1, 2);
//------------------------------------- //-------------------------------------
rowId ++; rowId ++;
QLabel * lbClockSource = new QLabel("Clock Source :", tab); QLabel * lbClockSource = new QLabel("Clock Source :", tab);
@ -166,6 +218,16 @@ DigiSettings::DigiSettings(Digitizer2Gen ** digi, unsigned short nDigi, QWidget
comGPIO->addItem("Fixed 0"); comGPIO->addItem("Fixed 0");
comGPIO->addItem("Fixed 1"); comGPIO->addItem("Fixed 1");
//-------------------------------------
QLabel * lbAutoDisarmAcq = new QLabel("Auto disarm ACQ :", tab);
lbAutoDisarmAcq->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbAutoDisarmAcq, rowId, 4, 1, 2);
QComboBox * comAutoDisarmAcq = new QComboBox(tab);
boardLayout->addWidget(comAutoDisarmAcq, rowId, 6);
comAutoDisarmAcq->addItem("Enabled");
comAutoDisarmAcq->addItem("Disabled");
//------------------------------------- //-------------------------------------
rowId ++; rowId ++;
QLabel * lbBusyInSource = new QLabel("Busy In Source :", tab); QLabel * lbBusyInSource = new QLabel("Busy In Source :", tab);
@ -178,6 +240,16 @@ DigiSettings::DigiSettings(Digitizer2Gen ** digi, unsigned short nDigi, QWidget
comBusyIn->addItem("GPIO"); comBusyIn->addItem("GPIO");
comBusyIn->addItem("LVDS"); comBusyIn->addItem("LVDS");
comBusyIn->addItem("LVDS"); comBusyIn->addItem("LVDS");
//-------------------------------------
QLabel * lbStatEvents = new QLabel("Stat. Event :", tab);
lbStatEvents->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbStatEvents, rowId, 4, 1, 2);
QComboBox * comAStatEvents = new QComboBox(tab);
boardLayout->addWidget(comAStatEvents, rowId, 6);
comAStatEvents->addItem("Enabled");
comAStatEvents->addItem("Disabled");
//------------------------------------- //-------------------------------------
rowId ++; rowId ++;
@ -233,38 +305,15 @@ DigiSettings::DigiSettings(Digitizer2Gen ** digi, unsigned short nDigi, QWidget
boardLayout->addWidget(sbRunDelay, rowId, 1); boardLayout->addWidget(sbRunDelay, rowId, 1);
//------------------------------------- //-------------------------------------
rowId ++;
QLabel * lbAutoDisarmAcq = new QLabel("Auto disarm ACQ :", tab);
lbAutoDisarmAcq->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbAutoDisarmAcq, rowId, 0);
QComboBox * comAutoDisarmAcq = new QComboBox(tab);
boardLayout->addWidget(comAutoDisarmAcq, rowId, 1);
comAutoDisarmAcq->addItem("Enabled");
comAutoDisarmAcq->addItem("Disabled");
//-------------------------------------
rowId ++;
QLabel * lbStatEvents = new QLabel("Stat. Event :", tab);
lbStatEvents->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbStatEvents, rowId, 0);
QComboBox * comAStatEvents = new QComboBox(tab);
boardLayout->addWidget(comAStatEvents, rowId, 1);
comAStatEvents->addItem("Enabled");
comAStatEvents->addItem("Disabled");
//-------------------------------------
rowId ++;
QLabel * lbClockOutDelay = new QLabel("Clock Out Delay [ps] :", tab); QLabel * lbClockOutDelay = new QLabel("Clock Out Delay [ps] :", tab);
lbClockOutDelay->setAlignment(Qt::AlignRight); lbClockOutDelay->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbClockOutDelay, rowId, 0); boardLayout->addWidget(lbClockOutDelay, rowId, 3, 1, 2);
QDoubleSpinBox * dsbClockOutDelay = new QDoubleSpinBox(tab); QDoubleSpinBox * dsbClockOutDelay = new QDoubleSpinBox(tab);
dsbClockOutDelay->setMinimum(-1888.888); dsbClockOutDelay->setMinimum(-1888.888);
dsbClockOutDelay->setMaximum(1888.888); dsbClockOutDelay->setMaximum(1888.888);
dsbClockOutDelay->setValue(0); dsbClockOutDelay->setValue(0);
boardLayout->addWidget(dsbClockOutDelay, rowId, 1); boardLayout->addWidget(dsbClockOutDelay, rowId, 5);
//------------------------------------- //-------------------------------------
rowId ++; rowId ++;
@ -282,7 +331,7 @@ DigiSettings::DigiSettings(Digitizer2Gen ** digi, unsigned short nDigi, QWidget
} }
{//------- Group channel settings {//^====================== Group channel settings
QGroupBox * chBox = new QGroupBox("Channel Settings", tab); tabLayout->addWidget(chBox, 1, 1, 1, 1); QGroupBox * chBox = new QGroupBox("Channel Settings", tab); tabLayout->addWidget(chBox, 1, 1, 1, 1);
QGridLayout * chLayout = new QGridLayout(chBox); //chBox->setLayout(chLayout); QGridLayout * chLayout = new QGridLayout(chBox); //chBox->setLayout(chLayout);
@ -336,259 +385,10 @@ DigiSettings::DigiSettings(Digitizer2Gen ** digi, unsigned short nDigi, QWidget
} }
} }
/*
for( unsigned short rowID = 0; rowID < digi->GetNChannels() + 2; rowID++){
//------ set Labels
if( rowID == 1){
unsigned short colID = 0;
QLabel * labCh = new QLabel("Ch", tab);
labCh->setAlignment(Qt::AlignRight);
chLayout->addWidget(labCh, rowID, colID);
colID ++;
QLabel * labOnOff = new QLabel("On", tab);
chLayout->addWidget(labOnOff, rowID, colID);
colID ++;
QLabel * labEvtTrg = new QLabel("Event Trg.", tab);
labEvtTrg->setAlignment(Qt::AlignCenter);
chLayout->addWidget(labEvtTrg, rowID, colID);
colID ++;
QLabel * labWaveTrg = new QLabel("Wave Trg.", tab);
labWaveTrg->setAlignment(Qt::AlignCenter);
chLayout->addWidget(labWaveTrg, rowID, colID);
colID ++;
QLabel * labWaveSave = new QLabel("Wave Save", tab);
labWaveSave->setAlignment(Qt::AlignCenter);
chLayout->addWidget(labWaveSave, rowID, colID);
colID ++;
QLabel * labWaveSource = new QLabel("Wave Source", tab);
labWaveSource->setAlignment(Qt::AlignCenter);
chLayout->addWidget(labWaveSource, rowID, colID);
colID ++;
QLabel * labWaveRes = new QLabel("Wave Res.", tab);
labWaveRes->setAlignment(Qt::AlignCenter);
chLayout->addWidget(labWaveRes, rowID, colID);
colID ++;
QLabel * labWaveLength = new QLabel("Wave Length [ns]", tab);
labWaveLength->setAlignment(Qt::AlignCenter);
chLayout->addWidget(labWaveLength, rowID, colID);
colID ++;
QLabel * labPreTrigger = new QLabel("Pre Trigger [ns]", tab);
labPreTrigger->setAlignment(Qt::AlignCenter);
chLayout->addWidget(labPreTrigger, rowID, colID);
colID ++; QLabel * labAnaProbe0 = new QLabel("Ana. Probe 0", tab); labAnaProbe0->setAlignment(Qt::AlignCenter); chLayout->addWidget(labAnaProbe0, rowID, colID);
colID ++; QLabel * labAnaProbe1 = new QLabel("Ana. Probe 1", tab); labAnaProbe1->setAlignment(Qt::AlignCenter); chLayout->addWidget(labAnaProbe1, rowID, colID);
colID ++; QLabel * labDigProbe0 = new QLabel("Dig. Probe 0", tab); labDigProbe0->setAlignment(Qt::AlignCenter); chLayout->addWidget(labDigProbe0, rowID, colID);
colID ++; QLabel * labDigProbe1 = new QLabel("Dig. Probe 1", tab); labDigProbe1->setAlignment(Qt::AlignCenter); chLayout->addWidget(labDigProbe1, rowID, colID);
colID ++; QLabel * labDigProbe2 = new QLabel("Dig. Probe 2", tab); labDigProbe2->setAlignment(Qt::AlignCenter); chLayout->addWidget(labDigProbe2, rowID, colID);
colID ++; QLabel * labDigProbe3 = new QLabel("Dig. Probe 3", tab); labDigProbe3->setAlignment(Qt::AlignCenter); chLayout->addWidget(labDigProbe3, rowID, colID);
colID ++;
QLabel * labChVetoSrc = new QLabel("Veto Source", tab);
labChVetoSrc->setAlignment(Qt::AlignCenter);
chLayout->addWidget(labChVetoSrc, rowID, colID);
colID ++;
QLabel * labChADCVetoWidth = new QLabel("Veto Width [ns]", tab);
labChADCVetoWidth->setAlignment(Qt::AlignCenter);
chLayout->addWidget(labChADCVetoWidth, rowID, colID);
}
//------ set all channel
if( rowID == 0 || rowID >= 2){
unsigned int ch = (rowID == 0 ? 64 : rowID-2);
unsigned short colID = 0;
QLabel * labCh = new QLabel(rowID == 0 ? "All" : QString::number(ch), tab);
labCh->setAlignment(Qt::AlignRight);
chLayout->addWidget(labCh, rowID, colID);
colID ++;
cbCh[ch] = new QCheckBox(tab);
chLayout->addWidget(cbCh[ch], rowID, colID);
onOffMapper->setMapping(cbCh[ch], ch);
connect(cbCh[ch], SIGNAL(clicked()), onOffMapper, SLOT(map()));
colID ++;
cmbEvtTrigger[ch] = new QComboBox(tab);
cmbEvtTrigger[ch]->addItem("Disable");
cmbEvtTrigger[ch]->addItem("SWTrigger");
cmbEvtTrigger[ch]->addItem("ChSelfTrigger");
cmbEvtTrigger[ch]->addItem("Ch64Trigger");
cmbEvtTrigger[ch]->addItem("TRGIN");
cmbEvtTrigger[ch]->addItem("Global");
cmbEvtTrigger[ch]->addItem("ITLA");
cmbEvtTrigger[ch]->addItem("ITLB");
chLayout->addWidget(cmbEvtTrigger[ch], rowID, colID);
colID ++;
cmbWaveTrigger[ch] = new QComboBox(tab);
cmbWaveTrigger[ch]->addItem("Disable");
cmbWaveTrigger[ch]->addItem("SWTrigger");
cmbWaveTrigger[ch]->addItem("ChSelfTrigger");
cmbWaveTrigger[ch]->addItem("Ch64Trigger");
cmbWaveTrigger[ch]->addItem("TRGIN");
cmbWaveTrigger[ch]->addItem("ADC Over Sat.");
cmbWaveTrigger[ch]->addItem("ADC under Sat.");
cmbWaveTrigger[ch]->addItem("Global");
cmbWaveTrigger[ch]->addItem("ITLA");
cmbWaveTrigger[ch]->addItem("ITLB");
cmbWaveTrigger[ch]->addItem("Ext.Inhibit");
chLayout->addWidget(cmbWaveTrigger[ch], rowID, colID);
colID ++;
cmbWaveSave[ch] = new QComboBox(tab);
cmbWaveSave[ch]->addItem("Always");
cmbWaveSave[ch]->addItem("on Request");
chLayout->addWidget(cmbWaveSave[ch], rowID, colID);
colID ++;
cmbWaveSource[ch] = new QComboBox(tab);
cmbWaveSource[ch]->addItem("ADC");
cmbWaveSource[ch]->addItem("Test Toggle");
cmbWaveSource[ch]->addItem("Test Ramp");
cmbWaveSource[ch]->addItem("Test Sin wave");
cmbWaveSource[ch]->addItem("Ramp");
cmbWaveSource[ch]->addItem("Square Wave");
chLayout->addWidget(cmbWaveSource[ch], rowID, colID);
colID ++;
cmbWaveRes[ch] = new QComboBox(tab);
cmbWaveRes[ch]->addItem(" 8 ns");
cmbWaveRes[ch]->addItem("16 ns");
cmbWaveRes[ch]->addItem("32 ns");
cmbWaveRes[ch]->addItem("64 ns");
chLayout->addWidget(cmbWaveRes[ch], rowID, colID);
colID ++;
sbRecordLength[ch] = new QSpinBox(tab);
sbRecordLength[ch]->setMinimum(32);
sbRecordLength[ch]->setMaximum(64800);
sbRecordLength[ch]->setSingleStep(8);
chLayout->addWidget(sbRecordLength[ch], rowID, colID);
colID ++;
sbPreTrigger[ch] = new QSpinBox(tab);
sbPreTrigger[ch]->setMinimum(32);
sbPreTrigger[ch]->setMaximum(32000);
sbPreTrigger[ch]->setSingleStep(8);
chLayout->addWidget(sbPreTrigger[ch], rowID, colID);
colID ++;
cmbAnaProbe0[ch] = new QComboBox(tab);
cmbAnaProbe0[ch]->addItem("ADC Input");
cmbAnaProbe0[ch]->addItem("Time Filter");
cmbAnaProbe0[ch]->addItem("Trapazoid");
cmbAnaProbe0[ch]->addItem("Trap. Baseline");
cmbAnaProbe0[ch]->addItem("Trap. - Baseline");
chLayout->addWidget(cmbAnaProbe0[ch], rowID, colID);
colID ++;
cmbAnaProbe1[ch] = new QComboBox(tab);
cmbAnaProbe1[ch]->addItem("ADC Input");
cmbAnaProbe1[ch]->addItem("Time Filter");
cmbAnaProbe1[ch]->addItem("Trapazoid");
cmbAnaProbe1[ch]->addItem("Trap. Baseline");
cmbAnaProbe1[ch]->addItem("Trap. - Baseline");
chLayout->addWidget(cmbAnaProbe1[ch], rowID, colID);
colID ++;
cmbDigProbe0[ch] = new QComboBox(tab);
cmbDigProbe0[ch]->addItem("Trigger");
cmbDigProbe0[ch]->addItem("Time Filter Armed");
cmbDigProbe0[ch]->addItem("ReTrigger Guard");
cmbDigProbe0[ch]->addItem("Trap. basline Freeze");
cmbDigProbe0[ch]->addItem("Peaking");
cmbDigProbe0[ch]->addItem("Peak Ready");
cmbDigProbe0[ch]->addItem("Pile-up Guard");
cmbDigProbe0[ch]->addItem("ADC Saturate");
cmbDigProbe0[ch]->addItem("ADC Sat. Protection");
cmbDigProbe0[ch]->addItem("Post Sat. Event");
cmbDigProbe0[ch]->addItem("Trap. Saturate");
cmbDigProbe0[ch]->addItem("ACQ Inhibit");
chLayout->addWidget(cmbDigProbe0[ch], rowID, colID);
colID ++;
cmbDigProbe1[ch] = new QComboBox(tab);
cmbDigProbe1[ch]->addItem("Trigger");
cmbDigProbe1[ch]->addItem("Time Filter Armed");
cmbDigProbe1[ch]->addItem("ReTrigger Guard");
cmbDigProbe1[ch]->addItem("Trap. basline Freeze");
cmbDigProbe1[ch]->addItem("Peaking");
cmbDigProbe1[ch]->addItem("Peak Ready");
cmbDigProbe1[ch]->addItem("Pile-up Guard");
cmbDigProbe1[ch]->addItem("ADC Saturate");
cmbDigProbe1[ch]->addItem("ADC Sat. Protection");
cmbDigProbe1[ch]->addItem("Post Sat. Event");
cmbDigProbe1[ch]->addItem("Trap. Saturate");
cmbDigProbe1[ch]->addItem("ACQ Inhibit");
chLayout->addWidget(cmbDigProbe1[ch], rowID, colID);
colID ++;
cmbDigProbe2[ch] = new QComboBox(tab);
cmbDigProbe2[ch]->addItem("Trigger");
cmbDigProbe2[ch]->addItem("Time Filter Armed");
cmbDigProbe2[ch]->addItem("ReTrigger Guard");
cmbDigProbe2[ch]->addItem("Trap. basline Freeze");
cmbDigProbe2[ch]->addItem("Peaking");
cmbDigProbe2[ch]->addItem("Peak Ready");
cmbDigProbe2[ch]->addItem("Pile-up Guard");
cmbDigProbe2[ch]->addItem("ADC Saturate");
cmbDigProbe2[ch]->addItem("ADC Sat. Protection");
cmbDigProbe2[ch]->addItem("Post Sat. Event");
cmbDigProbe2[ch]->addItem("Trap. Saturate");
cmbDigProbe2[ch]->addItem("ACQ Inhibit");
chLayout->addWidget(cmbDigProbe2[ch], rowID, colID);
colID ++;
cmbDigProbe3[ch] = new QComboBox(tab);
cmbDigProbe3[ch]->addItem("Trigger");
cmbDigProbe3[ch]->addItem("Time Filter Armed");
cmbDigProbe3[ch]->addItem("ReTrigger Guard");
cmbDigProbe3[ch]->addItem("Trap. basline Freeze");
cmbDigProbe3[ch]->addItem("Peaking");
cmbDigProbe3[ch]->addItem("Peak Ready");
cmbDigProbe3[ch]->addItem("Pile-up Guard");
cmbDigProbe3[ch]->addItem("ADC Saturate");
cmbDigProbe3[ch]->addItem("ADC Sat. Protection");
cmbDigProbe3[ch]->addItem("Post Sat. Event");
cmbDigProbe3[ch]->addItem("Trap. Saturate");
cmbDigProbe3[ch]->addItem("ACQ Inhibit");
chLayout->addWidget(cmbDigProbe3[ch], rowID, colID);
colID ++;
cmbChVetoSrc[ch] = new QComboBox(tab);
cmbChVetoSrc[ch]->addItem("Disable");
cmbChVetoSrc[ch]->addItem("BoardVeto");
cmbChVetoSrc[ch]->addItem("ADC Over Sat.");
cmbChVetoSrc[ch]->addItem("ADC under Sat.");
chLayout->addWidget(cmbChVetoSrc[ch], rowID, colID);
colID ++;
sbChADCVetoWidth[ch] = new QSpinBox(tab);
sbChADCVetoWidth[ch]->setMinimum(0);
sbChADCVetoWidth[ch]->setMaximum(524280);
sbChADCVetoWidth[ch]->setSingleStep(20);
chLayout->addWidget(sbChADCVetoWidth[ch], rowID, colID);
}
} */ //-- end of ch loop;
} }
{//------- Group trigger settings {//^====================== Group trigger settings
QGroupBox * triggerBox = new QGroupBox("Trigger Map", tab); QGroupBox * triggerBox = new QGroupBox("Trigger Map", tab);
QGridLayout * triggerLayout = new QGridLayout(triggerBox); QGridLayout * triggerLayout = new QGridLayout(triggerBox);
//triggerBox->setLayout(triggerLayout); //triggerBox->setLayout(triggerLayout);

View File

@ -245,20 +245,27 @@ MainWindow::~MainWindow(){
//delete logInfo; //delete logInfo;
printf("- %s\n", __func__); printf("- %s\n", __func__);
printf("-------- Delete readData Thread\n");
if( digi ){ if( digi ){
for( int i = 0; i < nDigi ; i++){ for( int i = 0; i < nDigi ; i++){
if( digi[i]->IsDummy()) continue;
if( readDataThread[i]->isRunning()) StopACQ(); if( readDataThread[i]->isRunning()) StopACQ();
} }
} }
CloseDigitizers();
printf("-------- Delete scalar Thread\n");
DeleteTriggerLineEdit(); DeleteTriggerLineEdit();
delete scalarThread; delete scalarThread;
CloseDigitizers();
//---- need manually delete //---- need manually delete
printf("-------- delete scope\n");
if( scope != NULL ) delete scope; if( scope != NULL ) delete scope;
printf("-------- delete digiSetting\n");
if( digiSetting != NULL ) delete digiSetting; if( digiSetting != NULL ) delete digiSetting;
printf("-------- delete influx\n");
if( influx != NULL ) delete influx; if( influx != NULL ) delete influx;
} }

28
makeTest Executable file
View File

@ -0,0 +1,28 @@
CC = g++
COPTS = -fPIC -DLINUX -O2 -std=c++17 -lpthread
CAENLIBS = -lCAEN_FELib
CURLLIBS = -lcurl
OBJS= ClassDigitizer2Gen.o influxdb.o
#
ALL = test windowID
#
################################################################
#
test : test.cpp ClassDigitizer2Gen.o influxdb.o
@echo "------- test"
$(CC) $(COPTS) $(OBJS) -o test test.cpp $(CAENLIBS) $(CURLLIBS)
#
ClassDigitizer2Gen.o : ClassDigitizer2Gen.cpp ClassDigitizer2Gen.h Event.h
@echo "------- ClassDigitizer2Gen.o"
$(CC) $(COPTS) -c ClassDigitizer2Gen.cpp $(CAENLIBS)
#
influxdb.o : influxdb.cpp influxdb.h
@echo "------- influxdb.o"
$(CC) $(COPTS) -c influxdb.cpp $(CURLLIBS)
#
windowID : windowID.cpp
@echo "------- windowID"
${CC} ${COPTS} -o windowID windowID.cpp -lX11 -lpng

View File

@ -1,32 +0,0 @@
CC="g++"
COPTS="-fPIC -DLINUX -O2 -std=c++17 -lpthread"
CAENLIBS="-lCAEN_FELib"
CURLLIBS="-lcurl"
OBJS="ClassDigitizer2Gen.o influxdb.o"
#
#ALL = test
#
################################################################
#
#test : test.cpp ClassDigitizer2Gen.o influxdb.o
# $(CC) $(COPTS) $(OBJS) -o test test.cpp $(CAENLIBS) $(CURLLIBS)
#
#ClassDigitizer2Gen.o : ClassDigitizer2Gen.cpp ClassDigitizer2Gen.h Event.h
# $(CC) $(COPTS) -c ClassDigitizer2Gen.cpp $(CAENLIBS)
#
#influxdb.o : influxdb.cpp influxdb.h
# $(CC) $(COPTS) -c influxdb.cpp $(CURLLIBS)
echo "------- influxdb.o"
${CC} ${COPTS} -c influxdb.cpp ${CURLLIBS}
echo "------- ClassDigitizer2Gen.o"
${CC} ${COPTS} -c ClassDigitizer2Gen.cpp ${CAENLIBS}
echo "------- test"
${CC} ${COPTS} ${OBJS} -o test test.cpp ${CAENLIBS} ${CURLLIBS}
echo "------- windowID"
${CC} ${COPTS} -o windowID windowID.cpp -lX11 -lpng

View File

@ -90,10 +90,15 @@ int main(int argc, char* argv[]){
digi->OpenDigitizer(url); digi->OpenDigitizer(url);
digi->Reset(); digi->Reset();
digi->ProgramPHA(false); //digi->ProgramPHA(false);
printf("--------%s \n", digi->ReadChValue("0..63", "WaveAnalogprobe0", true).c_str()); //printf("--------%s \n", digi->ReadChValue("0..63", "WaveAnalogprobe0", true).c_str());
//digi->SaveSettingsToFile("settings.txt");
printf("===================================\n");
digi->LoadSettingsFromFile("settings.txt");
//printf("%s \n", digi->ReadValue("/ch/0/par/ChRealtimeMonitor").c_str()); //printf("%s \n", digi->ReadValue("/ch/0/par/ChRealtimeMonitor").c_str());
//printf("%s \n", digi->ReadValue("/ch/0/par/Energy_Nbit").c_str()); //printf("%s \n", digi->ReadValue("/ch/0/par/Energy_Nbit").c_str());
//printf("%s \n", digi->ReadValue("/par/MaxRawDataSize").c_str()); //printf("%s \n", digi->ReadValue("/par/MaxRawDataSize").c_str());
@ -122,7 +127,7 @@ int main(int argc, char* argv[]){
printf("%s\n", digi->GetPath(parHandle).c_str()); printf("%s\n", digi->GetPath(parHandle).c_str());
*/ */
/*
digi->ReadDigitizerSettings(); digi->ReadDigitizerSettings();
digi->SetPHADataFormat(1); digi->SetPHADataFormat(1);
@ -159,7 +164,7 @@ int main(int argc, char* argv[]){
digi->CloseOutFile(); digi->CloseOutFile();
*/
digi->CloseDigitizer(); digi->CloseDigitizer();