Diana Software
QRealComplexFFT.cc
Go to the documentation of this file.
1 #include "QRealComplexFFT.hh"
2 
3 ClassImp(Diana::QRealComplexFFT)
4 
6 
9 
11  fFFTW(NULL),
12  fGSL(NULL)
13 {
14 #ifdef _HAVE_FFTW3_
16 #else
18 #endif
19 }
21  fFFTW(NULL),
22  fGSL(NULL)
23 {
24 #ifdef _HAVE_FFTW3_
25  fFFTW=new QRealComplexFFTW3(Size);
26 #else
27  fGSL=new QRealComplexFFTGSL(Size);
28 #endif
29 }
31 #ifdef _HAVE_FFTW3_
32  delete fFFTW;
33 #else
34  delete fGSL;
35 #endif
36 }
37 
39  bool compress){
40  int ret=0;
41  clock_t t0=::clock();
42 #ifdef _HAVE_FFTW3_
43  ret=fFFTW->TransformToFreq(data,FFT,compress);
44 #else
45  ret=fGSL->TransformToFreq(data,FFT,compress);
46 #endif
47  fTimer+=1.0E6*((UInt_t)(::clock()-t0))/CLOCKS_PER_SEC;
48  fNCalls++;
49  return ret;
50 }
51 
53  bool compress){
54  int ret=0;
55  clock_t t0=::clock();
56 #ifdef _HAVE_FFTW3_
57  ret=fFFTW->TransformFromFreq(FT,spectrum,compress);
58 #else
59  ret=fGSL->TransformFromFreq(FT,spectrum,compress);
60 #endif
61  fTimer+=1.0E6*((UInt_t)(::clock()-t0))/CLOCKS_PER_SEC;
62  fNCalls++;
63  return ret;
64 }
65 
67 #ifdef _HAVE_FFTW3_
68  return fFFTW->SetWindowType(wt,coherent);
69 #else
70  return fGSL->SetWindowType(wt,coherent);
71 #endif
72 }
74 #ifdef _HAVE_FFTW3_
75  return "FFTW3";
76 #else
77  return "GSL";
78 #endif
79 }
80 
82 
83 
double t0
Definition: CheckOF.C:26
#define Q_END_NAMESPACE
Definition: QDiana.hh:22
#define Q_BEGIN_NAMESPACE
Definition: QDiana.hh:20
ClassImp(QObject)
QRealComplexFFT * gRealComplexFFT
WindowType
window type
Definition: QFFT.hh:30
perform FFT of real vectors using GSL FFT
virtual int TransformFromFreq(const QVectorC &FT, QVector &spectrum, bool compress=false)
transform from the frequencies to the times
virtual int TransformToFreq(const QVector &data, QVectorC &FFT, bool compress=false)
transform from the times to the frequencies
virtual void SetWindowType(WindowType wt, int coherent=0)
resize working table and space
Real to complex FFT using FFTW3.
virtual void SetWindowType(WindowType wt, int coherent=0)
resize working table and space
virtual int TransformFromFreq(const QVectorC &FT, QVector &spectrum, bool compress=false)
transform from the frequencies to the times
virtual int TransformToFreq(const QVector &data, QVectorC &FFT, bool compress=false)
transform from the times to the frequencies
Wrapper for a specific QRealComplexFFT algorithm class.
virtual ~QRealComplexFFT()
static const char * GetFFTLibrary()
static size_t fNCalls
virtual void SetWindowType(WindowType wt, int coherent=0)
resize working table and space
QRealComplexFFTW3 * fFFTW
virtual int TransformFromFreq(const QVectorC &FT, QVector &spectrum, bool compress=false)
transform from the frequencies to the times
virtual int TransformToFreq(const QVector &data, QVectorC &FFT, bool compress=false)
transform from the times to the frequencies
QRealComplexFFTGSL * fGSL
static double fTimer
The total amount of time performing FFTs by the program.
Interface for complex vectors in Diana analysis.
Definition: QVectorC.hh:25
Interface for vectors in Diana analysis.
Definition: QVector.hh:30