#include <LarsoftHuffmanCompressService.h>
LarsoftHuffmanCompressService::LarsoftHuffmanCompressService |
( |
bool |
useBlock, |
|
|
bool |
useHuffman, |
|
|
int |
logLevel |
|
) |
| |
Definition at line 112 of file LarsoftHuffmanCompressService_service.cc.
113 const unsigned int adcsize = sigsin.size();
114 std::vector<short> zerosuppressed(sigsin.size());
115 unsigned int maxblocks = adcsize/2 + 1;
116 std::vector<short> blockbegin(maxblocks);
117 std::vector<short> blocksize(maxblocks);
118 unsigned int nblocks = 0;
119 unsigned int zerosuppressedsize = 0;
120 bool inblock =
false;
121 for (
unsigned int i=0; i<adcsize; ++i ) {
124 blockbegin[nblocks] = i;
125 blocksize[nblocks] = 0;
128 zerosuppressed[zerosuppressedsize] = sigsin[i];
129 ++zerosuppressedsize;
130 ++blocksize[nblocks];
131 if ( i == adcsize-1 ) ++nblocks;
132 }
else if ( inblock ) {
140 sigsout.resize(2+nblocks+nblocks+zerosuppressedsize);
141 sigsout[0] = adcsize;
142 sigsout[1] = nblocks;
143 for (
unsigned int i=0; i<nblocks; ++i ) sigsout[i+2] = blockbegin[i];
144 for (
unsigned int i=0; i<nblocks; ++i ) sigsout[i+nblocks+2] = blocksize[i];
145 for (
unsigned int i=0; i<zerosuppressedsize; ++i ) sigsout[i+nblocks+nblocks+2] = zerosuppressed[i];
Implements AdcCompressService.
Definition at line 62 of file LarsoftHuffmanCompressService_service.cc.
64 const string myname =
"LarsoftHuffmanCompressService::compress: ";
65 if ( keep.size() != sigs.size() ) {
66 cout <<
"ERROR: Filter and ADC have different sizes: " << keep.size()
67 <<
" != " << sigs.size() <<
endl;
72 logsigs(sigs,
m_LogLevel, 6, myname +
"Before compression");
73 logsigs(keep,
m_LogLevel, 6, myname +
"Filter");
76 for (
bool val : keep )
if (
val ) ++nkeep;
77 cout << myname <<
"Keeping " << nkeep <<
"/" << keep.size() <<
" ticks" <<
endl;
80 block(sigs, keep, newsigs);
85 repsvc.
compress(sigs, keep, offset, comp);
92 logsigs(sigs,
m_LogLevel, 5, myname +
"After compression");
void CompressHuffman(std::vector< short > &adc)
std::vector< AdcCount > AdcCountVector
void block(const AdcCountVector &oldsigs, const AdcFilterVector &keep, AdcCountVector &newsigs) const
Zero Suppression followed by Huffman Encoding.
Zero Suppression algorithm.
int compress(AdcCountVector &sigs, const AdcFilterVector &keep, AdcCount offset, raw::Compress_t &comp) const
QTextStream & endl(QTextStream &s)
ostream & LarsoftHuffmanCompressService::print |
( |
std::ostream & |
out = std::cout , |
|
|
std::string |
prefix = " " |
|
) |
| const |
|
virtual |
int LarsoftHuffmanCompressService::m_LogLevel |
|
private |
bool LarsoftHuffmanCompressService::m_UseBlock |
|
private |
bool LarsoftHuffmanCompressService::m_UseHuffman |
|
private |
The documentation for this class was generated from the following files: