From 0ad5d9cd30a7a8cd47940f7456499e4f43ff0aef Mon Sep 17 00:00:00 2001 From: Gordon McCann Date: Mon, 23 May 2022 09:23:12 -0400 Subject: [PATCH] Hotfix for bug in handling waves data. Properly size first hit when peaking number of samples. Limit amount of dynamic memory allocation when reading in data. Fix ROOT weirdness when using uint64_t for a branch by making DPPChannel calibrated energy int64_t (hardly ever used) --- src/evb/CompassFile.cpp | 12 +++++++----- src/evb/CompassFile.h | 1 + src/evbdict/DataStructs.h | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/evb/CompassFile.cpp b/src/evb/CompassFile.cpp index 939a7bf..f6c9e0f 100644 --- a/src/evb/CompassFile.cpp +++ b/src/evb/CompassFile.cpp @@ -90,8 +90,8 @@ namespace EventBuilder { if(IsWaves()) { m_hitsize += 5; - char* firstHit = new char[24]; //A compass hit by default has 24 bytes (at least in our setup) - m_file->read(firstHit, 24); + char* firstHit = new char[m_hitsize]; //A compass hit by default has 24 bytes (at least in our setup) + m_file->read(firstHit, m_hitsize); firstHit += m_hitsize - 4; uint32_t nsamples = *((uint32_t*) firstHit); m_hitsize += nsamples * 2; //Each sample is a 2 byte data value @@ -184,16 +184,18 @@ namespace EventBuilder { m_bufferIter += 1; m_currentHit.Ns = *((uint32_t*)m_bufferIter); m_bufferIter += 4; - for(uint32_t i=0; iGetShift(gchan); } diff --git a/src/evb/CompassFile.h b/src/evb/CompassFile.h index 193bb70..457d56b 100644 --- a/src/evb/CompassFile.h +++ b/src/evb/CompassFile.h @@ -64,6 +64,7 @@ namespace EventBuilder { bool m_hitUsedFlag; int m_bufsize = 200000; //size of the buffer in hits int m_hitsize; //size of a CompassHit in bytes (without alignment padding) + int m_channels_per_board = 16; //Number of channels per digitzer board, important for generating id! uint16_t m_header; int m_buffersize; diff --git a/src/evbdict/DataStructs.h b/src/evbdict/DataStructs.h index d28a09f..db8160a 100644 --- a/src/evbdict/DataStructs.h +++ b/src/evbdict/DataStructs.h @@ -13,7 +13,7 @@ struct DPPChannel { double Timestamp; int Channel, Board, Energy, EnergyShort; - uint64_t EnergyCal; + int64_t EnergyCal; int Flags; std::vector Samples; };