add PSD in the core Digitizer Class and SolReader
This commit is contained in:
parent
71464484ba
commit
95310aa1c2
|
@ -38,6 +38,7 @@ void Digitizer2Gen::Initialization(){
|
||||||
acqON = false;
|
acqON = false;
|
||||||
|
|
||||||
settingFileName = "";
|
settingFileName = "";
|
||||||
|
|
||||||
boardSettings = PHA::DIG::AllSettings;
|
boardSettings = PHA::DIG::AllSettings;
|
||||||
for( int ch = 0; ch < MaxNumberOfChannel ; ch ++) chSettings[ch] = PHA::CH::AllSettings;
|
for( int ch = 0; ch < MaxNumberOfChannel ; ch ++) chSettings[ch] = PHA::CH::AllSettings;
|
||||||
for( int index = 0 ; index < 4; index ++) {
|
for( int index = 0 ; index < 4; index ++) {
|
||||||
|
@ -50,6 +51,7 @@ void Digitizer2Gen::Initialization(){
|
||||||
for( int i = 0; i < (int) PHA::LVDS::AllSettings.size(); i++) LVDSMap[PHA::LVDS::AllSettings[i].GetPara()] = i;
|
for( int i = 0; i < (int) PHA::LVDS::AllSettings.size(); i++) LVDSMap[PHA::LVDS::AllSettings[i].GetPara()] = i;
|
||||||
for( int i = 0; i < (int) PHA::CH::AllSettings.size(); i++) chMap[PHA::CH::AllSettings[i].GetPara()] = i;
|
for( int i = 0; i < (int) PHA::CH::AllSettings.size(); i++) chMap[PHA::CH::AllSettings[i].GetPara()] = i;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Digitizer2Gen::SetDummy(unsigned short sn){
|
void Digitizer2Gen::SetDummy(unsigned short sn){
|
||||||
|
@ -58,7 +60,6 @@ void Digitizer2Gen::SetDummy(unsigned short sn){
|
||||||
serialNumber = sn;
|
serialNumber = sn;
|
||||||
nChannels = 64;
|
nChannels = 64;
|
||||||
FPGAType = "DPP_PHA";
|
FPGAType = "DPP_PHA";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//########################################### Handles functions
|
//########################################### Handles functions
|
||||||
|
@ -122,7 +123,6 @@ std::string Digitizer2Gen::ReadValue(const char * parameter, bool verbose){
|
||||||
|
|
||||||
std::string Digitizer2Gen::ReadValue(const Reg para, int ch_index, bool verbose){
|
std::string Digitizer2Gen::ReadValue(const Reg para, int ch_index, bool verbose){
|
||||||
std:: string ans = ReadValue(para.GetFullPara(ch_index).c_str(), verbose);
|
std:: string ans = ReadValue(para.GetFullPara(ch_index).c_str(), verbose);
|
||||||
//printf("%s | %s \n", para.GetFullPara(ch_index).c_str(), ans.c_str());
|
|
||||||
|
|
||||||
int index = FindIndex(para);
|
int index = FindIndex(para);
|
||||||
switch( para.GetType()){
|
switch( para.GetType()){
|
||||||
|
@ -132,6 +132,8 @@ std::string Digitizer2Gen::ReadValue(const Reg para, int ch_index, bool verbose
|
||||||
case TYPE::LVDS: LVDSSettings[ch_index][index].SetValue(ans);break;
|
case TYPE::LVDS: LVDSSettings[ch_index][index].SetValue(ans);break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//printf("%s | %s | index %d | %s \n", para.GetFullPara(ch_index).c_str(), ans.c_str(), index, chSettings[ch_index][index].GetValue().c_str());
|
||||||
|
|
||||||
return ans;
|
return ans;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,28 +221,64 @@ int Digitizer2Gen::OpenDigitizer(const char * url){
|
||||||
isConnected = true;
|
isConnected = true;
|
||||||
|
|
||||||
printf("#################################################\n");
|
printf("#################################################\n");
|
||||||
ReadAllSettings();
|
|
||||||
|
|
||||||
serialNumber = atoi(GetSettingValue(PHA::DIG::SerialNumber).c_str());
|
//========== PHA and PSD are the same
|
||||||
FPGAType = GetSettingValue(PHA::DIG::FirmwareType);
|
serialNumber = atoi(ReadValue(PHA::DIG::SerialNumber).c_str());
|
||||||
FPGAVer = atoi(GetSettingValue(PHA::DIG::CupVer).c_str());
|
FPGAType = ReadValue(PHA::DIG::FirmwareType);
|
||||||
nChannels = atoi(GetSettingValue(PHA::DIG::NumberOfChannel).c_str());
|
FPGAVer = atoi(ReadValue(PHA::DIG::CupVer).c_str());
|
||||||
ModelName = GetSettingValue(PHA::DIG::ModelName);
|
nChannels = atoi(ReadValue(PHA::DIG::NumberOfChannel).c_str());
|
||||||
int adcRate = atoi(GetSettingValue(PHA::DIG::ADC_SampleRate).c_str());
|
ModelName = ReadValue(PHA::DIG::ModelName);
|
||||||
|
int adcRate = atoi(ReadValue(PHA::DIG::ADC_SampleRate).c_str());
|
||||||
ch2ns = 1000/adcRate;
|
ch2ns = 1000/adcRate;
|
||||||
|
|
||||||
printf(" IP address : %s\n", GetSettingValue(PHA::DIG::IPAddress).c_str());
|
printf(" IP address : %s\n", ReadValue(PHA::DIG::IPAddress).c_str());
|
||||||
printf(" Net Mask : %s\n", GetSettingValue(PHA::DIG::NetMask).c_str());
|
printf(" Net Mask : %s\n", ReadValue(PHA::DIG::NetMask).c_str());
|
||||||
printf(" Gateway : %s\n", GetSettingValue(PHA::DIG::Gateway).c_str());
|
printf(" Gateway : %s\n", ReadValue(PHA::DIG::Gateway).c_str());
|
||||||
|
|
||||||
printf(" Model name : %s\n", ModelName.c_str());
|
printf(" Model name : %s\n", ModelName.c_str());
|
||||||
printf(" CUP version : %s\n", GetSettingValue(PHA::DIG::CupVer).c_str());
|
printf(" DPP Type : %s (%d)\n", FPGAType.c_str(), FPGAVer);
|
||||||
printf(" DPP Type : %s\n", GetSettingValue(PHA::DIG::FirmwareType).c_str());
|
|
||||||
printf("Serial number : %d\n", serialNumber);
|
printf("Serial number : %d\n", serialNumber);
|
||||||
printf(" ADC bits : %s\n", GetSettingValue(PHA::DIG::ADC_bit).c_str());
|
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, ch2ns : %d ns\n", adcRate, ch2ns);
|
||||||
printf(" Channels : %d\n", nChannels);
|
printf(" Channels : %d\n", nChannels);
|
||||||
|
|
||||||
|
if( FPGAType == DPPType::PHA) {
|
||||||
|
|
||||||
|
printf("========== defining setting arrays for %s \n", FPGAType.c_str());
|
||||||
|
|
||||||
|
boardSettings = PHA::DIG::AllSettings;
|
||||||
|
for( int ch = 0; ch < MaxNumberOfChannel ; ch ++) chSettings[ch] = PHA::CH::AllSettings;
|
||||||
|
for( int index = 0 ; index < 4; index ++) {
|
||||||
|
VGASetting[index] = PHA::VGA::VGAGain;
|
||||||
|
LVDSSettings[index] = PHA::LVDS::AllSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
//build map
|
||||||
|
for( int i = 0; i < (int) PHA::DIG::AllSettings.size(); i++) boardMap[PHA::DIG::AllSettings[i].GetPara()] = i;
|
||||||
|
for( int i = 0; i < (int) PHA::LVDS::AllSettings.size(); i++) LVDSMap[PHA::LVDS::AllSettings[i].GetPara()] = i;
|
||||||
|
for( int i = 0; i < (int) PHA::CH::AllSettings.size(); i++) chMap[PHA::CH::AllSettings[i].GetPara()] = i;
|
||||||
|
|
||||||
|
}else if (FPGAType == DPPType::PSD){
|
||||||
|
|
||||||
|
printf("========== defining setting arrays for %s \n", FPGAType.c_str());
|
||||||
|
|
||||||
|
boardSettings = PSD::DIG::AllSettings;
|
||||||
|
for( int ch = 0; ch < MaxNumberOfChannel ; ch ++) chSettings[ch] = PSD::CH::AllSettings;
|
||||||
|
for( int index = 0 ; index < 4; index ++) {
|
||||||
|
VGASetting[index] = PSD::VGA::VGAGain;
|
||||||
|
LVDSSettings[index] = PSD::LVDS::AllSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
//build map
|
||||||
|
for( int i = 0; i < (int) PSD::DIG::AllSettings.size(); i++) boardMap[PSD::DIG::AllSettings[i].GetPara()] = i;
|
||||||
|
for( int i = 0; i < (int) PSD::LVDS::AllSettings.size(); i++) LVDSMap[PSD::LVDS::AllSettings[i].GetPara()] = i;
|
||||||
|
for( int i = 0; i < (int) PSD::CH::AllSettings.size(); i++) chMap[PSD::CH::AllSettings[i].GetPara()] = i;
|
||||||
|
|
||||||
|
}else{
|
||||||
|
printf(" DPP Type %s is not supported.\n", FPGAType.c_str());
|
||||||
|
return -303;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReadAllSettings();
|
||||||
//------ set default setting file name
|
//------ set default setting file name
|
||||||
settingFileName = "settings_"+ std::to_string(serialNumber) + ".dat";
|
settingFileName = "settings_"+ std::to_string(serialNumber) + ".dat";
|
||||||
|
|
||||||
|
@ -283,30 +321,25 @@ void Digitizer2Gen::StopACQ(){
|
||||||
acqON = false;
|
acqON = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//================ Data Format
|
void Digitizer2Gen::SetDataFormat(unsigned short dataFormat){
|
||||||
//------- PHA
|
|
||||||
// 0 = all
|
|
||||||
// 1 = 1 trace
|
|
||||||
// 2 = no trace
|
|
||||||
// 3 = minimum (only energy and timestamp)
|
|
||||||
// 15 = raw buffer
|
|
||||||
//------- PSD
|
|
||||||
//?? 4 = all
|
|
||||||
//?? 5 = 1 trace
|
|
||||||
//?? 6 = no trace
|
|
||||||
//?? 7 = only energy + timestamp
|
|
||||||
//?? 16 = raw buffer
|
|
||||||
|
|
||||||
void Digitizer2Gen::SetPHADataFormat(unsigned short dataFormat){
|
|
||||||
|
|
||||||
printf("%s : %d\n", __func__, dataFormat);
|
printf("%s : %d\n", __func__, dataFormat);
|
||||||
|
|
||||||
///========== get endpoint and endpoint folder handle
|
///========== get endpoint and endpoint folder handle
|
||||||
if( dataFormat < 15 ){
|
if( dataFormat != DataFormat::RAW ){
|
||||||
|
|
||||||
|
if( FPGAType == DPPType::PHA ){
|
||||||
ret = CAEN_FELib_GetHandle(handle, "/endpoint/dpppha", &ep_handle);
|
ret = CAEN_FELib_GetHandle(handle, "/endpoint/dpppha", &ep_handle);
|
||||||
ret |= CAEN_FELib_GetParentHandle(ep_handle, NULL, &ep_folder_handle);
|
ret |= CAEN_FELib_GetParentHandle(ep_handle, NULL, &ep_folder_handle);
|
||||||
ret |= CAEN_FELib_SetValue(ep_folder_handle, "/par/activeendpoint", "dpppha");
|
ret |= CAEN_FELib_SetValue(ep_folder_handle, "/par/activeendpoint", "dpppha");
|
||||||
|
}else if(FPGAType == DPPType::PSD) {
|
||||||
|
ret = CAEN_FELib_GetHandle(handle, "/endpoint/dpppsd", &ep_handle);
|
||||||
|
ret |= CAEN_FELib_GetParentHandle(ep_handle, NULL, &ep_folder_handle);
|
||||||
|
ret |= CAEN_FELib_SetValue(ep_folder_handle, "/par/activeendpoint", "dpppsd");
|
||||||
|
}else{
|
||||||
|
ErrorMsg("DPP-Type not supported.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ret != CAEN_FELib_Success) {
|
if (ret != CAEN_FELib_Success) {
|
||||||
ErrorMsg("Set active endpoint");
|
ErrorMsg("Set active endpoint");
|
||||||
|
@ -326,10 +359,12 @@ void Digitizer2Gen::SetPHADataFormat(unsigned short dataFormat){
|
||||||
|
|
||||||
if( evt ) delete evt;
|
if( evt ) delete evt;
|
||||||
evt = new Event();
|
evt = new Event();
|
||||||
evt->SetDataType(dataFormat);
|
evt->SetDataType(dataFormat, FPGAType);
|
||||||
dataStartIndetifier = 0xAAA0 + dataFormat;
|
dataStartIndetifier = 0xAA00 + dataFormat;
|
||||||
|
if(FPGAType == DPPType::PSD ) dataStartIndetifier += 0x0010;
|
||||||
|
|
||||||
if( dataFormat == 0 ){
|
if( FPGAType == DPPType::PHA) {
|
||||||
|
if( dataFormat == DataFormat::ALL ){
|
||||||
ret = CAEN_FELib_SetReadDataFormat(ep_handle,
|
ret = CAEN_FELib_SetReadDataFormat(ep_handle,
|
||||||
"[ \
|
"[ \
|
||||||
{ \"name\" : \"CHANNEL\", \"type\" : \"U8\" }, \
|
{ \"name\" : \"CHANNEL\", \"type\" : \"U8\" }, \
|
||||||
|
@ -360,7 +395,7 @@ void Digitizer2Gen::SetPHADataFormat(unsigned short dataFormat){
|
||||||
]");
|
]");
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dataFormat == 1 ){
|
if( dataFormat == DataFormat::OneTrace ){
|
||||||
ret = CAEN_FELib_SetReadDataFormat(ep_handle,
|
ret = CAEN_FELib_SetReadDataFormat(ep_handle,
|
||||||
"[ \
|
"[ \
|
||||||
{ \"name\" : \"CHANNEL\", \"type\" : \"U8\" }, \
|
{ \"name\" : \"CHANNEL\", \"type\" : \"U8\" }, \
|
||||||
|
@ -381,7 +416,7 @@ void Digitizer2Gen::SetPHADataFormat(unsigned short dataFormat){
|
||||||
]");
|
]");
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dataFormat == 2 ){
|
if( dataFormat == DataFormat::NoTrace ){
|
||||||
ret = CAEN_FELib_SetReadDataFormat(ep_handle,
|
ret = CAEN_FELib_SetReadDataFormat(ep_handle,
|
||||||
"[ \
|
"[ \
|
||||||
{ \"name\" : \"CHANNEL\", \"type\" : \"U8\" }, \
|
{ \"name\" : \"CHANNEL\", \"type\" : \"U8\" }, \
|
||||||
|
@ -399,7 +434,7 @@ void Digitizer2Gen::SetPHADataFormat(unsigned short dataFormat){
|
||||||
]");
|
]");
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dataFormat == 3 ){
|
if( dataFormat == DataFormat::Minimum ){
|
||||||
ret = CAEN_FELib_SetReadDataFormat(ep_handle,
|
ret = CAEN_FELib_SetReadDataFormat(ep_handle,
|
||||||
"[ \
|
"[ \
|
||||||
{ \"name\" : \"CHANNEL\", \"type\" : \"U8\" }, \
|
{ \"name\" : \"CHANNEL\", \"type\" : \"U8\" }, \
|
||||||
|
@ -407,8 +442,94 @@ void Digitizer2Gen::SetPHADataFormat(unsigned short dataFormat){
|
||||||
{ \"name\" : \"ENERGY\", \"type\" : \"U16\" } \
|
{ \"name\" : \"ENERGY\", \"type\" : \"U16\" } \
|
||||||
]");
|
]");
|
||||||
}
|
}
|
||||||
|
}else if ( FPGAType == DPPType::PSD ){
|
||||||
|
|
||||||
if( dataFormat == 15 ){
|
if( dataFormat == DataFormat::ALL ){
|
||||||
|
ret = CAEN_FELib_SetReadDataFormat(ep_handle,
|
||||||
|
"[ \
|
||||||
|
{ \"name\" : \"CHANNEL\", \"type\" : \"U8\" }, \
|
||||||
|
{ \"name\" : \"TIMESTAMP\", \"type\" : \"U64\" }, \
|
||||||
|
{ \"name\" : \"FINE_TIMESTAMP\", \"type\" : \"U16\" }, \
|
||||||
|
{ \"name\" : \"ENERGY\", \"type\" : \"U16\" }, \
|
||||||
|
{ \"name\" : \"ENERGY_SHORT\", \"type\" : \"U16\" }, \
|
||||||
|
{ \"name\" : \"ANALOG_PROBE_1\", \"type\" : \"I32\", \"dim\" : 1 }, \
|
||||||
|
{ \"name\" : \"ANALOG_PROBE_2\", \"type\" : \"I32\", \"dim\" : 1 }, \
|
||||||
|
{ \"name\" : \"DIGITAL_PROBE_1\", \"type\" : \"U8\", \"dim\" : 1 }, \
|
||||||
|
{ \"name\" : \"DIGITAL_PROBE_2\", \"type\" : \"U8\", \"dim\" : 1 }, \
|
||||||
|
{ \"name\" : \"DIGITAL_PROBE_3\", \"type\" : \"U8\", \"dim\" : 1 }, \
|
||||||
|
{ \"name\" : \"DIGITAL_PROBE_4\", \"type\" : \"U8\", \"dim\" : 1 }, \
|
||||||
|
{ \"name\" : \"ANALOG_PROBE_1_TYPE\", \"type\" : \"U8\" }, \
|
||||||
|
{ \"name\" : \"ANALOG_PROBE_2_TYPE\", \"type\" : \"U8\" }, \
|
||||||
|
{ \"name\" : \"DIGITAL_PROBE_1_TYPE\", \"type\" : \"U8\" }, \
|
||||||
|
{ \"name\" : \"DIGITAL_PROBE_2_TYPE\", \"type\" : \"U8\" }, \
|
||||||
|
{ \"name\" : \"DIGITAL_PROBE_3_TYPE\", \"type\" : \"U8\" }, \
|
||||||
|
{ \"name\" : \"DIGITAL_PROBE_4_TYPE\", \"type\" : \"U8\" }, \
|
||||||
|
{ \"name\" : \"WAVEFORM_SIZE\", \"type\" : \"SIZE_T\" }, \
|
||||||
|
{ \"name\" : \"FLAGS_LOW_PRIORITY\", \"type\" : \"U16\"}, \
|
||||||
|
{ \"name\" : \"FLAGS_HIGH_PRIORITY\", \"type\" : \"U16\" }, \
|
||||||
|
{ \"name\" : \"TRIGGER_THR\", \"type\" : \"U16\" }, \
|
||||||
|
{ \"name\" : \"TIME_RESOLUTION\", \"type\" : \"U8\" }, \
|
||||||
|
{ \"name\" : \"BOARD_FAIL\", \"type\" : \"BOOL\" }, \
|
||||||
|
{ \"name\" : \"FLUSH\", \"type\" : \"BOOL\" }, \
|
||||||
|
{ \"name\" : \"AGGREGATE_COUNTER\", \"type\" : \"U32\" }, \
|
||||||
|
{ \"name\" : \"EVENT_SIZE\", \"type\" : \"SIZE_T\" } \
|
||||||
|
]");
|
||||||
|
}
|
||||||
|
|
||||||
|
if( dataFormat == DataFormat::OneTrace ){
|
||||||
|
ret = CAEN_FELib_SetReadDataFormat(ep_handle,
|
||||||
|
"[ \
|
||||||
|
{ \"name\" : \"CHANNEL\", \"type\" : \"U8\" }, \
|
||||||
|
{ \"name\" : \"TIMESTAMP\", \"type\" : \"U64\" }, \
|
||||||
|
{ \"name\" : \"FINE_TIMESTAMP\", \"type\" : \"U16\" }, \
|
||||||
|
{ \"name\" : \"ENERGY\", \"type\" : \"U16\" }, \
|
||||||
|
{ \"name\" : \"ENERGY_SHORT\", \"type\" : \"U16\" }, \
|
||||||
|
{ \"name\" : \"ANALOG_PROBE_1\", \"type\" : \"I32\", \"dim\" : 1 }, \
|
||||||
|
{ \"name\" : \"ANALOG_PROBE_1_TYPE\", \"type\" : \"U8\" }, \
|
||||||
|
{ \"name\" : \"WAVEFORM_SIZE\", \"type\" : \"SIZE_T\" }, \
|
||||||
|
{ \"name\" : \"FLAGS_LOW_PRIORITY\", \"type\" : \"U16\"}, \
|
||||||
|
{ \"name\" : \"FLAGS_HIGH_PRIORITY\", \"type\" : \"U16\" }, \
|
||||||
|
{ \"name\" : \"TRIGGER_THR\", \"type\" : \"U16\" }, \
|
||||||
|
{ \"name\" : \"TIME_RESOLUTION\", \"type\" : \"U8\" }, \
|
||||||
|
{ \"name\" : \"BOARD_FAIL\", \"type\" : \"BOOL\" }, \
|
||||||
|
{ \"name\" : \"FLUSH\", \"type\" : \"BOOL\" }, \
|
||||||
|
{ \"name\" : \"AGGREGATE_COUNTER\", \"type\" : \"U32\" }, \
|
||||||
|
{ \"name\" : \"EVENT_SIZE\", \"type\" : \"SIZE_T\" } \
|
||||||
|
]");
|
||||||
|
}
|
||||||
|
|
||||||
|
if( dataFormat == DataFormat::NoTrace ){
|
||||||
|
ret = CAEN_FELib_SetReadDataFormat(ep_handle,
|
||||||
|
"[ \
|
||||||
|
{ \"name\" : \"CHANNEL\", \"type\" : \"U8\" }, \
|
||||||
|
{ \"name\" : \"TIMESTAMP\", \"type\" : \"U64\" }, \
|
||||||
|
{ \"name\" : \"FINE_TIMESTAMP\", \"type\" : \"U16\" }, \
|
||||||
|
{ \"name\" : \"ENERGY\", \"type\" : \"U16\" }, \
|
||||||
|
{ \"name\" : \"ENERGY_SHORT\", \"type\" : \"U16\" }, \
|
||||||
|
{ \"name\" : \"FLAGS_LOW_PRIORITY\", \"type\" : \"U16\"}, \
|
||||||
|
{ \"name\" : \"FLAGS_HIGH_PRIORITY\", \"type\" : \"U16\" }, \
|
||||||
|
{ \"name\" : \"TRIGGER_THR\", \"type\" : \"U16\" }, \
|
||||||
|
{ \"name\" : \"TIME_RESOLUTION\", \"type\" : \"U8\" }, \
|
||||||
|
{ \"name\" : \"BOARD_FAIL\", \"type\" : \"BOOL\" }, \
|
||||||
|
{ \"name\" : \"FLUSH\", \"type\" : \"BOOL\" }, \
|
||||||
|
{ \"name\" : \"AGGREGATE_COUNTER\", \"type\" : \"U32\" }, \
|
||||||
|
{ \"name\" : \"EVENT_SIZE\", \"type\" : \"SIZE_T\" } \
|
||||||
|
]");
|
||||||
|
}
|
||||||
|
|
||||||
|
if( dataFormat == DataFormat::Minimum ){
|
||||||
|
ret = CAEN_FELib_SetReadDataFormat(ep_handle,
|
||||||
|
"[ \
|
||||||
|
{ \"name\" : \"CHANNEL\", \"type\" : \"U8\" }, \
|
||||||
|
{ \"name\" : \"TIMESTAMP\", \"type\" : \"U64\" }, \
|
||||||
|
{ \"name\" : \"ENERGY\", \"type\" : \"U16\" }, \
|
||||||
|
{ \"name\" : \"ENERGY_SHORT\", \"type\" : \"U16\" }, \
|
||||||
|
]");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if( dataFormat == DataFormat::RAW ){
|
||||||
ret = CAEN_FELib_SetReadDataFormat(ep_handle,
|
ret = CAEN_FELib_SetReadDataFormat(ep_handle,
|
||||||
" [ \
|
" [ \
|
||||||
{ \"name\": \"DATA\", \"type\": \"U8\", \"dim\": 1 }, \
|
{ \"name\": \"DATA\", \"type\": \"U8\", \"dim\": 1 }, \
|
||||||
|
@ -469,7 +590,10 @@ void Digitizer2Gen::PrintStat(){
|
||||||
int Digitizer2Gen::ReadData(){
|
int Digitizer2Gen::ReadData(){
|
||||||
//printf("========= %s \n", __func__);
|
//printf("========= %s \n", __func__);
|
||||||
|
|
||||||
if( evt->dataType == 0){
|
if( FPGAType != DPPType::PHA || FPGAType != DPPType::PSD ) return -404;
|
||||||
|
|
||||||
|
if( evt->dataType == DataFormat::ALL ){
|
||||||
|
if( FPGAType == DPPType::PHA ){
|
||||||
ret = CAEN_FELib_ReadData(ep_handle, 100,
|
ret = CAEN_FELib_ReadData(ep_handle, 100,
|
||||||
&evt->channel,
|
&evt->channel,
|
||||||
&evt->timestamp,
|
&evt->timestamp,
|
||||||
|
@ -497,7 +621,41 @@ int Digitizer2Gen::ReadData(){
|
||||||
&evt->aggCounter,
|
&evt->aggCounter,
|
||||||
&evt->event_size
|
&evt->event_size
|
||||||
);
|
);
|
||||||
}else if( evt->dataType == 1){
|
}else{
|
||||||
|
ret = CAEN_FELib_ReadData(ep_handle, 100,
|
||||||
|
&evt->channel,
|
||||||
|
&evt->timestamp,
|
||||||
|
&evt->fine_timestamp,
|
||||||
|
&evt->energy,
|
||||||
|
&evt->energy_short,
|
||||||
|
evt->analog_probes[0],
|
||||||
|
evt->analog_probes[1],
|
||||||
|
evt->digital_probes[0],
|
||||||
|
evt->digital_probes[1],
|
||||||
|
evt->digital_probes[2],
|
||||||
|
evt->digital_probes[3],
|
||||||
|
&evt->analog_probes_type[0],
|
||||||
|
&evt->analog_probes_type[1],
|
||||||
|
&evt->digital_probes_type[0],
|
||||||
|
&evt->digital_probes_type[1],
|
||||||
|
&evt->digital_probes_type[2],
|
||||||
|
&evt->digital_probes_type[3],
|
||||||
|
&evt->traceLenght,
|
||||||
|
&evt->flags_low_priority,
|
||||||
|
&evt->flags_high_priority,
|
||||||
|
&evt->trigger_threashold,
|
||||||
|
&evt->downSampling,
|
||||||
|
&evt->board_fail,
|
||||||
|
&evt->flush,
|
||||||
|
&evt->aggCounter,
|
||||||
|
&evt->event_size
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
evt->isTraceAllZero = false;
|
||||||
|
|
||||||
|
}else if( evt->dataType == DataFormat::OneTrace){
|
||||||
|
if( FPGAType == DPPType::PHA ){
|
||||||
ret = CAEN_FELib_ReadData(ep_handle, 100,
|
ret = CAEN_FELib_ReadData(ep_handle, 100,
|
||||||
&evt->channel,
|
&evt->channel,
|
||||||
&evt->timestamp,
|
&evt->timestamp,
|
||||||
|
@ -515,7 +673,31 @@ int Digitizer2Gen::ReadData(){
|
||||||
&evt->aggCounter,
|
&evt->aggCounter,
|
||||||
&evt->event_size
|
&evt->event_size
|
||||||
);
|
);
|
||||||
}else if( evt->dataType == 2){
|
}else{
|
||||||
|
ret = CAEN_FELib_ReadData(ep_handle, 100,
|
||||||
|
&evt->channel,
|
||||||
|
&evt->timestamp,
|
||||||
|
&evt->fine_timestamp,
|
||||||
|
&evt->energy,
|
||||||
|
&evt->energy_short,
|
||||||
|
evt->analog_probes[0],
|
||||||
|
&evt->analog_probes_type[0],
|
||||||
|
&evt->traceLenght,
|
||||||
|
&evt->flags_low_priority,
|
||||||
|
&evt->flags_high_priority,
|
||||||
|
&evt->trigger_threashold,
|
||||||
|
&evt->downSampling,
|
||||||
|
&evt->board_fail,
|
||||||
|
&evt->flush,
|
||||||
|
&evt->aggCounter,
|
||||||
|
&evt->event_size
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
evt->isTraceAllZero = false;
|
||||||
|
|
||||||
|
}else if( evt->dataType == DataFormat::NoTrace){
|
||||||
|
if( FPGAType == DPPType::PHA ){
|
||||||
ret = CAEN_FELib_ReadData(ep_handle, 100,
|
ret = CAEN_FELib_ReadData(ep_handle, 100,
|
||||||
&evt->channel,
|
&evt->channel,
|
||||||
&evt->timestamp,
|
&evt->timestamp,
|
||||||
|
@ -530,21 +712,52 @@ int Digitizer2Gen::ReadData(){
|
||||||
&evt->aggCounter,
|
&evt->aggCounter,
|
||||||
&evt->event_size
|
&evt->event_size
|
||||||
);
|
);
|
||||||
}else if( evt->dataType == 3){
|
}else{
|
||||||
|
ret = CAEN_FELib_ReadData(ep_handle, 100,
|
||||||
|
&evt->channel,
|
||||||
|
&evt->timestamp,
|
||||||
|
&evt->fine_timestamp,
|
||||||
|
&evt->energy,
|
||||||
|
&evt->energy_short,
|
||||||
|
&evt->flags_low_priority,
|
||||||
|
&evt->flags_high_priority,
|
||||||
|
&evt->trigger_threashold,
|
||||||
|
&evt->downSampling,
|
||||||
|
&evt->board_fail,
|
||||||
|
&evt->flush,
|
||||||
|
&evt->aggCounter,
|
||||||
|
&evt->event_size
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
evt->isTraceAllZero = true;
|
||||||
|
|
||||||
|
}else if( evt->dataType == DataFormat::Minimum){
|
||||||
|
if( FPGAType == DPPType::PHA ){
|
||||||
ret = CAEN_FELib_ReadData(ep_handle, 100,
|
ret = CAEN_FELib_ReadData(ep_handle, 100,
|
||||||
&evt->channel,
|
&evt->channel,
|
||||||
&evt->timestamp,
|
&evt->timestamp,
|
||||||
&evt->energy
|
&evt->energy
|
||||||
);
|
);
|
||||||
}else if( evt->dataType == 15){
|
}else{
|
||||||
|
ret = CAEN_FELib_ReadData(ep_handle, 100,
|
||||||
|
&evt->channel,
|
||||||
|
&evt->timestamp,
|
||||||
|
&evt->energy,
|
||||||
|
&evt->energy_short
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
evt->isTraceAllZero = true;
|
||||||
|
}else if( evt->dataType == DataFormat::RAW){
|
||||||
ret = CAEN_FELib_ReadData(ep_handle, 100, evt->data, &evt->dataSize, &evt->n_events );
|
ret = CAEN_FELib_ReadData(ep_handle, 100, evt->data, &evt->dataSize, &evt->n_events );
|
||||||
//printf("data size: %lu byte\n", evt.dataSize);
|
//printf("data size: %lu byte\n", evt.dataSize);
|
||||||
|
|
||||||
|
evt->isTraceAllZero = true; //assume no trace, as the trace need to be extracted.
|
||||||
}else{
|
}else{
|
||||||
return CAEN_FELib_UNKNOWN;
|
return CAEN_FELib_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
evt->isTraceAllZero = false;
|
|
||||||
|
|
||||||
if( ret != CAEN_FELib_Success) {
|
if( ret != CAEN_FELib_Success) {
|
||||||
//ErrorMsg("ReadData()");
|
//ErrorMsg("ReadData()");
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -582,10 +795,11 @@ void Digitizer2Gen::SaveDataToFile(){
|
||||||
outFile = fopen(outFileName, "wb"); //overwrite binary
|
outFile = fopen(outFileName, "wb"); //overwrite binary
|
||||||
}
|
}
|
||||||
|
|
||||||
if( evt->dataType == 0){
|
if( evt->dataType == DataFormat::ALL){
|
||||||
fwrite(&dataStartIndetifier, 2, 1, outFile);
|
fwrite(&dataStartIndetifier, 2, 1, outFile);
|
||||||
fwrite(&evt->channel, 1, 1, outFile);
|
fwrite(&evt->channel, 1, 1, outFile);
|
||||||
fwrite(&evt->energy, 2, 1, outFile);
|
fwrite(&evt->energy, 2, 1, outFile);
|
||||||
|
if( FPGAType == DPPType::PSD ) fwrite(&evt->energy_short, 2, 1, outFile);
|
||||||
fwrite(&evt->timestamp, 6, 1, outFile);
|
fwrite(&evt->timestamp, 6, 1, outFile);
|
||||||
fwrite(&evt->fine_timestamp, 2, 1, outFile);
|
fwrite(&evt->fine_timestamp, 2, 1, outFile);
|
||||||
fwrite(&evt->flags_high_priority, 1, 1, outFile);
|
fwrite(&evt->flags_high_priority, 1, 1, outFile);
|
||||||
|
@ -605,10 +819,11 @@ void Digitizer2Gen::SaveDataToFile(){
|
||||||
fwrite(evt->digital_probes[1], evt->traceLenght, 1, outFile);
|
fwrite(evt->digital_probes[1], evt->traceLenght, 1, outFile);
|
||||||
fwrite(evt->digital_probes[2], evt->traceLenght, 1, outFile);
|
fwrite(evt->digital_probes[2], evt->traceLenght, 1, outFile);
|
||||||
fwrite(evt->digital_probes[3], evt->traceLenght, 1, outFile);
|
fwrite(evt->digital_probes[3], evt->traceLenght, 1, outFile);
|
||||||
}else if( evt->dataType == 1){
|
}else if( evt->dataType == DataFormat::OneTrace){
|
||||||
fwrite(&dataStartIndetifier, 2, 1, outFile);
|
fwrite(&dataStartIndetifier, 2, 1, outFile);
|
||||||
fwrite(&evt->channel, 1, 1, outFile);
|
fwrite(&evt->channel, 1, 1, outFile);
|
||||||
fwrite(&evt->energy, 2, 1, outFile);
|
fwrite(&evt->energy, 2, 1, outFile);
|
||||||
|
if( FPGAType == DPPType::PSD ) fwrite(&evt->energy_short, 2, 1, outFile);
|
||||||
fwrite(&evt->timestamp, 6, 1, outFile);
|
fwrite(&evt->timestamp, 6, 1, outFile);
|
||||||
fwrite(&evt->fine_timestamp, 2, 1, outFile);
|
fwrite(&evt->fine_timestamp, 2, 1, outFile);
|
||||||
fwrite(&evt->flags_high_priority, 1, 1, outFile);
|
fwrite(&evt->flags_high_priority, 1, 1, outFile);
|
||||||
|
@ -616,20 +831,22 @@ void Digitizer2Gen::SaveDataToFile(){
|
||||||
fwrite(&evt->traceLenght, 8, 1, outFile);
|
fwrite(&evt->traceLenght, 8, 1, outFile);
|
||||||
fwrite(&evt->analog_probes_type[0], 1, 1, outFile);
|
fwrite(&evt->analog_probes_type[0], 1, 1, outFile);
|
||||||
fwrite(evt->analog_probes[0], evt->traceLenght*4, 1, outFile);
|
fwrite(evt->analog_probes[0], evt->traceLenght*4, 1, outFile);
|
||||||
}else if( evt->dataType == 2){
|
}else if( evt->dataType == DataFormat::NoTrace ){
|
||||||
fwrite(&dataStartIndetifier, 2, 1, outFile);
|
fwrite(&dataStartIndetifier, 2, 1, outFile);
|
||||||
fwrite(&evt->channel, 1, 1, outFile);
|
fwrite(&evt->channel, 1, 1, outFile);
|
||||||
fwrite(&evt->energy, 2, 1, outFile);
|
fwrite(&evt->energy, 2, 1, outFile);
|
||||||
|
if( FPGAType == DPPType::PSD ) fwrite(&evt->energy_short, 2, 1, outFile);
|
||||||
fwrite(&evt->timestamp, 6, 1, outFile);
|
fwrite(&evt->timestamp, 6, 1, outFile);
|
||||||
fwrite(&evt->fine_timestamp, 2, 1, outFile);
|
fwrite(&evt->fine_timestamp, 2, 1, outFile);
|
||||||
fwrite(&evt->flags_high_priority, 1, 1, outFile);
|
fwrite(&evt->flags_high_priority, 1, 1, outFile);
|
||||||
fwrite(&evt->flags_low_priority, 2, 1, outFile);
|
fwrite(&evt->flags_low_priority, 2, 1, outFile);
|
||||||
}else if( evt->dataType == 3){
|
}else if( evt->dataType == DataFormat::Minimum ){
|
||||||
fwrite(&dataStartIndetifier, 2, 1, outFile);
|
fwrite(&dataStartIndetifier, 2, 1, outFile);
|
||||||
fwrite(&evt->channel, 1, 1, outFile);
|
fwrite(&evt->channel, 1, 1, outFile);
|
||||||
fwrite(&evt->energy, 2, 1, outFile);
|
fwrite(&evt->energy, 2, 1, outFile);
|
||||||
|
if( FPGAType == DPPType::PSD ) fwrite(&evt->energy_short, 2, 1, outFile);
|
||||||
fwrite(&evt->timestamp, 6, 1, outFile);
|
fwrite(&evt->timestamp, 6, 1, outFile);
|
||||||
}else if( evt->dataType == 15){
|
}else if( evt->dataType == DataFormat::RAW){
|
||||||
fwrite(&dataStartIndetifier, 2, 1, outFile);
|
fwrite(&dataStartIndetifier, 2, 1, outFile);
|
||||||
fwrite(&evt->dataSize, 8, 1, outFile);
|
fwrite(&evt->dataSize, 8, 1, outFile);
|
||||||
fwrite(evt->data, evt->dataSize, 1, outFile);
|
fwrite(evt->data, evt->dataSize, 1, outFile);
|
||||||
|
@ -825,9 +1042,14 @@ std::string Digitizer2Gen::ErrorMsg(const char * funcName){
|
||||||
//^===================================================== Settings
|
//^===================================================== Settings
|
||||||
void Digitizer2Gen::ReadAllSettings(){
|
void Digitizer2Gen::ReadAllSettings(){
|
||||||
if( !isConnected ) return;
|
if( !isConnected ) return;
|
||||||
|
|
||||||
|
printf("Digitizer2Gen::%s | %s \n", __func__, FPGAType.c_str());
|
||||||
|
|
||||||
for(int i = 0; i < (int) boardSettings.size(); i++){
|
for(int i = 0; i < (int) boardSettings.size(); i++){
|
||||||
if( boardSettings[i].ReadWrite() == RW::WriteOnly) continue;
|
if( boardSettings[i].ReadWrite() == RW::WriteOnly) continue;
|
||||||
if( !(ModelName == "VX2745" && FPGAType == "DPP_PHA") &&
|
|
||||||
|
// here TempSens is same for PHA and PSD
|
||||||
|
if( !(ModelName == "VX2745") &&
|
||||||
(boardSettings[i].GetPara() == PHA::DIG::TempSensADC1.GetPara() ||
|
(boardSettings[i].GetPara() == PHA::DIG::TempSensADC1.GetPara() ||
|
||||||
boardSettings[i].GetPara() == PHA::DIG::TempSensADC2.GetPara() ||
|
boardSettings[i].GetPara() == PHA::DIG::TempSensADC2.GetPara() ||
|
||||||
boardSettings[i].GetPara() == PHA::DIG::TempSensADC3.GetPara() ||
|
boardSettings[i].GetPara() == PHA::DIG::TempSensADC3.GetPara() ||
|
||||||
|
@ -839,7 +1061,7 @@ void Digitizer2Gen::ReadAllSettings(){
|
||||||
ReadValue(boardSettings[i]);
|
ReadValue(boardSettings[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ModelName == "VX2745" && FPGAType == "DPP_PHA") for(int i = 0; i < 4 ; i ++) ReadValue(VGASetting[i], i);
|
if( ModelName == "VX2745") for(int i = 0; i < 4 ; i ++) ReadValue(VGASetting[i], i);
|
||||||
|
|
||||||
for( int index = 0; index < 4; index++){
|
for( int index = 0; index < 4; index++){
|
||||||
for( int i = 0; i < (int) LVDSSettings[index].size(); i++){
|
for( int i = 0; i < (int) LVDSSettings[index].size(); i++){
|
||||||
|
@ -855,6 +1077,7 @@ void Digitizer2Gen::ReadAllSettings(){
|
||||||
ReadValue(chSettings[ch][i], ch);
|
ReadValue(chSettings[ch][i], ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Digitizer2Gen::SaveSettingsToFile(const char * saveFileName, bool setReadOnly){
|
int Digitizer2Gen::SaveSettingsToFile(const char * saveFileName, bool setReadOnly){
|
||||||
|
@ -867,7 +1090,28 @@ int Digitizer2Gen::SaveSettingsToFile(const char * saveFileName, bool setReadOnl
|
||||||
for(int i = 0; i < (int) boardSettings.size(); i++){
|
for(int i = 0; i < (int) boardSettings.size(); i++){
|
||||||
if( boardSettings[i].ReadWrite() == RW::WriteOnly) continue;
|
if( boardSettings[i].ReadWrite() == RW::WriteOnly) continue;
|
||||||
totCount ++;
|
totCount ++;
|
||||||
if( boardSettings[i].GetValue() == "" && boardSettings[i].GetPara() != "Gateway") break;
|
//--- exclude Gateway
|
||||||
|
if( boardSettings[i].GetPara() == PHA::DIG::Gateway.GetPara()) {
|
||||||
|
totCount --;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--- exclude some TempSens for Not VX2745
|
||||||
|
if( ModelName != "VX2745" &&
|
||||||
|
( boardSettings[i].GetPara() == PHA::DIG::TempSensADC1.GetPara() ||
|
||||||
|
boardSettings[i].GetPara() == PHA::DIG::TempSensADC2.GetPara() ||
|
||||||
|
boardSettings[i].GetPara() == PHA::DIG::TempSensADC3.GetPara() ||
|
||||||
|
boardSettings[i].GetPara() == PHA::DIG::TempSensADC4.GetPara() ||
|
||||||
|
boardSettings[i].GetPara() == PHA::DIG::TempSensADC5.GetPara() ||
|
||||||
|
boardSettings[i].GetPara() == PHA::DIG::TempSensADC6.GetPara() ) ) {
|
||||||
|
totCount --;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( boardSettings[i].GetValue() == "") {
|
||||||
|
printf(" No value for %s \n", boardSettings[i].GetPara().c_str());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
fprintf(saveFile, "%-45s!%d!%4d!%s\n", boardSettings[i].GetFullPara().c_str(),
|
fprintf(saveFile, "%-45s!%d!%4d!%s\n", boardSettings[i].GetFullPara().c_str(),
|
||||||
boardSettings[i].ReadWrite(),
|
boardSettings[i].ReadWrite(),
|
||||||
8000 + i,
|
8000 + i,
|
||||||
|
@ -875,10 +1119,13 @@ int Digitizer2Gen::SaveSettingsToFile(const char * saveFileName, bool setReadOnl
|
||||||
count ++;
|
count ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ModelName == "VX2745" && FPGAType == "DPP_PHA") {
|
if( ModelName == "VX2745" && FPGAType == DPPType::PHA) {
|
||||||
for(int i = 0; i < 4 ; i ++){
|
for(int i = 0; i < 4 ; i ++){
|
||||||
totCount ++;
|
totCount ++;
|
||||||
if( VGASetting[i].GetValue() == "" ) break;
|
if( VGASetting[i].GetValue() == "" ) {
|
||||||
|
printf(" No value for %s \n", VGASetting[i].GetPara().c_str());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
fprintf(saveFile, "%-45s!%d!%4d!%s\n", VGASetting[i].GetFullPara(i).c_str(),
|
fprintf(saveFile, "%-45s!%d!%4d!%s\n", VGASetting[i].GetFullPara(i).c_str(),
|
||||||
VGASetting[i].ReadWrite(),
|
VGASetting[i].ReadWrite(),
|
||||||
9000 + i,
|
9000 + i,
|
||||||
|
@ -891,7 +1138,10 @@ int Digitizer2Gen::SaveSettingsToFile(const char * saveFileName, bool setReadOnl
|
||||||
for( int index = 0; index < 4; index++){
|
for( int index = 0; index < 4; index++){
|
||||||
if( LVDSSettings[index][i].ReadWrite() == RW::WriteOnly) continue;
|
if( LVDSSettings[index][i].ReadWrite() == RW::WriteOnly) continue;
|
||||||
totCount ++;
|
totCount ++;
|
||||||
if( LVDSSettings[index][i].GetValue() == "") break;
|
if( LVDSSettings[index][i].GetValue() == "") {
|
||||||
|
printf(" No value for %s \n", LVDSSettings[index][i].GetPara().c_str());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
fprintf(saveFile, "%-45s!%d!%4d!%s\n", LVDSSettings[index][i].GetFullPara(index).c_str(),
|
fprintf(saveFile, "%-45s!%d!%4d!%s\n", LVDSSettings[index][i].GetFullPara(index).c_str(),
|
||||||
LVDSSettings[index][i].ReadWrite(),
|
LVDSSettings[index][i].ReadWrite(),
|
||||||
7000 + 4 * index + i,
|
7000 + 4 * index + i,
|
||||||
|
@ -904,7 +1154,10 @@ int Digitizer2Gen::SaveSettingsToFile(const char * saveFileName, bool setReadOnl
|
||||||
for(int ch = 0; ch < nChannels ; ch++ ){
|
for(int ch = 0; ch < nChannels ; ch++ ){
|
||||||
if( chSettings[ch][i].ReadWrite() == RW::WriteOnly) continue;
|
if( chSettings[ch][i].ReadWrite() == RW::WriteOnly) continue;
|
||||||
totCount ++;
|
totCount ++;
|
||||||
if( chSettings[ch][i].GetValue() == "") break;
|
if( chSettings[ch][i].GetValue() == "") {
|
||||||
|
printf("[%i] No value for %s , ch-%02d\n", i, chSettings[ch][i].GetPara().c_str(), ch);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
fprintf(saveFile, "%-45s!%d!%4d!%s\n", chSettings[ch][i].GetFullPara(ch).c_str(),
|
fprintf(saveFile, "%-45s!%d!%4d!%s\n", chSettings[ch][i].GetFullPara(ch).c_str(),
|
||||||
chSettings[ch][i].ReadWrite(),
|
chSettings[ch][i].ReadWrite(),
|
||||||
ch*100 + i,
|
ch*100 + i,
|
||||||
|
|
|
@ -32,8 +32,8 @@ class Digitizer2Gen {
|
||||||
char retValue[256];
|
char retValue[256];
|
||||||
|
|
||||||
unsigned short serialNumber;
|
unsigned short serialNumber;
|
||||||
std::string FPGAType;
|
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;
|
unsigned int FPGAVer; // for checking copy setting
|
||||||
unsigned short nChannels;
|
unsigned short nChannels;
|
||||||
unsigned short ch2ns;
|
unsigned short ch2ns;
|
||||||
std::string ModelName;
|
std::string ModelName;
|
||||||
|
@ -71,21 +71,23 @@ class Digitizer2Gen {
|
||||||
Digitizer2Gen();
|
Digitizer2Gen();
|
||||||
~Digitizer2Gen();
|
~Digitizer2Gen();
|
||||||
|
|
||||||
unsigned short GetSerialNumber() const{return serialNumber;}
|
unsigned short GetSerialNumber() const {return serialNumber;}
|
||||||
std::string GetFPGAType() const {return FPGAType;}
|
std::string GetFPGAType() const {return FPGAType;}
|
||||||
std::string GetModelName() const {return ModelName;}
|
std::string GetModelName() const {return ModelName;}
|
||||||
unsigned int GetFPGAVersion() const {return FPGAVer;}
|
unsigned int GetFPGAVersion() const {return FPGAVer;}
|
||||||
|
|
||||||
void SetDummy(unsigned short sn);
|
void SetDummy(unsigned short sn);
|
||||||
bool IsDummy() const {return isDummy;}
|
bool IsDummy() const {return isDummy;}
|
||||||
|
bool IsConnected() const {return isConnected;}
|
||||||
|
|
||||||
int OpenDigitizer(const char * url);
|
int OpenDigitizer(const char * url);
|
||||||
bool IsConnected() const {return isConnected;}
|
|
||||||
int CloseDigitizer();
|
int CloseDigitizer();
|
||||||
|
|
||||||
int GetRet() const {return ret;};
|
int GetRet() const {return ret;};
|
||||||
|
|
||||||
int FindIndex(const Reg para); // get index from DIGIPARA
|
uint64_t GetHandle(const char * parameter);
|
||||||
|
uint64_t GetParentHandle(uint64_t handle);
|
||||||
|
std::string GetPath(uint64_t handle);
|
||||||
|
|
||||||
std::string ReadValue(const char * parameter, bool verbose = false);
|
std::string ReadValue(const char * parameter, bool verbose = false);
|
||||||
std::string ReadValue(const Reg para, int ch_index = -1, bool verbose = false); // read digitizer and save to memory
|
std::string ReadValue(const Reg para, int ch_index = -1, bool verbose = false); // read digitizer and save to memory
|
||||||
|
@ -94,9 +96,9 @@ class Digitizer2Gen {
|
||||||
void SendCommand(const char * parameter);
|
void SendCommand(const char * parameter);
|
||||||
void SendCommand(std::string shortPara);
|
void SendCommand(std::string shortPara);
|
||||||
|
|
||||||
uint64_t GetHandle(const char * parameter);
|
int FindIndex(const Reg para); // get index from DIGIPARA
|
||||||
uint64_t GetParentHandle(uint64_t handle);
|
std::string GetSettingValue(const Reg para, unsigned int ch_index = 0); // read from memory
|
||||||
std::string GetPath(uint64_t handle);
|
|
||||||
|
|
||||||
std::string ErrorMsg(const char * funcName);
|
std::string ErrorMsg(const char * funcName);
|
||||||
|
|
||||||
|
@ -104,11 +106,8 @@ class Digitizer2Gen {
|
||||||
void StopACQ();
|
void StopACQ();
|
||||||
bool IsAcqOn() const {return acqON;}
|
bool IsAcqOn() const {return acqON;}
|
||||||
|
|
||||||
void SetPHADataFormat(unsigned short dataFormat); // 0 = all data,
|
void SetDataFormat(unsigned short dataFormat); // dataFormat = namespace DataFormat
|
||||||
// 1 = analog trace-0 only + flags
|
|
||||||
// 2 = no trace, only ch, energy, timestamp, fine_timestamp + flags
|
|
||||||
// 3 = only ch, energy, timestamp, minimum
|
|
||||||
// 15 = raw data
|
|
||||||
int ReadData();
|
int ReadData();
|
||||||
int ReadStat(); // digitizer update it every 500 msec
|
int ReadStat(); // digitizer update it every 500 msec
|
||||||
void PrintStat();
|
void PrintStat();
|
||||||
|
@ -138,7 +137,6 @@ class Digitizer2Gen {
|
||||||
int ReadAndSaveSettingsToFile(const char * saveFileName = NULL); // ReadAllSettings + text file
|
int ReadAndSaveSettingsToFile(const char * saveFileName = NULL); // ReadAllSettings + text file
|
||||||
bool LoadSettingsFromFile(const char * loadFileName = NULL); // Load settings, write to digitizer and save to memory
|
bool LoadSettingsFromFile(const char * loadFileName = NULL); // Load settings, write to digitizer and save to memory
|
||||||
|
|
||||||
std::string GetSettingValue(const Reg para, unsigned int ch_index = 0); // read from memory
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
116
DigiParameters.h
116
DigiParameters.h
|
@ -1041,70 +1041,70 @@ namespace PSD{
|
||||||
|
|
||||||
const Reg ADCInputBaselineGuardSample ("ADCInputBaselineGuardS", RW::ReadWrite, TYPE::CH, {{"0", ""},{"1000", ""},{"1", ""}}, ANSTYPE::INTEGER, "sample");
|
const Reg ADCInputBaselineGuardSample ("ADCInputBaselineGuardS", RW::ReadWrite, TYPE::CH, {{"0", ""},{"1000", ""},{"1", ""}}, ANSTYPE::INTEGER, "sample");
|
||||||
const Reg CFDDelaySample ("CFDDelayS", RW::ReadWrite, TYPE::CH, {{"4", ""},{"1023", ""},{"1", ""}}, ANSTYPE::INTEGER, "sample");
|
const Reg CFDDelaySample ("CFDDelayS", RW::ReadWrite, TYPE::CH, {{"4", ""},{"1023", ""},{"1", ""}}, ANSTYPE::INTEGER, "sample");
|
||||||
const Reg TimeFilterRetriggerGuardSample ("TimeFilterRetriggerGuardT", RW::ReadWrite, TYPE::CH, {{"0", ""},{"8000", ""},{"8", ""}}, ANSTYPE::INTEGER, "sample");
|
const Reg TimeFilterRetriggerGuardSample ("TimeFilterRetriggerGuardS", RW::ReadWrite, TYPE::CH, {{"0", ""},{"8000", ""},{"8", ""}}, ANSTYPE::INTEGER, "sample");
|
||||||
const Reg GateLongLengthSample ("GateLongLengthS", RW::ReadWrite, TYPE::CH, {{"0", ""},{"4000", ""},{"1", ""}}, ANSTYPE::INTEGER, "sample");
|
const Reg GateLongLengthSample ("GateLongLengthS", RW::ReadWrite, TYPE::CH, {{"0", ""},{"4000", ""},{"1", ""}}, ANSTYPE::INTEGER, "sample");
|
||||||
const Reg GateShortLengthSample ("GateShortLengthS", RW::ReadWrite, TYPE::CH, {{"0", ""},{"4000", ""},{"1", ""}}, ANSTYPE::INTEGER, "sample");
|
const Reg GateShortLengthSample ("GateShortLengthS", RW::ReadWrite, TYPE::CH, {{"0", ""},{"4000", ""},{"1", ""}}, ANSTYPE::INTEGER, "sample");
|
||||||
const Reg GateOffsetSample ("GateOffsetS", RW::ReadWrite, TYPE::CH, {{"0", ""},{"250", ""},{"1", ""}}, ANSTYPE::INTEGER, "sample");
|
const Reg GateOffsetSample ("GateOffsetS", RW::ReadWrite, TYPE::CH, {{"0", ""},{"250", ""},{"1", ""}}, ANSTYPE::INTEGER, "sample");
|
||||||
|
|
||||||
|
|
||||||
const std::vector<Reg> AllSettings = {
|
const std::vector<Reg> AllSettings = {
|
||||||
SelfTrgRate ,
|
SelfTrgRate , // 0
|
||||||
ChannelStatus ,
|
ChannelStatus , // 1
|
||||||
GainFactor ,
|
GainFactor , // 2
|
||||||
ADCToVolts ,
|
ADCToVolts , // 3
|
||||||
ChannelRealtime ,
|
ChannelRealtime , // 4
|
||||||
ChannelDeadtime ,
|
ChannelDeadtime , // 5
|
||||||
ChannelTriggerCount ,
|
ChannelTriggerCount , // 6
|
||||||
ChannelSavedCount ,
|
ChannelSavedCount , // 7
|
||||||
ChannelWaveCount ,
|
ChannelWaveCount , // 8
|
||||||
ChannelEnable ,
|
ChannelEnable , // 9
|
||||||
DC_Offset ,
|
DC_Offset , // 10
|
||||||
TriggerThreshold ,
|
TriggerThreshold , // 11
|
||||||
Polarity ,
|
Polarity , // 12
|
||||||
WaveDataSource ,
|
WaveDataSource , // 13
|
||||||
RecordLength ,
|
RecordLength , // 14
|
||||||
WaveSaving ,
|
WaveSaving , // 15
|
||||||
WaveResolution ,
|
WaveResolution , // 16
|
||||||
PreTrigger ,
|
PreTrigger , // 17
|
||||||
WaveAnalogProbe0 ,
|
WaveAnalogProbe0 , // 18
|
||||||
WaveAnalogProbe1 ,
|
WaveAnalogProbe1 , // 19
|
||||||
WaveDigitalProbe0 ,
|
WaveDigitalProbe0 , // 20
|
||||||
WaveDigitalProbe1 ,
|
WaveDigitalProbe1 , // 21
|
||||||
WaveDigitalProbe2 ,
|
WaveDigitalProbe2 , // 22
|
||||||
WaveDigitalProbe3 ,
|
WaveDigitalProbe3 , // 23
|
||||||
EventTriggerSource ,
|
EventTriggerSource , // 24
|
||||||
ChannelsTriggerMask ,
|
ChannelsTriggerMask , // 25
|
||||||
ChannelVetoSource ,
|
ChannelVetoSource , // 26
|
||||||
WaveTriggerSource ,
|
WaveTriggerSource , // 27
|
||||||
EventSelector ,
|
EventSelector , // 28
|
||||||
WaveSelector ,
|
WaveSelector , // 29
|
||||||
CoincidenceMask ,
|
CoincidenceMask , // 30
|
||||||
AntiCoincidenceMask ,
|
AntiCoincidenceMask , // 31
|
||||||
CoincidenceLength ,
|
CoincidenceLength , // 32
|
||||||
CoincidenceLengthSample ,
|
CoincidenceLengthSample , // 33
|
||||||
ADCVetoWidth ,
|
ADCVetoWidth , // 34
|
||||||
EnergySkimLowDiscriminator ,
|
EnergySkimLowDiscriminator , // 35
|
||||||
EnergySkimHighDiscriminator,
|
EnergySkimHighDiscriminator, // 36
|
||||||
RecordLengthSample ,
|
RecordLengthSample , // 37
|
||||||
PreTriggerSample ,
|
PreTriggerSample , // 38
|
||||||
ITLConnect ,
|
ITLConnect , // 39
|
||||||
ADCInputBaselineAvg ,
|
ADCInputBaselineAvg , // 40
|
||||||
AbsoluteBaseline ,
|
AbsoluteBaseline , // 41
|
||||||
ADCInputBaselineGuard ,
|
ADCInputBaselineGuard , // 42
|
||||||
SmoothingFactor ,
|
SmoothingFactor , // 43
|
||||||
ChargeSmoothing ,
|
ChargeSmoothing , // 44
|
||||||
TimeFilterSmoothing ,
|
TimeFilterSmoothing , // 45
|
||||||
TriggerFilterSelection ,
|
TriggerFilterSelection , // 46
|
||||||
CFDDelay ,
|
CFDDelay , // 47
|
||||||
CFDFraction ,
|
CFDFraction , // 48
|
||||||
TimeFilterRetriggerGuard ,
|
TimeFilterRetriggerGuard , // 49
|
||||||
TriggerHysteresis ,
|
TriggerHysteresis , // 50
|
||||||
PileupGap ,
|
PileupGap , // 51
|
||||||
GateLongLength ,
|
GateLongLength , // 52
|
||||||
GateShortLength ,
|
GateShortLength , // 53
|
||||||
GateOffset ,
|
GateOffset , // 54
|
||||||
LongChargeIntegratorPedestal,
|
LongChargeIntegratorPedestal, //
|
||||||
ShortChargeIntegratorPedestal,
|
ShortChargeIntegratorPedestal, //
|
||||||
EnergyGain ,
|
EnergyGain ,
|
||||||
NeutronThreshold ,
|
NeutronThreshold ,
|
||||||
ADCInputBaselineGuardSample,
|
ADCInputBaselineGuardSample,
|
||||||
|
|
48
Event.h
48
Event.h
|
@ -7,14 +7,33 @@
|
||||||
|
|
||||||
#define MaxTraceLenght 8100
|
#define MaxTraceLenght 8100
|
||||||
|
|
||||||
|
enum DataFormat{
|
||||||
|
|
||||||
|
ALL = 0,
|
||||||
|
OneTrace = 1,
|
||||||
|
NoTrace = 2,
|
||||||
|
Minimum = 3,
|
||||||
|
RAW = 0x0A,
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace DPPType{
|
||||||
|
|
||||||
|
const std::string PHA = "DPP_PHA";
|
||||||
|
const std::string PSD = "DPP_PSD";
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
class Event {
|
class Event {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
unsigned short dataType;
|
unsigned short dataType;
|
||||||
|
std::string DPPType;
|
||||||
|
|
||||||
///============= for dpp-pha
|
///============= for dpp-pha
|
||||||
uint8_t channel; // 6 bit
|
uint8_t channel; // 6 bit
|
||||||
uint16_t energy; // 16 bit
|
uint16_t energy; // 16 bit
|
||||||
|
uint16_t energy_short; // 16 bit, only for PSD
|
||||||
uint64_t timestamp; // 48 bit
|
uint64_t timestamp; // 48 bit
|
||||||
uint16_t fine_timestamp; // 16 bit
|
uint16_t fine_timestamp; // 16 bit
|
||||||
uint16_t flags_low_priority; // 12 bit
|
uint16_t flags_low_priority; // 12 bit
|
||||||
|
@ -23,8 +42,8 @@ class Event {
|
||||||
uint8_t downSampling; // 8 bit
|
uint8_t downSampling; // 8 bit
|
||||||
bool board_fail;
|
bool board_fail;
|
||||||
bool flush;
|
bool flush;
|
||||||
uint8_t analog_probes_type[2]; // 3 bit
|
uint8_t analog_probes_type[2]; // 3 bit for PHA, 4 bit for PSD
|
||||||
uint8_t digital_probes_type[4]; // 4 bit
|
uint8_t digital_probes_type[4]; // 4 bit for PHA, 5 bit for PSD
|
||||||
int32_t * analog_probes[2]; // 18 bit
|
int32_t * analog_probes[2]; // 18 bit
|
||||||
uint8_t * digital_probes[4]; // 1 bit
|
uint8_t * digital_probes[4]; // 1 bit
|
||||||
uint16_t trigger_threashold; // 16 bit
|
uint16_t trigger_threashold; // 16 bit
|
||||||
|
@ -47,8 +66,12 @@ class Event {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init(){
|
void Init(){
|
||||||
|
DPPType = DPPType::PHA;
|
||||||
|
dataType = DataFormat::ALL;
|
||||||
|
|
||||||
channel = 0;
|
channel = 0;
|
||||||
energy = 0;
|
energy = 0;
|
||||||
|
energy_short = 0;
|
||||||
timestamp = 0;
|
timestamp = 0;
|
||||||
fine_timestamp = 0;
|
fine_timestamp = 0;
|
||||||
downSampling = 0;
|
downSampling = 0;
|
||||||
|
@ -91,11 +114,12 @@ class Event {
|
||||||
isTraceAllZero = true;
|
isTraceAllZero = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetDataType(unsigned int type){
|
void SetDataType(unsigned int type, std::string dppType){
|
||||||
dataType = type;
|
dataType = type;
|
||||||
|
DPPType = dppType;
|
||||||
ClearMemory();
|
ClearMemory();
|
||||||
|
|
||||||
if( dataType == 0xF){
|
if( dataType == DataFormat::RAW){
|
||||||
data = new uint8_t[20*1024*1024];
|
data = new uint8_t[20*1024*1024];
|
||||||
}else{
|
}else{
|
||||||
analog_probes[0] = new int32_t[MaxTraceLenght];
|
analog_probes[0] = new int32_t[MaxTraceLenght];
|
||||||
|
@ -131,15 +155,25 @@ class Event {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string AnaProbeType(uint8_t probeType){
|
std::string AnaProbeType(uint8_t probeType){
|
||||||
|
|
||||||
|
if( DPPType == DPPType::PHA){
|
||||||
switch(probeType){
|
switch(probeType){
|
||||||
case 0: return "ADC";
|
case 0: return "ADC";
|
||||||
case 1: return "Time filter";
|
case 1: return "Time filter";
|
||||||
case 2: return "Energy filter";
|
case 2: return "Energy filter";
|
||||||
default : return "none";
|
default : return "none";
|
||||||
}
|
}
|
||||||
|
}else if (DPPType == DPPType::PSD){
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
return "none";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string DigiProbeType(uint8_t probeType){
|
std::string DigiProbeType(uint8_t probeType){
|
||||||
|
|
||||||
|
if( DPPType == DPPType::PHA){
|
||||||
switch(probeType){
|
switch(probeType){
|
||||||
case 0: return "Trigger";
|
case 0: return "Trigger";
|
||||||
case 1: return "Time filter armed";
|
case 1: return "Time filter armed";
|
||||||
|
@ -156,6 +190,12 @@ class Event {
|
||||||
case 12: return "Signal inhibit";
|
case 12: return "Signal inhibit";
|
||||||
default : return "none";
|
default : return "none";
|
||||||
}
|
}
|
||||||
|
}else if (DPPType == DPPType::PSD){
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
return "none";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string HighPriority(uint16_t prio){
|
std::string HighPriority(uint16_t prio){
|
||||||
|
|
31
SolReader.h
31
SolReader.h
|
@ -67,7 +67,7 @@ SolReader::SolReader(){
|
||||||
SolReader::SolReader(std::string fileName, unsigned short dataType = 0){
|
SolReader::SolReader(std::string fileName, unsigned short dataType = 0){
|
||||||
init();
|
init();
|
||||||
OpenFile(fileName);
|
OpenFile(fileName);
|
||||||
evt->SetDataType(dataType);
|
evt->SetDataType(dataType, DPPType::PHA);
|
||||||
}
|
}
|
||||||
|
|
||||||
SolReader::~SolReader(){
|
SolReader::~SolReader(){
|
||||||
|
@ -107,20 +107,22 @@ inline int SolReader::ReadNextBlock(int opt){
|
||||||
|
|
||||||
fread(&blockStartIdentifier, 2, 1, inFile);
|
fread(&blockStartIdentifier, 2, 1, inFile);
|
||||||
|
|
||||||
if( (blockStartIdentifier & 0xAAA0) != 0xAAA0 ) {
|
if( (blockStartIdentifier & 0xAA00) != 0xAA00 ) {
|
||||||
printf("header fail.\n");
|
printf("header fail.\n");
|
||||||
return -2 ;
|
return -2 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( blockStartIdentifier & 0xF ) == 15 ){
|
if( ( blockStartIdentifier & 0xF ) == DataFormat::RAW ){
|
||||||
evt->SetDataType(15);
|
evt->SetDataType(DataFormat::RAW, ((blockStartIdentifier >> 1) & 0xF) == 0 ? DPPType::PHA : DPPType::PSD);
|
||||||
}
|
}
|
||||||
evt->dataType = blockStartIdentifier & 0xF;
|
evt->dataType = blockStartIdentifier & 0xF;
|
||||||
|
evt->DPPType = ((blockStartIdentifier >> 1) & 0xF) == 0 ? DPPType::PHA : DPPType::PSD;
|
||||||
|
|
||||||
if( evt->dataType == 0){
|
if( evt->dataType == DataFormat::ALL){
|
||||||
if( opt == 0 ){
|
if( opt == 0 ){
|
||||||
fread(&evt->channel, 1, 1, inFile);
|
fread(&evt->channel, 1, 1, inFile);
|
||||||
fread(&evt->energy, 2, 1, inFile);
|
fread(&evt->energy, 2, 1, inFile);
|
||||||
|
if( evt->DPPType == DPPType::PSD ) fread(&evt->energy_short, 2, 1, inFile);
|
||||||
fread(&evt->timestamp, 6, 1, inFile);
|
fread(&evt->timestamp, 6, 1, inFile);
|
||||||
fread(&evt->fine_timestamp, 2, 1, inFile);
|
fread(&evt->fine_timestamp, 2, 1, inFile);
|
||||||
fread(&evt->flags_high_priority, 1, 1, inFile);
|
fread(&evt->flags_high_priority, 1, 1, inFile);
|
||||||
|
@ -132,7 +134,7 @@ inline int SolReader::ReadNextBlock(int opt){
|
||||||
fread(&evt->event_size, 8, 1, inFile);
|
fread(&evt->event_size, 8, 1, inFile);
|
||||||
fread(&evt->aggCounter, 4, 1, inFile);
|
fread(&evt->aggCounter, 4, 1, inFile);
|
||||||
}else{
|
}else{
|
||||||
fseek(inFile, 31, SEEK_CUR);
|
fseek(inFile, evt->DPPType == DPPType::PHA ? 31 : 33, SEEK_CUR);
|
||||||
}
|
}
|
||||||
fread(&evt->traceLenght, 8, 1, inFile);
|
fread(&evt->traceLenght, 8, 1, inFile);
|
||||||
if( opt == 0){
|
if( opt == 0){
|
||||||
|
@ -147,16 +149,17 @@ inline int SolReader::ReadNextBlock(int opt){
|
||||||
}else{
|
}else{
|
||||||
fseek(inFile, 6 + evt->traceLenght*(12), SEEK_CUR);
|
fseek(inFile, 6 + evt->traceLenght*(12), SEEK_CUR);
|
||||||
}
|
}
|
||||||
}else if( evt->dataType == 1){
|
}else if( evt->dataType == DataFormat::OneTrace){
|
||||||
if( opt == 0 ){
|
if( opt == 0 ){
|
||||||
fread(&evt->channel, 1, 1, inFile);
|
fread(&evt->channel, 1, 1, inFile);
|
||||||
fread(&evt->energy, 2, 1, inFile);
|
fread(&evt->energy, 2, 1, inFile);
|
||||||
|
if( evt->DPPType == DPPType::PSD ) fread(&evt->energy_short, 2, 1, inFile);
|
||||||
fread(&evt->timestamp, 6, 1, inFile);
|
fread(&evt->timestamp, 6, 1, inFile);
|
||||||
fread(&evt->fine_timestamp, 2, 1, inFile);
|
fread(&evt->fine_timestamp, 2, 1, inFile);
|
||||||
fread(&evt->flags_high_priority, 1, 1, inFile);
|
fread(&evt->flags_high_priority, 1, 1, inFile);
|
||||||
fread(&evt->flags_low_priority, 2, 1, inFile);
|
fread(&evt->flags_low_priority, 2, 1, inFile);
|
||||||
}else{
|
}else{
|
||||||
fseek(inFile, 14, SEEK_CUR);
|
fseek(inFile, evt->DPPType == DPPType::PHA ? 14 : 16, SEEK_CUR);
|
||||||
}
|
}
|
||||||
fread(&evt->traceLenght, 8, 1, inFile);
|
fread(&evt->traceLenght, 8, 1, inFile);
|
||||||
if( opt == 0){
|
if( opt == 0){
|
||||||
|
@ -165,26 +168,28 @@ inline int SolReader::ReadNextBlock(int opt){
|
||||||
}else{
|
}else{
|
||||||
fseek(inFile, 1 + evt->traceLenght*4, SEEK_CUR);
|
fseek(inFile, 1 + evt->traceLenght*4, SEEK_CUR);
|
||||||
}
|
}
|
||||||
}else if( evt->dataType == 2){
|
}else if( evt->dataType == DataFormat::NoTrace){
|
||||||
if( opt == 0 ){
|
if( opt == 0 ){
|
||||||
fread(&evt->channel, 1, 1, inFile);
|
fread(&evt->channel, 1, 1, inFile);
|
||||||
fread(&evt->energy, 2, 1, inFile);
|
fread(&evt->energy, 2, 1, inFile);
|
||||||
|
if( evt->DPPType == DPPType::PSD ) fread(&evt->energy_short, 2, 1, inFile);
|
||||||
fread(&evt->timestamp, 6, 1, inFile);
|
fread(&evt->timestamp, 6, 1, inFile);
|
||||||
fread(&evt->fine_timestamp, 2, 1, inFile);
|
fread(&evt->fine_timestamp, 2, 1, inFile);
|
||||||
fread(&evt->flags_high_priority, 1, 1, inFile);
|
fread(&evt->flags_high_priority, 1, 1, inFile);
|
||||||
fread(&evt->flags_low_priority, 2, 1, inFile);
|
fread(&evt->flags_low_priority, 2, 1, inFile);
|
||||||
}else{
|
}else{
|
||||||
fseek(inFile, 14, SEEK_CUR);
|
fseek(inFile, evt->DPPType == DPPType::PHA ? 14 : 16, SEEK_CUR);
|
||||||
}
|
}
|
||||||
}else if( evt->dataType == 3){
|
}else if( evt->dataType == DataFormat::Minimum){
|
||||||
if( opt == 0 ){
|
if( opt == 0 ){
|
||||||
fread(&evt->channel, 1, 1, inFile);
|
fread(&evt->channel, 1, 1, inFile);
|
||||||
fread(&evt->energy, 2, 1, inFile);
|
fread(&evt->energy, 2, 1, inFile);
|
||||||
|
if( evt->DPPType == DPPType::PSD ) fread(&evt->energy_short, 2, 1, inFile);
|
||||||
fread(&evt->timestamp, 6, 1, inFile);
|
fread(&evt->timestamp, 6, 1, inFile);
|
||||||
}else{
|
}else{
|
||||||
fseek(inFile, 9, SEEK_CUR);
|
fseek(inFile, evt->DPPType == DPPType::PHA ? 9 : 11, SEEK_CUR);
|
||||||
}
|
}
|
||||||
}else if( evt->dataType == 15){
|
}else if( evt->dataType == DataFormat::RAW){
|
||||||
fread(&evt->dataSize, 8, 1, inFile);
|
fread(&evt->dataSize, 8, 1, inFile);
|
||||||
if( opt == 0){
|
if( opt == 0){
|
||||||
fread(evt->data, evt->dataSize, 1, inFile);
|
fread(evt->data, evt->dataSize, 1, inFile);
|
||||||
|
|
|
@ -436,7 +436,7 @@ int MainWindow::StartACQ(){
|
||||||
|
|
||||||
//digi[i]->SetPHADataFormat(1);// only save 1 trace
|
//digi[i]->SetPHADataFormat(1);// only save 1 trace
|
||||||
int dataFormatID = cbDataFormat->currentData().toInt();
|
int dataFormatID = cbDataFormat->currentData().toInt();
|
||||||
digi[i]->SetPHADataFormat(dataFormatID);// only save 1 trace
|
digi[i]->SetDataFormat(dataFormatID);
|
||||||
|
|
||||||
//Additional settings, it is better user to control
|
//Additional settings, it is better user to control
|
||||||
//if( cbDataFormat->currentIndex() < 2 ) {
|
//if( cbDataFormat->currentIndex() < 2 ) {
|
||||||
|
|
4
makeTest
4
makeTest
|
@ -1,5 +1,5 @@
|
||||||
CC = g++
|
CC = g++
|
||||||
COPTS = -fPIC -DLINUX -O2 -std=c++17 -lpthread
|
COPTS = -fPIC -DLINUX -O2 -std=c++17 -lpthread -g
|
||||||
CAENLIBS = -lCAEN_FELib
|
CAENLIBS = -lCAEN_FELib
|
||||||
CURLLIBS = -lcurl
|
CURLLIBS = -lcurl
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ test : test.cpp ClassDigitizer2Gen.o influxdb.o
|
||||||
@echo "------- test"
|
@echo "------- test"
|
||||||
$(CC) $(COPTS) $(OBJS) -o test test.cpp $(CAENLIBS) $(CURLLIBS)
|
$(CC) $(COPTS) $(OBJS) -o test test.cpp $(CAENLIBS) $(CURLLIBS)
|
||||||
#
|
#
|
||||||
ClassDigitizer2Gen.o : ClassDigitizer2Gen.cpp ClassDigitizer2Gen.h Event.h
|
ClassDigitizer2Gen.o : ClassDigitizer2Gen.cpp ClassDigitizer2Gen.h Event.h DigiParameters.h
|
||||||
@echo "------- ClassDigitizer2Gen.o"
|
@echo "------- ClassDigitizer2Gen.o"
|
||||||
$(CC) $(COPTS) -c ClassDigitizer2Gen.cpp $(CAENLIBS)
|
$(CC) $(COPTS) -c ClassDigitizer2Gen.cpp $(CAENLIBS)
|
||||||
#
|
#
|
||||||
|
|
|
@ -474,7 +474,7 @@ void Scope::StartScope(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
digi[iDigi]->SetPHADataFormat(0);
|
digi[iDigi]->SetDataFormat(0); //TODO Should be only trace?
|
||||||
digi[iDigi]->StartACQ();
|
digi[iDigi]->StartACQ();
|
||||||
|
|
||||||
readDataThread[iDigi]->SetSaveData(false);
|
readDataThread[iDigi]->SetSaveData(false);
|
||||||
|
|
16
test.cpp
16
test.cpp
|
@ -86,10 +86,22 @@ int main(int argc, char* argv[]){
|
||||||
|
|
||||||
remove("haha_000.sol");
|
remove("haha_000.sol");
|
||||||
|
|
||||||
const char * url = "dig2://192.168.0.100/";
|
//const char * url = "dig2://192.168.0.100/";
|
||||||
|
const char * url = "dig2://192.168.0.254/";
|
||||||
|
|
||||||
digi->OpenDigitizer(url);
|
digi->OpenDigitizer(url);
|
||||||
digi->Reset();
|
digi->Reset();
|
||||||
|
//digi->ReadValue(PSD::DIG::CupVer, -1, true);
|
||||||
|
digi->ReadAllSettings();
|
||||||
|
|
||||||
|
for( int ch = 0; ch < 64; ch++ ) {
|
||||||
|
printf( "|%s| \n", digi->GetSettingValue(PSD::CH::TimeFilterRetriggerGuard, ch).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
digi->SaveSettingsToFile("test_setting.txt");
|
||||||
|
|
||||||
|
|
||||||
//digi->ProgramDPPBoard(false);
|
//digi->ProgramDPPBoard(false);
|
||||||
|
|
||||||
//printf("--------%s \n", digi->ReadChValue("0..63", "WaveAnalogprobe0", true).c_str());
|
//printf("--------%s \n", digi->ReadChValue("0..63", "WaveAnalogprobe0", true).c_str());
|
||||||
|
@ -98,7 +110,7 @@ int main(int argc, char* argv[]){
|
||||||
|
|
||||||
//printf("===================================\n");
|
//printf("===================================\n");
|
||||||
|
|
||||||
printf("======== index : %d \n", digi->FindIndex(PHA::CH::ChannelEnable));
|
//printf("======== index : %d \n", digi->FindIndex(PHA::CH::ChannelEnable));
|
||||||
|
|
||||||
//digi->LoadSettingsFromFile("settings_21245.dat");
|
//digi->LoadSettingsFromFile("settings_21245.dat");
|
||||||
//printf("%s \n", digi->ReadValue("/ch/0/par/ChRealtimeMonitor").c_str());
|
//printf("%s \n", digi->ReadValue("/ch/0/par/ChRealtimeMonitor").c_str());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user