137 int transformSize = fFFT->
FFTSize();
144 std::unique_ptr<std::vector<recob::Wire> > wirecol(
new std::vector<recob::Wire>);
146 std::unique_ptr<art::Assns<raw::RawDigit,recob::Wire> > WireDigitAssn
151 auto digitVecHandle = evt.
getHandle< std::vector<raw::RawDigit> >(itag1);
154 if (digitVecHandle->size())
156 mf::LogInfo(
"CalWireDUNEDPhase") <<
"CalWireDUNEDPhase:: digitVecHandle size is " << digitVecHandle->size();
161 unsigned int dataSize = digitVec0->Samples();
164 int readoutwindowsize = detProp.ReadOutWindowSize();
165 if (
int(dataSize) != readoutwindowsize){
167 <<
"ReadOutWindowSize "<<readoutwindowsize<<
" does not match data size "<<dataSize<<
". Please set services.DetectorPropertiesService.NumberTimeSamples and services.DetectorPropertiesService.ReadOutWindowSize in fcl file to "<<dataSize;
175 std::vector<float> holder;
176 std::vector<short> rawadc(transformSize);
177 std::vector<TComplex> freqHolder(transformSize+1);
180 wirecol->reserve(digitVecHandle->size());
181 for(
size_t rdIter = 0; rdIter < digitVecHandle->size(); ++rdIter){
186 channel = digitVec->Channel();
190 holder.resize(transformSize);
197 holder[
bin]=(rawadc[
bin]-digitVec->GetPedestal());
199 for (
bin = dataSize;
bin<holder.size();
bin++){
200 holder[
bin] = (rawadc[
bin-dataSize]-digitVec->GetPedestal());
205 for(
bin = 0;
bin < holder.size(); ++
bin) holder[
bin]=holder[
bin]/DeconNorm;
208 holder.resize(dataSize,1
e-5);
215 for(
bin = 0;
bin < holder.size(); ++
bin) holder[
bin]-=average;
222 std::vector<std::pair<unsigned int, unsigned int>> holderInfo;
223 std::vector<std::pair<unsigned int, unsigned int>> rois;
228 unsigned int roiStart = 0;
230 double SigVal = holder[
bin];
231 if (SigVal > max) max = SigVal;
235 if (SigVal < deconNoise){
236 rois.push_back(std::make_pair(roiStart,
bin));
242 rois.push_back(std::make_pair(roiStart, dataSize-1));
255 if(rois.size() == 0)
continue;
257 for(
unsigned int ii = 0; ii < rois.size(); ++ii) {
261 rois[ii].first = low;
264 if(high >= dataSize) high = dataSize-1;
265 rois[ii].second = high;
269 if(rois.size() >= 1) {
272 for (
unsigned int ii = 0; ii<rois.size();ii++){
273 unsigned int roiStart = rois[ii].first;
274 unsigned int roiEnd = rois[ii].second;
277 unsigned int jj=ii+1;
280 if(rois[jj].first <= roiEnd ) {
281 roiEnd = rois[jj].second;
291 std::vector<float> sigTemp;
292 for(
unsigned int kk = roiStart; kk < roiEnd; ++kk) {
293 sigTemp.push_back(holder[kk]);
322 <<
"Can't associate wire #" << (wirecol->size() - 1)
323 <<
" with raw digit #" << digitVec.key();
327 if(wirecol->size() == 0)
328 mf::LogWarning(
"CalWireDUNEDPhase") <<
"No wires made for this event.";
double GetDeconNorm() const override
double fSigThrFact
Signal shreshold factor.
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.
Class managing the creation of a new recob::Wire object.
double GetDeconNoise(Channel channel) const override
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
std::string fDigitModuleLabel
constants
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
int fDoBaselineSub
number of postsample bins
int fPostsample
number of postsample bins
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
unsigned short fPostROIPad
ROI padding.
QTextStream & bin(QTextStream &s)
unsigned short fPreROIPad
ROI padding.
void SubtractBaseline(std::vector< float > &holder)
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.
void Deconvolute(unsigned int channel, std::vector< T > &func) const