LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
IWaveformTool.h
Go to the documentation of this file.
1 
13 #ifndef IWaveformTool_H
14 #define IWaveformTool_H
15 
16 #include "fhiclcpp/ParameterSet.h"
17 #include "TProfile.h"
18 
19 namespace reco_tool
20 {
21  template <class T> using Waveform = std::vector<T>;
22 
23  //< Enumerate some histograms that can be defined in methods below
24  enum HistogramType : int
25  {
35  };
36 
37  using HistogramMap = std::map<int, TProfile*>;
38 
40  {
41  public:
42  virtual ~IWaveformTool() noexcept = default;
43 
44  virtual void configure(const fhicl::ParameterSet& pset) = 0;
45 
46  using PeakTuple = std::tuple<size_t,size_t,size_t>; //< first bin, peak bin, last bin
47  using PeakTupleVec = std::vector<PeakTuple>; //< The collection of candidate peaks
48 
49  virtual void triangleSmooth(const std::vector<float>&, std::vector<float>&, size_t = 0) const = 0;
50  virtual void triangleSmooth(const std::vector<double>&, std::vector<double>&, size_t = 0) const = 0;
51  virtual void medianSmooth( const std::vector<float>&, std::vector<float>&, size_t = 3) const = 0;
52  virtual void medianSmooth( const std::vector<double>&, std::vector<double>&, size_t = 3) const = 0;
53  virtual void getTruncatedMeanRMS(const std::vector<float>&, float&, float&, float&, int&) const = 0;
54  virtual void getTruncatedMeanRMS(const std::vector<double>&, double&, double&, double&, int&) const = 0;
55  virtual void firstDerivative(const std::vector<float>&, std::vector<float>&) const = 0;
56  virtual void firstDerivative(const std::vector<double>&, std::vector<double>&) const = 0;
57  virtual void findPeaks(std::vector<float>::iterator, std::vector<float>::iterator, PeakTupleVec&, float, size_t) const = 0;
58  virtual void findPeaks(std::vector<double>::iterator, std::vector<double>::iterator, PeakTupleVec&, double, size_t) const = 0;
59  virtual void getFFTPower(const std::vector<float>& inputVec, std::vector<float>& outputPowerVec) const = 0;
60  virtual void getFFTPower(const std::vector<double>& inputVec, std::vector<double>& outputPowerVec) const = 0;
61 
62  virtual void getErosionDilationAverageDifference(const Waveform<short>&, //< Input waveform
63  int, //< Structuring element
64  HistogramMap&, //< Map of histograms to fill
65  Waveform<short>&, //< Output erosion vector
66  Waveform<short>&, //< Output dilation vector
67  Waveform<short>&, //< Output ave erosion & dilation
68  Waveform<short>&) const = 0; //< Output diff erosion and dilation
70  int,
71  HistogramMap&,
75  Waveform<float>&) const = 0;
77  int,
78  HistogramMap&,
82  Waveform<double>&) const = 0;
83 
84  virtual void getOpeningAndClosing(const Waveform<short>&, //< Input erosions vector
85  const Waveform<short>&, //< Input dilation vector
86  int, //< Structuring element
87  HistogramMap&, //< Map of histograms to fill
88  Waveform<short>&, //< Output closing vector
89  Waveform<short>&) const = 0; //< Output opening vector
90  virtual void getOpeningAndClosing(const Waveform<float>&, //< Input erosions vector
91  const Waveform<float>&, //< Input dilation vector
92  int, //< Structuring element
93  HistogramMap&, //< Map of histograms to fill
94  Waveform<float>&, //< Output closing vector
95  Waveform<float>&) const = 0; //< Output opening vector
96  virtual void getOpeningAndClosing(const Waveform<double>&, //< Input erosions vector
97  const Waveform<double>&, //< Input dilation vector
98  int, //< Structuring element
99  HistogramMap&, //< Map of histograms to fill
100  Waveform<double>&, //< Output closing vector
101  Waveform<double>&) const = 0; //< Output opening vector
102  };
103 }
104 
105 #endif
virtual void getErosionDilationAverageDifference(const Waveform< short > &, int, HistogramMap &, Waveform< short > &, Waveform< short > &, Waveform< short > &, Waveform< short > &) const =0
std::tuple< size_t, size_t, size_t > PeakTuple
Definition: IWaveformTool.h:46
std::vector< T > Waveform
Definition: IWaveformTool.h:21
intermediate_table::iterator iterator
virtual void firstDerivative(const std::vector< float > &, std::vector< float > &) const =0
virtual void getOpeningAndClosing(const Waveform< short > &, const Waveform< short > &, int, HistogramMap &, Waveform< short > &, Waveform< short > &) const =0
std::vector< PeakTuple > PeakTupleVec
Definition: IWaveformTool.h:47
virtual void getTruncatedMeanRMS(const std::vector< float > &, float &, float &, float &, int &) const =0
virtual void medianSmooth(const std::vector< float > &, std::vector< float > &, size_t=3) const =0
virtual void configure(const fhicl::ParameterSet &pset)=0
virtual void triangleSmooth(const std::vector< float > &, std::vector< float > &, size_t=0) const =0
virtual void findPeaks(std::vector< float >::iterator, std::vector< float >::iterator, PeakTupleVec &, float, size_t) const =0
std::map< int, TProfile * > HistogramMap
Definition: IWaveformTool.h:37
virtual void getFFTPower(const std::vector< float > &inputVec, std::vector< float > &outputPowerVec) const =0
virtual ~IWaveformTool() noexcept=default