added Min+fine_timestamp data format

This commit is contained in:
Ryan Tang 2023-11-06 13:45:45 -05:00
parent 7231a3305b
commit 445c31a516
3 changed files with 24 additions and 7 deletions

View File

@ -13,6 +13,8 @@
#define MAX_MULTI 64 #define MAX_MULTI 64
#define MAX_TRACE_LEN 2500 #define MAX_TRACE_LEN 2500
#define tick2ns 8 // 1 tick = 8 ns
SolReader ** reader; SolReader ** reader;
Hit ** hit; Hit ** hit;

View File

@ -14,6 +14,7 @@ enum DataFormat{
OneTrace = 0x01, OneTrace = 0x01,
NoTrace = 0x02, NoTrace = 0x02,
Minimum = 0x03, Minimum = 0x03,
MiniWithFineTime = 0x04,
Raw = 0x0A, Raw = 0x0A,
}; };
@ -240,6 +241,7 @@ class Hit {
case DataFormat::ALL : printf("============= Type : ALL\n"); break; case DataFormat::ALL : printf("============= Type : ALL\n"); break;
case DataFormat::OneTrace : printf("============= Type : OneTrace\n"); break; case DataFormat::OneTrace : printf("============= Type : OneTrace\n"); break;
case DataFormat::NoTrace : printf("============= Type : NoTrace\n"); break; case DataFormat::NoTrace : printf("============= Type : NoTrace\n"); break;
case DataFormat::MiniWithFineTime : printf("============= Type : Min with FineTimestamp\n"); break;
case DataFormat::Minimum : printf("============= Type : Minimum\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; default : return;

View File

@ -10,8 +10,6 @@
#include "Hit.h" #include "Hit.h"
#define tick2ns 8 // 1 tick = 8 ns
class SolReader { class SolReader {
private: private:
FILE * inFile; FILE * inFile;
@ -155,6 +153,7 @@ inline int SolReader::ReadNextBlock(int isSkip){
}else{ }else{
fseek(inFile, 6 + hit->traceLenght*(12), SEEK_CUR); fseek(inFile, 6 + hit->traceLenght*(12), SEEK_CUR);
} }
}else if( hit->dataType == DataFormat::OneTrace){ }else if( hit->dataType == DataFormat::OneTrace){
if( isSkip == 0 ){ if( isSkip == 0 ){
fread(&hit->channel, 1, 1, inFile); fread(&hit->channel, 1, 1, inFile);
@ -174,6 +173,7 @@ inline int SolReader::ReadNextBlock(int isSkip){
}else{ }else{
fseek(inFile, 1 + hit->traceLenght*4, SEEK_CUR); fseek(inFile, 1 + hit->traceLenght*4, SEEK_CUR);
} }
}else if( hit->dataType == DataFormat::NoTrace){ }else if( hit->dataType == DataFormat::NoTrace){
if( isSkip == 0 ){ if( isSkip == 0 ){
fread(&hit->channel, 1, 1, inFile); fread(&hit->channel, 1, 1, inFile);
@ -186,6 +186,18 @@ inline int SolReader::ReadNextBlock(int isSkip){
}else{ }else{
fseek(inFile, hit->DPPType == DPPType::PHA ? 14 : 16, SEEK_CUR); fseek(inFile, hit->DPPType == DPPType::PHA ? 14 : 16, SEEK_CUR);
} }
}else if( hit->dataType == DataFormat::MiniWithFineTime){
if( isSkip == 0 ){
fread(&hit->channel, 1, 1, inFile);
fread(&hit->energy, 2, 1, inFile);
if( hit->DPPType == DPPType::PSD ) fread(&hit->energy_short, 2, 1, inFile);
fread(&hit->timestamp, 6, 1, inFile);
fread(&hit->fine_timestamp, 2, 1, inFile);
}else{
fseek(inFile, hit->DPPType == DPPType::PHA ? 11 : 13, SEEK_CUR);
}
}else if( hit->dataType == DataFormat::Minimum){ }else if( hit->dataType == DataFormat::Minimum){
if( isSkip == 0 ){ if( isSkip == 0 ){
fread(&hit->channel, 1, 1, inFile); fread(&hit->channel, 1, 1, inFile);
@ -195,6 +207,7 @@ inline int SolReader::ReadNextBlock(int isSkip){
}else{ }else{
fseek(inFile, hit->DPPType == DPPType::PHA ? 9 : 11, SEEK_CUR); 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); fread(&hit->dataSize, 8, 1, inFile);
if( isSkip == 0){ if( isSkip == 0){