149 int transformSize = fFFT->
FFTSize();
156 std::unique_ptr<std::vector<recob::Wire> > wirecol(
new std::vector<recob::Wire>);
158 std::unique_ptr<art::Assns<raw::RawDigit,recob::Wire> > WireDigitAssn
163 auto digitVecHandle = evt.
getHandle< std::vector<raw::RawDigit> >(itag1);
165 if (!digitVecHandle->size())
return;
166 mf::LogInfo(
"CalWireDUNE35t") <<
"CalWireDUNE35t:: digitVecHandle size is " << digitVecHandle->size();
171 unsigned int dataSize = digitVec0->Samples();
175 int readoutwindowsize = detProp.ReadOutWindowSize();
176 if (
int(dataSize) != readoutwindowsize){
178 <<
"ReadOutWindowSize "<<readoutwindowsize<<
" does not match data size "<<dataSize<<
". Please set services.DetectorPropertiesService.NumberTimeSamples and services.DetectorPropertiesService.ReadOutWindowSize in fcl file to "<<dataSize;
186 std::vector<float> holder;
187 std::vector<short> rawadc(transformSize);
188 std::vector<TComplex> freqHolder(transformSize+1);
191 wirecol->reserve(digitVecHandle->size());
192 for(
size_t rdIter = 0; rdIter < digitVecHandle->size(); ++rdIter){
197 channel = digitVec->Channel();
201 holder.resize(transformSize);
205 int pedestal_value = (
int) digitVec->GetPedestal();
206 raw::Uncompress(digitVec->ADCs(), rawadc, pedestal_value, digitVec->Compression());
210 holder[
bin]=(rawadc[
bin]-digitVec->GetPedestal());
213 for (
bin = dataSize;
bin<holder.size();
bin++){
214 holder[
bin] = (rawadc[
bin-dataSize]-digitVec->GetPedestal());
219 for(
bin = 0;
bin < holder.size(); ++
bin) holder[
bin]=holder[
bin]/DeconNorm;
222 holder.resize(dataSize,1
e-5);
229 for(
bin = 0;
bin < holder.size(); ++
bin) holder[
bin]-=average;
237 std::vector<std::pair<unsigned int, unsigned int>> holderInfo;
238 std::vector<std::pair<unsigned int, unsigned int>> rois;
243 unsigned int roiStart = 0;
245 double SigVal = holder[
bin];
246 if (SigVal > max) max = SigVal;
250 if (SigVal < deconNoise){
251 rois.push_back(std::make_pair(roiStart,
bin));
257 rois.push_back(std::make_pair(roiStart, dataSize-1));
270 if(rois.size() == 0)
continue;
272 for(
unsigned int ii = 0; ii < rois.size(); ++ii) {
276 rois[ii].first = low;
279 if(high >= dataSize) high = dataSize-1;
280 rois[ii].second = high;
284 if(rois.size() >= 1) {
287 for (
unsigned int ii = 0; ii<rois.size();ii++){
288 unsigned int roiStart = rois[ii].first;
289 unsigned int roiEnd = rois[ii].second;
292 unsigned int jj=ii+1;
295 if(rois[jj].first <= roiEnd ) {
296 roiEnd = rois[jj].second;
306 std::vector<float> sigTemp;
307 for(
unsigned int kk = roiStart; kk < roiEnd; ++kk) {
308 sigTemp.push_back(holder[kk]);
329 <<
"Can't associate wire #" << (wirecol->size() - 1)
330 <<
" with raw digit #" << digitVec.key();
334 if(wirecol->size() == 0)
335 mf::LogWarning(
"CalWireDUNE35t") <<
"No wires made for this event.";
void Deconvolute(detinfo::DetectorClocksData const &clockData, Channel channel, std::vector< T > &func) const
unsigned short fPreROIPad
ROI padding.
Handle< PROD > getHandle(SelectorBase const &) const
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
bool BadChannel(uint32_t channel) const
const datarange_t & add_range(size_type offset, ITER first, ITER last)
Adds a sequence of elements as a range with specified offset.
unsigned short fPostROIPad
ROI padding.
Class managing the creation of a new recob::Wire object.
double GetDeconNoise(Channel channel) const override
int fPostsample
number of postsample bins
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
static int max(int a, int b)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
double fSigThrFact
Signal shreshold factor.
void SubtractBaseline(std::vector< float > &holder)
QTextStream & bin(QTextStream &s)
int fDoBaselineSub
number of postsample bins
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.
std::string fDigitModuleLabel
constants
double GetDeconNorm() const override