From 30f01f57935b9861d29660f9e70c92301e7a5b80 Mon Sep 17 00:00:00 2001 From: "Ryan@WorkStation" Date: Fri, 13 Oct 2023 13:05:59 -0400 Subject: [PATCH] change enum::DataFormat::RAW to Raw, edited README.md --- .gitignore | 1 + ClassDigitizer2Gen.cpp | 42 +++++++++++++++++++++++------------------- Hit.h | 14 +++++++------- README.md | 13 ++++++++++--- SOLARIS_Qt6_DAQ.pro | 6 +++++- SolReader.h | 6 +++--- 6 files changed, 49 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index 55f7304..4b68f27 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ screenshot.* *.dat Logs *.png +.gdb_history *~ *.autosave diff --git a/ClassDigitizer2Gen.cpp b/ClassDigitizer2Gen.cpp index d43ffda..9f2ac41 100644 --- a/ClassDigitizer2Gen.cpp +++ b/ClassDigitizer2Gen.cpp @@ -323,10 +323,21 @@ void Digitizer2Gen::StopACQ(){ void Digitizer2Gen::SetDataFormat(unsigned short dataFormat){ - printf("%s : %d\n", __func__, dataFormat); + printf("%s : %d for digi-%d %s\n", __func__, dataFormat, serialNumber, FPGAType.c_str() ); ///========== get endpoint and endpoint folder handle - if( dataFormat != DataFormat::RAW ){ + if( dataFormat == DataFormat::Raw ){ + + ret = CAEN_FELib_GetHandle(handle, "/endpoint/raw", &ep_handle); + ret |= CAEN_FELib_GetParentHandle(ep_handle, NULL, &ep_folder_handle); + ret |= CAEN_FELib_SetValue(ep_folder_handle, "/par/activeendpoint", "raw"); + + if (ret != CAEN_FELib_Success) { + ErrorMsg("Set active endpoint"); + return; + } + + }else{ if( FPGAType == DPPType::PHA ){ ret = CAEN_FELib_GetHandle(handle, "/endpoint/dpppha", &ep_handle); @@ -341,16 +352,6 @@ void Digitizer2Gen::SetDataFormat(unsigned short dataFormat){ return; } - if (ret != CAEN_FELib_Success) { - ErrorMsg("Set active endpoint"); - return; - } - - }else{ - ret = CAEN_FELib_GetHandle(handle, "/endpoint/raw", &ep_handle); - ret |= CAEN_FELib_GetParentHandle(ep_handle, NULL, &ep_folder_handle); - ret |= CAEN_FELib_SetValue(ep_folder_handle, "/par/activeendpoint", "raw"); - if (ret != CAEN_FELib_Success) { ErrorMsg("Set active endpoint"); return; @@ -363,6 +364,7 @@ void Digitizer2Gen::SetDataFormat(unsigned short dataFormat){ dataStartIndetifier = 0xAA00 + dataFormat; if(FPGAType == DPPType::PSD ) dataStartIndetifier += 0x0010; + //^===================================================== PSD if( FPGAType == DPPType::PHA) { if( dataFormat == DataFormat::ALL ){ ret = CAEN_FELib_SetReadDataFormat(ep_handle, @@ -442,6 +444,8 @@ void Digitizer2Gen::SetDataFormat(unsigned short dataFormat){ { \"name\" : \"ENERGY\", \"type\" : \"U16\" } \ ]"); } + + //^===================================================== PSD }else if ( FPGAType == DPPType::PSD ){ if( dataFormat == DataFormat::ALL ){ @@ -520,16 +524,16 @@ void Digitizer2Gen::SetDataFormat(unsigned short dataFormat){ 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\" }, \ + { \"name\" : \"CHANNEL\", \"type\" : \"U8\" }, \ + { \"name\" : \"TIMESTAMP\", \"type\" : \"U64\" }, \ + { \"name\" : \"ENERGY\", \"type\" : \"U16\" }, \ + { \"name\" : \"ENERGY_SHORT\", \"type\" : \"U16\" }, \ ]"); } } - if( dataFormat == DataFormat::RAW ){ + if( dataFormat == DataFormat::Raw ){ ret = CAEN_FELib_SetReadDataFormat(ep_handle, " [ \ { \"name\": \"DATA\", \"type\": \"U8\", \"dim\": 1 }, \ @@ -758,7 +762,7 @@ int Digitizer2Gen::ReadData(){ } hit->isTraceAllZero = true; - }else if( hit->dataType == DataFormat::RAW){ + }else if( hit->dataType == DataFormat::Raw){ ret = CAEN_FELib_ReadData(ep_handle, 100, hit->data, &hit->dataSize, &hit->n_events ); //printf("data size: %lu byte\n", evt.dataSize); @@ -855,7 +859,7 @@ void Digitizer2Gen::SaveDataToFile(){ fwrite(&hit->energy, 2, 1, outFile); if( FPGAType == DPPType::PSD ) fwrite(&hit->energy_short, 2, 1, outFile); fwrite(&hit->timestamp, 6, 1, outFile); - }else if( hit->dataType == DataFormat::RAW){ + }else if( hit->dataType == DataFormat::Raw){ fwrite(&dataStartIndetifier, 2, 1, outFile); fwrite(&hit->dataSize, 8, 1, outFile); fwrite(hit->data, hit->dataSize, 1, outFile); diff --git a/Hit.h b/Hit.h index 948a1de..285c644 100644 --- a/Hit.h +++ b/Hit.h @@ -10,11 +10,11 @@ enum DataFormat{ - ALL = 0, - OneTrace = 1, - NoTrace = 2, - Minimum = 3, - RAW = 0x0A, + ALL = 0x00, + OneTrace = 0x01, + NoTrace = 0x02, + Minimum = 0x03, + Raw = 0x0A, }; @@ -120,7 +120,7 @@ class Hit { DPPType = dppType; ClearMemory(); - if( dataType == DataFormat::RAW){ + if( dataType == DataFormat::Raw){ data = new uint8_t[20*1024*1024]; }else{ analog_probes[0] = new int32_t[MaxTraceLenght]; @@ -241,7 +241,7 @@ class Hit { case DataFormat::OneTrace : printf("============= Type : OneTrace\n"); break; case DataFormat::NoTrace : printf("============= Type : NoTrace\n"); break; case DataFormat::Minimum : printf("============= Type : Minimum\n"); break; - case DataFormat::RAW : printf("============= Type : RAW\n"); return; break; + case DataFormat::Raw : printf("============= Type : Raw\n"); return; break; default : return; } diff --git a/README.md b/README.md index 1acc6d8..4be8c95 100644 --- a/README.md +++ b/README.md @@ -54,14 +54,20 @@ When run stop, it will run the bash script under the directory scripts/endRUnScr Ubuntu 22.04 -CAEN_DIG2_v1.5.3 +CAEN_FELIB_v1.2.2 + (install first) -CAEN_FELIB_v1.2.2 +CAEN_DIG2_v1.5.3 + `sudo apt install qt6-base-dev libcurl4-openssl-dev libqt6charts6-dev` Digitizer firmware V2745-dpp-pha-2022092903.cup +## Developer is using these at 2023-Oct-13 + +CAEN_FELIB_v1.2.5 + +CAEN_DIG2_v1.5.10 + # Compile ## if *.pro does not exist @@ -85,4 +91,5 @@ then ` make` - LVDSTrgMask cannot acess. - 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. \ No newline at end of file +- Event/Wave trig. Source cannot set as SWTrigger. +- For PSD, it cannot use minimum dataformat. \ No newline at end of file diff --git a/SOLARIS_Qt6_DAQ.pro b/SOLARIS_Qt6_DAQ.pro index 0b7442f..3d47f42 100644 --- a/SOLARIS_Qt6_DAQ.pro +++ b/SOLARIS_Qt6_DAQ.pro @@ -8,9 +8,13 @@ INCLUDEPATH += . QT += widgets charts -QMAKE_CXXFLAGS += -g # for gdb debug LIBS += -lcurl -lCAEN_FELib -lX11 +#=========== for GDB debug +#QMAKE_CXXFLAGS += -g # for gdb debug +#QMAKE_CXXFLAGS_RELEASE = -O0 +#QMAKE_CFLAGS_RELEASE = -O0 + # You can make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # Please consult the documentation of the deprecated API in order to know diff --git a/SolReader.h b/SolReader.h index 55b5e21..15a1401 100644 --- a/SolReader.h +++ b/SolReader.h @@ -112,8 +112,8 @@ inline int SolReader::ReadNextBlock(int opt){ return -2 ; } - if( ( blockStartIdentifier & 0xF ) == DataFormat::RAW ){ - hit->SetDataType(DataFormat::RAW, ((blockStartIdentifier >> 1) & 0xF) == 0 ? DPPType::PHA : DPPType::PSD); + if( ( blockStartIdentifier & 0xF ) == DataFormat::Raw ){ + hit->SetDataType(DataFormat::Raw, ((blockStartIdentifier >> 1) & 0xF) == 0 ? DPPType::PHA : DPPType::PSD); } hit->dataType = blockStartIdentifier & 0xF; hit->DPPType = ((blockStartIdentifier >> 4) & 0xF) == 0 ? DPPType::PHA : DPPType::PSD; @@ -189,7 +189,7 @@ inline int SolReader::ReadNextBlock(int opt){ }else{ fseek(inFile, hit->DPPType == DPPType::PHA ? 9 : 11, SEEK_CUR); } - }else if( hit->dataType == DataFormat::RAW){ + }else if( hit->dataType == DataFormat::Raw){ fread(&hit->dataSize, 8, 1, inFile); if( opt == 0){ fread(hit->data, hit->dataSize, 1, inFile);