186 art::ServiceHandle<geo::Geometry> geom;
188 std::vector<double> decayConsts;
189 std::vector<int> kernMap;
190 std::vector<std::vector<std::complex<double>>> kernel;
192 if(
evt.isRealData()) {
204 std::unique_ptr<std::vector<recob::Wire> > wirecol(
new std::vector<recob::Wire>);
206 std::unique_ptr<art::Assns<raw::RawDigit,recob::Wire> > WireDigitAssn
207 (
new art::Assns<raw::RawDigit,recob::Wire>);
210 art::Handle< std::vector<raw::RawDigit> > digitVecHandle;
213 if (!digitVecHandle->size())
return;
214 mf::LogInfo(
"RecoWireICARUS") <<
"RecoWireICARUS:: digitVecHandle size is " << digitVecHandle->size();
217 art::Ptr<raw::RawDigit> digitVec0(digitVecHandle, 0);
219 unsigned int dataSize = digitVec0->Samples();
221 int transformSize = dataSize;
225 icarus_signal_processing::ICARUSFFT<double> fft(transformSize);
227 double decayConst = 0.;
228 double fitAmplitude = 0.;
229 std::vector<float> holder;
230 std::vector<float> shortADC;
231 std::vector<float> longADC;
232 std::vector<short> rawadc(transformSize);
233 std::vector<std::complex<double>> freqHolder(transformSize+1);
234 wirecol->reserve(digitVecHandle->size());
236 for(
unsigned int rdIter = 0; rdIter < digitVecHandle->size(); ++rdIter){
239 art::Ptr<raw::RawDigit> digitVec(digitVecHandle, rdIter);
240 channel = digitVec->Channel();
242 holder.resize(transformSize);
243 shortADC.resize(transformSize);
244 longADC.resize(transformSize);
250 holder[
bin]=(rawadc[
bin]-digitVec->GetPedestal());
259 throw cet::exception(
"RecoWireICARUS") <<
"Bad signal type = " << sigtype <<
"\n";
260 if (k >= kernel.size())
261 throw cet::exception(
"RecoWireICARUS") <<
"kernel size < " << k <<
"!\n";
272 for (
int ijk=0; ijk<30; ijk++) {
273 if ((
int(
bin)-ijk)>=0 && (
bin+ijk)<4096) {
282 if(shortADC[
bin]==0)holder[
bin]=0;
287 holder[
bin]+= holder[
bin-1];
291 if(shortADC[
bin]==0)holder[
bin]=0;
330 TH1D expTailData(
"expTailData",
"Tail data for fit",
332 TF1 expFit(
"expFit",
"[0]*exp([1]*x)");
336 decayConst = decayConsts[channel];
338 expFit.FixParameter(1,decayConst);
339 expFit.SetParameter(0,fitAmplitude);
340 expTailData.Fit(&expFit,
"QWN",
"",dataSize-
fExpEndBins,dataSize);
341 expFit.SetRange(dataSize,transformSize);
343 holder[dataSize+
bin]= expFit.Eval(
bin+dataSize);
356 std::copy(holder.begin(),holder.end(),temp.begin());
357 fft.convolute(temp,kernel[k],0);
358 std::copy(temp.begin(),temp.end(),holder.begin());
365 for(
bin = 0;
bin < holder.size(); ++
bin) holder[
bin]-=average;
372 throw art::Exception(art::errors::ProductRegistrationFailure)
373 <<
"Can't associate wire #" << (wirecol->size() - 1)
374 <<
" with raw digit #" << digitVec.key();
378 if(wirecol->size() == 0)
379 mf::LogWarning(
"RecoWireICARUS") <<
"No wires made for this event.";
381 evt.put(std::move(wirecol));
382 evt.put(std::move(WireDigitAssn));
std::vector< std::vector< std::complex< double > > > fKernelS
std::vector< double > fDecayConstsR
std::vector< double > fDecayConstsS
int fExpEndBins
number of end bins to consider for tail fit
Class managing the creation of a new recob::Wire object.
constexpr details::BinObj< T > bin(T value)
Returns a wrapper to print the specified data in binary format.
std::vector< int > fKernMapR
std::string fDigitModuleLabel
module that made digits
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
Signal from induction planes.
enum geo::_plane_sigtype SigType_t
int fPostsample
number of postsample bins
std::vector< SigProcPrecision > TimeVec
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
std::vector< std::vector< std::complex< double > > > fKernelR
std::vector< int > fKernMapS
unsigned int ChannelID_t
Type representing the ID of a readout channel.
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
Signal from collection planes.