9 #include "art/Framework/Core/EDProducer.h"
10 #include "art/Framework/Principal/Event.h"
11 #include "art/Framework/Principal/Handle.h"
12 #include "art/Framework/Services/Registry/ServiceHandle.h"
13 #include "art/Persistency/Common/PtrMaker.h"
14 #include "art/Utilities/ToolMacros.h"
15 #include "art/Utilities/make_tool.h"
16 #include "cetlib/cpu_timer.h"
17 #include "fhiclcpp/ParameterSet.h"
18 #include "messagefacility/MessageLogger/MessageLogger.h"
23 #include "sbndaq-artdaq-core/Overlays/ICARUS/PhysCrateFragment.hh"
27 #include "icarus_signal_processing/ICARUSSigProcDefs.h"
28 #include "icarus_signal_processing/WaveformTools.h"
29 #include "icarus_signal_processing/Filters/FFTFilterFunctions.h"
30 #include "icarus_signal_processing/Filters/ImageFilters.h"
31 #include "icarus_signal_processing/Denoising.h"
32 #include "icarus_signal_processing/Detection/EdgeDetection.h"
33 #include "icarus_signal_processing/Filters/BilateralFilters.h"
34 #include "icarus_signal_processing/ROIFinder2D.h"
68 virtual void configure(
const fhicl::ParameterSet&)
override;
77 const icarus_signal_processing::ArrayFloat&,
78 const size_t&)
override;
216 std::unique_ptr<icarus_signal_processing::IDenoiser2D>
fDenoiser2D;
258 fFilterModeVec = pset.get<std::vector<std::string>>(
"FilterModeVec", std::vector<std::string>()={
"e",
"g",
"d"});
264 fStructuringElement = pset.get<std::vector<size_t> >(
"StructuringElement", std::vector<size_t>()={8,16});
265 fThreshold = pset.get<std::vector<float> >(
"Threshold", std::vector<float>()={2.75,2.75,2.75});
287 fADFilter_SX = pset.get<
unsigned int >(
"ADFilter_SX", 7);
288 fADFilter_SY = pset.get<
unsigned int >(
"ADFilter_SY", 7);
289 fSigma_x = pset.get<
float >(
"Sigma_x", 10.0);
290 fSigma_y = pset.get<
float >(
"Sigma_y", 10.0);
291 fSigma_r = pset.get<
float >(
"Sigma_r", 30.0);
299 fBilateralFilters = std::make_unique<icarus_signal_processing::BilateralFilters>();
300 fEdgeDetection = std::make_unique<icarus_signal_processing::EdgeDetection>();
302 fROIFinder2D = std::make_unique<icarus_signal_processing::ROICannyFilter>(fButterworthFilter.get(),
304 fBilateralFilters.get(),
305 fEdgeDetection.get(),
316 fGeometry = art::ServiceHandle<geo::Geometry const>{}.get();
322 for(
int plane = 0; plane < 3; plane++)
324 if (plane < 2)
fFFTFilterFunctionVec.emplace_back(std::make_unique<icarus_signal_processing::WindowFFTFilter>(fFFTSigmaValsVec[plane], fFFTCutoffValsVec[plane]));
334 const icarus_signal_processing::ArrayFloat& dataArray,
335 const size_t& coherentNoiseGrouping)
337 cet::cpu_timer theClockTotal;
339 theClockTotal.start();
342 unsigned int numChannels = dataArray.size();
343 unsigned int numTicks = dataArray[0].size();
345 if (
fSelectVals.size() < numChannels)
fSelectVals.resize(numChannels, icarus_signal_processing::VectorBool(numTicks));
346 if (
fROIVals.size() < numChannels)
fROIVals.resize(numChannels, icarus_signal_processing::VectorBool(numTicks));
367 icarus_signal_processing::Denoiser1D denoiser;
368 icarus_signal_processing::WaveformTools<float> waveformTools;
371 for(
size_t idx = 0; idx < numChannels; idx++)
373 icarus_signal_processing::VectorFloat& pedCorDataVec =
fPedCorWaveforms[idx];
382 unsigned int plane = widVec[0].Plane;
405 std::cout <<
"***** FOUND NO MATCH FOR TYPE: " <<
fFilterModeVec[plane] <<
", plane " << plane <<
" DURING INITIALIZATION OF FILTER FUNCTIONS IN TPCNoiseFilterCannyMC" << std::endl;
410 waveformTools.getPedestalCorrectedWaveform(dataArray[idx],
423 icarus_signal_processing::ArrayFloat finalErosion(numChannels,icarus_signal_processing::VectorFloat(numTicks,0.));
425 std::cout <<
" --> calling icarus_signal_processing code" << std::endl;
430 std::cout <<
" --> have returned from denoising" << std::endl;
432 theClockTotal.stop();
434 double totalTime = theClockTotal.accumulated_real_time();
436 mf::LogInfo(
"TPCNoiseFilterCannyMC") <<
" *totalTime: " << totalTime << std::endl;
float fSigmaForTruncation
icarus_signal_processing::VectorFloat fTruncRMSVals
const icarus_signal_processing::ArrayFloat & getPedCorWaveforms() const override
Recover the pedestal subtracted waveforms.
icarus_signal_processing::VectorFloat fFullRMSVals
TPCNoiseFilterCannyMC class definiton.
icarus_signal_processing::ArrayFloat fPedCorWaveforms
icarus_signal_processing::FilterFunctionVec fFilterFunctionVec
std::vector< std::pair< float, float >> FloatPairVec
const icarus_signal_processing::VectorFloat & getPedestalVals() const override
Recover the pedestals for each channel.
const icarus_signal_processing::VectorFloat & getTruncRMSVals() const override
Recover the truncated RMS noise.
unsigned int fButterworthThreshold
Threshold for Butterworth filter.
unsigned int fCoherentNoiseOffset
Offset for the midplane...
This provides an art tool interface definition for tools which "decode" artdaq fragments into LArSoft...
icarus_signal_processing::ArrayBool fROIVals
const icarus_signal_processing::ArrayFloat & getIntrinsicRMS() const override
Recover the "intrinsic" RMS.
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
std::unique_ptr< icarus_signal_processing::IMorphologicalFunctions2D > fMorphologicalFilter
std::unique_ptr< icarus_signal_processing::BilateralFilters > fBilateralFilters
const icarus_signal_processing::VectorInt & getChannelIDs() const override
Recover the channels for the processed fragment.
unsigned int fCoherentNoiseGrouping
Number of consecutive channels in coherent noise subtraction.
const icarus_signal_processing::ArrayBool & getROIVals() const override
Recover the ROI values.
~TPCNoiseFilterCannyMC()
Destructor.
unsigned int fBinaryDilation_SY
std::unique_ptr< icarus_signal_processing::IFFTFilterFunction > fButterworthFilter
FloatPairVec fFFTSigmaValsVec
unsigned int fADFilter_SX
unsigned int fADFilter_SY
icarus_signal_processing::VectorFloat fPedestalVals
const icarus_signal_processing::ArrayFloat & getMorphedWaveforms() const override
Recover the morphological filter waveforms.
unsigned int fButterworthOrder
Order parameter for Butterworth filter.
const icarus_signal_processing::VectorFloat & getFullRMSVals() const override
Recover the full RMS before coherent noise.
icarus_signal_processing::ArrayFloat fCorrectedMedians
unsigned int fMorphologicalWindow
Window size for filter.
The geometry of one entire detector, as served by art.
virtual void configure(const fhicl::ParameterSet &) override
Interface for configuring the particular algorithm tool.
std::vector< std::string > fFilterModeVec
IDecoderFilter interface class definiton.
icarus_signal_processing::ArrayFloat fIntrinsicRMS
icarus_signal_processing::ArrayFloat fWaveLessCoherent
FloatPairVec fFFTCutoffValsVec
std::unique_ptr< icarus_signal_processing::EdgeDetection > fEdgeDetection
icarus_signal_processing::VectorInt fRangeBins
unsigned int fBinaryDilation_SX
icarus_signal_processing::FFTFilterFunctionVec fFFTFilterFunctionVec
const icarus_signal_processing::ArrayBool & getSelectionVals() const override
Recover the selection values.
Contains all timing reference information for the detector.
virtual void process_fragment(detinfo::DetectorClocksData const &, const daq::INoiseFilter::ChannelPlaneVec &, const icarus_signal_processing::ArrayFloat &, const size_t &) override
Given a set of recob hits, run DBscan to form 3D clusters.
icarus_signal_processing::VectorFloat fThresholdVec
const icarus_signal_processing::ArrayFloat & getWaveLessCoherent() const override
Recover the waveforms less coherent noise.
std::vector< size_t > fStructuringElement
Structuring element for morphological filter.
std::unique_ptr< icarus_signal_processing::IROIFinder2D > fROIFinder2D
const icarus_signal_processing::VectorInt & getNumTruncBins() const override
Recover the number of bins after truncation.
float fCoherentThresholdFactor
Threshold factor for coherent noise removal.
const icarus_signal_processing::ArrayFloat & getRawWaveforms() const override
Recover the pedestal subtracted waveforms.
TPCNoiseFilterCannyMC(fhicl::ParameterSet const &pset)
Constructor.
icarus_signal_processing::ArrayBool fSelectVals
std::vector< float > fThreshold
Threshold to apply for saving signal.
icarus_signal_processing::VectorInt fNumTruncBins
unsigned int fMorph2DStructuringElementY
Structuring element in Y.
const geo::Geometry * fGeometry
std::unique_ptr< icarus_signal_processing::IDenoiser2D > fDenoiser2D
icarus_signal_processing::ArrayFloat fMorphedWaveforms
unsigned int fMorph2DStructuringElementX
Structuring element in X.
icarus_signal_processing::ArrayFloat fRawWaveforms
const icarus_signal_processing::ArrayFloat & getCorrectedMedians() const override
Recover the correction median values.
art framework interface to geometry description
BEGIN_PROLOG could also be cout
icarus_signal_processing::VectorInt fChannelIDVec
std::vector< ChannelPlanePair > ChannelPlaneVec