6 #include "tbb/parallel_for.h"
7 #include "tbb/blocked_range.h"
11 #include "art/Framework/Core/ReplicatedProducer.h"
12 #include "art/Framework/Principal/Event.h"
13 #include "art/Framework/Services/Registry/ServiceHandle.h"
14 #include "art_root_io/TFileService.h"
15 #include "art/Framework/Core/ModuleMacros.h"
16 #include "art/Utilities/make_tool.h"
17 #include "canvas/Persistency/Common/Ptr.h"
18 #include "messagefacility/MessageLogger/MessageLogger.h"
75 explicit RawDigitFilterICARUS(fhicl::ParameterSet
const & pset, art::ProcessingFrame
const& frame);
79 virtual void configure(fhicl::ParameterSet
const & pset);
80 virtual void produce(art::Event &
e, art::ProcessingFrame
const& frame);
81 virtual void beginJob(art::ProcessingFrame
const& frame);
82 virtual void endJob(art::ProcessingFrame
const& frame);
83 void WaveformChar(
unsigned int i,
unsigned int& fDataSize,
unsigned int& fftsize,
void* fplan,
void* rplan,
84 vector<GroupWireDigIndx>& igwvec,
85 std::vector<const raw::RawDigit*>& rawDigitVec,
86 vector<vector<caldata::RawDigitVector>>& rawadcgvec,
87 vector<vector<WireChar>>& wgcvec,
89 std::unique_ptr<std::vector<raw::RawDigit> >& filteredRawDigit)
const;
90 void RemoveCorrelatedNoise(
unsigned int igrp,
unsigned int& fftSize,
unsigned int& halfFFTSize,
void* fplan,
void* rplan,
91 vector<vector<caldata::RawDigitVector>>& rawadcgvec,
92 vector<vector<WireChar>>& wgcvec,
94 std::unique_ptr<std::vector<raw::RawDigit> >& filteredRawDigit)
const;
98 template <
typename T>
void findPeaks(
typename std::vector<T>::iterator startItr,
99 typename std::vector<T>::iterator stopItr,
100 std::vector<std::tuple<size_t,size_t,size_t>>& peakTupleVec,
102 size_t firstTick)
const;
137 std::map<size_t,std::vector<std::complex<double>>>
fFilterVec;
154 unsigned int & fdatasize,
155 unsigned int & fftsize,
156 void* fplan,
void* rplan,
157 vector<GroupWireDigIndx>& igwv,
158 std::vector<const raw::RawDigit*>& rawdigitvec,
159 vector<vector<caldata::RawDigitVector>>& rawadcgv,
160 vector<vector<WireChar>>& wgcv,
162 std::unique_ptr<std::vector<raw::RawDigit> >& filteredrawdigit)
164 fDataSize(fdatasize),
169 rawDigitVec(rawdigitvec),
170 rawadcgvec(rawadcgv),
173 filteredRawDigit(filteredrawdigit){}
174 void operator()(
const tbb::blocked_range<size_t>& range)
const{
176 for (
size_t i = range.begin(); i < range.end(); ++i)
177 prod.WaveformChar(i, fDataSize, fftSize, fplan, rplan, igwvec, rawDigitVec, rawadcgvec, wgcvec, wgqvec, filteredRawDigit);
197 unsigned int & fftsize,
198 unsigned int & halffftsize,
200 vector<vector<caldata::RawDigitVector>>& rawadcgv,
201 vector<vector<WireChar>>& wgcv,
203 std::unique_ptr<std::vector<raw::RawDigit> >& filteredrawdigit)
213 void operator()(
const tbb::blocked_range<size_t>& range)
const{
214 for (
size_t i = range.begin(); i < range.end(); ++i)
231 art::ReplicatedProducer(pset, frame),
233 fBinAverageAlg(pset),
234 fCharacterizationAlg(pset.
get<fhicl::ParameterSet>(
"CharacterizationAlg")),
235 fCorCorrectAlg(pset.
get<fhicl::ParameterSet>(
"CorrelatedCorrectionAlg")),
236 fPedestalRetrievalAlg(*lar::
providerFrom<lariov::DetPedestalService>()),
240 fGeometry = lar::providerFrom<geo::Geometry>();
243 produces<std::vector<raw::RawDigit> >();
246 mf::LogInfo(
"RawDigitFilterICARUS") <<
"RawDigitFilterICARUS configured\n";
257 fWindowSize = pset.get<
size_t> (
"WindowSize", 6400);
262 fNRmsChannelReject = pset.get<std::vector<float>> (
"NRMSChannelReject", std::vector<float>() = {3., 3., 3. });
265 fRmsRejectionCutHi = pset.get<std::vector<float>> (
"RMSRejectionCutHi", std::vector<float>() = {25.0,25.0,25.0});
266 fRmsRejectionCutLow = pset.get<std::vector<float>> (
"RMSRejectionCutLow", std::vector<float>() = {0.70,0.70,0.70});
267 fMinMaxSelectionCut = pset.get<std::vector<short>> (
"MinMaxSelectionCut", std::vector<short>() = {13, 13, 11});
269 fNumWiresToGroup = pset.get<std::vector<size_t>>(
"NumWiresToGroup", std::vector<size_t>() = {48, 48, 96});
273 fNumRmsToSmoothVec = pset.get<std::vector<float>> (
"NumRmsToSmooth", std::vector<float>() = {3.6, 3.6, 4.});
275 fFFTMinPowerThreshold = pset.get<std::vector<double>>(
"FFTPowerThreshold", std::vector<double>() = {100.,75.,500.});
278 fRawDigitFilterTool = art::make_tool<caldata::IRawDigitFilter>(pset.get<fhicl::ParameterSet>(
"RawDigitFilterTool"));
281 const fhicl::ParameterSet& filterTools = pset.get<fhicl::ParameterSet>(
"FilterTools");
283 for(
const std::string& filterTool : filterTools.get_pset_names())
285 const fhicl::ParameterSet& filterToolParamSet = filterTools.get<fhicl::ParameterSet>(filterTool);
286 size_t planeIdx = filterToolParamSet.get<
size_t>(
"Plane");
288 fFilterToolMap.insert(std::pair<
size_t,std::unique_ptr<icarus_tool::IFilter>>(planeIdx,art::make_tool<icarus_tool::IFilter>(filterToolParamSet)));
297 art::ServiceHandle<art::TFileService>
tfs;
302 art::TFileDirectory
dir = tfs->mkdir(Form(
"RawDigitFilter"));
315 art::Handle< std::vector<raw::RawDigit> > digitVecHandle;
319 std::unique_ptr<std::vector<raw::RawDigit> > filteredRawDigit(
new std::vector<raw::RawDigit>);
320 filteredRawDigit->resize(digitVecHandle->size());
324 if (digitVecHandle.isValid() && digitVecHandle->size()>0 ){
328 std::vector<const raw::RawDigit*> rawDigitVec;
329 for(
size_t idx = 0; idx < digitVecHandle->size(); idx++) rawDigitVec.push_back(&digitVecHandle->at(idx));
330 std::sort(rawDigitVec.begin(),rawDigitVec.end(),
334 art::Ptr<raw::RawDigit> digitVec0(digitVecHandle, 0);
335 unsigned int fDataSize = digitVec0->Samples();
336 unsigned int fftSize;
342 vector<short> rawadc;
343 rawadc.resize(fftSize);
345 vector<vector<caldata::RawDigitVector>> rawadcgvec;
346 vector<vector<WireChar>> wgcvec;
347 vector<vector<vector <int>>> wgqvec;
348 vector<GroupWireDigIndx>igwvec;
350 vector<caldata::RawDigitVector> rawadcvec;
351 vector<WireChar> wcvec;
352 vector<vector<int>>wqvec;
364 for(
const auto& rawDigit : rawDigitVec){
370 std::vector<geo::WireID> wids;
377 if (channel >= maxChannels || !goodChan)
continue;
379 unsigned int plane = wids[0].Plane;
380 unsigned int wire = wids[0].Wire;
383 unsigned int dataSize = rawDigit->Samples();
385 std::cout <<
"****>> Found zero length raw digit buffer, channel: "
386 << channel <<
", plane: " << plane <<
", wire: " << wire << std::endl;
388 }
else if (dataSize!=fDataSize) {
389 std::cout <<
"****>> DataSize has changed from " << fDataSize <<
" to " << dataSize
390 <<
" for channel: " << channel <<
", plane: " << plane <<
", wire: " << wire << std::endl;
393 rawadcvec.push_back(rawadc);
408 igw.
windx=int(wcvec.size()-1);
410 igw.
group=int(wgcvec.size());
415 wqvec[0].push_back(wcvec.size()-1);
417 igw.
qgindx=wqvec[0].size()-1;
418 }
else if (group==1){
419 wqvec[1].push_back(wcvec.size()-1);
421 igw.
qgindx=wqvec[1].size()-1;
424 igwvec.push_back(igw);
429 rawadcgvec.push_back(rawadcvec);
430 wgcvec.push_back(wcvec);
431 wgqvec.push_back(wqvec);
446 unsigned int halfFFTSize(fftSize/2 + 1);
447 for(
unsigned int plne = 0; plne < 3; plne++)
463 rawadcgvec, wgcvec, wgqvec, filteredRawDigit);
464 tbb::parallel_for(tbb::blocked_range<size_t>(0, igwvec.size()), func);
477 rawadcgvec, wgcvec, wgqvec, filteredRawDigit);
478 tbb::parallel_for(tbb::blocked_range<size_t>(0, wgcvec.size()), func);
481 filteredRawDigit->erase(std::remove_if(filteredRawDigit->begin(),filteredRawDigit->end(),
482 [](
const raw::RawDigit & frd){
return frd.ADCs().size()==0;}),
483 filteredRawDigit->end());
495 event.put(std::move(filteredRawDigit));
500 vector<vector<caldata::RawDigitVector>>& rawadcgvec,
501 vector<vector<WireChar>>& wgcvec,
503 std::unique_ptr<std::vector<raw::RawDigit> >& filteredRawDigit)
const{
505 for (
size_t iq = 0; iq < 2; iq++) {
507 if (wgqvec[igrp][iq].
size() == 0)
continue;
510 wgqvec[igrp][iq].erase(std::remove_if(wgqvec[igrp][iq].
begin(),wgqvec[igrp][iq].
end(),[](
const int& i){
return i<0;}),wgqvec[igrp][iq].
end());
513 size_t nwq = wgqvec[igrp][iq].size();
514 if (nwq <= 2)
continue;
516 std::vector<float> corValVec;
517 corValVec.resize(fftSize, 0.);
522 for(
size_t itck = 0; itck < fftSize; itck++){
523 std::vector<float> adcValuesVec;
525 for (
size_t i = 0; i < nwq; i++) {
527 size_t iwdx = wgqvec[igrp][iq][i];
530 if (itck < wgcvec[igrp][iwdx].tcka || itck >= wgcvec[igrp][iwdx].tckb)
continue;
532 adcValuesVec.push_back(
float(rawadcgvec[igrp][iwdx][itck]) - wgcvec[igrp][iwdx].truncMean);
535 float medval(-10000);
536 if (!adcValuesVec.empty()) {
537 std::sort(adcValuesVec.begin(),adcValuesVec.end());
538 size_t medidx = adcValuesVec.size() / 2;
539 medval = adcValuesVec[medidx];
540 if (adcValuesVec.size() > 1 && medidx % 2) medval = (medval + adcValuesVec[medidx+1]) / 2;
542 corValVec[itck] = std::max(medval,
float(-10000.));
546 size_t iwdx0 = wgqvec[igrp][iq][0];
547 unsigned int plane = wgcvec[igrp][iwdx0].plane;
553 std::vector<float> localCorValVec = corValVec;
554 std::sort(localCorValVec.begin(),localCorValVec.end());
557 float corValSum = std::accumulate(localCorValVec.begin(),localCorValVec.begin() + nTruncVal,0.);
558 float meanCorVal = corValSum / float(nTruncVal);
560 std::vector<float> diffVec(nTruncVal);
561 std::transform(localCorValVec.begin(),localCorValVec.begin() + nTruncVal, diffVec.begin(),
562 std::bind(std::minus<float>(),std::placeholders::_1,meanCorVal));
564 float rmsValSq = std::inner_product(diffVec.begin(),diffVec.end(),diffVec.begin(),0.);
565 float rmsVal = std::sqrt(rmsValSq /
float(nTruncVal));
568 std::vector<float>::iterator lastGoodItr = corValVec.begin();
569 bool wasOutlier(
false);
570 for(std::vector<float>::iterator corValItr = lastGoodItr+1; corValItr != corValVec.end(); corValItr++){
573 float lastVal = *lastGoodItr;
574 float curVal = *corValItr;
576 float slope = (curVal - lastVal) / numTicks;
577 while(lastGoodItr != corValItr){
578 *lastGoodItr++ = (numTicks -
std::distance(lastGoodItr,corValItr)) * slope + lastVal;
582 lastGoodItr = corValItr;
591 std::vector<std::complex<double>> fftOutputVec(halfFFTSize);
593 lfftw.
DoFFT(corValVec, fftOutputVec);
595 std::vector<double> powerVec(halfFFTSize);
596 std::transform(fftOutputVec.begin(), fftOutputVec.begin() + halfFFTSize, powerVec.begin(), [](
const auto& val){
return std::abs(val);});
599 std::vector<double> firstDerivVec(powerVec.size(), 0.);
602 for(
size_t idx = 1; idx < firstDerivVec.size() - 1; idx++)
603 firstDerivVec.at(idx) = 0.5 * (powerVec.at(idx + 1) - powerVec.at(idx - 1));
606 std::vector<std::tuple<size_t,size_t,size_t>> peakTupleVec;
610 if (!peakTupleVec.empty())
612 for(
const auto& peakTuple : peakTupleVec)
614 size_t startTick = std::get<0>(peakTuple);
615 size_t stopTick = std::get<2>(peakTuple);
617 if (stopTick > startTick)
619 std::complex<double> slope = (fftOutputVec[stopTick] - fftOutputVec[startTick]) /
double(stopTick - startTick);
623 std::complex<double> interpVal = fftOutputVec[startTick] + double(
tick - startTick) * slope;
625 fftOutputVec[
tick] = interpVal;
631 std::vector<double> tmpVec(corValVec.size());
633 lfftw.
DoInvFFT(fftOutputVec, tmpVec);
635 std::transform(corValVec.begin(),corValVec.end(),tmpVec.begin(),corValVec.begin(),std::minus<double>());
642 for(
size_t itck = 0; itck < fftSize; itck++){
643 for (
size_t i = 0; i < nwq; i++) {
645 size_t iwdx = wgqvec[igrp][iq][i];
649 if (itck < wgcvec[igrp][iwdx].tcka || itck >= wgcvec[igrp][iwdx].tckb) {
652 corVal = corValVec[itck];
655 float newAdcValueFloat = float(rawadcgvec[igrp][iwdx][itck]) - corVal - wgcvec[igrp][iwdx].pedCor;
656 rawadcgvec[igrp][iwdx][itck] = std::round(newAdcValueFloat);
664 for (
size_t iwdx = 0; iwdx < wgcvec[igrp].size(); iwdx++) {
666 unsigned int plane = wgcvec[igrp][iwdx].plane;
675 float pedestal = wgcvec[igrp][iwdx].truncMean;
676 float pedCor = wgcvec[igrp][iwdx].pedCor;
677 float deltaPed = pedestal - pedCor;
685 int irdg = wgcvec[igrp][iwdx].irawdig;
688 filteredRawDigit->at(irdg).
SetPedestal(pedestal, rmsVal);
690 mf::LogInfo(
"RawDigitFilterICARUS") <<
"--> Rejecting channel for large rms, channel: "
691 << channel <<
", rmsVal: " << rmsVal <<
", truncMean: " << pedestal
692 <<
", pedestal: " << pedCor << std::endl;
700 vector<GroupWireDigIndx>& igwvec,
701 std::vector<const raw::RawDigit*>& rawDigitVec,
702 vector<vector<caldata::RawDigitVector>>& rawadcgvec,
703 vector<vector<WireChar>>& wgcvec,
705 std::unique_ptr<std::vector<raw::RawDigit> >& filteredRawDigit)
const{
706 int igrp = igwvec[i].group;
707 int iwdx = igwvec[i].windx;
708 int irdg = igwvec[i].irawdig;
724 unsigned int plane = wgcvec[igrp][iwdx].plane;
729 std::vector<float> holder(fftSize);
730 std::transform(rawADC.begin(),rawADC.end(),holder.begin(),[pedestal](
const auto& val){
return float(
float(val) - pedestal);});
734 std::vector<std::complex<double>> filterVec(filterVecPlane.size());
736 for(
size_t idx = 0; idx < filterVecPlane.size(); idx++)
737 filterVec[idx] = filterVecPlane[idx];
744 std::transform(holder.begin(), holder.end(), rawADC.begin(), [pedestal](
const float& adc){
return std::round(adc + pedestal);});
750 wgcvec[igrp][iwdx].wire,
751 wgcvec[igrp][iwdx].truncMean,
752 wgcvec[igrp][iwdx].truncRms,
753 wgcvec[igrp][iwdx].
mean,
754 wgcvec[igrp][iwdx].median,
755 wgcvec[igrp][iwdx].
mode,
756 wgcvec[igrp][iwdx].skewness,
757 wgcvec[igrp][iwdx].fullRms,
758 wgcvec[igrp][iwdx].minMax,
759 wgcvec[igrp][iwdx].neighborRatio,
760 wgcvec[igrp][iwdx].pedCor);
770 pedCorrectedVec.resize(rawADC.size(),0);
771 std::transform(rawADC.begin(),rawADC.end(),pedCorrectedVec.begin(),std::bind(std::minus<short>(),std::placeholders::_1,wgcvec[igrp][iwdx].pedCor));
775 filteredRawDigit->at(irdg).
SetPedestal(wgcvec[igrp][iwdx].truncMean,wgcvec[igrp][iwdx].truncRms);
787 filteredRawDigit->at(irdg).
SetPedestal(wgcvec[igrp][iwdx].truncMean,wgcvec[igrp][iwdx].truncRms);
791 mf::LogInfo(
"RawDigitFilterICARUS") <<
"--> Rejecting channel for large rms, channel: " << channel
792 <<
", rmsVal: " << wgcvec[igrp][iwdx].truncRms <<
", truncMean: " << wgcvec[igrp][iwdx].truncMean
793 <<
", pedestal: " << wgcvec[igrp][iwdx].pedCor << std::endl;
801 wgcvec[igrp][iwdx].tcka = 0;
802 wgcvec[igrp][iwdx].tckb = rawADC.size();
807 short mean = wgcvec[igrp][iwdx].mean;
810 if (wgcvec[igrp][iwdx].skewness > 0. && wgcvec[igrp][iwdx].neighborRatio < 0.7 && wgcvec[igrp][iwdx].minMax > 50){
811 raw::RawDigit::ADCvector_t::iterator stopChirpItr = std::find_if(rawADC.begin(),rawADC.end(),
812 [
mean,threshold](
const short& elem){
return abs(elem - mean) > threshold;});
813 size_t threshIndex =
std::distance(rawADC.begin(),stopChirpItr);
814 if (threshIndex > 60) wgcvec[igrp][iwdx].tcka = threshIndex;
815 }
else if (wgcvec[igrp][iwdx].minMax > 20 && wgcvec[igrp][iwdx].neighborRatio < 0.7){
817 raw::RawDigit::ADCvector_t::reverse_iterator startChirpItr = std::find_if(rawADC.rbegin(),rawADC.rend(),
818 [
mean,threshold](
const short& elem){
return abs(elem - mean) > threshold;});
819 size_t threshIndex =
std::distance(rawADC.rbegin(),startChirpItr);
820 if (threshIndex > 60) wgcvec[igrp][iwdx].tckb = rawADC.size() - threshIndex;
825 int iqgrp = igwvec[i].qgroup;
826 unsigned int iqdx = igwvec[i].qgindx;
827 if ( iqgrp == 0 || iqgrp == 1 ) {
828 wgqvec[igrp][iqgrp][iqdx]=-1;
831 std::transform(rawADC.begin(),rawADC.end(),rawADC.begin(),std::bind(std::minus<short>(),std::placeholders::_1,wgcvec[igrp][iwdx].pedCor));
839 typename std::vector<T>::iterator stopItr,
840 std::vector<std::tuple<size_t,size_t,size_t>>& peakTupleVec,
842 size_t firstTick)
const
848 typename std::vector<T>::iterator firstItr = std::max_element(startItr,stopItr,[](
float left,
float right){
return std::fabs(left) < std::fabs(right);});
851 if (std::fabs(*firstItr) > threshold)
858 typename std::vector<T>::iterator secondItr = firstItr;
863 typename std::vector<T>::iterator tempItr = secondItr;
865 while(tempItr != stopItr)
867 if (*++tempItr < -threshold)
869 if (*tempItr < *secondItr) secondItr = tempItr;
871 else if (secondItr != firstItr)
break;
877 typename std::vector<T>::iterator tempItr = secondItr;
879 while(tempItr != startItr)
881 if (*--tempItr > threshold)
883 if (*tempItr > *secondItr) secondItr = tempItr;
885 else if (secondItr != firstItr)
break;
888 std::swap(firstItr,secondItr);
892 if (firstItr != secondItr)
898 while(firstItr != startItr)
if (*--firstItr < 0.)
break;
899 while(secondItr != stopItr)
if (*++secondItr > 0.)
break;
905 findPeaks(startItr, firstItr, peakTupleVec, threshold, firstTick);
908 peakTupleVec.push_back(std::tuple<size_t,size_t,size_t>(firstBin+firstTick,peakBin+firstTick,lastBin+firstTick));
927 filteredRawDigit->emplace_back(channel, rawDigitVec.size(), rawDigitVec,
raw::kNone);
928 filteredRawDigit->back().SetPedestal(pedestal,rms);
936 mf::LogInfo(
"RawDigitFilterICARUS") <<
"Looked at " <<
fNumEvent <<
" events" << std::endl;
caldata::RawDigitCorrelatedCorrectionAlg fCorCorrectAlg
bool fTruncateChannels
If true then we drop channels with "no signal".
bool fApplyFFTCorrection
Use an FFT to get the correlated noise correction.
std::vector< short > fMinMaxSelectionCut
Plane by plane cuts for spread cut.
const ADCvector_t & ADCs() const
Reference to the compressed ADC count vector.
Collection of charge vs time digitized from a single readout channel.
void saveRawDigits(std::unique_ptr< std::vector< raw::RawDigit > > &, raw::ChannelID_t &, caldata::RawDigitVector &, float, float)
float fTruncMeanFraction
Fraction for truncated mean.
bool fTruncateTicks
If true then drop ticks off ends of wires.
T::provider_type const * providerFrom()
Returns a constant pointer to the provider of specified service.
virtual void produce(art::Event &e, art::ProcessingFrame const &frame)
ChannelID_t Channel() const
DAQ channel this raw data was read from.
std::string fDigitModuleLabel
The full collection of hits.
void RemoveCorrelatedNoise(unsigned int igrp, unsigned int &fftSize, unsigned int &halfFFTSize, void *fplan, void *rplan, vector< vector< caldata::RawDigitVector >> &rawadcgvec, vector< vector< WireChar >> &wgcvec, vector< vector< vector< int >>> &wgqvec, std::unique_ptr< std::vector< raw::RawDigit > > &filteredRawDigit) const
unsigned int fWindowSize
ticks to keep in window
raw::RawDigit::ADCvector_t RawDigitVector
bool fDoFFTCorrection
Run the FFT noise correction.
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
Definition of basic raw digits.
std::size_t size(FixedBins< T, C > const &) noexcept
bool fDoCorrelatedNoise
Process the noise.
const lariov::DetPedestalProvider & fPedestalRetrievalAlg
Keep track of an instance to the pedestal retrieval alg.
std::vector< ComplexVal > FrequencyVec
std::vector< float > fRmsRejectionCutHi
Maximum rms for input channels, reject if larger.
caldata::RawDigitCharacterizationAlg fCharacterizationAlg
void findPeaks(typename std::vector< T >::iterator startItr, typename std::vector< T >::iterator stopItr, std::vector< std::tuple< size_t, size_t, size_t >> &peakTupleVec, T threshold, size_t firstTick) const
unsigned int Nchannels() const
Returns the number of TPC readout channels in the detector.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
int fNumEvent
Number of events seen.
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
size_t channelGroup(size_t view, size_t wire) const
bool fApplyCorSmoothing
Attempt to smooth the correlated noise correction?
bool fSmoothCorrelatedNoise
Should we smooth the noise?
Collect all the RawData header files together.
bool fApplyTopHatFilter
Apply the top hat filter.
auto end(FixedBins< T, C > const &) noexcept
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
unsigned int fNumTicksToDropFront
ticks to drop from front of waveform
void Convolute(std::vector< T > &func, const ComplexVector &kern)
std::vector< double > fFFTMinPowerThreshold
Threshold for trimming FFT power spectrum.
virtual void beginJob(art::ProcessingFrame const &frame)
Begin job method.
std::map< size_t, std::vector< std::complex< double > > > fFilterVec
caldata::ChannelGroups fChannelGroups
Description of geometry of one entire detector.
This is the interface class for a tool to handle a filter for the overall response.
virtual float PedMean(raw::ChannelID_t ch) const =0
Retrieve pedestal information.
void getTruncatedRMS(const RawDigitVector &rawWaveform, float &pedestal, float &truncRms) const
std::vector< float > fRmsRejectionCutLow
Minimum rms to consider channel "alive".
virtual void configure(fhicl::ParameterSet const &pset)
auto begin(FixedBins< T, C > const &) noexcept
raw::Compress_t Compression() const
Compression algorithm used to store the ADC counts.
virtual ~RawDigitFilterICARUS()
Destructor.
double mean(const std::vector< short > &wf, size_t start, size_t nsample)
std::unique_ptr< caldata::IRawDigitFilter > fRawDigitFilterTool
This provides an interface for tools which are tasked with filtering input waveforms.
virtual void endJob(art::ProcessingFrame const &frame)
End job method.
void SetPedestal(float ped, float sigma=1.)
Set pedestal and its RMS (the latter is 0 by default)
caldata::RawDigitBinAverageAlg fBinAverageAlg
std::vector< float > fNumRmsToSmoothVec
"sigma" to smooth correlated correction vec
geo::GeometryCore const * fGeometry
pointer to Geometry service
art::ServiceHandle< art::TFileService > tfs
RawDigitFilterICARUS(fhicl::ParameterSet const &pset, art::ProcessingFrame const &frame)
void DoInvFFT(std::vector< T > &output)
std::map< size_t, std::unique_ptr< icarus_tool::IFilter > > fFilterToolMap
unsigned int ChannelID_t
Type representing the ID of a readout channel.
std::vector< size_t > fNumWiresToGroup
If smoothing, the number of wires to look at.
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
void initializeHists(art::ServiceHandle< art::TFileService > &)
Begin job method.
void getWaveformParams(const RawDigitVector &rawWaveform, unsigned int channel, unsigned int view, unsigned int wire, float &truncMean, float &truncRms, short &mean, short &median, short &mode, float &skewness, float &rms, short &minMax, float &neighborRatio, float &pedCorVal) const
void DoFFT(std::vector< T > &input)
std::vector< float > fNRmsChannelReject
rms to reject channel as no signal
art framework interface to geometry description
BEGIN_PROLOG could also be cout
void WaveformChar(unsigned int i, unsigned int &fDataSize, unsigned int &fftsize, void *fplan, void *rplan, vector< GroupWireDigIndx > &igwvec, std::vector< const raw::RawDigit * > &rawDigitVec, vector< vector< caldata::RawDigitVector >> &rawadcgvec, vector< vector< WireChar >> &wgcvec, vector< vector< vector< int >>> &wgqvec, std::unique_ptr< std::vector< raw::RawDigit > > &filteredRawDigit) const