improved the Input Delay
This commit is contained in:
parent
c215d3cea1
commit
abc0c99d6e
|
@ -25,7 +25,7 @@ void Digitizer2Gen::Initialization(){
|
|||
serialNumber = 0;
|
||||
FPGAType = "";
|
||||
nChannels = 0;
|
||||
ch2ns = 0;
|
||||
tick2ns = 0;
|
||||
CupVer = 0;
|
||||
|
||||
outFileIndex = 0;
|
||||
|
@ -238,7 +238,7 @@ int Digitizer2Gen::OpenDigitizer(const char * url){
|
|||
ModelName = ReadValue(PHA::DIG::ModelName);
|
||||
CupVer = atoi(ReadValue(PHA::DIG::CupVer).c_str());
|
||||
int adcRate = atoi(ReadValue(PHA::DIG::ADC_SampleRate).c_str());
|
||||
ch2ns = 1000/adcRate;
|
||||
tick2ns = 1000/adcRate;
|
||||
|
||||
printf(" IP address : %s\n", ReadValue(PHA::DIG::IPAddress).c_str());
|
||||
printf(" Net Mask : %s\n", ReadValue(PHA::DIG::NetMask).c_str());
|
||||
|
@ -247,7 +247,7 @@ int Digitizer2Gen::OpenDigitizer(const char * url){
|
|||
printf(" DPP Type : %s (%d)\n", FPGAType.c_str(), FPGAVer);
|
||||
printf("Serial number : %d\n", serialNumber);
|
||||
printf(" ADC bits : %s\n", ReadValue(PHA::DIG::ADC_bit).c_str());
|
||||
printf(" ADC rate : %d Msps, ch2ns : %d ns\n", adcRate, ch2ns);
|
||||
printf(" ADC rate : %d Msps, tick2ns : %d ns\n", adcRate, tick2ns);
|
||||
printf(" Channels : %d\n", nChannels);
|
||||
|
||||
if( FPGAType == DPPType::PHA) {
|
||||
|
|
|
@ -37,7 +37,7 @@ class Digitizer2Gen {
|
|||
std::string FPGAType; // look the DigitiParameter.h::PHA::DIG::FirwareType, DPP_PHA, DPP_ZLE, DPP_PSD, DPP_DAW, DPP_OPEN, and Scope
|
||||
unsigned int FPGAVer; // for checking copy setting
|
||||
unsigned short nChannels;
|
||||
unsigned short ch2ns;
|
||||
unsigned short tick2ns;
|
||||
std::string ModelName;
|
||||
|
||||
void Initialization();
|
||||
|
@ -126,7 +126,7 @@ class Digitizer2Gen {
|
|||
void PrintChannelSettings(unsigned short ch);
|
||||
|
||||
unsigned short GetNChannels() const {return nChannels;}
|
||||
unsigned short GetCh2ns() const {return ch2ns;}
|
||||
unsigned short GetTick2ns() const {return tick2ns;}
|
||||
uint64_t GetHandle() const {return handle;}
|
||||
|
||||
Hit *hit; // should be hit[MaxNumber], when full or stopACQ, save into file
|
||||
|
|
|
@ -404,7 +404,7 @@ namespace PHA{
|
|||
}
|
||||
|
||||
namespace GROUP{
|
||||
const Reg InputDelay ("InputDelay", RW::ReadWrite, TYPE::GROUP, {{"0",""}, {"100", ""}, {"0.000001", ""}}, ANSTYPE::INTEGER, "sec");
|
||||
const Reg InputDelay ("InputDelay", RW::ReadWrite, TYPE::GROUP, {{"0",""}, {"32768", ""}, {"8", ""}}, ANSTYPE::INTEGER, "ns");
|
||||
}
|
||||
|
||||
namespace VGA{
|
||||
|
|
12
README.md
12
README.md
|
@ -94,6 +94,17 @@ run ` qmake6 *.pro` it will generate Makefile
|
|||
|
||||
then ` make`
|
||||
|
||||
# Using the CAENDig2.h
|
||||
|
||||
The CAENDig2.h is not copied to system include path as the CAEN+FELib.h. But we can copy it from the source. In the caen_dig2-vXXXX folder, go to the include folder, copy the CAENDig2.h to /usr/local/include/.
|
||||
|
||||
This enable us to compile code with -lCAEN_Dig2. For example, we can use the following to get the CAEN Dig2 Library version.
|
||||
```
|
||||
char version[16];
|
||||
CAENDig2_GetLibVersion(version);
|
||||
puts(version);
|
||||
```
|
||||
|
||||
# Known Issues
|
||||
|
||||
- The "Trig." Rate in the Scaler does not included the coincident condition. This is related to the ChSavedEventCnt from the firmware.
|
||||
|
@ -101,3 +112,4 @@ then ` make`
|
|||
- The CoincidenceLengthT not loaded.
|
||||
- Sometime, the digitizer halt after sent the /cmd/armacquisition command. This is CAEN library problem.
|
||||
- Event/Wave trig. Source cannot set as SWTrigger.
|
||||
- After update to CAEN_FELIB_v1.2.5 and CAEN_DIG2_v1.5.10, old firmware version before 202309XXXX is not supported.
|
|
@ -111,8 +111,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
Reg reg = infoIndex[j].second;
|
||||
QString text = QString::fromStdString(digi[iDigi]->ReadValue(reg));
|
||||
if( reg.GetPara() == PHA::DIG::ADC_SampleRate.GetPara() ) {
|
||||
short tick2ns = 1000/ text.toInt();
|
||||
text += " = " + QString::number(tick2ns, 'f', 1) + " ns" ;
|
||||
text += " = " + QString::number(digi[iDigi]->GetTick2ns(), 'f', 1) + " ns" ;
|
||||
}
|
||||
leInfo[iDigi][j]->setText(text);
|
||||
infoLayout->addWidget(lab, j%nRow, 2*(j/nRow));
|
||||
|
@ -797,8 +796,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
//LVDSLayout->setSpacing(2);
|
||||
|
||||
for(int k = 0; k < MaxNumberOfGroup; k ++){
|
||||
SetupSpinBox(spbInputDelay[iDigi][k], PHA::GROUP::InputDelay, k, false, "ch : " + QString::number(4*k) + " - " + QString::number(4*k+3) + " [s] ", groupLayout, k/4, 2*(k%4));
|
||||
spbInputDelay[iDigi][k]->setDecimals(6);
|
||||
SetupSpinBox(spbInputDelay[iDigi][k], PHA::GROUP::InputDelay, k, false, "ch : " + QString::number(4*k) + " - " + QString::number(4*k+3) + " [ns] ", groupLayout, k/4, 2*(k%4));
|
||||
}
|
||||
|
||||
}else{
|
||||
|
@ -2524,7 +2522,12 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
|
|||
}
|
||||
|
||||
for (unsigned short j = 0; j < (unsigned short) infoIndex.size(); j++){
|
||||
leInfo[ID][j]->setText(QString::fromStdString(digi[ID]->GetSettingValue(infoIndex[j].second)));
|
||||
Reg reg = infoIndex[j].second;
|
||||
QString text = QString::fromStdString(digi[ID]->ReadValue(reg));
|
||||
if( reg.GetPara() == PHA::DIG::ADC_SampleRate.GetPara() ) {
|
||||
text += " = " + QString::number(digi[ID]->GetTick2ns(), 'f', 1) + " ns" ;
|
||||
}
|
||||
leInfo[ID][j]->setText(text);
|
||||
}
|
||||
|
||||
//-------- board settings
|
||||
|
@ -2983,6 +2986,22 @@ void DigiSettingsPanel::SetupSpinBox(RSpinBox *&spb, const Reg para, int ch_inde
|
|||
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(para.GetPara()) ;
|
||||
if( para.GetType() == TYPE::CH ) msg += ",CH:" + (index == -1 ? "All" : QString::number(index));
|
||||
msg += " = " + QString::number(spb->value());
|
||||
|
||||
if( para.GetPara() == PHA::GROUP::InputDelay.GetPara() ){
|
||||
|
||||
if( digi[ID]->WriteValue(para, std::to_string(spb->value()/8), index)){
|
||||
SendLogMsg(msg + "|OK.");
|
||||
spb->setStyleSheet("");
|
||||
UpdatePanelFromMemory();
|
||||
UpdateOtherPanels();
|
||||
}else{
|
||||
SendLogMsg(msg + "|Fail.");
|
||||
spb->setStyleSheet("color:red;");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}else{
|
||||
if( digi[ID]->WriteValue(para, std::to_string(spb->value()), index)){
|
||||
SendLogMsg(msg + "|OK.");
|
||||
spb->setStyleSheet("");
|
||||
|
@ -2992,6 +3011,7 @@ void DigiSettingsPanel::SetupSpinBox(RSpinBox *&spb, const Reg para, int ch_inde
|
|||
SendLogMsg(msg + "|Fail.");
|
||||
spb->setStyleSheet("color:red;");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -3093,8 +3113,13 @@ void DigiSettingsPanel::FillComboBoxValueFromMemory(RComboBox *&cbb, const Reg p
|
|||
void DigiSettingsPanel::FillSpinBoxValueFromMemory(RSpinBox *&spb, const Reg para, int ch_index){
|
||||
QString result = QString::fromStdString(digi[ID]->GetSettingValue(para, ch_index));
|
||||
//printf("%s === %s, %d, %p\n", __func__, result.toStdString().c_str(), ID, spb);
|
||||
|
||||
if( para.GetPara() == PHA::GROUP::InputDelay.GetPara()) {
|
||||
spb->setValue(result.toInt()*8);
|
||||
}else{
|
||||
spb->setValue(result.toDouble());
|
||||
}
|
||||
}
|
||||
|
||||
void DigiSettingsPanel::ReadBoardSetting(int cbIndex){
|
||||
|
||||
|
|
4
makeTest
4
makeTest
|
@ -1,6 +1,6 @@
|
|||
CC = g++
|
||||
COPTS = -fPIC -DLINUX -O2 -std=c++17 -lpthread -g
|
||||
CAENLIBS = -lCAEN_FELib
|
||||
CAENLIBS = -lCAEN_FELib -lCAEN_Dig2
|
||||
CURLLIBS = -lcurl
|
||||
|
||||
OBJS= ClassDigitizer2Gen.o influxdb.o
|
||||
|
@ -8,7 +8,7 @@ OBJS= ClassDigitizer2Gen.o influxdb.o
|
|||
#
|
||||
#
|
||||
################################################################
|
||||
all : test windowID
|
||||
all : test
|
||||
|
||||
#
|
||||
test : test.cpp ClassDigitizer2Gen.o influxdb.o
|
||||
|
|
25
test.cpp
25
test.cpp
|
@ -11,7 +11,6 @@
|
|||
#include "ClassDigitizer2Gen.h"
|
||||
#include "influxdb.h"
|
||||
|
||||
|
||||
#define maxRead 400
|
||||
|
||||
std::mutex digiMTX;
|
||||
|
@ -78,6 +77,9 @@ static void StatLoop(){
|
|||
|
||||
}
|
||||
|
||||
#include <CAENDig2.h>
|
||||
|
||||
int CAENDig2_GetLibVersion(char* version);
|
||||
|
||||
int main(int argc, char* argv[]){
|
||||
|
||||
|
@ -87,8 +89,20 @@ int main(int argc, char* argv[]){
|
|||
|
||||
remove("haha_000.sol");
|
||||
|
||||
//const char * url = "dig2://192.168.0.100/";
|
||||
const char * url = "dig2://192.168.0.254/";
|
||||
char version[16];
|
||||
CAENDig2_GetLibVersion(version);
|
||||
puts(version);
|
||||
|
||||
char haha[100];
|
||||
CAEN_FELib_GetLibInfo(haha, 100);
|
||||
puts(haha);
|
||||
|
||||
CAEN_FELib_GetLibVersion(version);
|
||||
puts(version);
|
||||
|
||||
/*
|
||||
const char * url = "dig2://192.168.0.100/";
|
||||
//const char * url = "dig2://192.168.0.254/";
|
||||
|
||||
digi->OpenDigitizer(url);
|
||||
//digi->Reset();
|
||||
|
@ -100,6 +114,7 @@ int main(int argc, char* argv[]){
|
|||
|
||||
digi->PrintChannelSettings(0);
|
||||
|
||||
digi->ReadValue(PHA::CH::ADCToVolts, 0, true);
|
||||
|
||||
digi->SetDataFormat(DataFormat::ALL);
|
||||
|
||||
|
@ -135,9 +150,13 @@ int main(int argc, char* argv[]){
|
|||
|
||||
digi->CloseOutFile();
|
||||
|
||||
|
||||
|
||||
digi->CloseDigitizer();
|
||||
|
||||
delete digi;
|
||||
*/
|
||||
|
||||
delete influx;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user