66 Name(
"OpDetWaveformsTag"),
67 Comment(
"input tag of the raw::OpDetWaveform collection to be dumped")};
70 Comment(
"name of the category used for the output"),
71 "DumpOpDetWaveforms"};
74 Name(
"DigitsPerLine"),
75 Comment(
"the dump of ADC readings will put this many of them for each line"),
80 Comment(
"ADC readings are written relative to this number"),
84 Name(
"SortByChannelAndTime"),
85 Comment(
"waveforms are dumped in channel number order, and then timestamp"),
90 Comment(
"write an index in front of each digit dump line; choose between:" 91 " \"tick\" (waveform tick number)" 92 ", \"timestamp\" (electronics clock time in microseconds)" 93 ", \"none\" (no tick label)"),
120 unsigned int tick)
const override 134 std::unique_ptr<dump::raw::OpDetWaveformDumper::TimeLabelMaker>
fTimeLabel;
137 static std::vector<std::vector<raw::OpDetWaveform const*>>
groupByChannel(
138 std::vector<raw::OpDetWaveform>
const& waveforms);
141 static void sortByTimestamp(std::vector<raw::OpDetWaveform const*>& waveforms);
159 std::string
const tickLabelStr = config().TickLabel();
160 if (tickLabelStr ==
"none") {
163 else if (tickLabelStr ==
"tick") {
164 fTimeLabel = std::make_unique<dump::raw::OpDetWaveformDumper::TickLabelMaker>();
166 else if (tickLabelStr ==
"time") {
167 auto const clock_data =
169 fTimeLabel = std::make_unique<TimestampLabelMaker>(clock_data.OpticalClock().TickPeriod());
173 <<
"Invalid choice '" << tickLabelStr <<
"' for time label.\n";
183 auto const& Waveforms =
event.getProduct<std::vector<raw::OpDetWaveform>>(
fOpDetWaveformsTag);
189 << Waveforms.size() <<
" optical detector channels";
192 <<
"A pedestal of " <<
fPedestal <<
" counts will be subtracted from all ADC readings.";
207 for (
auto& channelWaveforms : groupedWaveforms) {
208 if (channelWaveforms.empty())
continue;
211 auto const channel = channelWaveforms.front()->ChannelNumber();
214 << channelWaveforms.size() <<
" waveforms:";
218 dump(log, *pWaveform);
229 std::vector<raw::OpDetWaveform>
const& waveforms)
231 std::vector<std::vector<raw::OpDetWaveform const*>> groups;
232 for (
auto const& waveform : waveforms) {
233 auto const channel = waveform.ChannelNumber();
234 if (groups.size() <= channel) groups.resize(channel + 1);
235 groups[channel].push_back(&waveform);
244 struct ChannelSorter {
265 std::sort(waveforms.begin(), waveforms.end(), ChannelSorter());
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
Detector simulation of raw signals on wires.
EDAnalyzer(fhicl::ParameterSet const &pset)
pure virtual base interface for detector clocks
#define DEFINE_ART_MODULE(klass)
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Collection of utilities for dumping data on screen.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Event finding and building.