11 #ifndef LARDATAALG_DUMPERS_RAWDATA_OPDETWAVEFORM_H 12 #define LARDATAALG_DUMPERS_RAWDATA_OPDETWAVEFORM_H 30 using namespace ::
raw;
76 {
return digitsOf(waveform.size()); }
117 template <
typename Stream>
121 template <
typename Stream>
131 static unsigned int digitsOf(
unsigned int n);
149 template <
typename Stream>
155 auto const&
data = waveform;
162 <<
"on channel #" << waveform.
ChannelNumber() <<
" (time stamp: " 163 << waveform.
TimeStamp() <<
"): " <<
data.size() <<
" time ticks";
171 unsigned int repeat_count = 0U;
172 unsigned int index = 0U;
173 unsigned int firstLineTick = 0U;
176 auto flushRepeatCount
177 = [
this, &out, &waveform, &firstLineTick](
unsigned int&
count)
188 out <<
" [ ... repeated " <<
count <<
" more times ]";
198 <<
"content of the channel (" <<
fDigitsPerLine <<
" ticks per line):";
199 auto iTick =
data.cbegin(), tend =
data.cend();
200 while (iTick != tend) {
202 unsigned int line_size
204 if (line_size == 0)
break;
207 DigitBuffer.resize(line_size);
208 auto iBuf = DigitBuffer.begin(), bend = DigitBuffer.end();
209 while ((iBuf != bend) && (iTick != tend))
211 firstLineTick =
index;
215 if (DigitBuffer == LastBuffer) {
222 flushRepeatCount(repeat_count);
234 for (
auto digit: DigitBuffer)
243 flushRepeatCount(repeat_count);
244 if (Extrema.
min() != Extrema.
max()) {
246 <<
" range of " <<
data.size()
247 <<
" samples: [" << Extrema.
min() <<
";" << Extrema.
max() <<
"] (span: " 248 << (Extrema.
max() - Extrema.
min());
250 out <<
", absolute: [" 267 if (s.length() > width) {
269 return {
s, 0U, width };
273 padded.reserve(width);
276 unsigned int nPadding
277 = (s.length() >= width)? 0U: (width - s.length()) / padding.length();
280 if (nPadding * padding.length() + s.length() < width) {
283 padding.end() - (width - (nPadding * padding.length() + s.length())),
289 while (nPadding-- > 0) padded += padding;
292 assert(padded.length() == width);
300 unsigned int digits = 1U;
312 #endif // LARDATAALG_DUMPERS_RAWDATA_OPDETWAVEFORM_H Data_t max() const
Returns the accumulated maximum, or a very small number if no values.
This_t & add(Data_t value)
Include a single value in the statistics.
IndentSettings & restoreIndentSettings()
Restores and returns the last saved settings.
void set(std::string const &newIndent, std::string const &newFirstIndent)
Classes gathering simple statistics.
Keeps track of the minimum and maximum value we observed.
Data_t min() const
Returns the accumulated minimum, or a very large number if no values.
void swap(Handle< T > &a, Handle< T > &b)
std::string const & indent() const
Returns the indentation string currently configured for all lines.
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
decltype(auto) indenter(Stream &&out) const
Returns an Indenter object tied to this dumper and out stream.
Q_EXPORT QTSManip setw(int w)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
IndentSettings & saveIndentSettings()
Stacks a copy of the current settings, and returns the "new" ones.
Base class for data dumpers.
std::string to_string(ModuleType const mt)
Helper base class for implementing data product dump algorithms.