43 fhicl::Comment(
"Number of remaining ticks to keep after initial drop"),
47 fhicl::Comment(
"A multiplicative scale factor applied to the output recob::Wires"),
103 const size_t nraw = raw->size();
108 const size_t nsig = sig->size();
116 std::unordered_map<raw::ChannelID_t, art::Ptr<raw::RawDigit> > chid2rawptr;
119 auto outrsa = std::make_unique< art::Assns<raw::RawDigit,recob::Wire> >();
120 auto outraw = std::make_unique< std::vector<raw::RawDigit> >();
121 auto outsig = std::make_unique< std::vector<recob::Wire> >();
128 for (
size_t iraw=0; iraw != nraw; ++iraw) {
129 const auto& inrd = raw->at(iraw);
130 const auto& inadcs = inrd.ADCs();
131 const size_t inlen = inadcs.size();
133 const int outlen =
std::min(inlen-ndrop, nkeep < 0 ? inlen : nkeep);
139 size_t outind = outraw->size();
144 auto& outrd = outraw->back();
145 outrd.SetPedestal(inrd.GetPedestal(), inrd.GetSigma());
147 chid2rawptr[chid] = RawPtr(outind);
152 for (
size_t isig=0; isig != nsig; ++isig) {
153 const auto& inw = sig->at(isig);
154 std::vector<float> wave = inw.Signal();
155 const size_t inlen = wave.size();
157 const int outlen =
std::min(inlen-ndrop, nkeep < 0 ? inlen : nkeep);
163 const auto chid = inw.Channel();
164 const auto view = inw.View();
168 auto first = wave.begin()+ndrop;
169 auto done = wave.begin()+ndrop+outlen;
172 beg = std::find_if(beg, done, [](
float v){
return v != 0.0;});
176 auto end = std::find_if(beg, done, [](
float v){
return v == 0.0;});
178 std::vector<float> scaled(beg,
end);
179 for (
int ind=0; ind<
end-beg; ++ind) {
180 scaled[ind] *= sigscale;
182 roi.
add_range(beg-first, scaled.begin(), scaled.end());
186 const size_t outind = outsig->size();
187 outsig->emplace_back(
recob::Wire(roi, chid, view));
190 auto rawit = chid2rawptr.find(chid);
191 if (rawit == chid2rawptr.end()) {
194 auto const& rawptr = rawit->second;
195 auto const sigptr = SigPtr(outind);
196 outrsa->addSingle(rawptr, sigptr);
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
Collection of charge vs time digitized from a single readout channel.
ChannelGroupService::Name Name
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.
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
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
EventButcher(Parameters const ¶ms)
Class holding the regions of interest of signal from a channel.
Declaration of basic channel signal object.
const EventButcherConfig m_cfg
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Event finding and building.