8 #include "art/Utilities/ToolMacros.h"
9 #include "art/Utilities/make_tool.h"
10 #include "art_root_io/TFileService.h"
11 #include "messagefacility/MessageLogger/MessageLogger.h"
12 #include "cetlib_except/exception.h"
15 #include "icarus_signal_processing/WaveformTools.h"
16 #include "icarus_signal_processing/Filters/FFTFilterFunctions.h"
17 #include "icarus_signal_processing/Denoising.h"
37 void configure(
const fhicl::ParameterSet& pset)
override;
44 float getMedian(
const icarus_signal_processing::VectorFloat,
const unsigned int)
const;
83 fStructuringElement = pset.get<std::vector<size_t> >(
"StructuringElement", std::vector<size_t>()={8,16});
84 fThreshold = pset.get<std::vector<float> >(
"Threshold", std::vector<float>()={2.75,2.75,2.75});
96 if (morphedWaveforms.size() != constInputImage.size()) morphedWaveforms.resize(constInputImage.size(),icarus_signal_processing::VectorFloat(constInputImage[0].
size()));
98 for(
auto& morph : morphedWaveforms)
std::fill(morph.begin(),morph.end(),0.);
104 icarus_signal_processing::WaveformTools<float> waveformTools;
106 for(
size_t waveIdx = 0; waveIdx < inputImage.size(); waveIdx++) waveformTools.triangleSmooth(constInputImage[waveIdx],inputImage[waveIdx]);
126 for(
size_t waveIdx = 0; waveIdx < morphedWaveforms.size(); waveIdx++)
129 VectorFloat& morphedWave = morphedWaveforms[waveIdx];
132 float median =
getMedian(morphedWave, morphedWave.size());
134 for(
auto& val : morphedWave) val -= median;
142 if (selVals.size() != morphedWave.size()) selVals.resize(morphedWave.size());
144 std::fill(selVals.begin(),selVals.end(),
false);
148 for(
size_t idx = 0; idx < morphedWave.size(); idx++)
150 if (morphedWave[idx] > threshold)
160 size_t maxIdx = 0.75 * rmsVec.size();
162 std::nth_element(rmsVec.begin(), rmsVec.begin() + maxIdx, rmsVec.end());
164 float rms = std::sqrt(std::inner_product(rmsVec.begin(), rmsVec.begin() + maxIdx, rmsVec.begin(), 0.) / float(maxIdx));
165 float minVal = *std::min_element(morphedWave.begin(),morphedWave.end());
166 float maxVal = *std::max_element(morphedWave.begin(),morphedWave.end());
190 const auto m1 = vals.begin() + nVals / 2 - 1;
191 const auto m2 = vals.begin() + nVals / 2;
192 std::nth_element(vals.begin(), m1, vals.begin() + nVals);
194 std::nth_element(vals.begin(), m2, vals.begin() + nVals);
196 median = (e1 + e2) / 2.0;
200 const auto m = vals.begin() + nVals / 2;
201 std::nth_element(vals.begin(),
m, vals.begin() + nVals);
215 fTupleTree = histDir.make<TTree>(
"ROIFinder",
"Tree by ROIMorphological2D_tool");
The data type to uniquely identify a Plane.
std::size_t size(FixedBins< T, C > const &) noexcept
tuple m
now if test mode generate materials, CRT shell, world, gdml header else just generate CRT shell for u...
void fill(const art::PtrVector< recob::Hit > &hits, int only_plane)
PlaneID_t Plane
Index of the plane within its TPC.
This provides an interface for tools which are tasked with finding ROI's in input waveforms...
art framework interface to geometry description