Commit dc1e3071 authored by Jérémie Dudouet's avatar Jérémie Dudouet
Browse files

correct an error on the cdat type compression (gain a factor 2 in compression :) )

parent 50a0faf8
Pipeline #144252 passed with stage
in 14 minutes and 51 seconds
......@@ -223,20 +223,19 @@ UInt_t CompressedCrystalFrame_::ReadImp()
fCompressedSignal->Import(fBuffer);
unsigned char* CompTrace = ( unsigned char*)fCompressedSignal->Address(&dummy);
unsigned int ll = uncompress_trace(CompTrace,length,seg->GetSignal()->Address(&dummy));
unsigned int nsamp = uncompress_trace(CompTrace,length*2,seg->GetSignal()->Address(&dummy));
seg->GetSignal()->Resize(ll,'n');
seg->GetSignal()->Resize(nsamp,'n');
if(ll != CrystalInterface::kDefaultLength) {
std::cout<<"Error in CrystalFrame.icpp => CrystalInterface::kDefaultLength differ from the uncompressed value" << std::endl;
std::cout<<"CrystalInterface::kDefaultLength = " << CrystalInterface::kDefaultLength << " ; uncompressed trace size: " << ll << std::endl;
if(nsamp != CrystalInterface::kDefaultLength) {
std::cout<<"Error in CrystalFrame.icpp => CrystalInterface::kDefaultLength differ from the uncompressed trace length" << std::endl;
std::cout<<"CrystalInterface::kDefaultLength = " << CrystalInterface::kDefaultLength << " ; uncompressed trace length: " << nsamp << std::endl;
seg->GetSignal()->Reset();
}
}
for (UShort_t i = 0u; i < kNbCores; i++ ) {
GeCore *core = fCore.At(i); (*fBuffer) >> length >> status >> id >> energy >> t;
core->SetStatus(status);
core->SetID(id);
core->SetE(energy);
......@@ -248,16 +247,15 @@ UInt_t CompressedCrystalFrame_::ReadImp()
fCompressedSignal->Import(fBuffer);
unsigned char* CompTrace = ( unsigned char*)fCompressedSignal->Address(&dummy);
unsigned int ll = uncompress_trace(CompTrace,length,core->GetSignal()->Address(&dummy));
unsigned int nsamp = uncompress_trace(CompTrace,length*2,core->GetSignal()->Address(&dummy));
core->GetSignal()->Resize(ll,'n');
core->GetSignal()->Resize(nsamp,'n');
if(ll != CrystalInterface::kDefaultLength) {
std::cout<<"Error in CrystalFrame.icpp => CrystalInterface::kDefaultLength differ from the uncompressed value" << std::endl;
std::cout<<"CrystalInterface::kDefaultLength = " << CrystalInterface::kDefaultLength << " ; uncompressed trace size: " << ll << std::endl;
if(nsamp != CrystalInterface::kDefaultLength) {
std::cout<<"Error in CrystalFrame.icpp => CrystalInterface::kDefaultLength differ from the uncompressed trace length" << std::endl;
std::cout<<"CrystalInterface::kDefaultLength = " << CrystalInterface::kDefaultLength << " ; uncompressed trace length: " << nsamp << std::endl;
core->GetSignal()->Reset();
}
}
return fBuffer->Offset();
}
......@@ -283,7 +281,15 @@ UInt_t CompressedCrystalFrame_::WriteImp()
energy = (Float_t)seg->GetE();
unsigned char* fCompTrace = ( unsigned char*)fCompressedSignal->Address(&dummy);
// as we don't know the compressed size, make sure to have enough space
fCompressedSignal->Resize(CrystalInterface::kDefaultLength,'-');
length = compress_trace(seg->GetSignal()->Address(&dummy),fCompTrace);
// To allow a simplified inspection of the compressed data each trace is aligned to an an even number of bytes
// The possible extra byte has been zeroed by the compression routine;
// The decompression is not influenced by the possible extra byte.
length = (length+1)/2;
fCompressedSignal->Resize(length,'-');
......@@ -299,7 +305,16 @@ UInt_t CompressedCrystalFrame_::WriteImp()
t = (Float_t)core->GetT();
unsigned char* fCompTrace = ( unsigned char*)fCompressedSignal->Address(&dummy);
// as we don't know the compressed size, make sure to have enough space
fCompressedSignal->Resize(CrystalInterface::kDefaultLength,'-');
length = compress_trace(core->GetSignal()->Address(&dummy),fCompTrace);
// To allow a simplified inspection of the compressed data each trace is aligned to an an even number of bytes
// The possible extra byte has been zeroed by the compression routine;
// The decompression is not influenced by the possible extra byte.
length = (length+1)/2;
fCompressedSignal->Resize(length,'-');
(*fBuffer) << length << core->GetStatus() << core->GetID() << energy << t;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment