LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
IWaveformTool.h
Go to the documentation of this file.
1 
13 #ifndef IWaveformTool_H
14 #define IWaveformTool_H
15 
16 namespace fhicl {
17  class ParameterSet;
18 }
19 class TProfile;
20 
21 #include <map>
22 #include <tuple>
23 #include <vector>
24 
25 namespace reco_tool {
26  template <class T>
27  using Waveform = std::vector<T>;
28 
29  //< Enumerate some histograms that can be defined in methods below
30  enum HistogramType : int {
40  };
41 
42  using HistogramMap = std::map<int, TProfile*>;
43 
44  class IWaveformTool {
45  public:
46  virtual ~IWaveformTool() noexcept = default;
47 
48  virtual void configure(const fhicl::ParameterSet& pset) = 0;
49 
50  using PeakTuple = std::tuple<size_t, size_t, size_t>; //< first bin, peak bin, last bin
51  using PeakTupleVec = std::vector<PeakTuple>; //< The collection of candidate peaks
52 
53  virtual void triangleSmooth(const std::vector<float>&,
54  std::vector<float>&,
55  size_t = 0) const = 0;
56  virtual void triangleSmooth(const std::vector<double>&,
57  std::vector<double>&,
58  size_t = 0) const = 0;
59  virtual void medianSmooth(const std::vector<float>&, std::vector<float>&, size_t = 3) const = 0;
60  virtual void medianSmooth(const std::vector<double>&,
61  std::vector<double>&,
62  size_t = 3) const = 0;
63  virtual void getTruncatedMeanRMS(const std::vector<float>&,
64  float&,
65  float&,
66  float&,
67  int&) const = 0;
68  virtual void getTruncatedMeanRMS(const std::vector<double>&,
69  double&,
70  double&,
71  double&,
72  int&) const = 0;
73  virtual void firstDerivative(const std::vector<float>&, std::vector<float>&) const = 0;
74  virtual void firstDerivative(const std::vector<double>&, std::vector<double>&) const = 0;
75  virtual void findPeaks(std::vector<float>::iterator,
77  PeakTupleVec&,
78  float,
79  size_t) const = 0;
80  virtual void findPeaks(std::vector<double>::iterator,
82  PeakTupleVec&,
83  double,
84  size_t) const = 0;
85  virtual void getFFTPower(const std::vector<float>& inputVec,
86  std::vector<float>& outputPowerVec) const = 0;
87  virtual void getFFTPower(const std::vector<double>& inputVec,
88  std::vector<double>& outputPowerVec) const = 0;
89 
90  virtual void getErosionDilationAverageDifference(
91  const Waveform<short>&, //< Input waveform
92  int, //< Structuring element
93  HistogramMap&, //< Map of histograms to fill
94  Waveform<short>&, //< Output erosion vector
95  Waveform<short>&, //< Output dilation vector
96  Waveform<short>&, //< Output ave erosion & dilation
97  Waveform<short>&) const = 0; //< Output diff erosion and dilation
98  virtual void getErosionDilationAverageDifference(const Waveform<float>&,
99  int,
100  HistogramMap&,
104  Waveform<float>&) const = 0;
105  virtual void getErosionDilationAverageDifference(const Waveform<double>&,
106  int,
107  HistogramMap&,
111  Waveform<double>&) const = 0;
112 
113  virtual void getOpeningAndClosing(const Waveform<short>&, //< Input erosions vector
114  const Waveform<short>&, //< Input dilation vector
115  int, //< Structuring element
116  HistogramMap&, //< Map of histograms to fill
117  Waveform<short>&, //< Output closing vector
118  Waveform<short>&) const = 0; //< Output opening vector
119  virtual void getOpeningAndClosing(const Waveform<float>&, //< Input erosions vector
120  const Waveform<float>&, //< Input dilation vector
121  int, //< Structuring element
122  HistogramMap&, //< Map of histograms to fill
123  Waveform<float>&, //< Output closing vector
124  Waveform<float>&) const = 0; //< Output opening vector
125  virtual void getOpeningAndClosing(const Waveform<double>&, //< Input erosions vector
126  const Waveform<double>&, //< Input dilation vector
127  int, //< Structuring element
128  HistogramMap&, //< Map of histograms to fill
129  Waveform<double>&, //< Output closing vector
130  Waveform<double>&) const = 0; //< Output opening vector
131  };
132 }
133 
134 #endif
intermediate_table::iterator iterator
std::vector< T > Waveform
Definition: IWaveformTool.h:27
std::vector< PeakTuple > PeakTupleVec
Definition: IWaveformTool.h:51
parameter set interface
std::map< int, TProfile * > HistogramMap
Definition: IWaveformTool.h:42
std::tuple< size_t, size_t, size_t > PeakTuple
Definition: IWaveformTool.h:50