LarsoftHuffmanCompressService.h
Go to the documentation of this file.
1 // LarsoftHuffmanCompressService.h
2 //
3 // David Adams
4 // February 2016
5 //
6 // Service to compress an ADC vector using the LArSoft
7 // conventions in larsoft/lardata/RawData/raw.cxx.
8 // Uncompress in that same utility can be used to uncompress.
9 // Data may be put in block format, Huffman encoded or both or neither.
10 // In the latter case, any zero-supressed values are replaced with zero.
11 //
12 // FCL parameters:
13 // UseBlock - Put the data in larsoft block format
14 // UseHuffman - Do Huffman encoding
15 // LogLevel - Log messaging level
16 // 0 - no messages
17 // 1 - Initialization only
18 // 2 - Short message for each event
19 // 3 - Long message for each event
20 // 4 - Very long message for each event
21 
22 #ifndef LarsoftHuffmanCompressService_H
23 #define LarsoftHuffmanCompressService_H
24 
26 
27 namespace fhicl {
28 class ParameterSet;
29 }
30 namespace art {
31 class ActivityRegistry;
32 }
33 
35 
36 public:
37 
38  // Ctor from parameters that characterize the algorithm.
39  LarsoftHuffmanCompressService(bool useBlock, bool useHuffman, int logLevel);
40 
41  // Ctor from fcl.
43 
44  // Compress a vector of signals.
45  // Suppressed signals are replaced with the value of offset + (FCL parameter) Zero.
46  int compress(AdcCountVector& sigs,
47  const AdcFilterVector& keep,
48  AdcCount offset,
49  raw::Compress_t& comp) const;
50 
51  // Print the configuration.
52  std::ostream& print(std::ostream& out =std::cout, std::string prefix =" ") const;
53 
54 private:
55 
56  // Convert to block format.
57  void block(const AdcCountVector& oldsigs, const AdcFilterVector& keep, AdcCountVector& newsigs) const;
58 
59 private:
60 
61  bool m_UseBlock;
64 
65 };
66 
68 
69 #endif
std::vector< AdcCount > AdcCountVector
Definition: AdcTypes.h:19
enum raw::_compress Compress_t
std::string string
Definition: nybbler.cc:12
DECLARE_ART_SERVICE_INTERFACE_IMPL(MySharedService, art::test::MyServiceInterface, SHARED) DEFINE_ART_SERVICE_INTERFACE_IMPL(MySharedService
std::vector< bool > AdcFilterVector
Definition: AdcTypes.h:27
short AdcCount
Definition: AdcTypes.h:18