AdcDeconvoluteFFT.h
Go to the documentation of this file.
1 // AdcDeconvoluteFFT.h
2 //
3 // Tool to perform deconvolution or convolution on AdcChannelData.
4 // The tool is configured with a response function and a filter function.
5 // It updates the samples in a passed AdcChannelData as specified by action:
6 // 0 - No change in samples
7 // 1 - Deconvolute with the reponse and convolute with filter.
8 // 2 - Convolute with the response using FFT. Filter is ignored.
9 // 3 - Convolute with the filter using FFT. Response is ignored.
10 // 4 - Convolute with the response directly. Filter is ignored.
11 // 5 - Convolute with the filter directly. Response is ignored.
12 // 6-9 - Options for direct deconvolution. Most successful is option 8 which
13 // does chi-square minimization inluding a smoothing term.
14 // Note that an attempt to deconvolute with insufficient smearing, e.g. a delta
15 // function filter, is likely to result in large oscillations due to noise
16 // or numerical rounding.
17 //
18 // The response function is configured with an explicit vector that is padded
19 // zeroes to the length of the passed data. It is is implictly periodic.
20 // If empty, no action is taken.
21 //
22 // High frequncy filtering is provided by a Gaussian with time-domain sigma
23 // specified by a configuration parameter.
24 //
25 // Low-frequency filtering is provided by the function
26 // 1/[ 1 + 1/(W N k)^P ]
27 // N is the number of samples and and k is the wave number.
28 // The width W and power P are configuration parameters.
29 // W < 0 disables the filter
30 // W = 0 filters out k = 0 only
31 // W > 0 removes k = 0 and applies the above for other values
32 //
33 // Other options may later be added for the response or filter.
34 //
35 // If an index map tool is provided, then it is used with the channel number to choose
36 // the reponse vector and filter. Otherwise, the first entry is used.
37 //
38 // Configuration:
39 // LogLevel: 0=silent, 1=init, 2=each event, >2=more
40 // Action: Option for action described above.
41 // ResponseVectors: Vector of discrete sequences representing the response function.
42 // ResponseCenters: Vector specifying the zero tick for each of the response fundtions.
43 // SmoothVectors: Vector o discrete sequnces holding smoothing functions.
44 // SmoothScales: Scale factors for the smoothing functions: 1 if missing.
45 // GausFilterSigmas: - Vector of time-domain sigmas [Tick] for the Gaussian filter.
46 // LowFilterWidth: - Vector of widths [tick] [Tick] for the low-frequency filter.
47 // LowFilterPower: - Vector of powers time-domain sigma [Tick] for the low-frequncy filter.
48 // IndexMapTool - Name of the tool mapping channel to response index.
49 
50 #ifndef AdcDeconvoluteFFT_H
51 #define AdcDeconvoluteFFT_H
52 
54 #include "fhiclcpp/ParameterSet.h"
57 
59 
60 public:
61 
62  using Index = unsigned int;
63 
65 
66  ~AdcDeconvoluteFFT() override =default;
67 
68  DataMap update(AdcChannelData& acd) const override;
69 
70 private:
71 
72  using Name = std::string;
73  using IndexVector = std::vector<Index>;
74  using ResponseVector = AdcSignalVector; // Same type as AdcChannel data
75  using ResponseVectorVector = std::vector<ResponseVector>;
76  using FloatVector = std::vector<float>;
77  using IndexMapToolPtr = std::unique_ptr<IndexMapTool>;
78 
79  // Configuration data.
90 
91  // Derived from configuration.
99 
100 };
101 
102 
103 #endif
~AdcDeconvoluteFFT() override=default
FloatVector m_LowFilterWidths
unsigned int Index
std::string string
Definition: nybbler.cc:12
FloatVector m_SmoothScales
ResponseVectorVector m_SmoothVectors
AdcDeconvoluteFFT(fhicl::ParameterSet const &ps)
ResponseVectorVector m_ResponseVectors
std::unique_ptr< IndexMapTool > IndexMapToolPtr
std::vector< float > FloatVector
AdcSignalVector ResponseVector
IndexVector m_ResponseCenters
static constexpr double ps
Definition: Units.h:99
DataMap update(AdcChannelData &acd) const override
FloatVector m_LowFilterPowers
std::vector< AdcSignal > AdcSignalVector
Definition: AdcTypes.h:22
IndexMapToolPtr m_channelToIndex
FloatVector m_GausFilterSigmas
std::vector< ResponseVector > ResponseVectorVector
std::vector< Index > IndexVector