DuneFFT.h
Go to the documentation of this file.
1 // DuneFFT.h
2 
3 // David Adams
4 // April 2019
5 //
6 // This utility provides wrappers for performing forward and backward DFT (discrete
7 // Fourier transform) of real (time-domain) data. It uses the the Root TVirtualFFT
8 // interface which in turn uses FFTW by default.
9 //
10 // The real data is held in a vector of floats. The DFT is a vector of complex values
11 // of the same length and so has a factor of two redundancy. The DFT data is returned
12 // in an object with the RealDftData interface that provkdes methods to access the real,
13 // imaginary, amplitude and phase parts of the terms in the complex vector.
14 //
15 // The concrete type for the returned data is
16 // CompactRealDftData<float>
17 
18 #ifndef DuneFFT_H
19 #define DuneFFT_H
20 
22 
23 class DuneFFT {
24 
25 public:
26 
27  using Index = unsigned int;
29  using FloatVector = std::vector<float>;
30 
31  // Forward transform: real data (ntick starting at psam[0] --> complex freqs).
32  // ntick - # ticks to use in transform.
33  // psam - Address of the first element in the data array
34  // dft - the DFT
35  // logLevel - 0=silent, 1=init, 2=each event, >2=more
36  static int fftForward(Index ntick, const float* psam, DFT& dft, Index logLevel =0);
37 
38  // Same for a full sample vector sams.
39  static int fftForward(const FloatVector& sams, DFT& dft, Index logLevel =0);
40 
41  // Inverse transform: complex freqs mags, phases --> real data sams
42  // Thr real and imag freq component are also recorded in xres, xims
43  static int fftInverse(const DFT& dft, FloatVector& sams, Index logLevel =0);
44 
45 };
46 
47 #endif
std::vector< float > FloatVector
Definition: DuneFFT.h:29
unsigned int Index
Definition: DuneFFT.h:27
static int fftForward(Index ntick, const float *psam, DFT &dft, Index logLevel=0)
Definition: DuneFFT.cxx:23
static int fftInverse(const DFT &dft, FloatVector &sams, Index logLevel=0)
Definition: DuneFFT.cxx:79