From 445c31a516ad2b73666edcbb7a4686c4c7b09633 Mon Sep 17 00:00:00 2001 From: "Ryan@WorkStation" Date: Mon, 6 Nov 2023 13:45:45 -0500 Subject: [PATCH] added Min+fine_timestamp data format --- armory/EventBuilder.cpp | 2 ++ armory/Hit.h | 12 +++++++----- armory/SolReader.h | 17 +++++++++++++++-- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/armory/EventBuilder.cpp b/armory/EventBuilder.cpp index 71d6a25..f8749c3 100644 --- a/armory/EventBuilder.cpp +++ b/armory/EventBuilder.cpp @@ -13,6 +13,8 @@ #define MAX_MULTI 64 #define MAX_TRACE_LEN 2500 +#define tick2ns 8 // 1 tick = 8 ns + SolReader ** reader; Hit ** hit; diff --git a/armory/Hit.h b/armory/Hit.h index 285c644..27ff1f2 100644 --- a/armory/Hit.h +++ b/armory/Hit.h @@ -14,6 +14,7 @@ enum DataFormat{ OneTrace = 0x01, NoTrace = 0x02, Minimum = 0x03, + MiniWithFineTime = 0x04, Raw = 0x0A, }; @@ -237,11 +238,12 @@ class Hit { void PrintAll(){ switch(dataType){ - case DataFormat::ALL : printf("============= Type : ALL\n"); break; - 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::ALL : printf("============= Type : ALL\n"); break; + case DataFormat::OneTrace : printf("============= Type : OneTrace\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::Raw : printf("============= Type : Raw\n"); return; break; default : return; } diff --git a/armory/SolReader.h b/armory/SolReader.h index eab99d8..8761666 100644 --- a/armory/SolReader.h +++ b/armory/SolReader.h @@ -10,8 +10,6 @@ #include "Hit.h" -#define tick2ns 8 // 1 tick = 8 ns - class SolReader { private: FILE * inFile; @@ -155,6 +153,7 @@ inline int SolReader::ReadNextBlock(int isSkip){ }else{ fseek(inFile, 6 + hit->traceLenght*(12), SEEK_CUR); } + }else if( hit->dataType == DataFormat::OneTrace){ if( isSkip == 0 ){ fread(&hit->channel, 1, 1, inFile); @@ -174,6 +173,7 @@ inline int SolReader::ReadNextBlock(int isSkip){ }else{ fseek(inFile, 1 + hit->traceLenght*4, SEEK_CUR); } + }else if( hit->dataType == DataFormat::NoTrace){ if( isSkip == 0 ){ fread(&hit->channel, 1, 1, inFile); @@ -186,6 +186,18 @@ inline int SolReader::ReadNextBlock(int isSkip){ }else{ 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){ if( isSkip == 0 ){ fread(&hit->channel, 1, 1, inFile); @@ -195,6 +207,7 @@ inline int SolReader::ReadNextBlock(int isSkip){ }else{ fseek(inFile, hit->DPPType == DPPType::PHA ? 9 : 11, SEEK_CUR); } + }else if( hit->dataType == DataFormat::Raw){ fread(&hit->dataSize, 8, 1, inFile); if( isSkip == 0){