source: branches/Mars_use_drstimefiles/mtools/MFFT.h@ 18569

Last change on this file since 18569 was 4958, checked in by gaug, 20 years ago
*** empty log message ***
File size: 2.3 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 MArrayI;
25class MArrayD;
26class MArrayF;
27class MFFT : public TObject
28{
29private:
30
31 void Swap(Float_t &a, Float_t &b) { Float_t c = a; a = b; b = c; }
32 void Swap(Double_t &a, Double_t &b) { Double_t c = a; a = b; b = c; }
33
34 void TransformF(const Int_t isign, TArrayF &data);
35 void TransformD(const Int_t isign, TArrayD &data);
36 void RealFTF(const Int_t isign);
37 void RealFTD(const Int_t isign);
38
39 void CheckDim(Int_t a);
40 TH1 *CheckHist(const TH1 *hist, const Int_t flag);
41
42 Float_t ApplyWindow(const Int_t j, const Float_t a, const Float_t b) const
43 {
44
45 return 1.0-TMath::Abs((j-a)*b); // Bartlett
46 // return 1.0; // Square
47 // return 1.0-(((j-a)*b)*((j-a)*b)); // Welch
48
49 }
50
51 Int_t fDim;
52 TArrayF fDataF;
53 TArrayD fDataD;
54 TArrayF fWindowF;
55 TArrayD fWindowD;
56
57public:
58
59 MFFT();
60 ~MFFT();
61
62 TArrayF* RealFunctionFFT( const TArrayF *data);
63 TArrayF* RealFunctionIFFT(const TArrayF *data);
64
65 TArrayD* RealFunctionFFT( const TArrayD *data);
66 TArrayD* RealFunctionIFFT(const TArrayD *data);
67
68 Float_t* RealFunctionFFT( const Int_t n, const Float_t *data);
69 Float_t* RealFunctionIFFT(const Int_t n, const Float_t *data);
70
71 Double_t* RealFunctionFFT( const Int_t n, const Double_t *data);
72 Double_t* RealFunctionIFFT(const Int_t n, const Double_t *data);
73
74 TH1F* PowerSpectrumDensity(const TH1 *hist);
75 TH1F* PowerSpectrumDensity(const TH1F *hist);
76 TH1F* PowerSpectrumDensity(const TH1I *hist);
77 TH1D* PowerSpectrumDensity(const TH1D *hist);
78
79 TArrayF* PowerSpectrumDensity(const TArrayI *array);
80 TArrayF* PowerSpectrumDensity(const TArrayF *array);
81 TArrayD* PowerSpectrumDensity(const TArrayD *array);
82
83 MArrayF* PowerSpectrumDensity(const MArrayI *array);
84 MArrayF* PowerSpectrumDensity(const MArrayF *array);
85 MArrayD* PowerSpectrumDensity(const MArrayD *array);
86
87 TArrayF* RealFunctionSpectrum(const TArrayF *data);
88
89 ClassDef(MFFT,0) // Class to perform a Fast Fourier Transform
90};
91
92#endif
Note: See TracBrowser for help on using the repository browser.