wavecatcher-analysis
|
#include <Filters.h>
Static Public Member Functions | |
static void | Bilateral2Filter (double *&, int, int, double, double, double) |
Nonlinear filter based on bilateral filter. | |
static void | BilateralFilter (double *&, int, double, double, double) |
Bilateral filter (non-linear) with 3 sigma kernel. | |
static void | BoxFilter (double *&, int, int) |
Simple running average (box) filter. | |
static void | Convolute (double *&, double *, double *, int) |
Helper to perform convolution of two 1D arrays. | |
static void | Convolute (double *&, double *, int) |
Helper to perform convolution of two 1D arrays. | |
static void | Deconvolute (double *&, double *, double *, int, double, double=0., double=0.) |
Helper to perform partial deconvolution of two 1D arrays. | |
static void | GausFFTFilter (double *&, int, double, double) |
Gaussian smoothing with FFT convolution. | |
static void | GausFilter (double *&, int, double, double) |
Gaussian smoothing with simple 3 sigma kernel. | |
static void | MedianFilter (double *&ar, int, int) |
Median filter. | |
static void | ResponseFilter (double *&, int, double=.4, double=1.2, double=.25, double=.3125) |
Custom filter emulating primitive response function. | |
static void | SecondOrderUnderdampedFilter (double *&, int, double, double, double, double=.3125, bool=false) |
Shifted second order underdamped filter. | |
static void | SecondOrderUnderdampedFilter (TH1F *&, int, double, double, double, double=.3125, bool=false) |
Shifted second order underdamped filter See above for details. | |
static void | SmoothArray (double *&, int, double, int, double=.3125, double=1.5) |
Apply smoothing array of double with length nbins. | |
static void | SmoothArray (double *&, int, double=.625, string="Gaus", double=.3125, double=1.5) |
Apply smoothing array of double with length nbins. | |
|
static |
Nonlinear filter based on bilateral filter.
Uses data and slope of data to weight the smoothing. x is not used. Very slow.
ar | Array to be smoothed. |
nbins | Number of bins of input. |
sigma_x | Window along x in bins. |
sigma_y | Sigma along y in mV. |
sigma_slope | Sigma of slope in mV. |
bin_size | Bin size in ns. |
Definition at line 338 of file Filters.cc.
|
static |
Bilateral filter (non-linear) with 3 sigma kernel.
For noise reduction while preserving edges, i .e. for baseline correction. Slow.
ar | Array to be smoothed. |
nbins | Number of bins of input. |
sigma_x | Gauss sigma along x in ns. |
sigma_y | Gauss sigma along y in mV. |
bin_size | Bin size in ns. |
Definition at line 299 of file Filters.cc.
|
static |
Simple running average (box) filter.
ar | Array to be smoothed. |
nbins | Number of bins of input. |
sigma | Number of bins before and after central bin. |
Definition at line 207 of file Filters.cc.
|
static |
Helper to perform convolution of two 1D arrays.
WARNING: All arrays must be of the same size.
Used for smoothing etc.
[in,out] | result | Array containing convolution result |
first | First array for convolution | |
second | Second array for convolution | |
size | Size of arrays |
Definition at line 12 of file Filters.cc.
|
static |
Helper to perform convolution of two 1D arrays.
WARNING: All arrays must be of the same size.
Used for smoothing etc.
[in,out] | first | Array to be convoluted |
second | Second array for convolution | |
size | Size of arrays |
Definition at line 65 of file Filters.cc.
|
static |
Helper to perform partial deconvolution of two 1D arrays.
WARNING: All arrays must be of the same size.
[in,out] | result | Array containing deconvolution result |
first | First array for deconvolution | |
second | Second array for deconvolution | |
size | Size of arrays | |
sigma | Gaussian sigma in ns | |
x0 | Gaussian center in ns | |
bin_size | Bin size in ns |
Definition at line 80 of file Filters.cc.
|
static |
Gaussian smoothing with FFT convolution.
ar | Array to be smoothed. |
nbins | Number of bins of input. |
sigma | Gauss sigma in ns. |
bin_size | Bin size in ns. |
Definition at line 266 of file Filters.cc.
|
static |
Gaussian smoothing with simple 3 sigma kernel.
ar | Array to be smoothed. |
nbins | Number of bins of input. |
sigma | Gauss sigma in ns. |
bin_size | Bin size in ns. |
Definition at line 230 of file Filters.cc.
|
static |
Median filter.
ar | Array to be smoothed. |
nbins | Number of bins of input. |
window_size | Window size for median in bins. |
Definition at line 378 of file Filters.cc.
|
static |
Custom filter emulating primitive response function.
Can be used to highlight peaks and suppress long tails (see pole-zero cancellation). Emulates response function of an amplifier setup.
Uses constant padding to avoid edge effects.
Use Filter_test.ipynb to test parameters.
[in,out] | ar | Array to be filtered. |
nbins | Number of bins of input. | |
sigma1 | First. | |
sigma2 | Second. | |
factor | Factor for negative part (<=1). | |
bin_size | Bin width. Default is .3125. Set to 1 to get sigma in units of bins. |
Definition at line 421 of file Filters.cc.
|
static |
Shifted second order underdamped filter.
Emulating 2nd order underdamped response (simple damped harmonic oscillator).
Will only consider 3 periods of the response function.
In development, for testing only.
[in,out] | ar | Array to be filtered. |
nbins | Number of bins of input. | |
period | Period of response function in ns. | |
damping | Damping time constant of the response function in ns. Needs to be > 0. | |
shift | Shift of response function in ns. | |
bin_size | Bin width of the input. | |
do_plot | Plot response function and save to file. |
Definition at line 466 of file Filters.cc.
|
static |
Shifted second order underdamped filter See above for details.
[in,out] | his | Histogram to be filtered. |
Definition at line 547 of file Filters.cc.
|
static |
Apply smoothing array of double with length nbins.
method | If 0: Use running average (box kernel smoothing). Simple, very fast. If 1: Use 5 sigma FFT gaussian smoothing. This method is not central and will shift peaks. Very slow. Else: Use 3 sigma gaussian kernel smoothing. Preferred method, fast. |
Definition at line 179 of file Filters.cc.
|
static |
Apply smoothing array of double with length nbins.
Use with care. Method="Gaus" is preferred.
Please note that if you want to use gaussian smoothing for data with a binning different from 0.3125 ns/bin you need to set the variable bin_size to the new bin size.
[in,out] | ar | Array to be smoothed. |
nbins | Number of bins of input. | |
sigma | Number of bins before and after central bin for "Box" and "Median". Gaussian sigma in ns for "Gaus" and "GausFFT". Sigma in x for "Bilateral" and "Bilateral2". | |
method | "Box": Use running average (box kernel smoothing). Simple, very fast. "GausFFT": Use 5 sigma FFT gaussian smoothing. This method is not central and will shift peaks. Very slow. "Gaus": Use 3 sigma gaussian kernel smoothing. Preferred method, fast. "Median": Use median filter. Fast. "Bilateral": Use bilateral filter. Slow. "Bilateral2": Use bilateral filter with different kernel. Slow. | |
bin_size | Bin width of the array to smooth for gauss sigma. Default is .3125 for wavecatcher sampling rate. Set to 1 to change sigma unit to number of bins. | |
sigma2 | Sigma in y for "Bilateral" and "Bilateral2". |
Definition at line 160 of file Filters.cc.