source: trunk/MagicSoft/Mars/mtools/MFFT.h@ 4933

Last change on this file since 4933 was 3125, checked in by gaug, 21 years ago
*** empty log message ***
File size: 2.1 KB
Line 
1#ifndef MARS_MFFT
2#define MARS_MFFT
3
4#ifndef MARS_MAGIC
5#include "MAGIC.h"
6#endif
7
8#ifndef ROOT_TArrayF
9#include "TArrayF.h"
10#endif
11
12#ifndef ROOT_TArrayD
13#include "TArrayD.h"
14#endif
15
16#ifndef ROOT_TH1F
17#include "TH1F.h"
18#endif
19
20#ifndef ROOT_TH1D
21#include "TH1D.h"
22#endif
23
24class MFFT : public TObject
25{
26private:
27
28 void Swap(Float_t &a, Float_t &b) { Float_t c = a; a = b; b = c; }
29 void Swap(Double_t &a, Double_t &b) { Double_t c = a; a = b; b = c; }
30
31 void TransformF(const Int_t isign, TArrayF &data);
32 void TransformD(const Int_t isign, TArrayD &data);
33 void RealFTF(const Int_t isign);
34 void RealFTD(const Int_t isign);
35
36 void CheckDim(Int_t a);
37 TH1 *CheckHist(const TH1 *hist, const Int_t flag);
38
39 Float_t ApplyWindow(const Int_t j, const Float_t a, const Float_t b) const
40 {
41
42 return 1.0-TMath::Abs((j-a)*b); // Bartlett
43 // return 1.0; // Square
44 // return 1.0-(((j-a)*b)*((j-a)*b)); // Welch
45
46 }
47
48 Int_t fDim;
49 TArrayF fDataF;
50 TArrayD fDataD;
51 TArrayF fWindowF;
52 TArrayD fWindowD;
53
54public:
55
56 MFFT();
57 ~MFFT();
58
59 TArrayF* RealFunctionFFT( const TArrayF *data);
60 TArrayF* RealFunctionIFFT(const TArrayF *data);
61
62 TArrayD* RealFunctionFFT( const TArrayD *data);
63 TArrayD* RealFunctionIFFT(const TArrayD *data);
64
65 Float_t* RealFunctionFFT( const Int_t n, const Float_t *data);
66 Float_t* RealFunctionIFFT(const Int_t n, const Float_t *data);
67
68 Double_t* RealFunctionFFT( const Int_t n, const Double_t *data);
69 Double_t* RealFunctionIFFT(const Int_t n, const Double_t *data);
70
71 TH1F* PowerSpectrumDensity(const TH1 *hist);
72 TH1F* PowerSpectrumDensity(const TH1F *hist);
73 TH1F* PowerSpectrumDensity(const TH1I *hist);
74 TH1D* PowerSpectrumDensity(const TH1D *hist);
75
76 TArrayF* PowerSpectrumDensity(const TArrayI *array);
77 TArrayF* PowerSpectrumDensity(const TArrayF *array);
78 TArrayD* PowerSpectrumDensity(const TArrayD *array);
79
80 TArrayF* RealFunctionSpectrum(const TArrayF *data);
81
82 ClassDef(MFFT,0) // Class to perform a Fast Fourier Transform
83};
84
85#endif
Note: See TracBrowser for help on using the repository browser.