41 fhicl::Comment(
"Number of remaining ticks to keep after initial drop"),
45 fhicl::Comment(
"A multiplicative scale factor applied to the output recob::Wires"),
101 const size_t nraw = raw->size();
106 const size_t nsig = sig->size();
114 std::unordered_map<raw::ChannelID_t, art::Ptr<raw::RawDigit> > chid2rawptr;
117 auto outrsa = std::make_unique< art::Assns<raw::RawDigit,recob::Wire> >();
118 auto outraw = std::make_unique< std::vector<raw::RawDigit> >();
119 auto outsig = std::make_unique< std::vector<recob::Wire> >();
126 for (
size_t iraw=0; iraw != nraw; ++iraw) {
127 const auto& inrd = raw->at(iraw);
128 const auto& inadcs = inrd.ADCs();
129 const size_t inlen = inadcs.size();
131 const int outlen =
std::min(inlen-ndrop, nkeep < 0 ? inlen : nkeep);
137 size_t outind = outraw->size();
142 auto& outrd = outraw->back();
143 outrd.SetPedestal(inrd.GetPedestal(), inrd.GetSigma());
145 chid2rawptr[chid] = RawPtr(outind);
150 for (
size_t isig=0; isig != nsig; ++isig) {
151 const auto& inw = sig->at(isig);
152 std::vector<float> wave = inw.Signal();
153 const size_t inlen = wave.size();
155 const int outlen =
std::min(inlen-ndrop, nkeep < 0 ? inlen : nkeep);
161 const auto chid = inw.Channel();
162 const auto view = inw.View();
166 auto first = wave.begin()+ndrop;
167 auto done = wave.begin()+ndrop+outlen;
170 beg = std::find_if(beg, done, [](
float v){
return v != 0.0;});
174 auto end = std::find_if(beg, done, [](
float v){
return v == 0.0;});
176 std::vector<float> scaled(beg,
end);
177 for (
int ind=0; ind<
end-beg; ++ind) {
178 scaled[ind] *= sigscale;
180 roi.
add_range(beg-first, scaled.begin(), scaled.end());
184 const size_t outind = outsig->size();
185 outsig->emplace_back(
recob::Wire(roi, chid, view));
188 auto rawit = chid2rawptr.find(chid);
189 if (rawit == chid2rawptr.end()) {
192 auto const& rawptr = rawit->second;
193 auto const sigptr = SigPtr(outind);
194 outrsa->addSingle(rawptr, sigptr);
Collection of charge vs time digitized from a single readout channel.
std::vector< short > ADCvector_t
Type representing a (compressed) vector of ADC counts.
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.
fhicl::Atom< double > sigscale
fhicl::Atom< std::string > outRawTag
fhicl::Atom< std::string > outAssnTag
#define DEFINE_ART_MODULE(klass)
fhicl::Atom< std::string > inSigTag
void produce(art::Event &evt)
fhicl::Atom< std::string > inRawTag
fhicl::Atom< std::string > outSigTag
EventButcher(Parameters const ¶ms)
Class holding the deconvoluted signals from a channel.
Declaration of basic channel signal object.
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
const EventButcherConfig m_cfg
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Event finding and building.