78 Name(
"rawDigitLabel"),
79 Comment(
"input tag for the original raw::RawDigit collection")
83 Name(
"compressionType"),
84 Comment(
"compression mode code (e.g. \"kHuffman\")")
89 Comment(
"instance name for the output data product (none by default)"),
163 std::string toupper(std::string
s) {
166 std::transform(s.begin(), s.end(), s.begin(), (int(*)(int)) std::toupper);
178 auto oldRawDigitHandle
179 =
event.getValidHandle<std::vector<raw::RawDigit>>(
fRawDigitLabel);
181 auto newRawDigits = std::make_unique<std::vector<raw::RawDigit>>();
186 std::set<raw::Compress_t> formats;
190 formats.insert(oldDigits.Compression());
224 ADCs.shrink_to_fit();
240 std::string SPEC(toupper(spec));
242 if ((SPEC ==
"NONE" ) || (SPEC ==
"KNONE" ))
return raw::kNone ;
243 if ((SPEC ==
"HUFFMAN" ) || (SPEC ==
"KHUFFMAN" ))
return raw::kHuffman ;
245 if ((SPEC ==
"ZEROHUFFMAN" ) || (SPEC ==
"KZEROHUFFMAN" ))
return raw::kZeroHuffman ;
246 if ((SPEC ==
"DYNAMICDEC" ) || (SPEC ==
"KDYNAMICDEC" ))
return raw::kDynamicDec ;
250 <<
"Unrecognized compression type: '" << spec <<
"'\n";
const ADCvector_t & ADCs() const
Reference to the compressed ADC count vector.
enum raw::_compress Compress_t
Collection of charge vs time digitized from a single readout channel.
ChannelID_t Channel() const
DAQ channel this raw data was read from.
std::vector< short > ADCvector_t
Type representing a (compressed) vector of ADC counts.
Definition of basic raw digits.
Zero Suppression followed by Huffman Encoding.
unsigned short Samples() const
Number of samples in the uncompressed ADC data.
Zero Suppression algorithm.
#define DEFINE_ART_MODULE(klass)
art::InputTag fRawDigitLabel
tag of input raw digit collection
raw::Compress_t fCompressionType
type of compression to be applied
Collect all the RawData header files together.
static raw::Compress_t parseCompressionType(std::string spec)
Returns the compression mode corresponding to the specified string.
raw::Compress_t Compression() const
Compression algorithm used to store the ADC counts.
static raw::RawDigit recompress(raw::RawDigit const &digit, Compress_t newFormat, bool force=false)
Returns a RawDigit with its waveform compressed in newFormat
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::string fInstanceName
instance name of output data product
RecompressRawDigits(Parameters const &config)
Constructor; see module documentation for configuration directions.
fhicl::Atom< std::string > instanceName
void Compress(std::vector< short > &adc, raw::Compress_t compress)
Compresses a raw data buffer.
fhicl::Atom< art::InputTag > rawDigitLabel
fhicl::Atom< std::string > compressionType
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
virtual void produce(art::Event &event) override
Writes the input raw::RawDigit with a different compression.
Event finding and building.