change enum::DataFormat::RAW to Raw, edited README.md

This commit is contained in:
Ryan Tang 2023-10-13 13:05:59 -04:00
parent 10e734e07d
commit 30f01f5793
6 changed files with 49 additions and 33 deletions

1
.gitignore vendored
View File

@ -12,6 +12,7 @@ screenshot.*
*.dat
Logs
*.png
.gdb_history
*~
*.autosave

View File

@ -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);

14
Hit.h
View File

@ -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;
}

View File

@ -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
@ -86,3 +92,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.
- For PSD, it cannot use minimum dataformat.

View File

@ -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

View File

@ -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);