21 #include "larrecodnn/ImagePatternAlgs/ToolInterfaces/IWaveformRecog.h" 32 #include "cetlib_except/exception.h" 41 class WaveformRoiFinder;
77 <<
"Both RawProducerLabel and WireProducerLabel are empty";
82 <<
"Only one of RawProducerLabel and WireProducerLabel should be set";
85 auto const*
geo = lar::providerFrom<geo::Geometry>();
90 auto const tool_psets = p.get<std::vector<fhicl::ParameterSet>>(
"WaveformRecogs");
91 fWaveformSize = tool_psets[0].get<
unsigned int>(
"WaveformSize");
92 for (
auto const& pset : tool_psets) {
96 produces<std::vector<recob::Wire>>();
102 std::vector<art::Ptr<raw::RawDigit>> rawlist;
106 std::vector<art::Ptr<recob::Wire>> wirelist;
110 std::unique_ptr<std::vector<recob::Wire>> outwires(
new std::vector<recob::Wire>);
112 auto const*
geo = lar::providerFrom<geo::Geometry>();
117 for (
unsigned int ich = 0; ich < (rawlist.empty() ? wirelist.size() : rawlist.size()); ++ich) {
123 if (!wirelist.empty()) {
124 const auto& wire = wirelist[ich];
125 const auto& signal = wire->Signal();
129 for (
size_t itck = 0; itck < inputsignal.size(); ++itck) {
130 inputsignal[itck] = signal[itck];
133 else if (!rawlist.empty()) {
134 const auto& digitVec = rawlist[ich];
136 view =
geo->View(rawlist[ich]->Channel());
139 raw::Uncompress(digitVec->ADCs(), rawadc, digitVec->GetPedestal(), digitVec->Compression());
140 for (
size_t itck = 0; itck < rawadc.size(); ++itck) {
141 inputsignal[itck] = rawadc[itck] - digitVec->GetPedestal();
149 std::vector<float> sigs;
150 int lastsignaltick = -1;
160 sigs.push_back(inputsignal[i]);
165 if (
int(i) != lastsignaltick + 1) {
166 rois.
add_range(roistart, std::move(sigs));
168 sigs.push_back(inputsignal[i]);
173 sigs.push_back(inputsignal[i]);
179 if (!sigs.empty()) { rois.
add_range(roistart, std::move(sigs)); }
180 if (!wirelist.empty() && hasROI) {
181 outwires->emplace_back(
recob::Wire(rois, wirelist[ich]->Channel(), wirelist[ich]->View()));
183 else if (!rawlist.empty() && hasROI) {
184 outwires->emplace_back(
185 recob::Wire(rois, rawlist[ich]->Channel(),
geo->View(rawlist[ich]->Channel())));
189 e.
put(std::move(outwires));
Utilities related to art service access.
EDProducer(fhicl::ParameterSet const &pset)
const datarange_t & add_range(size_type offset, ITER first, ITER last)
Adds a sequence of elements as a range with specified offset.
Definition of basic raw digits.
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
#define DEFINE_ART_MODULE(klass)
Collect all the RawData header files together.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Class holding the regions of interest of signal from a channel.
Declaration of basic channel signal object.
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
Namespace collecting geometry-related classes utilities.
art framework interface to geometry description
cet::coded_exception< error, detail::translate > exception