Skip to content
Snippets Groups Projects

Waveform reconstruction

Merged Eric Torrence requested to merge torrence/calypso:wavereco into master
49 files
+ 2463
13
Compare changes
  • Side-by-side
  • Inline
Files
49
@@ -95,6 +95,7 @@ ScintWaveformDecoderTool::convert(const DAQFormats::EventFull* re,
ATH_MSG_DEBUG("Fragment:\n" << *frag);
digitizer = new DigitizerDataFragment(frag->payload<const uint32_t*>(), frag->payload_size());
break;
}
@@ -103,7 +104,12 @@ ScintWaveformDecoderTool::convert(const DAQFormats::EventFull* re,
return StatusCode::FAILURE;
}
// ATH_MSG_DEBUG("Digitizer Fragment:\n" << *digitizer);
// Check validity here
if (!digitizer->valid()) {
ATH_MSG_WARNING("Found invalid digitizer fragment:\n" << *digitizer);
} else {
ATH_MSG_DEBUG("Found valid digitizer fragment");
}
std::vector<unsigned int>* channelList;
@@ -127,13 +133,18 @@ ScintWaveformDecoderTool::convert(const DAQFormats::EventFull* re,
for (unsigned int channel: *channelList) {
ATH_MSG_DEBUG("Converting channel "+std::to_string(channel)+" for "+key);
// Check if this has data
if (!digitizer->channel_has_data(channel)) {
ATH_MSG_INFO("Channel " << channel << " has no data - skipping!");
continue;
}
ScintWaveform* wfm = new ScintWaveform();
// Finally, set values in Waveform object from Digitizer fragment
try {
wfm->setWaveform( channel, digitizer->channel_adc_counts( channel ) );
} catch ( DigitizerDataException& e ) {
ATH_MSG_INFO("ScintWaveformDecoderTool:\n"
ATH_MSG_WARNING("ScintWaveformDecoderTool:\n"
<<e.what()
<< "\nChannel "
<< channel
@@ -151,12 +162,19 @@ ScintWaveformDecoderTool::convert(const DAQFormats::EventFull* re,
}
container->push_back(wfm);
// Sanity check
if (wfm->adc_counts().size() != wfm->n_samples()) {
ATH_MSG_WARNING("Created waveform channel" << channel << "with length " << wfm->adc_counts().size() << " but header reports n_samples = " << wfm->n_samples() << "!");
ATH_MSG_WARNING(*wfm);
}
}
// Don't spring a leak
delete digitizer;
ATH_MSG_DEBUG( "ScintWaveformDecoderTool created container " << key
<< " with size=" << container->size());
ATH_MSG_DEBUG( "ScintWaveformDecoderTool created container " << key
<< " with size=" << container->size());
return StatusCode::SUCCESS;
}
Loading