Skip to content
Snippets Groups Projects
Commit b3e5b13f authored by Giovanna Lazzari Miotto's avatar Giovanna Lazzari Miotto :mushroom: Committed by RoccoA97
Browse files

fix, ref: Use Fill for everything part 2. Fixes bad pointer in CaloSum

parent adf8dffc
No related branches found
No related tags found
1 merge request!98Reduce wait time for writing the EoR file
...@@ -32,8 +32,7 @@ int BmtfOrbitProcessor::ProcessBlock(uint32_t bx, uint32_t orbit, bool has_heade ...@@ -32,8 +32,7 @@ int BmtfOrbitProcessor::ProcessBlock(uint32_t bx, uint32_t orbit, bool has_heade
// as well as the warning test enable flag. // as well as the warning test enable flag.
uint32_t header = uint32_t{(static_cast<uint32_t>(has_header) << 8) + bx_data.count}; uint32_t header = uint32_t{(static_cast<uint32_t>(has_header) << 8) + bx_data.count};
writer.Fill(BxMetadataType{header, bx, orbit}); writer.Fill(BxMetadataType{header, bx, orbit});
writer.Fill(bx_data.GetBuffer(), bx_data.GetSize());
bx_data.FillBuffer(writer.GetDoublePtr());
return bx_data.count; // Original incremented counts by sCount return bx_data.count; // Original incremented counts by sCount
} }
\ No newline at end of file
...@@ -11,20 +11,15 @@ int CaloSumOrbitProcessor::ProcessBlock(uint32_t bx, uint32_t orbit, bool, Write ...@@ -11,20 +11,15 @@ int CaloSumOrbitProcessor::ProcessBlock(uint32_t bx, uint32_t orbit, bool, Write
using SourceDataType = blockCaloSum; using SourceDataType = blockCaloSum;
using SinkDataType = uint32_t; using SinkDataType = uint32_t;
using BxMetadata = DataBuffer<BxMetadataType, 1>; // const uint32_t source_data_length = 6;
const uint32_t source_data_length = 6;
assert(reader.CheckBounds(sizeof(SourceDataType))); assert(reader.CheckBounds(sizeof(SourceDataType)));
assert(writer.CheckBounds(GetPacketSize())); // Max size a decoded block can use assert(writer.CheckBounds(GetPacketSize())); // Max size a decoded block can use
SourceDataType *bl = reader.Scan<SourceDataType>(); SourceDataType *bl = reader.Scan<SourceDataType>();
writer.Fill(BxMetadataType{bx, orbit});
// BxData<SinkDataType, source_data_length> bx_data; // BxData<SinkDataType, source_data_length> bx_data;
writer.Fill(BxMetadataType{bx, orbit});
memcpy(*writer.GetDoublePtr(), (char *)&bl->calo_sum, sizeof(bl->calo_sum)); writer.Fill(bl->calo_sum, sizeof(bl->calo_sum));
(*writer.GetDoublePtr()) += sizeof(bl->calo_sum);
return 6; // Original left counts at zero return 6; // Original left counts at zero
} }
\ No newline at end of file
...@@ -38,11 +38,7 @@ class OrbitProcessor : public Processor { ...@@ -38,11 +38,7 @@ class OrbitProcessor : public Processor {
void Add(T v) { data[count++] = v; } void Add(T v) { data[count++] = v; }
void FillBuffer(char **write_pointer) { private:
memcpy(*write_pointer, &data, GetSize());
(*write_pointer) += GetSize();
}
const static uint32_t max_elem = N; const static uint32_t max_elem = N;
T data[max_elem]; T data[max_elem];
uint32_t count = 0; uint32_t count = 0;
......
...@@ -10,7 +10,6 @@ int UgtOrbitProcessor::ProcessBlock(uint32_t bx, uint32_t orbit, bool, Writeable ...@@ -10,7 +10,6 @@ int UgtOrbitProcessor::ProcessBlock(uint32_t bx, uint32_t orbit, bool, Writeable
}; };
using SourceDataType = blockUgt; using SourceDataType = blockUgt;
// using BxMetadata = DataBuffer<BxMetadataType, 1>;
assert(reader.CheckBounds(sizeof(SourceDataType))); assert(reader.CheckBounds(sizeof(SourceDataType)));
assert(writer.CheckBounds(GetPacketSize())); // Max size a decoded block can use assert(writer.CheckBounds(GetPacketSize())); // Max size a decoded block can use
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment